path: root/vm_insnhelper.h
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:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-23* vm_core.h, vm_insnhelper.h: move definition of VMDEBUGko1
from vm_insnhelper.h to vm_core.h. git-svn-id: svn+ssh:// 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:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-02* vm_insnhelper.h (GET_PC_COUNT): remove unused macro.ko1
git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-03* method.h: split rb_method_definition_t::flag to several flags.ko1
`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:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-11* node.h: remove NODE_IFUNC, NEW_IFUNC.ko1
* 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:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-11* vm_insnhelper.h: use T_IMEMO to create THROW_DATA.ko1
Add THROW_DATA_NEW(). * internal.h: move defnition of `struct THROW_DATA' from vm_insnhelper.h to internal.h. Rename `THROW_DATA' to `vm_throw_data'. * eval_intern.h (THROW_DATA_P): move to internal.h. THROW_DATA is no longer T_NODE, so check T_IMEMO. * gc.c (gc_mark_children): mark THROW_DATA. * vm.c: catch up these changes. * vm_eval.c: ditto. * vm_insnhelper.c: ditto. git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-11* vm_insnhelper.c: use T_IMEMO to create SVAR.ko1
* internal.h, vm_insnhelper.h: move definition `struct SVAR' from vm_insnhelper.h to internal.h. And rename it to strcut vm_svar. new imemo_type imemo_svar is added. * gc.c (gc_mark_children): mark imemo_svar. * node.c (rb_gc_mark_node): remove useless marking. git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-10* vm_insnhelper.h (THROW_DATA_STATE): return int, not VALUE.ko1
* vm_insnhelper.h (THROW_DATA_STATE_SET): accept int value. git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-10* vm_insnhelper.h: define struct IFUNC.ko1
* vm_eval.c (rb_iterate): use it. * vm_insnhelper.c (vm_yield_with_cfunc): ditto. git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-10* vm_insnhelper.h: define struct THROW_DATA to representko1
throwing data. Also define accessor functions. * eval_intern.h: move related changes into vm_insnhelper.h. Now these MACROs (functions) are only used in vm*.c. There is only THROW_DATA_P(err) to check this data type or not. * vm.c: catch up these changes. * vm_eval.c: ditto. * vm_insnhelper.c: ditto. git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-08* vm_insnhelper.h: define struct SVAR for SVAR.ko1
This data type is also same layout of NODE (NODE_IF). * vm_insnhelper.c: catch up this change. git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-08* internal.h: define rb_cref_t and change to use it.ko1
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:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-08* vm_insnhelper.h (COPY_CREF_OMOD): fix translation miss.ko1
git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-08* internal.h: define CREF accessor macros.ko1
* CREF_CLASS(cref) * CREF_NEXT(cref) * CREF_VISI(cref) * CREF_VISI_SET(cref, v) * CREF_REFINEMENTS(cref) * CREF_PUSHED_BY_EVAL(cref) * CREF_PUSHED_BY_EVAL_SET(cref) * CREF_OMOD_SHARED(cref) * CREF_OMOD_SHARED_SET(cref) * CREF_OMOD_SHARED_UNSET(cref) This is process to change CREF data type from NODE. git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-18vm_core.h: redefined_flag in rb_vm_tnobu
* vm_core.h (struct rb_vm_struct): move redefined_flag from ruby_vm_redefined_flag. * vm_core.h (BASIC_OP_UNREDEFINED_P): move from vm_insnhelper.h. git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-20* include/ruby/ruby.h: rename OBJ_WRITE and OBJ_WRITTEN intoko1
RB_OBJ_WRITE and RB_OBJ_WRITTEN. * array.c, class.c, compile.c, hash.c, internal.h, iseq.c, proc.c, process.c, re.c, string.c, variable.c, vm.c, vm_eval.c, vm_insnhelper.c, vm_insnhelper.h, vm_method.c: catch up this change. git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-09* compile.c, insns.def, test/ruby/test_rubyvm.rb, vm.c, vm_core.h,charliesome
vm_insnhelper.c, vm_insnhelper.h, vm_method.c: Rename method_serial to global_method_state and constant_serial to global_constant_state after discussion with ko1. git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-08gc.c: promote long-lived NODE_CREF objects to oldgentmm1
* include/ruby/ruby.h: add RGENGC_WB_PROTECTED_NODE_CREF setting In a large app, this reduces the size of remembered_shady_object_count by 80%. [Bug #9225] [ruby-core:58947] * gc.c (rb_node_newnode): add FL_WB_PROTECTED flag to NODE_CREF * class.c (rewrite_cref_stack): insert OBJ_WRITE for NODE_CREF * iseq.c (set_relation): ditto * iseq.c (rb_iseq_clone): ditto * vm_eval.c (rb_yield_refine_block): ditto * vm_insnhelper.c (vm_cref_push): ditto * vm_insnhelper.h (COPY_CREF): ditto git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-09* compile.c (iseq_compile_each): emit opt_str_freeze if the #freezecharliesome
method is called on a static string literal with no arguments. * defs/id.def (firstline): add freeze so idFreeze is available * insns.def (opt_str_freeze): add opt_str_freeze instruction which pushes a frozen string literal without allocating a new object if String#freeze is not overriden * string.c (Init_String): define String#freeze * vm.c (vm_init_redefined_flag): define BOP_FREEZE on String class as a basic operation * vm_insnhelper.h: ditto git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-09* class.c: unify names of vm state version counters to 'serial'.charliesome
This includes renaming 'vm_state_version_t' to 'rb_serial_t', 'method_state' to 'method_serial', 'seq' to 'class_serial', 'vmstat' to 'constant_serial', etc. * insns.def: ditto * internal.h: ditto * vm.c: ditto * vm_core.h: ditto * vm_insnhelper.c: ditto * vm_insnhelper.h: ditto * vm_method.c: ditto git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-29* insns.def, vm.c, vm_insnhelper.c, vm_insnhelper.h, vm_method.c: splitcharliesome
ruby_vm_global_state_version into two separate counters - one for the global method state and one for the global constant state. This means changes to constants do not affect method caches, and changes to methods do not affect constant caches. In particular, this means inclusions of modules containing constants no longer globally invalidate the method cache. * class.c, eval.c, include/ruby/intern.h, insns.def, vm.c, vm_method.c: rename rb_clear_cache_by_class to rb_clear_method_cache_by_class * class.c, include/ruby/intern.h, variable.c, vm_method.c: add rb_clear_constant_cache * compile.c, vm_core.h, vm_insnhelper.c: rename vmstat field in rb_call_info_struct to method_state * vm_method.c: rename vmstat field in struct cache_entry to method_state git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-28* vm.c: vm_clear_all_cache is not necessary now we use a 64 bit countercharliesome
for global state version. * vm_insnhelper.h: ruby_vm_global_state_version overflow is unnecessary git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-26* insns.def (opt_regexpmatch1): check Regexp#=~ is not defined beforecharliesome
calling rb_reg_match() * test/ruby/test_regexp.rb: add test * vm.c (ruby_vm_redefined_flag): change type to short[] * vm.c (vm_redefinition_check_flag): return REGEXP_REDEFINED_OP_FLAG if klass == rb_cRegexp * vm.c (vm_init_redefined_flag): setup BOP flag for Regexp#=~ * vm_insnhelper.h: add REGEXP_REDEFINED_OP_FLAG [ruby-core:57385] [Bug #8953] git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-04* class.c, compile.c, eval.c, gc.h, insns.def, internal.h, method.h,charliesome
variable.c, vm.c, vm_core.c, vm_insnhelper.c, vm_insnhelper.h, vm_method.c: Implement class hierarchy method cache invalidation. [ruby-core:55053] [Feature #8426] [GH-387] git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-31* vm_insnhelper.h (CALL_SIMPLE_METHOD): change name of 'recv' argumentcharliesome
so that other variable names may be used when calling this macro git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-27vm_insnhelper.h: RBASIC_CLASSnobu
* vm_insnhelper.c (opt_eq_func): use RBASIC_CLASS() instead of HEAP_CLASS_OF(). * insns.def (opt_plus, opt_minus, opt_mult, opt_div, opt_mod, opt_lt), (opt_gt, opt_ltlt, opt_aref, opt_aset, opt_length, opt_size), (opt_empty_p, opt_succ): ditto. git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-22* vm_insnhelper.h: partly revert r37631 (DTrace support).naruse
"vm usage information is always collected, so uncomment the functions." causes performance impact. [Bug #7370] Off course this revert disables related probes. git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-12* probes.d: add DTrace probe declarations. [ruby-core:27448]tenderlove
* array.c (empty_ary_alloc, ary_new): added array create DTrace probe. * compile.c (rb_insns_name): allowing DTrace probes to access instruction sequence name. * translate probes.d file to appropriate header file. * declare dependencies on the DTrace header. * add a test for existence of DTrace. * eval.c (setup_exception): add a probe for when an exception is raised. * gc.c: Add DTrace probes for mark begin and end, and sweep begin and end. * hash.c (empty_hash_alloc): Add a probe for hash allocation. * insns.def: Add probes for function entry and return. * internal.h: function declaration for compile.c change. * load.c (rb_f_load): add probes for `load` entry and exit, require entry and exit, and wrapping search_required for load path search. * object.c (rb_obj_alloc): added a probe for general object creation. * parse.y (yycompile0): added a probe around parse and compile phase. * string.c (empty_str_alloc, str_new): DTrace probes for string allocation. * test/dtrace/*: tests for DTrace probes. * vm.c (vm_invoke_proc): add probes for function return on exception raise, hash create, and instruction sequence execution. * vm_core.h: add probe declarations for function entry and exit. * vm_dump.c: add probes header file. * vm_eval.c (vm_call0_cfunc, vm_call0_cfunc_with_frame): add probe on function entry and return. * vm_exec.c: expose instruction number to instruction name function. * vm_insnshelper.c: add function entry and exit probes for cfunc methods. * vm_insnhelper.h: vm usage information is always collected, so uncomment the functions. 12 19:14:50 2012 Akinori MUSHA <> * (isinf, isnan): isinf() and isnan() are macros on DragonFly which cannot be found by AC_REPLACE_FUNCS(). This workaround enforces the fact that they exist on DragonFly. 12 15:59:38 2012 Shugo Maeda <> * vm_core.h (rb_call_info_t::refinements), compile.c (new_callinfo), vm_insnhelper.c (vm_search_method): revert r37616 because it's too slow. [ruby-dev:46477] * test/ruby/test_refinement.rb (test_inline_method_cache): skip the test until the bug is fixed efficiently. git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-15* vm_insnhelper.h (CI_SET_FASTPATH): add new parameter `enabled'.ko1
If `enable' is 0 then CI_SET_FASTPATH() doesn't work. And add new configuration option OPT_CALL_FASTPATH. If this macro was defined by 0, then CI_SET_FASTPATH() doesn't work any more. * vm_insnhelper.c (vm_call_method): Pass `0' for `enabled' parameter of CI_SET_FASTPATH if this method is protected. git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-14* vm_insnhelper.h CI_SET_FASTPATH: introduce new macroko1
`CI_SET_FASTPATH(ci, func)'. This macro set `ci->call' as `func'. `func' (ci->call) is called at the last of `send' (and `invokesuper') instruction. `CI_SET_FASTPATH' does not set `ci->call' when the method (stored in `ci->me') is `protected'. * vm_insnhelper.c (vm_call_method): use `CI_SET_FASTPATH'. After several checking (visibility, argc checking), the result of checking can be reused until re-definition of this method with inline method cache. Note that this optimization is now experimental. If you find any problem about it, please tell us. git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-14* insns.def (send, invokesuper, invokeblock, opt_*), vm_core.h:ko1
use only a `ci' (rb_call_info_t) parameter instead of using parameters such as `op_id', 'op_argc', `blockiseq' and flag. These information are stored in rb_call_info_t at the compile time. This technique simplifies parameter passings at related function calls (~10% speedups for simple mehtod invocation at my machine). `rb_call_info_t' also has new function pointer variable `call'. This `call' variable enables to customize method (block) invocation process for each place. However, it always call `vm_call_general()' at this changes. `rb_call_info_t' also has temporary variables for method (block) invocation. * vm_core.h, compile.c, insns.def: introduce VM_CALL_ARGS_SKIP_SETUP VM_CALL macro. This flag indicates that this call can skip caller_setup (block arg and splat arg). * compile.c: catch up above changes. * iseq.c: catch up above changes (especially for TS_CALLINFO). * tool/instruction.rb: catch up above chagnes. * vm_insnhelper.c, vm_insnhelper.h: ditto. Macros and functions parameters are changed. * vm_eval.c (vm_call0): ditto (it will be rewriten soon). git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-09* vm_core.h (rb_call_info_t): add new type `rb_call_inf_t'.ko1
This data structure contains information including inline method cache. After that, `struct iseq_inline_cache_entry' does not need to contain inline cache for method invocation. Other information will be added to this data structure. * vm_core.h (rb_iseq_t): add `callinfo_entries' and `callinfo_size' members to `rb_iseq_t'. * insns.def, compile.c: Use CALL_INFO instead of IC. * tool/instruction.rb: support CALL_INFO as operand type. * vm_insnhelper.c, vm_insnhelper.h: ditto. git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-08* eval.c, gc.c, iseq.c, node.h, vm_insnhelper.c, vm_insnhelper.h,shugo
vm_method.c: rename omod and overlaid modules to refinements. * eval.c (hidden_identity_hash_new): renamed from identity_hash_new. git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-04* vm.c (VM_COLLECT_USAGE_DETAILS): make new VM usage analysisko1
hooks (old macro name is COLLECT_USAGE_ANALYSIS). This feature is only for VM developers. (I'm not sure I can use `VM developers' (the plural form) in this sentence). If VM_COLLECT_USAGE_DETAILS is not 0, VM enables the following usage collection features: (1) insntruction: collect intruction usages. (2) operand: collect operand usages. (3) register: collect register usages. The results are stored in RubyVM::USAGE_ANALYSIS_INSN for (1, 2), RubyVM::USAGE_ANALYSIS_INSN_BIGRAM for (1) and RubyVM::USAGE_ANALYSIS_REGS for (3). You can stop collecting usages with RubyVM::USAGE_ANALYSIS_INSN_STOP(), RubyVM::USAGE_ANALYSIS_OPERAND_STOP(), RubyVM::USAGE_ANALYSIS_REGISTER_STOP() for (1), (2), (3) respectively. You can also change the hook functions by setting C level global variables `ruby_vm_collect_usage_func_(insn|operand|register)' for (1), (2), (3) respectively. See codes for more details. * tool/instruction.rb: fix macro names. * iseq.c (insn_operand_intern): make it export (used in vm.c). fix to skip several processes if not needed (pointer is 0). * vm_dump.c: move codes for collection features to vm.c. * vm_exec.h: rename macro and function names. * vm_insnhelper.h: ditto. git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-26* insns.def: add new instruction `opt_empty_p' for optimize `empty?'ko1
method. Apply a patch proposed at [ruby-dev:46120] [ruby-trunk - Feature #6972] by Glass_saga (Masaki Matsushita). * compile.c (iseq_specialized_instruction), vm.c, vm_insnhelper.h: ditto. * id.c, template/id.h.tmpl: ditto. * test/ruby/test_optimization.rb: test for this changes. git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-23* include/ruby/ruby.h: introduce flonum technique forko1
64bit CPU environment (sizeof(double) == sizeof(VALUE)). flonum technique enables to avoid double object creation if the double value d is in range about between 1.72723e-77 < |d| <= 1.15792e+77 or 0.0. flonum Float value is immediate and their lowest two bits are b10. If flonum is activated, then USE_FLONUM macro is 1. I'll write detailed in this technique on * benchmark/bmx_temp.rb: add an benchmark for simple Float calculation. * gc.c (id2ref, rb_obj_id): add flonum Float support. * include/ruby/intern.h: move decl of rb_float_new(double) to include/ruby/ruby.h. * insns.def, vm.c, vm_insnhelper.c: add flonum optimization and simplify source code. * vm_insnhelper.h (FLONUM_2_P): added. * marshal.c: support flonum output. * numeric.c (rb_float_new_in_heap): added. * parse.y: support flonum. * random.c: ditto. git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-02* eval.c (rb_mod_using): new method Module#using. [experimental]shugo
* eval.c (rb_mod_refine): new method Module#refine. [experimental] * eval.c (f_using): new method Kernel#using. [experimental] git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-02* class.c, insns.def, method.h, proc.c, vm.c, vm_core.h, vm_eval.c,shugo
vm_insnhelper.c, vm_insnhelper.h, vm_method.c: add klass to rb_control_frame_t to implement super correctly. git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-11* vm_core.h: remove lfp (local frame pointer) and renameko1
dfp (dynamic frame pointer) to ep (environment pointer). This change make VM `normal' (similar to other interpreters). Before this commit: Each frame has two env pointers lfp and dfp. lfp points local environment which is method/class/toplevel frame. lfp[0] is block pointer. dfp is block local frame. dfp[0] points previous (parent) environment pointer. lfp == dfp when frame is method/class/toplevel. You can get lfp from dfp by traversing previous environment pointers. After this commit: Each frame has only `ep' to point respective enviornoment. If there is parent environment, then ep[0] points parent envioenment (as dfp). If there are no more environment, then ep[0] points block pointer (as lfp). We call such ep as `LEP' (local EP). We add some macros to get LEP and to detect LEP or not. In short, we replace dfp and lfp with ep and LEP. rb_block_t and rb_binding_t member `lfp' and `dfp' are removed and member `ep' is added. rename rb_thread_t's member `local_lfp' and `local_svar' to `root_lep' and `root_svar'. (VM_EP_PREV_EP(ep)): get previous environment pointer. This macro assume that ep is not LEP. (VM_EP_BLOCK_PTR(ep)): get block pointer. This macro assume that ep is LEP. (VM_EP_LEP_P(ep)): detect ep is LEP or not. (VM_ENVVAL_BLOCK_PTR(ptr)): make block pointer. (VM_ENVVAL_BLOCK_PTR_P(v)): detect v is block pointer. (VM_ENVVAL_PREV_EP_PTR(ptr)): make prev environment pointer. (VM_ENVVAL_PREV_EP_PTR_P(v)): detect v is prev env pointer. * vm.c: apply above changes. (VM_EP_LEP(ep)): get LEP. (VM_CF_LEP(cfp)): get LEP of cfp->ep. (VM_CF_PREV_EP(cfp)): utility function VM_EP_PREV_EP(cfp->ep). (VM_CF_BLOCK_PTR(cfp)): utility function VM_EP_BLOCK_PTR(cfp->ep). * vm.c, vm_eval.c, vm_insnhelper.c, vm_insnhelper.h, insns.def: apply above changes. * cont.c: ditto. * eval.c, eval_intern.h: ditto. * proc.c: ditto. * thread.c: ditto. * vm_dump.c: ditto. * vm_exec.h: fix function name (on vm debug mode). git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-04* vm_insnhelper.h: remove magical code "lfp[0] & 0x02".ko1
Current VM doesn't use this bit. * vm_core.h (RUBY_VM_GET_BLOCK_PTR): added. * eval.c (rb_block_given_p): use RUBY_VM_GET_BLOCK_PTR(). * vm_eval.c (rb_f_block_given_p): ditto. git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-06fix typoskazu
git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-06* vm_eval.c (make_no_method_execption): extract fromnobu
raise_method_missing(). * vm_eval.c (send_internal): remove inadvertent symbol creation from public_send. based on a patch by Jeremy Evans <code AT> in [ruby-core:38576]. [Feature #5112] * vm_insnhelper.c (vm_call_method): remove inadvertent symbol creation from send and __send__, too. git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-24* vm_insnhelper.h, vm_insnhelper.c, vm.c, vm_method.c, insns.def:ko1
Manage a redefinition of special methods for each classes. A patch from Joel Gouly <>. Thanks! git-svn-id: svn+ssh:// 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:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-30* vm_insnhelper.h (COPY_CREF): should copyshugo
the NODE_FL_CREF_PUSHED_BY_EVAL flag to hide constants from methods defined by class_eval. [ruby-dev:43365] git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-24* vm_insnhelper.h: parenthesize macro arguments.akr
git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-11* vm_insnhelper.h (GET_BLOCK_PTR): return 0 when in class frame.wanabe
git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-06* insns.def (opt_*): add IC operands.ko1
* vm_insnhelper.h (CALL_SIMPLE_METHOD): add a version which use an inline cache. USE_IC_FOR_SPECIALIZED_METHOD macro switchs the behaviour. This change also removes CALL_SIMPLE_METHOD_IC() macro. * tool/instruction.rb: fix elimination process to ignore variable "ic". git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-06* vm_insnhelper.h (CALL_SIMPLE_METHOD_IC): make a macroko1
invoke simple method with inline cache entry. * insns.def (opt_length, opt_size): fix to use inline method cache. git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e