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

271 Коммитов

Автор SHA1 Сообщение Дата
nobu 25b9eb5e57 * include/ruby/ruby.h (rb_data_type_t): restructured. [ruby-dev:41862]
add parent member.

* error.c (rb_typeddata_inherited_p): new function.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28676 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-18 07:31:54 +00:00
nobu c04d79f867 * thread.c (rb_thread_wakeup_alive): split from rb_thread_wakeup.
merged from r13476.  c.f. [ruby-core:31320]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28660 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-17 04:04:51 +00:00
mame d9d650ecfd * thread.c (rb_fd_resize, rb_fd_copy): avoid NULL dereference upon
failed realloc by using xrealloc instead of not realloc.  a patch
  from Jim Meyering <meyering at redhat.com> in [ruby-core:30920]
  [Bug #3489]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28457 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-28 12:58:03 +00:00
nobu f5534ad5b4 * thread.c (Init_Thread): no need to suppress warning for
ruby_thread_set_native anymore.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28196 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-07 18:30:35 +00:00
akr f40d2c9670 * vm.c (Init_BareVM): call Init_native_thread here.
* thread.c (Init_Thread): don't call Init_native_thread.

* thread_pthread.c (Init_native_thread): exported.

* thread_win32.c (Init_native_thread): ditto.

[ruby-dev:41536]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28183 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-05 23:26:43 +00:00
nobu 45f6fbf339 * removed trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-29 18:51:39 +00:00
tarui 12a99794b4 * thread.c (RB_GC_SAVE_MACHINE_CONTEXT), gc.c (ruby_gc_stress_start):
revert r28078.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-29 17:26:01 +00:00
tarui d0914b3552 * thread.c (RB_GC_SAVE_MACHINE_CONTEXT): start GC
by switching the thread if gc_stress == true 

* gc.c (ruby_gc_stress_start): dotto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28078 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-29 16:32:59 +00:00
kosaki 827a17bdbb * thread.c (blocking_region_begin): avoid RUBY_VM_CHECK_INTS()
call during GVL state transition. [Bug#3354] [ruby-dev:41435]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28055 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-28 12:28:32 +00:00
usa f82a6840a8 * thread.c (subtract_tv): if the rest is zero, should finish waiting
immediately.

* win32/win32.c (subtract): ditto.
  based on a patch from Roger Pack in [ruby-core:27957].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-20 16:13:35 +00:00
marcandre 7729de4d91 * array.c: Documentation: change => in call-seq to ->.
Harmonize "#=>" in examples. [ruby-core:30206]

* bignum.c: ditto

* class.c: ditto

* compar.c: ditto

* cont.c: ditto

* dir.c: ditto

* encoding.c: ditto

* enum.c: ditto

* enumerator.c: ditto

* error.c: ditto

* eval.c: ditto

* file.c: ditto

* gc.c: ditto

* io.c: ditto

* load.c: ditto

* marshal.c: ditto

* math.c: ditto

* numeric.c: ditto

* object.c: ditto

* pack.c: ditto

* proc.c: ditto

* process.c: ditto

* random.c: ditto

* range.c: ditto

* re.c: ditto

* ruby.c: ditto

* signal.c: ditto

* sprintf.c: ditto

* string.c: ditto

* struct.c: ditto

* thread.c: ditto

* time.c: ditto

* transcode.c: ditto

* variable.c: ditto

* vm_eval.c: ditto

* vm_method.c: ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-17 21:07:33 +00:00
mame 50587316b8 * vm_core.c (rb_thread_struct): add a field for sigaltstack.
* thread_pthread.c (thread_start_func_1): initialize machine stack
  information.

* thread.c (thread_start_func_2): set sigaltstack for each sub thread.
  [ruby-core:24540] [ruby-core:30207]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27789 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-13 16:20:26 +00:00
nobu 6aa05eba8a * thread.c (rb_thread_aset): fixed argument type.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27678 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-08 15:27:48 +00:00
marcandre 1dee5e34a3 * error.c: RDoc for subclasses of Exception. [ruby-core:28394]
* cont.c: ditto

* enumerator.c: ditto

* io.c: ditto

* math.c: ditto

* numeric.c: ditto

* proc.c: ditto

* re.c: ditto

* thread.c: ditto

* transcode.c: ditto. Thanks to Run Paint for some of the documentation.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27671 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-08 04:50:09 +00:00
mame 97cfd1869c * thread. (rb_thread_terminate_all): revert r24591 which caused SEGV
sometimes.  [ruby-dev:40936] [ruby-core:27245] [ruby-core:27416]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-28 13:56:32 +00:00
nobu 92e2b86c3d * thread.c (timer_thread_function): unused variable.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27522 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-28 00:47:19 +00:00
mame 4af243a8af * eval.c (ruby_cleanup): before cleanup, check signal buffer and run
handler if any.  [ruby-core:20970]

* thread.c (rb_threadptr_check_signal): separeted from
  timer_thread_function.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27513 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-27 12:27:13 +00:00
mame 59b91237c3 * thread.c (rb_thread_blocking_region, rb_thread_blocking_region_end):
preserve errno.  [Bug #2606] [ruby-core:28924]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27401 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-19 15:34:04 +00:00
mame 42b8a699ed * thread.c (rb_thread_priority, rb_thread_priority_set): fix rdoc.
Lower-priority thread may run even if there are higher-priority
  threads.  See [ruby-dev:40977].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27351 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-15 13:44:52 +00:00
kosaki 75ce78429e * vm_core.h: Introduce UNINITIALIZED_VAR() macro.
* thread.c (do_select): Use UNINITIALIZED_VAR() instead FAKE_FD_ZERO().
	  Also, remove FAKE_FD_ZERO completely. [Feature #3018]




git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-06 14:07:06 +00:00
wanabe 0a6418d85e * thread.c (thread_reset_event_flags): set flags to thread.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27046 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-25 14:56:38 +00:00
mame 96ecfe9a57 * thread.c (thread_create_core): let new thread inherit RUBY_EVENT_VM
of event_flags.  [ruby-core:25191]

* thread.c (rb_threadptr_exec_event_hooks): delete RUBY_EVENT_VM if
  all event_hooks are removed.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27033 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-24 14:47:00 +00:00
usa 6ebdbb30ad * thread.c (do_select): wrong conditions. [ruby-core:27753]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-25 14:09:46 +00:00
nobu a1d4164257 * thread.c (thread_start_func_2): unlock all locking mutexes
before clean up.  [ruby-core:26877]

* thread.c (rb_thread_atfork): no other threads to be joined.

* vm_core.h (rb_thread_lock_unlock, rb_thread_lock_destroy):
  new functions.

* vm.c (ruby_vm_destruct): unlock and destroy global VM lock.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26390 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-23 20:18:36 +00:00
yugui 295bc2fe25 removes the dtrace support. reverts r26239, r26238 and r26235.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-05 05:59:23 +00:00
yugui b80814c339 * gc.c: added UNLIKELY to probes for optimization.
* vm.c: ditto.

* thread.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26239 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-04 12:36:46 +00:00
yugui 72b199940d * trace.h: new file. wraps tracing mechanisms.
* defs/dtrace.d: new file. defined a dtrace provider "ruby".

* include/ruby/ruby.h (LIKELY): moved from vm.c.
  (UNLIKELY): ditto.
  (OBJSETUP): probe "object-create".
  (RUBY_EVENT_RESCUE): new event.

* vm_exec.c (DEBUG_ENTER_INSN): embeded a probe insn-entry into it.
  (DEBUG_END_INSN): insn-return.

* vm.c (LIKELY): moved into ruby.h.
  (UNLIKELY): ditto.
  (Init_BareVM): embeded a probe "raise" into it.

* variable.c (rb_class2name_without_alloc): new utility function.

* tool/rbinstall.rb (install?(:ext, :arch, :'ext-arch')): installs 
  dtrace.d if necessary.

* thread_pthread.c (add_signal_thread_list): probe "raise".
  (rb_thread_create_timer_thread): ditto.

* thread.c (rb_thread_schedule_rec): probes "thread-enter" and
  "thread-leave",
  (thread_start_func_2): ditto.
  (thread_cleanup_func): probe "thread-term"

* lib/mkmf.rb: supports dtrace postprocessor on making an extension.

* iseq.c (rb_vm_insn_name): new utility function.
  (rb_vm_insn_len): ditto.

* insns.def (hook): probes "method-etnry", "method-return", "line",
  and "rescue".

* compile.c (iseq_compile_each): adds a trace op for "rescue" probe.

* gc.c (garbage_collect): probes "gc-begin" and "gc-end".
  (obj_free): probe "object-free"
  (garbage_collect_with_gvl): probe "raise"
  (negative_size_allocation_error): ditto.
  (rb_memerror): ditto.

* eval.c (rb_rescue2): probe "rescue"
  (rb_longjmp): probe "raise"

* ext/probe/probe.c: new extension for application defined probes.

* ext/probe/extconf.rb: ditto.

* configure.in (--with-tracing-model): new option to choose a tracing
  mechanism.
  (DTRACE): new substitution. name of dtrace(1).
  (RUBY_TRACING_MODEL): new substitution.
  (DTRACE_OBJ): ditto.
  (MINIDTRACE_OBJ): ditto.
  (GOLFDTRACE_OBJ): ditto.
  (LIBRUBY_DTRACE_OBJ): ditto.
  (RUBY_DTRACE_POSTPROCESS): new macro. checks whether the dtrace on 
  the system needs postprocessing.
  (RUBY_DTRACE_BSD_BROKEN): new macro. checks whether the dtrace
  supports USDT.

* Makefile.in: 
  (DTRACE): new variable. name of dtrace(1).
  (TRACING_MODEL): new variable. name of the chosen tracing mechanism.
  (DTRACE_OBJ): same as the one in configure.in.
  (MINIDTRACE_OBJ): ditto.
  (GOLFDTRACE_OBJ): ditto.
  (LIBRUBY_DTRACE_OBJ): ditto.
  (CPPOUTFILE): new substitution. necessary for generating dtrace.d
  (trace_none.h): new target for TRACING_MODEL=none
  (RUBY_H_INCLUDES): appended a header for tracing.
  (distclean-local): also removes preprocessed version of dtrace.d
  ($(LIBRUBY_A)): needs $(LIBRUBY_DTRACE_OBJ) if dtrace needs 
  postprocessing.
  ($(PROGRAM)): ditto.
  (golf): ditto.
  (miniruby): ditto.
  ($(arch_hdrdir)/ruby/dtrace.d): new target. preprocessed verson 
  of defs/dtrace.d. generated if necessary.
  ($(arch_hdrdir)/ruby/trace_dtrace.h): new target.
  definition of probes.
  ($(LIBRUBY_DTRACE_OBJ)): new target. generated if dtrace needs 
  postprocessing.
  ($(DTRACE_OBJ)): ditto.
  ($(MINIDTRACE_OBJ)): ditto.
  ($(GOLFDTRACE_OBJ)): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-03 15:36:17 +00:00
naruse f62310ac62 doc fix: mutex.lock => self [ruby-core:27115]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26072 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-12-13 14:08:37 +00:00
nobu 748fe216c2 * thread.c (rb_thread_atfork_internal): reinitialize global lock
at fork to get rid of deadlock.  based on the patch from Hongli
  Lai in [ruby-core:26783].  [ruby-core:26361]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25842 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-18 09:25:11 +00:00
nobu e8c17f1a59 * thread.c (terminate_atfork_i): all mutex locks by other threads
have been abandoned at fork.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25841 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-18 08:48:24 +00:00
mame 31c0e3385f * thread.c (thread_cleanup_func): delete locking_mutex when thread
object become dummy because of fork.  [ruby-core:26744]
  [ruby-core:26745]

* bootstraptest/test_thread.rb: add a test for above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25771 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-15 15:10:49 +00:00
nobu 9ba317f157 * thread.c (thread_start_func_2): see first_func, not first_proc,
to decide which to use.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25748 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-13 07:22:04 +00:00
nobu 1d4183030d * thread.c (thread_create_core): moved failure handling from
native_thread_core().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25726 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-12 04:57:39 +00:00
akr 6ebdf24500 * thread.c (blocking_region_begin): define before BLOCKING_REGION.
reported by Luis Lavena.  [ruby-core:26670]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25713 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-10 23:34:03 +00:00
akr d6f5da84e3 * thread.c (rb_gc_save_machine_context): don't save the stack pointer
in this function.
  (RB_GC_SAVE_MACHINE_CONTEXT): call rb_gc_save_machine_context and
  save the stack pointer at caller side.
  (rb_thread_schedule_rec): use RB_GC_SAVE_MACHINE_CONTEXT instead of
  rb_gc_save_machine_context.
  (blocking_region_begin): changed to a macro.  use
  RB_GC_SAVE_MACHINE_CONTEXT instead of rb_gc_save_machine_context.
  [ruby-dev:39659]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25701 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-09 11:18:17 +00:00
akr b9e0294eda fix typos.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-03 17:46:28 +00:00
usa 9ee5e613b5 * thread_{pthread,win32}.c (native_stop_timer_thread): join the thread
here.

* thread_{pthread,win32}.c (native_reset_timer_thread): new function.

* thread.c (rb_thread_stop_timer_thread, rb_thread_reset_timer_thread):
  call above function instead of simply seting 0.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25627 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-02 03:58:25 +00:00
nobu 6116f52f61 * thread.c (rb_thread_blocking_region): reverted r25566, and added
description that no exception is allowed inside `func', instead.
  see [ruby-dev:39582]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25570 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-30 04:36:40 +00:00
usa de6d21a381 * thread.c (rb_thread_blocking_region): standard C doesn't accept
preprosessing directive within macro expansion.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25567 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-30 04:01:46 +00:00
nobu 411b747091 * thread.c (rb_thread_blocking_region): must ensure to unlock GVL.
[ruby-dev:39579]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25566 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-30 01:55:38 +00:00
marcandre a77a9bb20c * thread.c: Revert changes to Thread#raise made in r25278 [ruby-core:25367]
* eval_intern.h: ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25316 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-12 23:53:48 +00:00
marcandre 4aa531ead4 * thread.c: Doc fix for Thread#raise
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25306 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-11 22:08:51 +00:00
nobu 478d3535ef * eval.c (rb_threadptr_errinfo): renamed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25283 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-10 08:57:02 +00:00
marcandre 8571bdbd67 * thread.c (rb_threadptr_execute_interrupts_rec, rb_threadptr_raise): Thread#raise with no argument will now re-raise the current exception if there is one [ruby-core:25367]
* eval.c (get_errinfo, rb_rubylevel_thread_errinfo): Getter for current exception for a given thread

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25278 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-10 05:13:08 +00:00
nobu 56e358d5f9 * thread.c (ruby_suppress_tracing): get rid of clobbering by
longjmp.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25180 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-02 06:34:18 +00:00
nobu fe1ce93f52 * compile.c, cont.c, gc.c, insns.def, iseq.c, iseq.h, process.c,
thread.c, vm.c, vm_core.h, vm_dump.c, vm_eval.c,
  vm_insnhelper.c, vm_method.c, template/insns_info.inc.tmpl,
  tool/instruction.rb: fixed types.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25030 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-21 20:58:26 +00:00
nobu 76fa0d6615 * thread.c: added rdocs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24978 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-17 04:51:33 +00:00
nobu a289f7a4b1 * thread.c (rb_thread_s_debug_set): set level, not only boolean.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-17 04:50:52 +00:00
marcandre 1796522f10 * thread.c (rb_exec_recursive_outer, rb_exec_recursive): Added method to short-circuit to the outermost level in case of recursion
* test/ruby/test_thread.rb (test_recursive_outer): Test for above

* hash.c (rb_hash_hash): Return a sensible hash for in case of recursion [ruby-core:24648]

* range.c (rb_range_hash): ditto

* struct.c (rb_struct_hash): ditto

* array.c (rb_array_hash): ditto

* test/ruby/test_array.rb (test_hash2): test for above

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-15 21:30:50 +00:00
nobu 60f545e2ac * thread.c (thread_list_access): prototyped.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24892 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-13 05:09:15 +00:00