* proc.c (rb_proc_location): return file name and line number where
the proc is defined.
* thread.c (thread_s_new): call initialize. [ruby-core:13835]
* thread.c (thread_initialize): split initialize method.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14109 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
[ruby-dev:31351]
* thread.c (ruby_suppress_tracing): added a new parameter, which
directs to call func always.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14104 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
load path. [ruby-dev:31932]
* eval_load.c (load_lock): check the result of barrier waiting.
* thread.c (rb_barrier_wait): check if owned by the current thread.
* thread.c (rb_barrier_release): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13826 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* thread_win32.ci, thread_win32.h, thread_pthread.ci, thread_pthread.h:
prepare native_cond_*() which are based on pthread_cond_*() spec.
* prelude.rb: fix Mutex#synchronize method.
* vm_core.h, include/ruby/intern.h: change unblock function interface
(to pass some user data).
* file.c, process.c: ditto.
* benchmark/bm_vm2_mutex.rb: add a benchmark for mutex.
* benchmark/bm_vm3_thread_mutex.rb: add a benchmark for mutex
with contension.
* benchmark/run.rb: fix to remove ENV['RUBYLIB'] for matzruby.
* test/ruby/test_thread.rb: add a test.
* common.mk: fix benchmark options.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13290 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
thrown by another thread or not. [ruby-dev:31371]
* bootstraptest/test_thread.rb: add a test for above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12925 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
thread. submitted at [ruby-core:11873] by David Flanagan <david AT
davidflanagan.com>. [ruby-core:11876]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12915 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
well as version 1.8.
* include/ruby/ruby.h (is_ruby_native_thread): moved prototype
from intern.h as well as version 1.8.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12837 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* gc.h (SET_MACHINE_STACK_END): new macro to replace
rb_gc_set_stack_end. it find out accurate stack boundary by
asm using gcc on x86.
* thread.c (rb_gc_set_stack_end): don't define if asm-version
SET_MACHINE_STACK_END is available.
* gc.c (mark_current_thread): extracted from garbage_collect.
it use SET_MACHINE_STACK_END to not scan out of stack area.
it notify conservative GC information to valgrind if
--enable-valgrind.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12785 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* insnhelper.ci: added. this function includes all functions that
vm insns need.
* common.mk: ditto.
* insnhelper.h, vm.h, vm.c: move some declaration.
* gc.h: remove GC_CHECK() macro because GC.stress is more useful.
* compile.c, iseq.c, vm_dump: ditto.
* gc.h, thread.c: move a prototype decalaration.
* debug.c, debug.h: rename some functions.
* compile.h: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12605 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
[ruby-talk:253586]
* thread.c (ruby_suppress_tracing): new function to call a function
with suppressing trace.
* lib/debug.rb, lib/tracer.rb: for YARV.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12569 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
to avoid GC problem in very early stage.
(RUBY_GC_STRESS causes GC in such stage.)
* variable.c (rb_gc_mark_global_tbl): rb_global_tbl may be 0 in
very early stage.
* thread.c (thread_cleanup_func) [IA64]: clear register stack position.
(thread_start_func_2) [IA64]: record the beginning of register
stack using extra argument.
(rb_gc_save_machine_context) [IA64]: record the end of register
stack.
* gc.c [IA64] (SET_STACK_END): record the end of register stack.
(garbage_collect) [IA64]: use recorded register stack area for
GC marking.
(yarv_machine_stack_mark) [IA64]: GC mark from the register stack
area.
* yarvcore.c [IA64] (rb_gc_register_stack_start): defined.
(Init_VM): store th->self on stack to fix GC problem.
(Init_yarv) [IA64]: initialize the beginning of register stack.
* yarvcore.h (struct rb_thread_struct) [IA64]: new members for
register stack area.
* thread_pthread.ci (thread_start_func_1) [IA64]: call
thread_start_func_2 with the end of register stack.
* cont.c (struct rb_context_struct) [IA64]: new members for register
stack area.
(cont_mark) [IA64]: GC mark from register stack area.
(cont_free) [IA64]: free saved register stack.
(cont_save_machine_stack) [IA64]: record the position and contents
of the register stack.
(cont_capture): store cont->self on stack to fix GC problem.
(cont_restore_1) [IA64]: restore the register stack.
[IA64] (register_stack_extend): new function.
(cont_restore_0) [IA64]: call register_stack_extend instead of
cont_restore_1.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12537 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Fiber is known as "Micro Thread", "Coroutine", and other terms.
At this time, only Fiber#pass is supported to change context.
I want to know more suitable method name/API for Fiber (... do you
know more suitable class name instead of Fiber?) as "suspend/resume",
"call", "yield", "start/kick/stop/restart", ....
* eval.c, eval_intern.h, thread.c, yarvcore.c, yarvcore.h: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12395 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
search_required, rb_require_safe), ext/extmk.rb: Fix
a bug where a statically linked extension cannot be autoloaded.
[ruby-dev:30023] / [ruby-dev:30239]
* thread.c: added an internal class, Barrier.
* yarvcore.h (struct rb_vm_struct): moved loading_table from global.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12246 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* eval_error.h (error_handle): no message when exiting by signal.
* intern.h (rb_thread_signal_raise, ruby_default_signal): prototypes.
* signal.c (esignal_init): takes a signal number and an optional
signal name.
* signal.c (interrupt_init): pass SIGINT always.
* signal.c (ruby_default_signal): invoke system default signal
handler.
* signal.c (rb_f_kill): use NUM2PIDT instead of NUM2INT.
* signal.c (rb_signal_exec, trap): handle SIGTERM. [ruby-dev:30505]
* thread.c (rb_thread_signal_raise): now takes signal number instead
of signal name.
* thread.c (rb_thread_signal_exit): since rb_make_exception() calls
#exception method, rb_class_new_instance() is not needed here.
* yarvcore.h (struct rb_vm_struct), eval_jump.h (terminate_process):
exit_code is no longer stored in VM.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
support set_trace_func (incomplete. id and klass
don't be passed). And support Thread#set_trace_func
which hook only specified thread and Thread#add_trace_func
which add new trace func instead of replace old one.
C level API was modified. See thread.c (logic) and
yarvcore.h (data structures).
* vm.c, vm_macro.def: add hook points.
* compile.c, insns.def: fix "trace" instruction.
* iseq.c, vm_macro.h: add compile option "trace_instruction".
* test/ruby/test_settracefunc.rb: hook "c-return" of set_trace_func.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* thread_pthread.ci: fix to show error code in error message.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12173 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* thread.c (BLOCKING_REGION): restore previous UBF.
* thread.c (rb_thread_blocking_region): default UBF to interrupt
in system dependent way by RB_UBF_DFL.
+ ubf_select() on posix system
+ ubf_handle() on Win32
+ none on cygwin
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11861 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* thread_win32.ci (w32_wait_events): rename from w32_wait_event(), and
now receive multiple event handles.
* win32/win32.c (wait_events, rb_w32_main_context): removed.
* thread_win32.ci (rb_w32_wait_events): new function.
* thread_win32.ci, win32/win32.c (rb_w32_sleep, rb_w32_Sleep): move
from win32/win32.c to thread_win32.ci, and use w32_wait_events().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11832 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
on cygwin/mswin32, iterate in unblocking region.
* thread.c (rb_thread_select): don't iterate on this function.
(iterate in do_select).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11722 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
move cleanup function to thread_start_func_2().
* thread.c, thread_pthread.ci, thread_win32.ci:
add more destruct functions.
(native_thread_destroy() and native_mutex_destroy())
* thread_pthread.ci, thread_pthread.h: make native_mutex_* functions
(check error, etc), it's not macro any more.
* thread_win32.ci (thread_start_func_1): store some values before
running thread (to release these after running thread).
* thread_win32.ci (native_thread_create): fix spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11671 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* thread.c: fix to define Continuation methods
(they only do rb_notimplement()).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11655 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
moving definitions place, add/remove prototypes, deleting
unused variables and removing yarv.h.
This commit doesn't change any behavior of ruby/vm.
* yarv.h, common.mk: remove yarv.h (contents are moved to yarvcore.h).
* error.c, eval_intern.h: include yarvcore.h instead yarv.h
* rename some functions:
* debug.[ch]: debug_*() -> ruby_debug_*()
* iseq.c: iseq_*() -> rb_iseq_*(), ruby_iseq_disasm()
* iseq.c: node_name() -> ruby_node_name()
* vm.c: yarv_check_redefinition_opt_method() ->
rb_vm_check_redefinition_opt_method()
* some refactoring with checking -Wall.
* array.c: remove rb_ary_ptr() (unused) and remove unused
local variables.
* object.c: add a prototype of rb_mod_module_exec().
* eval_intern.h (ruby_cref): set it inline.
* eval_load.c (rb_load), yarvcore.c: yarv_load() -> rb_load_internal().
* parse.y: add a prototype of rb_parse_in_eval() (in eval.c).
* process.c: add a prototype of rb_thread_stop_timer_thread() (in thread.c).
* thread.c: remove raw_gets() function (unused) and fix some format
mismatch (format mismatchs have remained yet. this is todo).
* thread.c (rb_thread_wait_fd_rw): fix typo on label name.
* thread_pthread.ci: comment out codes with USE_THREAD_CACHE.
* vm.c (rb_svar, rb_backref_get, rb_backref_get,
rb_lastline_get, rb_lastline_set) : moved from yarvcore.c.
* vm.c (yarv_init_redefined_flag): add a prototype and rename
yarv_opt_method_table to vm_opt_method_table.
* vm.c (rb_thread_eval): moved from yarvcore.c.
* yarvcore.c: remove unused global variables and fix to use nsdr().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* yarvcore.c: rename cYarvThread to rb_cThread.
* gc.c: remove YARV_* prefix.
* gc.h: add an include guard and prototype of rb_gc_set_stack_end().
* inits.c: fix to ANSI prototype style and reorder Init_*().
* io.c (pipe_finalize): TODO: comment out last_status.
* process.c, yarvcore.h: fix to use yarv_vm_t#last_status instead of
rb_last_status and make last_status_get() to access $?.
* yarvcore.c (vm_mark): mark yarv_vm_t#last_status.
* ruby.h: add declarations of rb_cISeq and rb_cVM.
* thread.c: move eval_thread.c codes to thread.c and remove yarv_*
function prefix.
* thread.c (thread_start_func_2): use yarv_thread_t#first_func if
it is not null.
* vm.c: fix copyright year.
* yarvcore.c (Init_vm): rename to Init_VM().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11631 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
rb_thread_start_timer_thread()): added.
* thread_pthread.ci: add a native_thread_join() and move
rb_thread_reset_timer_thread() definition to thread.c.
* thread_win32.ci: ditto
* process.c: fix before_exec(), after_exec() to stop timer thread
(and restart timer thread if exec failed). and fix to reset
timer thread information when forked child process starts
(to fix [ruby-core:09822]).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e