summaryrefslogtreecommitdiff
path: root/vm.c
AgeCommit message (Collapse)Author
2012-02-15merge revision(s) 34629,34630:naruse
* 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. when the fiber was destroyed. [ruby-core:41456] [Bug #5700] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@34637 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-17* vm.c (rb_vm_make_env_object, rb_vm_get_sourceline): export as anobu
workaround for ruby-debug19 for the time being. [ruby-core:38972] [Bug #5193] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@33289 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/branches/ruby_1_9_3@33100 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-27* backport r33096 from trunk.ktsj
* proc.c (proc_new): force to rewrite errinfo when calling Proc.new in ensure. [Bug #5234] [ruby-core:39125] * 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/branches/ruby_1_9_3@33098 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-24* vm.c (vm_make_env_each): work around to solve Bug #2729.ko1
fixes: Bug #2729 a patch from Kazuki Tsujimoto <kazuki@callcc.net> This problem is caused by changing dfp (dynamic env pointer) from saved dfp. Saved dfp is pointed env in VM stack. However, the dfp can be moved because VM copies env from VM stack to the heap. At this copying, dfp was also changed. To solve this problem, I'll try to change throw mechanism (not save target dfp, but save target cfp). * bootstraptest/test_flow.rb: add a test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@33063 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/branches/ruby_1_9_3@32986 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-11* backport r32815 from trunk.kosaki
* gc.c (init_heap): allocate sigaltstack after heaps are allocated. [ruby-dev:44315] [Bug #5139] * vm.c (thread_free): use free because objspace is not ready. * vm.c (th_init): use malloc because objspace is not ready. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@32933 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-31* backport r32768 from trunk.ktsj
* vm.c: check if cfp is valid. [Bug #5083] [ruby-dev:44208] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@32769 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-30merge revision(s) 32749:kosaki
* vm.c (th_init): preallocate alternative stack. 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/branches/ruby_1_9_3@32750 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-29 * math.c: Attach documentation for Math.drbrain
* object.c: Document NIL, TRUE, FALSE. * io.c: Improve grammar in ARGF comment. Document STDIN/OUT/ERR. Document ARGF global constant. * lib/rake: Hide deprecated toplevel constants from RDoc (import from rake trunk). * lib/thwait.rb: Document ThWait. * lib/mathn.rb: Hide Math redefinition from RDoc * lib/sync.rb: Add a basic comment for Sync_m, Synchronizer_m, Sync, Synchronizer. * parse.y: Document SCRIPT_LINES__. * hash.c: Document ENV class and global constant. * vm.c: Document TOPLEVEL_BINDING. * version.c: Document RUBY_* constants. * ruby.c: Document DATA and ARGV. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32281 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* method.h, internal.h iseq.h: declare internal functions.akr
* 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* internal.h: declare more internal functions.akr
* 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-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* 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-11* vm.c (thread_memsize): don't ignore size of th->local_storage.kosaki
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31992 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-09* gc.c (rb_objspace_call_finalizer): use rb_typeddata_is_kind_of() fornagachika
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-04-16* vm.c (Init_VM): suppress warning: "OPT_BASIC_OPERATIONS" is not defined.kazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31292 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-24* vm.c (ruby_vm_destruct): run vm exit hooks after all objects arenobu
destructed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30953 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-20* prevent temporary objects from GC, and should not usenobu
RSTRING_PTR() for function calls since it evaluates the argument a couple of times. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-12* vm.c (th_init): rename from th_init2.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30851 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-11* eval.c (ruby_cleanup): use rb_ary_free to free internal object.nobu
* gc.h (RUBY_FREE_UNLESS_NULL): get rid of double free. [ruby-core:35192] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30840 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-12* vm.c (thread_free): reset ruby_current_thread if it points theakr
thread to free. * gc.c (slot_sweep): don't call RUBY_VM_SET_FINALIZER_INTERRUPT if there is no current thread. [ruby-dev:43000] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30522 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-05* vm.c (rb_vm_make_proc): fix indent.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30462 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-30* vm.c (vm_define_method): guard iseq from GC while method definition.wanabe
[ruby-dev:42832] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30432 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-03* gc.c (rb_objspace_free): With our "lazy-sweep" GC engine, it isshyouhei
possible for an object to survive until its surrounding object space is about to be freed. Those objects, if any, remains not leaked for the rest of a process life. This is problematic because for instance a T_DATA object may have its own destructor to terminate something. * vm.c (ruby_vm_destruct): ruby_current_vm termination should be somewhere after rb_objspace_free for above reason. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30065 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-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-23* vm.c (rb_thread_mark): should mark self in conrolnobu
frames. [ruby-core:33289] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29885 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-24* array.c, gc.c, hash.c, object.c, string.c, struct.c,nobu
transcode.c, variable.c, vm.c, vm_insnhelper.c, vm_method.c: replace calls to rb_error_frozen() with rb_check_frozen(). a patch from Run Paint Run Run at [ruby-core:32014] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29583 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-24* vm.c (vm_define_method): defined method is run with the defaultnobu
public visibility regardless the visibility context of definition. [ruby-core:30638] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29578 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-19Commit miss.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-19* test/ruby/test_sprintf.rb: fix ML ref. [ruby-core:32848]nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-13* iseq.c (insn_operand_intern, rb_iseq_disasm): fix format specifiers.nobu
* vm.c (thread_free): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29487 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-13 * vm.c (ruby_vm_destruct): This function type was wrong; correct to the ↵shyouhei
prototype. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29482 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-12* compile.c (iseq_build_body), error.c (set_syserr, get_syserr),nobu
(syserr_initialize), gc.c (define_final, rb_gc_copy_finalizer), (run_final), hash.c (rb_hash_aref, rb_hash_lookup2), (rb_hash_fetch_m, rb_hash_clear, rb_hash_aset, eql_i), iseq.c (iseq_load, iseq_data_to_ary), marshal.c (r_symlink), thread.c (rb_thread_local_aref), variable.c (generic_ivar_remove, ivar_get, rb_const_get_0), (rb_cvar_get), vm.c (rb_vm_check_redefinition_opt_method), vm_insnhelper.c (vm_get_ev_const), vm_method.c (remove_method), ext/iconv/iconv.c (map_charset): use st_data_t. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29462 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-03* enc/unicode.c (onigenc_unicode_property_name_to_ctype):naruse
remove useless assignment. * vm.c (vm_make_proc_from_block): ditto. * variable.c (rb_ivar_count): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29405 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-24* string.c (sym_call), vm.c (invoke_block_from_c),nobu
vm_insnhelper.c (vm_yield_with_cfunc): pass given block. [ruby-core:32075] * vm_eval.c (rb_funcall_passing_block): new function to call method with passing given block. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29335 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-09* vm.c (vm_backtrace_each): skip allocator frames which have nonobu
name. [ruby-core:32231] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29205 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-29* vm.c (rb_thread_method_id_and_class): curried proc has nonobu
method. [ruby-core:31871] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29136 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-21* vm.c: add missing prototype of rb_iseq_clone for r29063.naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29064 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-21* vm.c (vm_define_method): copy iseq to avoid overwriting iseq->klass.wanabe
#2502, #3136. see #2420. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29063 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-26* vm.c (rb_thread_mark): should mark iseq itself other than normalnobu
iseq. [ruby-dev:41880] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-26* vm.c (rb_thread_mark): mark only self of normal iseqs, notnobu
nodes. [ruby-dev:41874] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28752 b2dd03c8-39d4-4d8f-98ff-823fe69b080e