summaryrefslogtreecommitdiff
path: root/vm.c
AgeCommit message (Collapse)Author
2015-11-13* refactoring CREF related code.ko1
* eval_intern.h: remove unused setter functions. CREF_CLASS_SET() CREF_NEXT_SET() CREF_SCOPE_VISI_COPY() * eval_intern.h: rename flags: * NODE_FL_CREF_PUSHED_BY_EVAL_ -> CREF_FL_PUSHED_BY_EVAL * NODE_FL_CREF_OMOD_SHARED_ -> CREF_FL_OMOD_SHARED and use IMEMO_FL_USER1/2. * vm.c (vm_cref_new): accept push_by_eval parameter. * vm.c (vm_cref_new_use_prev): added for rb_vm_rewrite_cref(). * vm_insnhelper.c (vm_cref_push): accept pushed_by_eval parameter. * vm_insnhelper.h: remove unused macros: COPY_CREF_OMOD() and COPY_CREF(). * vm_eval.c, insns.def: catch up this fix. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52564 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-13* vm.c (vm_define_method): refactoring.ko1
* get CREF in this function. * cbase is no longer needed (CREF_CLASS(cref) is enough). * compile.c: RubyVM::FrozenCore.define_method only accept 2 args. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52563 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-13* vm.c (vm_define_method): do not use current CREF immediately,ko1
but check CREF in environment or methods. Methods defined in methods should be public. [Bug #11571] * vm_method.c (rb_scope_module_func_check): check CREF in env or me. if CREF is contained by `me', then return FALSE. * test/ruby/test_method.rb: add a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52562 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-31use rb_source_loc and rb_source_locationnobu
* error.c, eval.c, eval_error.c, gc.c, variable.c, vm.c, vm_eval.c, vm_trace.c: use rb_source_loc/rb_source_location instead of combination of rb_sourcefile/rb_sourcefilename and rb_sourceline. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52398 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-31vm.c: initialize line alwaysnobu
* vm.c (rb_source_location): reset line to 0 if no location is found. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52397 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-29use NULL instead of 0ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52369 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-29* vm.c: add ifndef guard for VM_CHECK_MODE.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52367 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-29RUBY_DTRACE_CREATE_HOOKnobu
* internal.h (RUBY_DTRACE_CREATE_HOOK): macro to call hook at object creation. * vm.c (rb_source_location, rb_source_loc): retrieve source path and line number at once. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52340 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-29vm.c: ruby_th_dtrace_setupnobu
* vm.c (ruby_th_dtrace_setup): extract setup for calling dtrace hook from RUBY_DTRACE_HOOK macro. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52338 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-23* vm_insnhelper.c: introduce new call handler for simple ISeqs.ko1
vm_call_iseq_setup_normal_0start() is simple, however it has some loops/conditions depends on ISeq::param.size and ISeq::local_size (in vm_push_frame(), inlined into this function). There are many simple methods which has a few parameters and local variables. So that this patch introduces several special functions generated in vm_call_iseq_optimized.inc by tool/mk_call_iseq_optimized.rb. This script makes vm_call_iseq_setup_normal_0start_Xparams_Ylocals() where X is 0 to 3 and Y is 1 to 6 (as current setting). In this case, X * Y = 24 functions are created. These functions creates fast method dispatch by inlining vm_push_frame() with immediate params/locals sizes. On my laptop, we can have the following results. vm2_method* 1.083 (8.3% faster) vm2_poly_method* 0.961 (3.4% slower) It shows 8.3% faster for inner loop method dispatch (hit inline cache), but 3.4% slower when inline cache miss because we need to find a suitable call handler. * common.mk: add a rule for vm_call_iseq_optimized.inc. * tool/mk_call_iseq_optimized.rb: added. * vm.c: include vm_call_iseq_optimized.inc. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52254 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-16vm_args.c: symbol procnobu
* vm_args.c (vm_caller_setup_arg_block): store symbols instead of ifuncs. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52138 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-15vm.c: simplifynobu
* vm.c (env_mark): remove redundant conditions and mark block.iseq simply unless null. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52130 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-10* vm.c (invoke_block_from_c): split this function into severalko1
functions. * vm_insnhelper.c (vm_yield_callee_setup_arg): remove this function beacuse it is only delegation function. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52104 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-29compile.c: fix performance of strconcatnobu
* compile.c (compile_dstr_fragments): fix performance by omitting the first empty string only for keeping literal encoding if other literals are too. [ruby-core:70930] [Bug #11556] * string.c (rb_str_append_literal): append but keep encoding non US-ASCII. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-19* vm_core.h: split rb_call_info_t into several structs.ko1
* rb_call_info (ci) has compiled fixed information. * if ci->flag & VM_CALL_KWARG, then rb_call_info is also rb_call_info_with_kwarg. This technique reduce one word for major rb_call_info data. * rb_calling_info has temporary data (argc, blockptr, recv). for each method dispatch. This data is allocated only on machine stack. * rb_call_cache is for inline method cache. Before this patch, only rb_call_info_t data is passed. After this patch, above three structs are passed. This patch improves: * data locarity (rb_call_info is now read-only data). * reduce memory consumption (rb_call_info_with_kwarg, rb_calling_info). * compile.c: use above data. * insns.def: ditto. * iseq.c: ditto. * vm_args.c: ditto. * vm_eval.c: ditto. * vm_insnhelper.c: ditto. * vm_insnhelper.h: ditto. * iseq.h: add iseq_compile_data::ci_index and iseq_compile_data::ci_kw_indx. * tool/instruction.rb: introduce TS_CALLCACHE operand type. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51903 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-15gc.c: define objspace functions alwaysnobu
* gc.c (rb_objspace_alloc, rb_objspace_free): define always regardless ENABLE_VM_OBJSPACE, and free heap pages. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51867 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-07vm_core.h: objspace alwaysnobu
* vm_core.h (rb_vm_struct): define objspace always regardless ENABLE_VM_OBJSPACE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-28* vm.c (hook_before_rewind): prevent kicking :return event whileko1
finishing vm_exec func because invoke_block_from_c() kick a :return event for bmethods. [Bug #11492] * test/ruby/test_settracefunc.rb: add a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51713 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-12* class.c, gc.c vm.c: use ID_TABLE_* instead of ST_*ko1
(such as ST_CONTINUE) for enum rb_id_table_iterator_result. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51544 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-12* id_table.h: introduce ID key table.ko1
[Feature #11420] This table only manage ID->VALUE table to reduce overhead of st. Some functions prefixed rb_id_table_* are provided. * id_table.c: implement rb_id_table_*. There are several algorithms to implement it. Now, there are roughly 4 types: * st * array * hash (implemented by Yura Sokolov) * mix of array and hash The macro ID_TABLE_IMPL can choose implementation. You can see detailes about them at the head of id_table.c. At the default, I choose 34 (mix of list and hash). This is not final decision. Please report your suitable parameters or your data structure. * symbol.c: introduce rb_id_serial_t and rb_id_to_serial() to represent ID by serial number. * internal.h: use id_table for method tables. * class.c, gc.c, marshal.c, vm.c, vm_method.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51541 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-09vm.c: frozen_strings in rb_vm_tnobu
* vm.c (Init_vm_objects, rb_vm_fstring_table): use frozen_strings table in rb_vm_t. [ruby-core:70274] [Bug #11423] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-24* vm_core.h: size should be unsigned.ko1
* rb_call_info_t::index * rb_iseq_constant_body::stack_max * rb_iseq_constant_body::local_size * rb_iseq_constant_body::param::size * rb_iseq_constant_body::local_table_size * rb_iseq_constant_body::is_size * rb_iseq_constant_body::callinfo_size * iseq.h: same for iseq_catch_table::size. * compile.c: catch up these fix. * iseq.c: ditto. * proc.c: ditto. * vm.c: ditto. * vm_args.c: ditto. * vm_eval.c: ditto. * vm_insnhelper.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51369 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-24* vm_core.h: constify rb_iseq_constant_body::catch_table.ko1
* compile.c (iseq_set_exception_table): catch up this fix. * iseq.c: ditto. * vm.c (vm_exec): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51365 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-21* make rb_iseq_t T_IMEMO object (type is imemo_iseq).ko1
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
2015-07-21* vm_core.h: constify rb_call_info_t::kw_arg,ko1
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
2015-07-21* vm_core.h: constify rb_call_info_t::blockiseq and rb_iseq_t::iseq.ko1
* 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
2015-07-16vm.c: fix mark with rewinding cfpnobu
* vm.c (REWIND_CFP): keep the arguments region inside the valid value stack. [ruby-core:69969] [Bug #11352] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51264 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-16vm.c: fix mark with rewinding cfpnobu
* vm.c (m_core_hash_merge_ptr): copy the arguments to the machine stack before rewinding the control frame pointer and leaving the arguments outside valid region of the value stack. [ruby-core:69969] [Bug #11352] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51263 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-15remove redundant NULL checks after RUBY_VM_IFUNC_Pnormal
* proc.c (proc_mark): remove redundant check * vm.c (env_mark): ditto This doesn't change object code size, but the unstripped executable is smaller and the code less confusing. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51253 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-15remove redundant NULL check in mark functionsnormal
gc.c (gc_mark_children)only calls mark_func if the T_DATA ptr is non-NULL, so avoid redundantly checking for that in each mark function. * iseq.c (iseq_mark): remove check for data pointer * proc.c (binding_mark): ditto * vm.c (rb_thread_mark): ditto * vm_trace.c (tp_mark): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51252 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-15* vm.c (vm_make_env_each): add comments about env layout.ko1
Do not use `i' to specify `new_ep'. * vm.c (rb_proc_create, rb_vm_make_proc_lambda): envval is not used. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51250 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-14* vm_core.h, vm.c: remove rb_proc_t::envval because we can know it viako1
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
2015-07-14* vm_core.h, vm.c: remvoe rb_env_t::prev_envval because we can know itko1
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
2015-07-14* remove trailing spaces.svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51244 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-14* vm.c: refactoring Proc/Env related code.ko1
* 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
2015-07-06* vm.c (vm_define_method): remove an unused local variable.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51169 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-06* vm_core.h: remove rb_iseq_t::defined_method_id because it is notko1
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
2015-07-06* vm_core.h: remove rb_iseq_t::klass to reduce dynamic data.ko1
* 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
2015-07-04vm.c: reduce branches for always-set VM fieldsnormal
thgroup_default, mark_object_ary, load_path, load_path_snapshot, expanded_load_path, loaded_features, loaded_features_snapshot, top_self, defined_module_hash are always defined at process startup. This makes it wasteful to have extra branches in an an effort to skip the function call to `rb_gc_mark'. This reduces binary size a small amount on x86-64: text data bss dec hex filename 2830738 22672 71584 2924994 2ca1c2 ruby.orig 2830234 22672 71584 2924490 2c9fca ruby.after More similar changes coming when I'm bored enough to notice... * vm.c (rb_vm_mark): reduce branches for always-set VM fields (rb_vm_add_root_module): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51136 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-03* remove trailing spaces.svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51127 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-03* method.h: introduce rb_callable_method_entry_t to removeko1
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
2015-06-30move RB_GC_GUARD responsibility to rb_add_method_iseqnormal
This simplifies all the callers and makes code easier to use and review. I was confused about the need for RB_GC_GUARD in define_{aset,aref}_method of struct.c without reading rb_add_method_iseq. Likewise, do the same for rb_iseq_clone, where the GC guard only seems neccesary iff RGenGC is disabled. * vm_method.c (rb_add_method_iseq): add RB_GC_GUARD * class.c (clone_method): remove RB_GC_GUARD * struct.c (define_aref_method): ditto (define_aset_method): ditto * vm.c (vm_define_method): * iseq.c (rb_iseq_clone): add RB_GC_GUARD git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51079 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-18* vm.c (rb_vm_control_frame_id_and_class): remove usless codes.ko1
`me' knows ID and owner class. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50950 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-13mark thread name stringnaruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50869 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-13* vm_core.h (rb_thread_t): add th->name.naruse
* 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
2015-06-12vm.c: break from orphan blocknobu
* vm.c (rb_vm_search_cf_from_ep): break from orphan block is possible condition, but not [BUG]. [ruby-core:69548] [Bug #11254] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50850 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-10* vm.c: use VM_ASSERT instead of assert().ko1
* vm_args.c: ditto. * vm_insnhelper.c: ditto. * vm_method.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50822 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-10* vm_core.h: define VM_ASSERT() for assertionko1
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
2015-06-05* internal.h: move definition of rb_cref_t to method.h.ko1
* eval_intern.h: move definition of rb_scope_visibility_t to method.h. * method.h: change rb_cref_t::scope_visi from VALUE to rb_scope_visibility_t. [Bug #11219] * vm.c (vm_cref_new): accept rb_method_visibility_t directly. * vm_insnhelper.c (rb_vm_rewrite_cref): don't use 0, but METHOD_VISI_UNDEF. * vm_method.c (rb_scope_visibility_set): don't need to use cast. * vm_method.c (rb_scope_module_func_set): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-03* class.c (clone_method): remove redundant check for me->def != NULL.ko1
Now, all `me` have `me->def`. * proc.c (rb_method_entry_location): ditto. * vm.c (rb_vm_check_redefinition_opt_method): ditto. * vm.c (add_opt_method): ditto. * vm_eval.c (vm_call0_body): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50748 b2dd03c8-39d4-4d8f-98ff-823fe69b080e