CIL フォーマット
0A
/ stloc.0
0B
/ stloc.1
0C
/ stloc.2
0D
/ stloc.3
13
(uint8) / stloc.s
(indx)
FE 0E
(uint16) / stloc
(indx)
JVM フォーマット
36
(uint8) / istore
(index)
37
(uint8) / lstore
(index)
38
(uint8) / fstore
(index)
39
(uint8) / dstore
(index)
3A
(uint8) / astore
(index)
3B
〜3E
/ istore_
(n)
3F
〜42
/ lstore_
(n)
43
〜46
/ fstore_
(n)
47
〜4A
/ dstore_
(n)
4B
〜4E
/ astore_
(n)
※Javaではローカル変数と引数リストの区別はない。
ローカル変数は(引数の個数)から順に番号がつく。
※Javaでは型によって命令が異なる。
スタック
..., value → ...
詳細
スタックの先頭を取り出し、indx番目のローカル変数に移動します。 ローカル変数は0から順に番号がついています。 valueの型はメソッド・ヘッダで宣言されたローカル変数の型と 等しくなければなりません。 最初の4つのローカル変数に関しては、 stloc.0, stloc.1, stloc.2, stloc.3 の利用が効率的です。 4番目から255番目の引数に関しては stloc.s の利用が効率的です。
4バイトより小さいローカル変数には、移動の際にint32から切り詰められます。 浮動小数点数はネイティブ・サイズ(F)から丸められます。