summaryrefslogtreecommitdiff
path: root/insns.def
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-02-06 05:22:17 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-02-06 05:22:17 +0000
commit42ce75cdff741d69927e407ac57b68dd58408111 (patch)
tree23c31bb9a51e489645b42457e69ac9a50fd5014d /insns.def
parentd4d5f27077dd356fb2bef031991864777cc54ef6 (diff)
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@11639 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'insns.def')
-rw-r--r--insns.def46
1 files changed, 12 insertions, 34 deletions
diff --git a/insns.def b/insns.def
index b84d07f290..dab579d4fc 100644
--- a/insns.def
+++ b/insns.def
@@ -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);
}