summaryrefslogtreecommitdiff
path: root/vm_core.h
AgeCommit message (Collapse)Author
2012-03-16* iseq.c (rb_iseq_first_lineno): constified.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35051 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-30* vm_core.h: Fix comment about arg_opts of iseq and some typosmarcandre
* doc/re.rdoc: Rdoc small fixes * iseq.c: Fix comment git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-26* vm_core.h (struct rb_iseq_struct), compile.c (iseq_set_arguments), iseq.c ↵mame
(rb_iseq_parameters), vm_insnhelper.c (vm_callee_setup_arg_complex): support Method#parameters for keyword arguments. The provisional spec is what Benoit Daloze proposed. [ruby-core:40518] * test/ruby/test_keyword.rb: add a test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34137 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-26* vm_core.h (struct rb_iseq_struct), compile.c (iseq_set_arguments, ↵mame
iseq_compile_each), vm_insnhelper.c (vm_callee_setup_arg_complex): implement keyword arguments. See [ruby-core:40290] The feature is promised to be included in 2.0, but the detail spec is still under discussion; this commit is a springboard for further discussion. Please try it and give us feedback. This commit includes fixes for some problems reported by Benoit Daloze <eregontp AT gmail.com> [ruby-core:40518] and Marc-Andre Lafortune <ruby-core-mailing-list AT marc-andre.ca> [ruby-core:41772]. * iseq.c (iseq_free, prepare_iseq_build): bookkeeping. * test/ruby/test_keyword.rb: add tests for keyword arguments. * test/ripper/dummyparser.rb (class DummyParser): temporal fix for ripper test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34136 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-18* vm_core.h (ruby_current_thread): probeprofiler has been removednobu
long ago. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33475 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-27* vm.c (rb_vm_rewrite_dfp_in_errinfo): change return typektsj
to suppress a warning. * vm_core.h: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33099 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-27* proc.c (proc_new): force to rewrite errinfo when calling Proc.new in ensure.ktsj
[Bug #5234] [ruby-core:39125] This code will be removed after changing throw mechanism (see r33064). * vm.c (rb_vm_rewrite_dfp_in_errinfo): new function. * vm.c (vm_make_env_each): changed accordingly. * vm_core.h: ditto. * bootstraptest/test_flow.rb: add tests for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-26* vm_core.h: add a decl. of rb_autoloading_value().ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33079 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-24* iseq.h, iseq.c, compile.c: Change the line number data structureko1
to solve an issue reported at [ruby-dev:44413] [Ruby 1.9 - Bug #5217]. Before this fix, each instruction has an information including line number (iseq::iseq_insn_info_table). Instead of this data structure, recording only line number changing places (iseq::iseq_line_info_table). The order of entries in iseq_line_info_table is ascending order of iseq_line_info_table_entry::position. You can get a line number by an iseq and a program counter with this data structure. This fix reduces memory consumption of iseq (bytecode). On my measurement, a rails application consumes 21.8MB for iseq with this fix on the 32bit CPU. Without this fix, it consumes 24.7MB for iseq [ruby-dev:44415]. * proc.c: ditto. * vm_insnhelper.c: ditto. * vm_method.c: ditto. * vm.c (rb_vm_get_sourceline): change to use rb_iseq_line_no(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33046 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-16* vm.c (ruby_threadptr_data_type): rename to hide.nobu
[ruby-core:38972] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32986 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-30* vm_core.h (ALT_STACK_SIZE): use MINSIGSTKSZ*2 instead of SIGSTKSZ*2.kosaki
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32751 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-30* vm.c (th_init): preallocate alternative stack.kosaki
NoMemoryError is better than rb_bug, of course. Patch by Eric Wong. [ruby-core:38572][ruby-core:38594]. * signal.c (rb_register_sigaltstack): ditto. * vm_core.h: moved ALT_STACK_SIZE definition from signal.c. * vm.c (thread_free): use xfree() instead of free(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32749 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-25* proc.c (struct METHOD), gc.c (gc_marks), vm_method.cmame
(rb_gc_mark_unlinked_live_method_entries): fix SEGV bug. rb_method_entry_t was free'd even when the method is still on the stack if it is BMETHOD (i.e., Method#call). This is because rb_method_entry_t is embedded in struct METHOD. This commit separates them and marks the live method entries. See [ruby-core:38449] in detail. fix [Bug #5047] [ruby-core:38171] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32669 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-10* thread_pthread.c (rb_thread_create_timer_thread): removedkosaki
rb_disable_interrupt()/rb_enable_interrupt(). * vm_core.h: ditto. * process.c (static void before_exec): ditto. * process.c (static void after_exec): ditto. [Bug #4765] [ruby-dev:43571] * eval_intern.h: removed rb_trap_restore_mask(). * vm_eval.c (rb_throw_obj): ditto. * eval.c (setup_exception): ditto. * signal.c: removed trap_last_mask. * signal.c (trap_restore_mask): removed. * signal.c (init_sigchld): comment clarification why signal block is needed. and removed trap_last_mask operation. * signal.c (trap_ensure): removed trap_last_mask operation. * signal.c (rb_disable_interrupt, rb_enable_interrupt): made static and removed sigdelset(SIGVTALARM) and sigdelset(SIGSEGV). * process.c (rb_syswait): removed implicit signal handler change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-10* vm_core.h (typedef struct rb_vm_struct): create a newkosaki
'inhibit_thread_createion' field. * thread.c (rb_thread_terminate_all): set inhibit_thread_creation. * thread.c (thread_s_new): don't permit to create new thread if the VM is under destruction. Otherwise evil finalizer code can make SEGV. [Bug #4992][ruby-core:37858] * bootstraptest/test_objectspace.rb: new test for this fix. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-08* thread.c (thread_unlock_all_locking_mutexes): rename tokosaki
rb_threadptr_unlock_all_locking_mutexes and remove static. * vm_core.h: add rb_threadptr_unlock_all_locking_mutexes declaration. * thread.c (thread_start_func_2): adjust the above rename. * eval.c (ruby_cleanup): call rb_threadptr_unlock_all_locking_mutexes again after finalizer. [Bug #4988] [ruby-dev:44049] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32446 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-30* thread.c (rb_threadptr_check_signal): only wake up main thread.ko1
* thread.c (rb_threadptr_execute_interrupts_common): check signal deliverly if it is main thread. fixes [ruby-dev:44005] [Ruby 1.9 - Bug #4950] * bootstraptest/test_fork.rb: add a test for above. * signal.c (rb_get_next_signal): skip if signal_buff is empty. (check signal_buff.size first) * vm_core.h: remove unused variable rb_thread_t::exec_signal. * thread.c (rb_thread_check_trap_pending): check rb_signal_buff_size() because rb_thread_t::exec_signal is no longer available. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32345 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-27* thread_pthread.c: Stop polling in the timer thread when there areko1
no waiting thread. If there are 2 or more runnable threads, the timer thread does polling. Avoid polling makes power save for several computers (0.2W per a Ruby process, when I measured). If outside-event such as signal or Thread#kill was occuerred when the timer thread does not do polling, then wake-up the timer thread using communication-pipe (the timer thread waits this communication-pipe with select(2)). The discussion about this modification can be found from the post [ruby-core:33456] and other related posts. Note that Eric Wong and KOSAKI Motohiro give us the huge contributions for this modification. Thanks. * thread_pthread.c (rb_thread_wakeup_timer_thread): add a function. This function wakes up the timer thread using communication-pipe. * thread.c (rb_thread_stop_timer_thread): add a parameter which specify closing communication-pipe or not. * thread.c (rb_thread_terminate_all): do not stop timer thread here (ruby_cleanup() terminate timer thread). * signal.c: wake up timer thread using rb_thread_wakeup_timer_thread() from signal handler. * eval.c (ruby_cleanup): use rb_thread_stop_timer_thread(1). * process.c: use rb_thread_stop_timer_thread(0) (reuse communication-pipe). * thread_win32.c (rb_thread_wakeup_timer_thread): add a dummy function. * vm_core.h: add and fix decl. of functions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32244 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-18* vm.c, vm_core.h (rb_vm_stack_to_heap): remove const.kosaki
It makes compilations warnings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32167 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-18* vm.c, vm_core.h (rb_vm_stack_to_heap): fix "const" place.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32166 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-18* eval.c, hash.c, load.c, proc.c, range.c, thread.c, time.c: don'takr
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-17* internal.h: declare internal functions here.akr
* 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-13* thread_pthread.c: rewrite GVL completely.kosaki
* thread_win32.c: ditto. * thread_pthread.h: ditto. * vm_core.h: ditto. * thread.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32064 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-13* vm_core.h, vm_insnhelper.h: move decl. ofko1
ruby_vm_global_state_version and related macros from vm_core.h to vm_insnhelper.h. * vm.c (vm_clear_all_cache): added. This function is called when ruby_vm_global_state_version overflows. TODO: vm_clear_all_inline_method_cache() is only place holder. We need to implement it ASAP. * vm_method.c (vm_clear_global_method_cache): added. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32056 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-12* thread.c: remove th->transition_for_lock. It's thread unsafe.kosaki
[Bug #4723][ruby-dev:43563] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32022 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-11* vm_core.h (RUBY_VM_SET_TIMER_INTERRUPT, RUBY_VM_SET_INTERRUPT,kosaki
RUBY_VM_SET_FINALIZER_INTERRUPT): use atomic ops for preventing interrupt_flag bit lost. * thread.c (rb_threadptr_execute_interrupts_rec): ditto. * vm_core.h (typedef struct rb_thread_struct): change type of interrupt_flag to rb_atomic_t. * atomic.h: move atomic ops definition from signal.c. * signal.c: remove atomic ops definition. * common.mk (gc, signal, thread, cont): add to dependency to atomic.h. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32014 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-09* io.c: fix IO.copy_stream interrupt handling.akr
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-05-17* vm_core.h (rb_thread_struct): add volatile tokosaki
transition_for_lock because it is not protected by lock. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31609 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-01* vm_core.h (RUBY_VM_CHECK_INTS_TH): merge a patch by ko1nobu
in [ruby-dev:43373]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31227 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-12* thread.c (rb_thread_io_blocking_region): new function to runnobu
blocking region with GIL released, for fd. * thread.c (rb_thread_fd_close): implement. [ruby-core:35203] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-04* vm.c (ruby_thread_data_type): add prefix.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30783 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-04 * vm_core.h (GetThreadPtr): use TypedData_Get_Struct() insteadkosaki
CoreDataFromValue() because we need type check. Otherwise, type mismatch can cause segmentation fault crash. [ruby-core:35086] [Ruby 1.9-Bug#4367] * vm.c (thread_data_type): remove static. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30781 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-21* vm_core.h: parenthesize macro arguments.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30622 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-20* compile.c (setup_args), vm.c (invoke_block_from_c),nobu
vm_insnhelper.c (caller_setup_args): reverted r30241 and r30243 except for the test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30283 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-18* compile.c (setup_args), vm.c (invoke_block_from_c),nobu
vm_insnhelper.c (caller_setup_args): fix of r30241. lambda block shoud check argument number. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-10remove a comma at end of enumerator list.kazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-04* vm_core.h (rb_vm_inc_const_missing_count): missing prototype.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30076 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-02 * vm.c (ruby_vm_at_exit): new API. This enables extension libs toshyouhei
hook a VM termination. Right now, because the VM we have is process global, most extensions do not deallocate resources and leave them to Operating System's reaping userland processes. But in a future we plan to have multiple VMs to run simultaneously in a single process (MVM project). At that stage we can no longer rely on OSes and have to manage every resources to be reclaimed properly. So it is. For a forward-compatibility reason this API is introduced now, encouraging you to be as gentle as you can for your resources; that is, tidy up your room. * include/ruby/vm.h: ditto. * vm_core.h (rb_vm_struct): new field. * vm.c (vm_init2): initialize above new field. * eval.c (ruby_cleanup): trigger those hooks. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30050 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-28* thread_pthread.c (gvl_release, gvl_init): suppress warnings.nobu
* vm_core.h (rb_vm_gvl_destroy): add prototype. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29958 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-27* thread.c, vm_core.h: make gvl_acquire/release/init/destructko1
APIs to modularize GVL implementation. * thread_pthread.c, thread_pthread.h: Two GVL implementations. (1) Simple locking GVL which is same as existing GVL. (2) Wake-up queued threads. The wake-up order is simple FIFO. (We can make several queues to support exact priorities, however this causes some issues such as priority inversion and so on.) This impl. prevents spin-loop (*1) caused on SMP environemnts. *1: Only one Ruby thread acqures GVL again and again. Bug #2359 [ruby-core:26694] * thread_win32.c, thread_win32.h: Using simple lock not by CRITICAL_SECTION but by Mutex. Bug #3890 [ruby-dev:42315] * vm.c (ruby_vm_destruct): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29956 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-03* gc.c, vm.c, vm_core.h: remove USE_VALUE_CACHE option.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29675 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-31* compile.c (new_child_iseq): adjust argument types.nobu
* iseq.c (prepare_iseq_build, rb_iseq_new), (rb_iseq_new_with_bopt_and_opt, rb_iseq_new_with_opt), (rb_iseq_new_with_bopt): ditto. * compile.c (iseq_set_exception_table): suppress warnings. * insns.def (putspecialobject, defined): ditto. * iseq.c (iseq_load): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-31* vm_core.h: some refactoring.ko1
- move decl. of rb_compile_option_struct to iseq.h. - define enum iseq_type. - define enum vm_special_object_type. * compile.c: some refactoring. - apply above changes. - (struct iseq_link_element): change value of type. - remove unused decl. - fix comment. - rename iseq_build_body and iseq_build_exception to iseq_build_from_ary_body and iseq_build_from_ary_exception. * iseq.h: define enum catch_type and enum defined_type. * insns.def: apply above changes. * iseq.c: define ISEQ_MAJOR_VERSION and ISEQ_MINOR_VERSION. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29649 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-09* vm_core.h (rb_signal_buff_size, rb_signal_exec): movednobu
declarations from thread.c. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29432 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-06* vm_core.h: add missing prototypes.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29413 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-04* load.c (ruby_init_ext): export for golfers.nobu
* vm_core.h (rb_iseq_eval, rb_iseq_compile_with_option): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29180 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-14* vm_core.h (rb_{get,set,reset}_coverages): used in coverage.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28978 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-02* insns.def, vm_core.h: fixed typo. reported by Rocky Bernsteinnobu
<rockyb AT rubyforge.org> at [ruby-core:31596]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28837 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-28* vm_core.h (rb_thread_check_trap_pending): hidden API for tcl/tk wrapper.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28774 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-22* include/ruby/{intern,io}.h: add missing prototypes.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28710 b2dd03c8-39d4-4d8f-98ff-823fe69b080e