From e4198a73d406d9a9f61a6db2d2a243c0f5267679 Mon Sep 17 00:00:00 2001 From: ko1 Date: Tue, 21 Jul 2015 22:52:59 +0000 Subject: * make rb_iseq_t T_IMEMO object (type is imemo_iseq). 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 --- struct.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'struct.c') diff --git a/struct.c b/struct.c index 729b7c2685..0d979c8aac 100644 --- a/struct.c +++ b/struct.c @@ -19,8 +19,8 @@ enum { AREF_HASH_THRESHOLD = 10 }; -VALUE rb_method_for_self_aref(VALUE name, VALUE arg, rb_insn_func_t func); -VALUE rb_method_for_self_aset(VALUE name, VALUE arg, rb_insn_func_t func); +const rb_iseq_t *rb_method_for_self_aref(VALUE name, VALUE arg, rb_insn_func_t func); +const rb_iseq_t *rb_method_for_self_aset(VALUE name, VALUE arg, rb_insn_func_t func); VALUE rb_cStruct; static ID id_members, id_back_members; @@ -287,18 +287,18 @@ static void define_aref_method(VALUE nstr, VALUE name, VALUE off) { rb_control_frame_t *FUNC_FASTCALL(rb_vm_opt_struct_aref)(rb_thread_t *, rb_control_frame_t *); - VALUE iseqval = rb_method_for_self_aref(name, off, rb_vm_opt_struct_aref); + const rb_iseq_t *iseq = rb_method_for_self_aref(name, off, rb_vm_opt_struct_aref); - rb_add_method_iseq(nstr, SYM2ID(name), iseqval, NULL, METHOD_VISI_PUBLIC); + rb_add_method_iseq(nstr, SYM2ID(name), iseq, NULL, METHOD_VISI_PUBLIC); } static void define_aset_method(VALUE nstr, VALUE name, VALUE off) { rb_control_frame_t *FUNC_FASTCALL(rb_vm_opt_struct_aset)(rb_thread_t *, rb_control_frame_t *); - VALUE iseqval = rb_method_for_self_aset(name, off, rb_vm_opt_struct_aset); + const rb_iseq_t *iseq = rb_method_for_self_aset(name, off, rb_vm_opt_struct_aset); - rb_add_method_iseq(nstr, SYM2ID(name), iseqval, NULL, METHOD_VISI_PUBLIC); + rb_add_method_iseq(nstr, SYM2ID(name), iseq, NULL, METHOD_VISI_PUBLIC); } static VALUE -- cgit v1.2.3