java - putfield order of arguments -
in java bytecode "putfield" instruction expects top of stack value, , top-1 of stack reference. why not other way round ?
it asked in lecture notes , cannot find answer.
the order doesn't matter, since vm , compiler implemented either way. sun chose have lower arguments appear lower on stack.
you can see not putfield
, many other instructions, such array loading , storing , method invocation. obey same convention. explanation can think of is more intuitive way.
if read out stack bottom top left right, arguments on stack have same order arguments in method signatures or original source code. if wanted other way, programmers have mentally treat stack reversed, isn't big deal, possibly less intuitive.
Comments
Post a Comment