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

283 Коммитов

Автор SHA1 Сообщение Дата
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