Reputation: 2239
What's the difference between java bytecode astore_1
and astore_2
?
Upvotes: 6
Views: 1730
Reputation: 81724
The instructions astore_n
, for small values of n
, are just shorthand equivalents for astore n
. Either version stores what's on top of the stack into local variable n
.
Upvotes: 11
Reputation: 223133
astore_1
is the same as astore 1
, and astore_2
is the same as astore 2
, except that astore_1
and astore_2
are one byte each, whereas astore
is a two-byte instruction.
Upvotes: 5