Skip to content
Advertisement

Java Object Method Stack Frame Parameters

So in java, say you have a non-static method ‘bar()’ in an class ‘Foo’.

JavaScript

Say then that you call this method like so:

JavaScript

Now the stack frame for the call includes the integer parameter, as well as a ‘this’ parameter to be used as an internal reference to the object.

What other interesting parameters are copied to the new stack frame, in addition to ‘this’ and the method parameters?

.

Advertisement

Answer

Usually a pointer to the calling instruction, so that the VM (in this case, the CPU in native apps) will know where to set the instruction pointer (or PC – Program Counter) so the stack will be unfolded correctly

Advertisement