It is evident from Java Virtual Machine Implementation (http://docs.oracle.com/javase/specs/jvms/se7/html/index.html) that stack frame present on heap which stores the method's runtime data. But what are the contents of stack frame in java and how the stack frame is organized to store values of local variables and intermediate results. How is the data structure organized.
A stack frame consists of many bytes, each of which has its own address; each kind of computer has a convention for choosing one byte whose address serves as the address of the frame. Usually this address is kept in a register called the frame pointer register while execution is going on in that frame.
A stack frame is a memory management technique used in some programming languages for generating and eliminating temporary variables. In other words, it can be considered the collection of all information on the stack pertaining to a subprogram call. Stack frames are only existent during the runtime process.
Stack is one of the segments of application memory that is used to store the local variables, function calls of the function. Whenever there is a function call in our program the memory to the local variables and other function calls or subroutines get stored in the stack frame.
A frame is used to store data and partial results, as well as to perform dynamic linking, return values for methods, and dispatch exceptions. A new frame is created each time a method is invoked.
First of all, stack frame is part of JVM stack, not Heap [JVM memory is divided in 5 parts: Method Area, Heap, Stack, PC Register and Native Memory.]
To answer your question, stack frame is divided into three parts: local variable array, frame data and operand stack. Refer to the following link for detailed info: http://www.artima.com/insidejvm/ed2/jvm8.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With