Граф коммитов

260 Коммитов

Автор SHA1 Сообщение Дата
ko1 c4bc9b5758 * iseq.c, vm_eval.c: set th->base_block properly.
th->base_block is information for (a) parsing, (b) compiling
  and (c) setting up the frame to execute the program passed by
  `eval' method.  For example, (1) parser need to know up-level
  variables to detect it is variable or method without paren.
  Befor (a), (b) and (c), VM set th->base_block by passed bindng
  (or previous frame information).  After execute (a), (b) and (c),
  VM should clear th->base_block.  However, if (a), (b) or (c)
  raises an exception, then th->base_block is not cleared.
  Problem is that the uncleared value th->balo_block is used for
  irrelevant iseq compilation.  It causes SEGV or critical error.
  I tried to solve this problem: to clear them before exception,
  but finally I found out that it is difficult to do it (Ruby
  program can be run in many places).
  Because of this background, I set th->base_block before
  compiling iseq and restore it after compiling.
  Basically, th->base_block is dirty hack (similar to global
  variable) and this patch is also dirty.
* bootstraptest/test_eval.rb: add a test for above.
* internal.h: remove unused decl.
* iseq.c (rb_iseq_compile_with_option): add base_block parameter.
  set th->base_block before compation and restore it after
  compilation.
* ruby.c (require_libraries): pass 0 as base_block instead of
  setting th->base_block
* tool/compile_prelude.rb (prelude_eval): apply above changes.
* vm.c, vm_eval.c: ditto.
* vm_core.h: add comments.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36179 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-22 09:32:56 +00:00
akr ed8040a62b * process.c (rb_execarg_addopt): take a VALUE argument instead of
struct rb_execarg.
  (rb_exec_arg_addopt): follow the rb_execarg_addopt change.
  (check_exec_options_i): ditto.

* io.c (pipe_open): follow the rb_execarg_addopt change.

* internal.h (rb_execarg_addopt): follow the definition change.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36167 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-21 12:18:40 +00:00
akr 46e23dc03d * process.c (rb_execarg_init): take a VALUE argument instead of
struct rb_execarg.
  (rb_execarg_new): follow the rb_execarg_init change.
  (rb_exec_arg_init): ditto.

* internal.h (rb_execarg_init): follow the definition change.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-21 09:39:10 +00:00
akr d73d3a743b * process.c (rb_execarg_fixup): take a VALUE argument instead of
struct rb_execarg.

* internal.h (rb_execarg_fixup): follow the definition change.

* io.c (pipe_open): follow rb_execarg_fixup change.

* ext/pty/pty.c (establishShell): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36157 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-20 21:25:20 +00:00
akr 5309af971d * internal.h (struct rb_execarg): add umask_given and umask_mask
fields.

* process.c (STATIC_ASSERT): removed.
  (rb_execarg_addopt): follow the rb_execarg change.
  (rb_execarg_run_options): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36154 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-20 12:27:09 +00:00
akr b60713de73 * internal.h (struct rb_execarg) moved and renamed from
struct rb_exec_arg in intern.h.

* include/ruby/intern.h (struct rb_exec_arg): refer Data object which
  contains struct rb_execarg.

* process.c: use struct rb_execarg instead of struct rb_exec_arg
  except functions declared in intern.h.
  (rb_exec_arg_addopt): extract a pointer to struct rb_execarg from
  struct rb_exec_arg.
  (rb_exec_arg_init): ditto.
  (rb_exec_arg_fixup): ditto.
  (rb_run_exec_options_err): ditto.
  (rb_run_exec_options): ditto.
  (rb_exec_err): ditto.
  (rb_exec): ditto.

* io.c: use struct rb_execarg instead of struct rb_exec_arg.

* ext/pty/pty.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36153 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-20 11:46:50 +00:00
akr 826f98e688 * internal.h (rb_execarg_new): declared.
(rb_execarg_get): ditto.

* process.c (mark_exec_arg): new function.
  (free_exec_arg): ditto.
  (memsize_exec_arg): ditto.
  (exec_arg_data_type): defined.
  (rb_execarg_new): new function.
  (rb_execarg_get): ditto.
  (rb_f_exec): use rb_execarg_new.
  (rb_spawn_internal): ditto.
  (rb_f_spawn): ditto.

* io.c (pipe_open_v): use rb_execarg_new.
  (pipe_open_s): ditto.

* ext/pty/pty.c (establishShell): use rb_execarg_new.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36152 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-20 10:31:02 +00:00
akr 37a1355bf8 * include/ruby/intern.h (rb_exec_arg_init): deprecated.
(rb_exec_arg_addopt): ditto.
  (rb_exec_arg_fixup): ditto.
  (rb_run_exec_options): ditto.
  (rb_run_exec_options_err): ditto.

* internal.h (rb_execarg_init): declared.
  (rb_execarg_addopt): ditto.
  (rb_execarg_fixup): ditto.
  (rb_execarg_run_options): ditto.

* process.c: call rb_execarg_addopt, rb_execarg_fixup,
  rb_execarg_run_options, rb_execarg_init.
  (rb_execarg_addopt): renamed from rb_exec_arg_addopt.
  (rb_exec_arg_addopt): stub to call rb_execarg_addopt.
  (rb_execarg_init): renamed from rb_exec_arg_init.
  (rb_exec_arg_init): stub to call rb_execarg_init.
  (rb_execarg_fixup): renamed from rb_exec_arg_fixup.
  (rb_exec_arg_fixup): stub to call rb_execarg_fixup.
  (rb_execarg_run_options): renamed from rb_run_exec_options_err.
  (rb_run_exec_options_err): stub to call rb_execarg_run_options.
  (rb_run_exec_options): call rb_execarg_run_options.

* io.c: call rb_execarg_addopt, rb_execarg_fixup,
  rb_execarg_run_options, rb_execarg_init.

* ext/pty/pty.c (establishShell): call rb_execarg_init and
  rb_execarg_fixup.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36039 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-12 11:34:51 +00:00
akr 4b70fab915 * process.c (rb_fork_ruby): new function.
(rb_f_fork): use rb_fork_ruby instead of rb_fork.
  (rb_daemon): ditto.

* io.c (pipe_open): use rb_fork_ruby instead of rb_fork.

* internal.h (rb_fork_ruby): declared.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36018 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-10 11:21:07 +00:00
akr 18088467e7 * process.c (rb_exec_async_signal_safe): exported.
* ext/pty/extconf.rb: modify $INCFLAGS to include internal.h

* ext/pty/pty.c: include internal.h.
  (chfunc): don't call rb_thread_atfork_before_exec.  use
  rb_exec_async_signal_safe instead of rb_f_exec.
  (establishShell): set up earg.  use rb_fork_async_signal_safe
  instead of rb_fork_err.

* internal.h (rb_exec_async_signal_safe): declared.
  (rb_fork_async_signal_safe): declared.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36002 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-10 01:29:58 +00:00
nobu f64e7c834f string.c: rb_str_symname_p
* string.c (rb_str_symname_p): new function that checks if the string
  is valid as a symbol name.  split from sym_inspect().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35987 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-09 14:36:17 +00:00
akr 13edb951b7 * include/ruby/intern.h: rb_exec_arg and related stuff moved back from
internal.h



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35954 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-07 11:29:43 +00:00
akr 70232e400c * process.c (proc_exec_v): don't call dln_find_exe_r here because it
is not async-signal-safe and proc_exec_v is called in a child
  process.
  command_abspath field of rb_exec_arg.
  (rb_exec_fillarg): call dln_find_exe_r and set command_abspath.
  (rb_exec_err): Give the absolute path of the invoking command for
  proc_exec_v, instead of the command name.

* internal.h: add command_abspath field for rb_exec_arg. 



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35944 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-06 11:49:30 +00:00
akr 3162e673a1 * internal.h (rb_exec_arg_init): change return type to void.
* process.c (rb_exec_arg_init): don't return a value.
  (rb_exec_arg_prepare): ditto.
  (rb_spawn_process): don't take the prog argument.  extract the 
  information from earg.
  (rb_spawn_internal): follow rb_spawn_process change.
  (rb_f_spawn): ditto.

* io.c (pipe_open): don't take the prog argument.  extract the
  information from eargp.
  (pipe_open_v): follow pipe_open change.
  (pipe_open_s): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35928 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-05 15:24:32 +00:00
akr 53b17a769b * internal.h (rb_exec_arg): use union to represent command invocation
with/without shell.

* process.c: follow the rb_exec_arg change.

* io.c (pipe_open): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35927 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-05 14:53:31 +00:00
akr a79bbdf6b5 * internal.h: rb_exec_arg and related stuff moved from intern.h
* include/ruby/intern.h (rb_proc_exec_n): removed.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35925 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-05 13:29:54 +00:00
akr 71fd73dff8 * process.c (rb_exec_fillarg): allocate one more element before
beginning in argv_str for try_with_sh.

* internal.h (ARGVSTR2ARGC): adjust for the above change.
  (ARGVSTR2ARGV): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35910 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-04 11:01:41 +00:00
akr 41819dc447 * internal.h (ARGVSTR2ARGC): defined.
(ARGVSTR2ARGV): defined.

* process.c (proc_exec_v): use ARGVSTR2ARGV.
  (rb_spawn_process): use ARGVSTR2ARGC and ARGVSTR2ARGV.

* io.c (pipe_open): use ARGVSTR2ARGV.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35909 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-04 10:19:32 +00:00
ko1 b57c81ae3e * common.mk: fix to build vm_backtrace.c only itself (vm_backtrace.c
is no longer included from vm.c).  I hope this separation reduce
  compile time of vm.c.
* internal.h: ditto.
* vm.c, vm_core.h, vm_dump.c, vm_eval.c: ditto.
* vm_eval.c: some functions (callee, etc) moved to vm_backtrace.c.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-02 15:59:37 +00:00
ko1 d5893b91fa * vm_method.c (rb_method_defined_by): removed.
nobu pointed out that rb_method_basic_definition_p() is enough
  for last commit.
* error.c, eval_error.c: change for above.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35770 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-24 06:36:44 +00:00
ko1 3dcebce523 * vm.c: add RubyVM::Backtrace object (btobj).
Backtrace information contains an array consists of location
  information for each frames by string.
  RubyVM::Backtrace object is lightweight backtrace information,
  which contains complete information to generate traditional style
  backtrace (an array of strings) with faster generation.
  If someone accesses to backtrace information via
  Exception#backtrace, then convert a RubyVM::Backtrace object to
  traditonal style backtrace.
  This change causes incompatibility on marshal dumpped binary
  of Exception.  If you have any trouble on it, please tell us
  before Ruby 2.0 release.
  Note that RubyVM::Backtrace object should not expose Ruby level.
* error.c, eval.c, vm_eval.c: ditto.
* internal.h: ditto.
* eval_error.c: fix to skip "set_backtrace" method invocation in
  creating an exception object if it call a normal set_backtrace
  method (defined by core).
* test/ruby/test_settracefunc.rb: fix for above change.
* vm_method.c (rb_method_defined_by): added.  This function
  checks that the given object responds with the given method
  by the given cfunc.
* benchmark/bm_vm2_raise1.rb, benchmark/bm_vm2_raise2.rb:
  add to measure exception creation speed. raise1 create
  exception objects from shallow stack frame.  raise2 create
  exception objects from deep stack frame.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35769 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-24 06:09:23 +00:00
marcandre 4c2e2d8bde * numeric.c: fix flodivmod for cornercases [Bug #6044]
add ruby_float_mod

* insns.def (opt_mod): use ruby_float_mod

* internal.h: declare ruby_float_mod

* test/ruby/test_float.rb: tests for above

* test/ruby/envutil.rb: create helper assert_is_minus_zero

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35013 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-14 06:10:01 +00:00
nobu e78ff08968 * array.c (rb_ary_cat): new function to concat objects into array.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34948 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-08 15:25:04 +00:00
nobu 075d98c7dc * error.c (rb_load_fail): should honor encoding.
* load.c (load_failed): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34944 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-07 07:30:31 +00:00
nobu 72de92d1f9 rb_load_fail
* error.c (rb_load_fail): use path as a string, not char*.
* internal.h: (rb_load_fail): moved from ruby/intern.h.
* ruby.c (load_file_internal): fname cannot be NULL.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34941 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-07 03:26:30 +00:00
nobu 0b89081bbb * internal.h (rb_file_const, rb_file_load_ok): moved functions for
internal use only.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34864 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-01 07:13:22 +00:00
marcandre f12c14d3ef * proc.c (method_hash, proc_hash): Fix {Unbound}Method#hash
[Bug #6048]. Isolate hash computation for proc

* internal.h: Declaration for above

* vm_method.c (rb_method_definition_hash): Computation for
  hash part of a method definition

* method.h: Declaration for above

* test/ruby/test_method.rb: Test for above

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34715 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-21 00:13:44 +00:00
nagachika 2910f6736e * cont.c (rb_fiber_reset_root_local_storage): add a new function to
restore rb_thread_t::local_storage.

* cont.c (rb_obj_is_fiber): add a new function to tell finalizer to
  prevent fibers from destroy.

* gc.c (rb_objspace_call_finalizer): don't sweep fibers at finalizing
  objspace.

* internal.h (rb_fiber_reset_root_local_storage, rb_obj_is_fiber):
  add prototypes.

* vm.c (ruby_vm_destruct): reset main thread's local_storage before
  free main thread. rb_thread_t::local_storage is replaced by fiber's
  local storage when forked from fiber, and it should be already freed
  when the fiber was destroyed.

* test/ruby/test_fiber.rb (test_fork_from_fiber): add test for fork
  from fiber.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34629 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-15 14:00:11 +00:00
naruse 56dc6f5acc * gc.c (ruby_mimmalloc): defined for objects need not rb_objspace,
but should return pointer suitable for ruby_xfree;
  main vm and main thread.
  patched by Sokolov Yura. https://github.com/ruby/ruby/pull/79

* internal.h: ditto.

* vm.c (Init_BareVM): use ruby_mimmalloc.

* ext/dl/cfunc.c: #include <ruby/util.h>.

* ext/syslog/syslog.c: use xfree because it is allocated by
  ruby_strdup.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34257 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-10 03:49:10 +00:00
naruse 82ab1e189b * thread.c (rb_barrier_waiting): save the number of waiting threads
in RBASIC()->flags. [ruby-dev:45002] [Bug #5768]

* thread.c (rb_barrier_wait): increment and decrement around
  rb_mutex_lock, and use rb_barrier_waiting().

* thread.c (rb_barrier_release): use rb_barrier_waiting().

* thread.c (rb_barrier_destroy): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-30 22:25:16 +00:00
nobu ab6c8910f4 * load.c (load_unlock): all threads requiring one file should
share same loading barrier, so it must be kept alive while those
  are waiting on it.  [ruby-core:41618] [Bug #5754]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34027 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-13 07:13:31 +00:00
akr b7d397348e * internal.h (rb_maygvl_fd_fix_cloexec): change the visibility for
ext/socket.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33600 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-01 03:37:01 +00:00
akr c16f98ab0a * io.c (rb_maygvl_fd_fix_cloexec): renamed from fd_set_cloexec.
* internal.h (rb_maygvl_fd_fix_cloexec): declared.

* ext/socket/init.c (cloexec_accept): use rb_maygvl_fd_fix_cloexec.
  (rsock_s_accept_nonblock): use rb_update_max_fd.
  (rsock_s_accept): use rb_update_max_fd.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33598 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-01 03:04:03 +00:00
nobu bc2a1f2a98 * variable.c (rb_const_set): show the previous definition
location.  [EXPERIMENTAL]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33175 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-03 15:11:53 +00:00
naruse 6bc83a18b7 * internal.h (rb_strftime_timespec): moved from time.c and define only
if ruby/encoding.h is included.

* internal.h (rb_strftime): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33097 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-27 10:06:25 +00:00
naruse 7412263eba * internal.h (rb_strftime_timespec): move to time.c because it depends
encoding.h.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33095 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-27 09:45:15 +00:00
naruse 23b2808693 * strftime.c (rb_strftime_with_timespec): get enc argument to specify
the encoding of the format. On Windows (at least Japanese Windows),
  Time#strftime("%Z") includes non ASCII in locale encoding (CP932).
  So convert locale to default internal. [ruby-core:39092] [Bug #5226]

* strftime.c (rb_strftime): ditto.

* strftime.c (rb_strftime_timespec): ditto.

* internal.h (rb_strftime_timespec): follow above.

* time.c (rb_strftime_alloc): ditto.

* time.c (strftimev): ditto.

* time.c (time_strftime): ditto.

* time.c (time_to_s): the resulted string of Time#to_s is always
  ascii only, so this should be US-ASCII.

* time.c (time_asctime): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33094 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-27 09:18:18 +00:00
nobu d93746490d * array.c (rb_ary_set_len): new function to set array length.
* vm_eval.c (method_missing): set the length of argv array, to mark
  arguments.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32740 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-29 14:53:51 +00:00
nobu 34918aa832 * object.c (rb_mod_{const,cvar}_defined, rb_obj_ivar_defined):
avoid inadvertent symbol creation in reflection methods.  based
  on a patch by Jeremy Evans at [ruby-core:38367].  [Feature #5072]
* vm_method.c (rb_mod_method_defined)
  (rb_mod_{public,private,protected}_method_defined)
  (obj_respond_to): ditto.
* parse.y (rb_check_id): new function returns already interned ID
  or 0.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32621 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-22 12:06:42 +00:00
akr b41ccc4a9c * include/ruby/intern.h (rb_update_max_fd): declaration moved from
internal.h.

* file.c: ditto.

* io.c: call rb_update_max_fd for each new fds.

* process.c: ditto.

* random.c: ditto.

* ruby.c: ditto.

* ext/io/console/console.c: ditto.

* ext/openssl/ossl_bio.c: ditto.

* ext/pty/pty.c: ditto.

* ext/socket/init.c: ditto.

* ext/socket/socket.c: ditto.

* ext/socket/ancdata.c: ditto.

* ext/socket/unixsocket.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32587 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-20 13:26:10 +00:00
akr 2c7576a021 * io.c (rb_update_max_fd): new function.
* internal.h (rb_update_max_fd): declare rb_update_max_fd.

* thread_pthread.c (rb_thread_create_timer_thread): update max fd when
  timer thread pipe is created.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32579 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-19 07:10:19 +00:00
ko1 ce698d4c0d * internal.h: add comments (cautions).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32497 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-10 12:52:03 +00:00
ko1 919978a8d9 * internal.h (rb_thread_call_with_gvl, rb_thread_call_without_gvl):
make them visible as experimental C APIs.  fixes Feature #4328.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32486 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-10 05:19:47 +00:00
tadf aef7007477 * internal.h: rb_rational_reciprocal is defined in rational.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32476 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-09 11:06:43 +00:00
tadf bc11aa72d3 * internal.h: added declarations.
* complex.c: followed the above change.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32475 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-09 10:50:51 +00:00
ko1 3b32735546 * ext/objspace/objspace.c (ObjectSpace.count_tdata_objects):
Fix rdoc.
* ext/objspace/objspace.c (ObjectSpace.count_tdata_objects):
  Change key type if the klass of a object is zero (internal object).
  Read rdoc for details.
* internal.h: export rb_objspace_data_type_name().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32323 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-30 08:37:06 +00:00
ko1 c22126755c * error.c (rb_async_bug_errno): async-safe bug report function.
In timer thread, signal handler shoul use it.
  The patch is contributed by Eric Wong <normalperson@yhbt.net>.
  Refs: [ruby-core:37644] and [ruby-core:37647]
* thread_pthread.c: use rb_async_bug_errno().
  And replace all fprintf() to write().
* internal.h (rb_async_bug_errno): add decl. of above func.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32274 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-28 21:17:29 +00:00
kosaki 908baefe7d * internal.h: move rb_thread_io_blocking_region() declaration
from intern.h to internal.h. It's still experimental API and
  need more discussion. [ruby-dev:43698]
* include/ruby/intern.h: ditto.

* ext/socket/rubysocket.h: include internal.h.
* ext/socket/depend: add internal.h dependency.
* ext/socket/extconf.rb: add $INCFLAGS to topdir.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32187 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-21 12:31:17 +00:00
kosaki b9d9ea62b4 revert r32183
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32186 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-21 11:52:24 +00:00
kosaki 97beed076f * internal.h: move rb_thread_io_blocking_region() declaration
from intern.h to internal.h. It's still experimental API and
  need more discussion.
* include/ruby/intern.h: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32183 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-21 10:57:53 +00:00
akr 5ed8c08aa0 * eval.c, hash.c, load.c, proc.c, range.c, thread.c, time.c: don't
declare internal functions.

* internal.h, vm_core.h: declare internal functions.

* array.c: include internal.h.

* common.mk: update dependency for array.o.




git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32165 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-18 08:26:19 +00:00
akr bc46292caa * internal.h: declarations declared in include/ruby/*.h removed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32164 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-18 04:41:53 +00:00
akr 7da3ea811e * method.h, internal.h iseq.h: declare internal functions.
* compile.c, eval.c, iseq.c, object.c, parse.y, proc.c, process.c,
  thread.c, vm.c, vm_eval.c, vm_insnhelper.c, vm_method.c: don't
  declare internal functions.

  Note that rb_method_entry_eq() is defined in vm_method.c but
  there was a declaration in proc.c with different const-ness.
  Now it is declared in method.h with same const-ness to the
  definition.

* object.c (rb_mod_module_exec): don't declare functions declared in
  include/ruby/intern.h.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-18 03:49:33 +00:00
nobu 19f386674e * include/ruby/backward/classext.h: for evil gems. fixed #4803
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-18 03:05:11 +00:00
akr afd7e4668f * internal.h: declare more internal functions.
* iseq.h (rb_method_get_iseq): declared.

* compile.c, eval.c, eval_error.c, iseq.c, parse.y, proc.c, range.c,
  ruby.c, time.c, util.c, vm.c: don't declare internal functions.

* eval.c, parse.y, thread_pthread.c: non-existing function declarations
  removed.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-18 01:54:57 +00:00
akr e7996eb3cc * internal.h: declare internal functions here.
* node.h: declare NODE dependent internal functions here.

* iseq.h: declare rb_iseq_t dependent internal functions here.

* vm_core.h: declare rb_thread_t dependent internal functions here.

* bignum.c, class.c, compile.c, complex.c, cont.c, dir.c, encoding.c,
  enumerator.c, error.c, eval.c, file.c, gc.c, hash.c, inits.c, io.c,
  iseq.c, load.c, marshal.c, math.c, numeric.c, object.c, parse.y,
  proc.c, process.c, range.c, rational.c, re.c, ruby.c, string.c,
  thread.c, time.c, transcode.c, variable.c, vm.c,
  tool/compile_prelude.rb: don't declare internal functions declared
  in above headers.  include above headers if required.

  Note that rb_thread_mark() was declared as
  void rb_thread_mark(rb_thread_t *th) in cont.c but defined as
  void rb_thread_mark(void *ptr) in vm.c.  Now it is declared as
  the later in internal.h.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-17 22:43:38 +00:00
akr 87f025da25 * io.c: fix IO.copy_stream interrupt handling.
based on the patch by Eric Wong.  [ruby-core:36156]

* vm_core.h (rb_thread_call_with_gvl): don't declare here.

* thread.c: include internal.h.
  (rb_thread_execute_interrupts): new function.

* internal.h (rb_thread_execute_interrupts): declared.
  (rb_thread_call_with_gvl): declared.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31971 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-09 15:02:46 +00:00
nagachika 1fdbe0f437 * gc.c (rb_objspace_call_finalizer): use rb_typeddata_is_kind_of() for
type check to get rid of a double free when main Thread has singleton
  class. [ruby-core:36741] [Bug #4828]
* thread.c (rb_obj_is_mutex): add a new utility function.
* vm.c (rb_obj_is_thread): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-09 14:45:56 +00:00
nobu a3ffe9698b * numeric.c (flo_round): fix for negative value.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31778 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-29 06:09:08 +00:00
nobu 52f5f410e4 * internal.h: add for internal use only.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31627 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-18 13:41:54 +00:00