aboutsummaryrefslogtreecommitdiffstats
path: root/vm_core.h
Commit message (Collapse)AuthorAgeFilesLines
* * vm_core.h: constify rb_iseq_constant_body::local_table andko12015-07-231-3/+3
| | | | | | | | | | | rb_iseq_param_keyword::table and rb_iseq_param_keyword::default_values. * compile.c: catch up this fix. * iseq.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_core.h: constify rb_iseq_constant_body::iseq_encoded andko12015-07-231-2/+2
| | | | | | | | | | | rb_control_frame_t::pc. * compile.c (rb_iseq_translate_threaded_code): catch up this fix. * iseq.c: ditto. * vm_exec.c (vm_exec_core): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51356 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_core.h: modify layout of rb_iseq_constant_body.ko12015-07-221-20/+18
| | | | | | | | Move frequent accesssing fields to upper part. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51341 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_core.h: remove unused declaration ofko12015-07-221-4/+0
| | | | | | | | iseq_compile_data_ensure_node_stack. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51340 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_core.h: separate rb_iseq_body into rb_iseq_constant_body andko12015-07-221-12/+6
| | | | | | | | | | | | rb_iseq_variable_body (rb_iseq_t::variable_body). rb_iseq_variable_body can be modified after compilation. * compile.c: use rb_iseq_t::variable_body. * iseq.c: ditto. * thread.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51339 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * make rb_iseq_t T_IMEMO object (type is imemo_iseq).ko12015-07-211-26/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All contents of previous rb_iseq_t is in rb_iseq_t::body. Remove rb_iseq_t::self because rb_iseq_t is an object. RubyVM::InstructionSequence is wrapper object points T_IMEMO/iseq. So RubyVM::ISeq.of(something) method returns different wrapper objects but they point the same T_IMEMO/iseq object. This patch is big, but most of difference is replacement of iseq->xxx to iseq->body->xxx. (previous) rb_iseq_t::compile_data is also located to rb_iseq_t::compile_data. It was moved from rb_iseq_body::compile_data. Now rb_iseq_t has empty two pointers. I will split rb_iseq_body data into static data and dynamic data. * compile.c: rename some functions/macros. Now, we don't need to separate iseq and iseqval (only VALUE). * eval.c (ruby_exec_internal): `n' is rb_iseq_t (T_IMEMO/iseq). * ext/objspace/objspace.c (count_imemo_objects): count T_IMEMO/iseq. * gc.c: check T_IMEMO/iseq. * internal.h: add imemo_type::imemo_iseq. * iseq.c: define RubyVM::InstructionSequnce as T_OBJECT. Methods are implemented by functions named iseqw_.... * load.c (rb_load_internal0): rb_iseq_new_top() returns rb_iseq_t (T_IMEMO/iesq). * method.h (rb_add_method_iseq): accept rb_iseq_t (T_IMEMO/iseq). * vm_core.h (GetISeqPtr): removed because it is not T_DATA now. * vm_core.h (struct rb_iseq_body): remove padding for [Bug #10037][ruby-core:63721]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51327 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_core.h: constify rb_call_info_t::kw_arg,ko12015-07-211-3/+3
| | | | | | | | | | | rb_control_frame_t::iseq and rb_control_frame_t::block_iseq. * iseq.c (iseq_free): catch up this fix. * vm.c: ditto. * vm_dump.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51325 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_core.h: constify rb_call_info_t::blockiseq and rb_iseq_t::iseq.ko12015-07-211-2/+2
| | | | | | | | | | * vm.c, vm_insnhelper.c: catch up this fix. * iseq.c (iseq_data_to_ary): constify the first iseq parameter. * vm_insnhelper.c (vm_make_proc_with_iseq): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51323 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby_vm_throw_flagsnobu2015-07-201-0/+6
| | | | | | * vm_core.h (ruby_vm_throw_flags): constants for throw. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51300 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c: use ruby_tag_typenobu2015-07-171-0/+21
| | | | | | | | * compile.c (iseq_compile_each): use enum ruby_tag_type names. * vm_core.h (ruby_tag_type): move from eval_intern.h for compiling break/next/redo/return. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51283 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* RUBY_VM_CHECK_INTS: eval the argument only oncenobu2015-07-171-5/+8
| | | | | | | * vm_core.h (RUBY_VM_CHECK_INTS): evaluate the argument only once to get rid of inadvertent side effects. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51281 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* RUBY_VM_CHECK_INTS_BLOCKING: move to thread.cnobu2015-07-171-11/+0
| | | | | | | * thread.c (RUBY_VM_CHECK_INTS_BLOCKING): move from vm_core.h for the static function rb_threadptr_pending_interrupt_empty_p. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51280 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* EXEC_EVENT_HOOK_ORIG: eval the arguments only oncenobu2015-07-171-15/+24
| | | | | | | | * vm_core.h (EXEC_EVENT_HOOK_ORIG): evaluate each arguments only once to get rid of inadvertent side effects. fix use of `th` variable in the second `if` statement. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51279 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_core.h: constify rb_iseq_t::parent_iseq.ko12015-07-161-2/+2
| | | | | | | | | | | | rb_iseq_t::local_iseq is not constant data because local_iseq::flip_cnt can be modified (commentted). * compile.c: catch up this fix. * iseq.c: ditto. * vm_insnhelper.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51269 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_core.h, vm.c: remove rb_proc_t::envval because we can know it viako12015-07-141-2/+1
| | | | | | | | | | | | rb_proc_t::block::ep. rb_vm_proc_envval(const rb_proc_t *proc) returns an Env object which the Proc object use. * proc.c: catch up this fix. * vm_dump.c (rb_vmdebug_proc_dump_raw): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51246 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_core.h, vm.c: remvoe rb_env_t::prev_envval because we can know itko12015-07-141-2/+2
| | | | | | | | | | | | | | | | | via env->ep. rb_vm_env_prev_envval(env) returns prev_envval via env->ep. * vm_core.h (rb_vm_env_local_variables): change parameter type from VALUE (T_DATA/env) to `const rb_env_t *' to make same as rb_vm_env_prev_envval(). * proc.c: catch up these changes. * vm_dump.c: ditto. * vm.c: rename macros. * ENV_IN_HEAP_P() to VM_EP_IN_HEAP_P() because it uses ep. * ENV_VAL() to VM_ENV_EP_ENVVAL() because it is too short. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51245 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm.c: refactoring Proc/Env related code.ko12015-07-141-4/+0
| | | | | | | | | | | | | | | | | * vm_core.h: remove blockprocval field from rb_proc_t and rb_binding_t. Instead of this field, mark given block in Proc at rb_env_t::env. * vm.c (vm_make_env_each): make an Env object with this layout. And also simplify parameters. * proc.c: catch up this fix. * vm_core.h: remove rb_env_t::local_size because it is not used. * vm_dump.c (rb_vmdebug_env_dump_raw): catch up this fix. * vm_core.h (rb_vm_make_env_object): remove rb_vm_make_env_object() because it is only refered from vm.c. * vm_eval.c (eval_string_with_cref): catch up this fix. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_core.h: remove rb_call_info_t::klass becauseko12015-07-091-1/+0
| | | | | | | | | | | | | | | | rb_callable_method_entry_t has information about defined class. * vm_insnhelper.c (vm_search_method): don't set ci->klass because it is removed. * vm_insnhelper.c (rb_equal_opt): ditto. * vm_insnhelper.c (vm_search_superclass): removed because it is too simple to write code directly. * vm_insnhelper.c (vm_defined): don't use vm_search_superclass(). This fix avoid searching current callable `me' twice. * vm_insnhelper.c (vm_search_super_method): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51200 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_core.h (rb_control_frame_t): fix comments (layout index).ko12015-07-091-4/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51198 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_core.h: remove rb_iseq_t::orig because rb_iseq_clone()ko12015-07-071-1/+0
| | | | | | | | | no longer exists. * iseq.c: don't use rb_iseq_t::orig. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51172 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_core.h: remove rb_iseq_t::defined_method_id because it is notko12015-07-061-1/+0
| | | | | | | | | | | | | | needed. * eval.c (frame_func_id): simplify. rb_callable_method_entry_t has enough information. * eval.c (frame_called_id): ditto. * iseq.c (prepare_iseq_build): catch up this fix. * proc.c (rb_mod_define_method): ditto. * vm.c (vm_define_method): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51168 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_core.h: remove a useless declaration.ko12015-07-061-2/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51167 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_core.h: remove rb_iseq_t::klass to reduce dynamic data.ko12015-07-061-1/+0
| | | | | | | | | | | | | | | | | | | | | | * internal.h, iseq.c (rb_iseq_klass): remove it because rb_iseq_t::klass is removed. * vm_insnhelper.c (vm_super_outside): do not see cfp->iseq, but check callable method entry on a frame. This fix simplify the logic to search super class. * test/ruby/test_method.rb: support super() from Proc. Now, [Bug #4881] and [Bug #3136] was solved. * proc.c (rb_mod_define_method): catch up this change. * vm.c (vm_define_method): ditto. * vm_backtrace.c (rb_profile_frames): now, each `frame' objects are rb_callable_method_entry_t data or iseq VALUEs. This fix introduce minor compatibility issue that rb_profile_frame_label() always returns rb_profile_frame_base_label(). * test/-ext-/debug/test_profile_frames.rb: catch up this change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51166 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * method.h: introduce rb_callable_method_entry_t to removeko12015-07-031-12/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | rb_control_frame_t::klass. [Bug #11278], [Bug #11279] rb_method_entry_t data belong to modules/classes. rb_method_entry_t::owner points defined module or class. module M def foo; end end In this case, owner is M. rb_callable_method_entry_t data belong to only classes. For modules, MRI creates corresponding T_ICLASS internally. rb_callable_method_entry_t can also belong to T_ICLASS. rb_callable_method_entry_t::defined_class points T_CLASS or T_ICLASS. rb_method_entry_t data for classes (not for modules) are also rb_callable_method_entry_t data because it is completely same data. In this case, rb_method_entry_t::owner == rb_method_entry_t::defined_class. For example, there are classes C and D, and incldues M, class C; include M; end class D; include M; end then, two T_ICLASS objects for C's super class and D's super class will be created. When C.new.foo is called, then M#foo is searcheed and rb_callable_method_t data is used by VM to invoke M#foo. rb_method_entry_t data is only one for M#foo. However, rb_callable_method_entry_t data are two (and can be more). It is proportional to the number of including (and prepending) classes (the number of T_ICLASS which point to the module). Now, created rb_callable_method_entry_t are collected when the original module M was modified. We can think it is a cache. We need to select what kind of method entry data is needed. To operate definition, then you need to use rb_method_entry_t. You can access them by the following functions. * rb_method_entry(VALUE klass, ID id); * rb_method_entry_with_refinements(VALUE klass, ID id); * rb_method_entry_without_refinements(VALUE klass, ID id); * rb_resolve_refined_method(VALUE refinements, const rb_method_entry_t *me); To invoke methods, then you need to use rb_callable_method_entry_t which you can get by the following APIs corresponding to the above listed functions. * rb_callable_method_entry(VALUE klass, ID id); * rb_callable_method_entry_with_refinements(VALUE klass, ID id); * rb_callable_method_entry_without_refinements(VALUE klass, ID id); * rb_resolve_refined_method_callable(VALUE refinements, const rb_callable_method_entry_t *me); VM pushes rb_callable_method_entry_t, so that rb_vm_frame_method_entry() returns rb_callable_method_entry_t. You can check a super class of current method by rb_callable_method_entry_t::defined_class. * method.h: renamed from rb_method_entry_t::klass to rb_method_entry_t::owner. * internal.h: add rb_classext_struct::callable_m_tbl to cache rb_callable_method_entry_t data. We need to consider abotu this field again because it is only active for T_ICLASS. * class.c (method_entry_i): ditto. * class.c (rb_define_attr): rb_method_entry() does not takes defiend_class_ptr. * gc.c (mark_method_entry): mark RCLASS_CALLABLE_M_TBL() for T_ICLASS. * cont.c (fiber_init): rb_control_frame_t::klass is removed. * proc.c: fix `struct METHOD' data structure because rb_callable_method_t has all information. * vm_core.h: remove several fields. * rb_control_frame_t::klass. * rb_block_t::klass. And catch up changes. * eval.c: catch up changes. * gc.c: ditto. * insns.def: ditto. * vm.c: ditto. * vm_args.c: ditto. * vm_backtrace.c: ditto. * vm_dump.c: ditto. * vm_eval.c: ditto. * vm_insnhelper.c: ditto. * vm_method.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51126 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* error.c: remove singleton methodnobu2015-06-251-1/+1
| | | | | | | | | | * error.c (rb_name_err_mesg_new): remove singleton method, and unused argument. * vm_eval.c (make_no_method_exception): call rb_name_err_mesg_new directly instead of constant lookup and method invocation. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* $SAFE=2 is now obsoletenobu2015-06-181-1/+1
| | | | | | | | | * include/ruby/ruby.h (RUBY_SAFE_LEVEL_CHECK): fix safe_level limit. * vm_core.h (rb_proc_t): update comment for safe_level. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50960 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_core.h (rb_thread_t): add th->name.naruse2015-06-131-0/+1
| | | | | | | | | | | | | | * vm.c (th_init): initialize th->name. * thread.c (Init_Thread): add Thread.name and Thread.name=. * thread.c (rb_thread_inspect): show thread's name if set. * thread.c (rb_thread_getname): defined. * thread.c (rb_thread_setname): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50863 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_core.h: make VM_ASSERT an expressionnobu2015-06-111-4/+4
| | | | | | | * vm_core.h (VM_ASSERT): make an expression, as well as standard assert(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_core.h: define VM_ASSERT() for assertionko12015-06-101-0/+16
| | | | | | | | | | | enabled only when (VM_CHECK_MODE > 0). * vm_insnhelper.c: move definition VM_CHECK_MODE from vm_insnhelper.c to vm_core.h. * vm.c: remove <assert.h> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50821 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_core.h (rb_vm_rewrite_cref_stack): rename to rb_vm_rewrite_cref().ko12015-06-031-1/+1
| | | | | | | | | | * class.c (clone_method): use renamed name. * vm_insnhelper.c (rb_vm_rewrite_cref): do not use `node' in variable names. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50752 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_core.h: rename enum missing_reason to enum method_missing_reason.ko12015-06-031-10/+12
| | | | | | | | | | | * vm_core.h: use enum method_missing_reason for rb_thread_t::method_missing_reason. * vm_eval.c: catch up this fix. * vm_insnhelper.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50747 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * method.h: split rb_method_definition_t::flag to several flags.ko12015-06-031-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `flag' contains several categories of attributes and it makes us confusion (at least, I had confused). * rb_method_visibility_t (flags::visi) * NOEX_UNDEF -> METHOD_VISI_UNDEF = 0 * NOEX_PUBLIC -> METHOD_VISI_PUBLIC = 1 * NOEX_PRIVATE -> METHOD_VISI_PRIVATE = 2 * NOEX_PROTECTED -> METHOD_VISI_PROTECTED = 3 * NOEX_SAFE(flag)) -> safe (flags::safe, 2 bits) * NOEX_BASIC -> basic (flags::basic, 1 bit) * NOEX_MODFUNC -> rb_scope_visibility_t in CREF * NOEX_SUPER -> MISSING_SUPER (enum missing_reason) * NOEX_VCALL -> MISSING_VCALL (enum missing_reason) * NOEX_RESPONDS -> BOUND_RESPONDS (macro) Now, NOEX_NOREDEF is not supported (I'm not sure it is needed). Background: I did not know what "NOEX" stands for. I asked Matz (who made this name) and his answer was "Nothing". "At first, it meant NO EXport (private), but the original meaning was gone." This is why I remove the mysterious word "NOEX" from MRI. * vm_core.h: introduce `enum missing_reason' to represent method_missing (NoMethodError) reason. * eval_intern.h: introduce rb_scope_visibility_t to represent scope visibility. It has 3 method visibilities (public/private/protected) and `module_function`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * method.h: make rb_method_entry_t a VALUE.ko12015-06-021-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Motivation and new data structure are described in [Bug #11203]. This patch also solve the following issues. * [Bug #11200] Memory leak of method entries * [Bug #11046] __callee__ returns incorrect method name in orphan proc * test/ruby/test_method.rb: add a test for [Bug #11046]. * vm_core.h: remvoe rb_control_frame_t::me. me is located at value stack. * vm_core.h, gc.c, vm_method.c: remove unlinked_method... codes because method entries are simple VALUEs. * method.h: Now, all method entries has own independent method definititons. Strictly speaking, this change is not essential, but for future changes. * rb_method_entry_t::flag is move to rb_method_definition_t::flag. * rb_method_definition_t::alias_count is now rb_method_definition_t::alias_count_ptr, a pointer to the counter. * vm_core.h, vm_insnhelper.c (rb_vm_frame_method_entry) added to search the current method entry from value stack. * vm_insnhelper.c (VM_CHECK_MODE): introduced to enable/disable assertions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50728 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_core.h (VM_FRAME_MAGIC_DUMMY): introduce new frame type toko12015-05-311-0/+1
| | | | | | | | | | recognize dummy frame. * vm.c (th_init): use new frame type. * vm_args.c (raise_argument_error): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50701 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * method.h, vm_method.c (rb_free_method_entry): constify a parameter.ko12015-05-301-1/+0
| | | | | | | | | * vm_method.c (rb_unlink_method_entry): constify a parameter. * vm_core.h: remove useless declaration about rb_unlink_method_entry(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50687 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* proc.c: rb_proc_allocnobu2015-05-161-1/+1
| | | | | | | | | * proc.c (rb_proc_alloc, proc_dup): allocate rb_proc_t instead of wrapping to get rid of potential memory leak. * vm.c (rb_proc_create): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_args.c: protect value stack from calling other methodsko12015-04-061-1/+0
| | | | | | | | | | | | | | during complex parameter setting process (splat, kw, and so on). [Bug #11027] * vm_core.h: remove rb_thead_t::mark_stack_len. With this modification, we don't need to use th->mark_stack_len. * test/ruby/test_keyword.rb: add a test. * cont.c (cont_capture): catch up this fix. * vm.c (rb_thread_mark): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50172 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_core.h: update for OPT_CALL_CFUNC_WITHOUT_FRAMEnobu2015-04-031-2/+2
| | | | | | | | | * vm_eval.c (vm_call0_cfunc): update invoker arguments. * vm_insnhelper.c (vm_call_cfunc_latter): ditto. * vm_insnhelper.c (rb_vm_call_cfunc_push_frame): ditto, and prefix with rb_. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50154 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * node.h: remove NODE_IFUNC, NEW_IFUNC.ko12015-03-111-1/+1
| | | | | | | | | | | | | | | | | * internal.h: use T_IMEMO for IFUNC. rename `struct IFUNC' to `struct vm_ifunc' and move the definition from vm_insnhelper.h. Add imemo_ifunc. * gc.c (gc_mark_children): mark imemo_ifunc type T_IMEMO object. * compile.c: catch up these changes. * proc.c: ditto. * vm_core.h (RUBY_VM_IFUNC_P): ditto. * vm_eval.c (rb_iterate): ditto. * vm_insnhelper.c: ditto. * ext/objspace/objspace.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49938 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * proc.c: use RUBY_VM_IFUNC_P() to recognize IFUNC or not.ko12015-03-101-1/+1
| | | | | | | | | | | * vm.c: ditto. * vm_dump.c: ditto. * vm_insnhelper.c: ditto. * vm_core.h: use RB_TYPE_P() instead of BUILTIN_TYPE(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * internal.h: define rb_cref_t and change to use it.ko12015-03-081-2/+2
| | | | | | | | | rb_cref_t is data type of CREF. Now, the body is still NODE. It is easy to understand what is CREF and what is pure NODE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49897 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * fix namespace issue on singleton class expressions. [Bug #10943]ko12015-03-061-12/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * vm_core.h, method.h: remove rb_iseq_t::cref_stack. CREF is stored to rb_method_definition_t::body.iseq_body.cref. * vm_insnhelper.c: modify SVAR usage. When calling ISEQ type method, push CREF information onto method frame, SVAR located place. Before this fix, SVAR is simply nil. After this patch, CREF (or NULL == Qfalse for not iseq methods) is stored at the method invocation. When SVAR is requierd, then put NODE_IF onto SVAR location, and NDOE_IF::nd_reserved points CREF itself. * vm.c (vm_cref_new, vm_cref_dump, vm_cref_new_toplevel): added. * vm_insnhelper.c (vm_push_frame): accept CREF. * method.h, vm_method.c (rb_add_method_iseq): added. This function accepts iseq and CREF. * class.c (clone_method): use rb_add_method_iseq(). * gc.c (mark_method_entry): mark method_entry::body.iseq_body.cref. * iseq.c: remove CREF related codes. * insns.def (getinlinecache/setinlinecache): CREF should be cache key because a different CREF has a different namespace. * node.c (rb_gc_mark_node): mark NODE_IF::nd_reserved for SVAR. * proc.c: catch up changes. * struct.c: ditto. * insns.def: ditto. * vm_args.c (raise_argument_error): ditto. * vm_eval.c: ditto. * test/ruby/test_class.rb: add a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49874 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_core.h: define vm_svar_index.ko12015-02-271-0/+8
| | | | | | | | | | * vm_insnhelper.c, vm.c, compile.c: use vm_svar_index names. * iseq.h: remove DEFAULT_SPECIAL_VAR_COUNT. use VM_SVAR_FLIPFLOP_START instead. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49772 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_insnhelper.c (rb_vm_rewrite_cref_stack): copy nd_refinementsktsj2015-02-221-0/+2
| | | | | | | | | | | of orignal crefs. It fixes segmentation fault when calling refined method in duplicate module. [ruby-dev:48878] [Bug #10885] * vm_core.h, class.c: change accordingly. * test/ruby/test_refinement.rb: add a test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49685 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_core.h: fix symbols leaknobu2015-02-061-1/+1
| | | | | | | | * vm_core.h (rb_call_info_kw_arg_struct): make keywords a symbols list to get rid of inadvertent creation by variable keyword arguments. [ruby-core:68031] [Bug #10831] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49517 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm.c, vm_core.h: constify VM_CF_LEP, VM_CF_PREV_EP, VM_CF_BLOCK_PTRko12015-01-161-1/+1
| | | | | | | | and rb_vm_control_frame_block_ptr. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49279 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_core.h: preserve thread orderingnormal2014-12-271-1/+1
| | | | | | | | | | I'm hesitant to consider this as spec, but this causes a user-visible change which could break user code. * vm_core.h (rb_vm_living_threads_insert): preserve order [Bug #10660] [ruby-core:67154] [ruby-core:67159] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49036 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm.c: constifynobu2014-12-171-2/+2
| | | | | | | | * vm.c (rb_vm_get_binding_creatable_next_cfp): constify arguments. (rb_vm_get_ruby_level_next_cfp): ditto. (vm_get_ruby_level_caller_cfp): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48875 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_core.h: introduce new fieldko12014-12-101-0/+1
| | | | | | | | | | | | | | rb_thread_t::local_storage_recursive_hash_for_trace to store recursive hash to avoid creating new recursive (nested) hashes for each trace events. [Bug #10511] * vm_trace.c (rb_threadptr_exec_event_hooks_orig): use it. * cont.c: catch up this fix. * vm.c (rb_thread_mark): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48765 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_core.h: add rb_thread_t::local_storage_recursive_hashko12014-11-271-3/+1
| | | | | | | | | | | | | | | | | to speed up Thread#[:__recursive_key__] access. [Bug #10511] * thread.c (threadptr_local_aref): add fast path for :__recursive_data__. * thread.c (threadptr_recursive_hash, threadptr_recursive_hash_set): add special accessor for recursive hash. * cont.c: store/restore local_storage_recursive_hash. * vm.c: init and mark local_storage_recursive_hash. * vm_trace.c (rb_threadptr_exec_event_hooks_orig): clear and restore local_storage_recursive_hash directly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48596 b2dd03c8-39d4-4d8f-98ff-823fe69b080e