diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-10-04 13:52:20 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-10-04 13:52:20 +0000 |
commit | 08c8605de91d2f04dcb53672a2eca6bd3f77bb18 (patch) | |
tree | 95f15e8497aedf68c1f4707ae7578c8081ad1990 /insns.def | |
parent | 326e22e14a7625fd947f038f8c3f2235a059d522 (diff) |
* insns.def (getlocal, setlocal): remove old getlocal/setlocal
instructions and rename getdaynmic/setdynamic instructions
to getlocal/setlocal.
* compile.c: ditto.
* iseq.c: remove TS_DINDEX.
* vm_exec.h (dindex_t): remove type definition of `dindex_t'.
* tool/instruction.rb: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37087 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'insns.def')
-rw-r--r-- | insns.def | 72 |
1 files changed, 22 insertions, 50 deletions
@@ -46,30 +46,44 @@ nop /** @c variable - @e Get value of local variable (pointed to by idx). - @j idx で指定されたローカル変数をスタックに置く。 + @e Get local variable (pointed by `idx' and `level'). + 'level' indicates the nesting depth from the current block. + @j level, idx で指定されたローカル変数の値をスタックに置く。 + level はブロックのネストレベルで、何段上かを示す。 */ DEFINE_INSN getlocal -(lindex_t idx) +(lindex_t idx, rb_num_t level) () (VALUE val) { - val = *(GET_LEP() - idx); + rb_num_t i; + VALUE *ep = GET_EP(); + for (i = 0; i < level; i++) { + ep = GET_PREV_EP(ep); + } + val = *(ep - idx); } /** @c variable - @e Set value of local variable (pointed to by idx) to val. - @j idx で指定されたローカル変数を val に設定する。 + @e Set a local variable (pointed to by 'idx') as val. + 'level' indicates the nesting depth from the current block. + @j level, idx で指定されたローカル変数の値を val にする。 + level はブロックのネストレベルで、何段上かを示す。 */ DEFINE_INSN setlocal -(lindex_t idx) +(lindex_t idx, rb_num_t level) (VALUE val) () { - *(GET_LEP() - idx) = val; + rb_num_t i; + VALUE *ep = GET_EP(); + for (i = 0; i < level; i++) { + ep = GET_PREV_EP(ep); + } + *(ep - idx) = val; } /** @@ -102,48 +116,6 @@ setspecial /** @c variable - @e Get value of block local variable (pointed to by idx and level). - 'level' indicates the nesting depth from the current block. - @j level, idx で指定されたブロックローカル変数の値をスタックに置く。 - level はブロックのネストレベルで、何段上かを示す。 - */ -DEFINE_INSN -getdynamic -(dindex_t idx, rb_num_t level) -() -(VALUE val) -{ - rb_num_t i; - VALUE *ep = GET_EP(); - for (i = 0; i < level; i++) { - ep = GET_PREV_EP(ep); - } - val = *(ep - idx); -} - -/** - @c variable - @e Set block local variable (pointed to by 'idx') as val. - 'level' indicates the nesting depth from the current block. - @j level, idx で指定されたブロックローカル変数の値を val にする。 - level はブロックのネストレベルで、何段上かを示す。 - */ -DEFINE_INSN -setdynamic -(dindex_t idx, rb_num_t level) -(VALUE val) -() -{ - rb_num_t i; - VALUE *ep = GET_EP(); - for (i = 0; i < level; i++) { - ep = GET_PREV_EP(ep); - } - *(ep - idx) = val; -} - -/** - @c variable @e Get value of instance variable id of self. If is_local is not 0, get value of class local variable. @j self のインスタンス変数 id の値を得る。 |