diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-02-06 05:22:17 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-02-06 05:22:17 +0000 |
commit | 6b595b26af59f90e2a6fca9a33a14904e58799f5 (patch) | |
tree | 23c31bb9a51e489645b42457e69ac9a50fd5014d /insns.def | |
parent | 4452f448ce7c78fefbc8d7ea89adf4e24c8a8880 (diff) | |
download | ruby-6b595b26af59f90e2a6fca9a33a14904e58799f5.tar.gz ruby-6b595b26af59f90e2a6fca9a33a14904e58799f5.tar.xz ruby-6b595b26af59f90e2a6fca9a33a14904e58799f5.zip |
* compile.c, insns.def: remove (get|set)instancevariable2 and add a
operand is_local to (get|set)instancevariable.
* yarvtest/test_class.rb: add a test for class local instance variable.
* parse.y (rb_decompose_ivar2): remove unused variable oid.
* tool/insns2vm.rb: remove needless require.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@11639 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'insns.def')
-rw-r--r-- | insns.def | 46 |
1 files changed, 12 insertions, 34 deletions
@@ -175,60 +175,38 @@ setdynamic /** @c variable @e get instance variable id of obj. + if is_local is not 0, search as class local variable. @j obj のインスタンス変数 id を得る。 + もし is_local が !0 ならクラスローカル変数を得る */ DEFINE_INSN getinstancevariable -(ID id) +(ID id, num_t is_local) () (VALUE val) { - val = rb_ivar_get(GET_SELF(), id); -} - -/** - @c variable - @e get class local instance variable id of obj. - @j obj のクラスローカルインスタンス変数 id を得る。 - */ -DEFINE_INSN -getinstancevariable2 -(ID id) -() -(VALUE val) -{ - /* need to cache composed id */ - id = rb_compose_ivar2(id, eval_get_cvar_base(th, GET_ISEQ())); + if (is_local) { + id = rb_compose_ivar2(id, eval_get_cvar_base(th, GET_ISEQ())); + } val = rb_ivar_get(GET_SELF(), id); } /** @c variable @e set instance variable id of obj as val. + if is_local is not 0, search as class local variable. @j obj のインスタンス変数を val にする。 + もし is_local が !0 ならクラスローカル変数を得る */ DEFINE_INSN setinstancevariable -(ID id) +(ID id, num_t is_local) (VALUE val) () { - rb_ivar_set(GET_SELF(), id, val); -} - -/** - @c variable - @e set class local instance variable id of obj as val. - @j obj のクラスローカルインスタンス変数を val にする。 - */ -DEFINE_INSN -setinstancevariable2 -(ID id) -(VALUE val) -() -{ - /* need to cache composed id */ - id = rb_compose_ivar2(id, eval_get_cvar_base(th, GET_ISEQ())); + if (is_local) { + id = rb_compose_ivar2(id, eval_get_cvar_base(th, GET_ISEQ())); + } rb_ivar_set(GET_SELF(), id, val); } |