Lines Matching full:stack
8 * The structure of compiled code stack frames and stack traversing
12 * Stack unwinding during exception handling
50 …_ | StackFrameKind | A kind of the current stack frame (compiled code or interpreter sta…
82 ## Stack frame
83 A stack frame contains data necessary to execute the function the frame belongs to.
84 …kinds of stack frames. But all the frames of managed code must have the structure described in [Co…
86 ### Interpreter stack frame
87 …terpreter stack frame is decribed by `panda::Frame` class. The class has fields to store virtual r…
88 All the consecutive interpreter stack frames are organized into a linked list. The field `panda::Fr…
90 ### Compiled code stack frame
91 Each compiled function is responsible to reserve stack frame for its purpose and then release it wh…
92 Generaly compiled function builds the stack frame in prolog and releases it in epilog. If a compile…
93 the stack frame it can omit its creation.
94 …mpiled code is executing the `stack pointer` register must point to a valid stack frame (newly cre…
100 Release of the stack frame could be done by restoring values of `stack pointer` and `frame pointer`…
102 …d code stack frames of caller and callee must be continuous in the stack i.e. the callee's stack f…
104 A compiled code stack frame must have the following structure:
107 (Stack grows in increasing order: higher slot has lower address)
108 -----+----------------------+ <- Stack pointer
132 Stack frame elements:
139 There are two special registers: `stack pointer` and `frame pointer`.
140 `stack pointer` register contains a pointer to the last stack element.
141 `frame pointer` register contains a pointer to the place in the stack where the return address is s…
148 prepare arguments in the registers and the stack (if necessary) and jump to callee's entrypoint.
177 * putting callee saved (if need) and param holding (if any) register values to the stack
178 …callee saved regisers goes to Bridge Function stack frame, caller saved registers goes to the curr…
184 * setup the Bridge Function stack frame
185 …aller saved registers (except of registers holding function parameters) to the caller's stack frame
186 * adjust Stack Pointer, and pass execution to the runtime function
187 * restore the Stack Pointer and caller saved registers
189 Bridge Function stack frame:
219 * Build a boundary stack frame.
221 * Change stack frame kind in `panda::ManagedThread::stack_frame_kind_` to compiled code stack frame…
225 * After the return save the result to the interpreter stack frame.
226 * Change stack frame kind in `panda::ManagedThread::stack_frame_kind_` back to interpreter stack fr…
227 * Drop the boundary stack frame.
229 `InterpreterToCompiledCodeBridge`'s boundary stack frame is necessary to link the interpreter's fra…
232 ---- +----------------+ <- stack pointer
247 The structure of boundary frame is the same as a stack frame of compiled code.
254 * Change stack frame kind in `panda::ManagedThread::stack_frame_kind_` to interpreter stack frame.
255 * Creates a boundary stack frame which contains room for interpreter frame.
256 …e by the arguments passed to `CompiledCodeToInterpreterBridge` in the registers or via the stack.
258 * Store the result in registers or in the stack according to the target calling convention.
259 * Drop the boundary stack frame.
260 * Change stack frame kind in `panda::ManagedThread::stack_frame_kind_` back to compiled code stack …
262 `CompiledCodeToInterpreterBridge`'s boundary stack frame is necessary to link the compiled code's f…
265 ---- +----------------+ <-+ stack pointer
281 The structure of boundary frame is the same as a stack frame of compiled code.
283 Frame pointer points to the previous frame in compiled code stack frame.
286 ## Stack traversing
287 Stack traversing is performed by the runtime. When the runtime examinates a managed thread's stack …
288 Stack unwinding always starts from the top frame. Its kind could be determined from `panda::Managed…
289 to the top frame could be determined depends on the kind of the top stack frame:
290 * The top stack frame is an interpreter stack frame. Address of the interpreter's frame could be re…
291 * The top stack frame is a compiled code stack frame. `frame pointer` register contains the address…
293 Having a pointer to the top stack frame, its kind and structure the runtime can move to the next fr…
296 | Kind of the current stack frame | How to get a pointer to the next stack frame | Kind of the prev…
298 | Interpreter stack frame | Read `panda::Frame::prev_` field | Interpreter stac…
299 …O_COMPILED_CODE_BRIDGE boundary stack frame | Read `pointer to the interpreter frame` from the sta…
300 …ILED_CODE_TO_INTERPRETER_BRIDGE boundary stack frame | Read `frame pointer` from the stack | Compi…
301 | Compiled code stack frame | Read `frame pointer` | Compiled code stack frame or INTERPRETER_TO_CO…
303 Thus the runtime can traverse all the managed stack frames moving from one frame to the previous fr…
306 Unwinding of stack frames has specifics.
308 during handling a compiled code stack frame it uses meta information generated by the compiler (See…
309 * Compiled code may save any callee-saved registers on the stack. Before moving to the next stack f…
310 To do that the runtime uses information about callee-saved registers stored on the stack. This info…
311 * Values of virtual registers could be changed during stack unwinding. For example, when GC moves a…
322 In this situation the stack might look as follow:
324 ---- +----------------+ <- stack pointer
332 u t | stack frame | |
377 …s kind of the top stack frame by reading `panda::ManagedThread::stack_frame_kind_` (the top stack …
378 …nagedThread::GetCurrentFrame()` method must return the pointer to `baz`'s interpreter stack frame.
379 …nda::Frame::prev_` which must point to `COMPILED_CODE_TO_INTERPRETER_BRIDGE` boundary stack frame.
380 It means that to get `bar`'s stack frame the runtime must read `frame pointer` and the kind of the …
381 At this step the runtime has a pointer to `bar`'s compiled code stack frame. To go to the next fram…
382 `INTERPRETER_TO_COMPILED_CODE_BRIDGE` boundary stack frame. To reach `foo`'s interpreter stack fram…
387 The function reconstructs the interpreter stack frame and calls the interpreter.
388 …naged functions (inlined functions) `Deoptimize` reconstructs interpreter stack frame and calls th…
394 * Saves all the callee-saved registers to the stack
396 * Unwind compiled code stack frames to find the corresponding exception handler by going from one s…
398 If the corresponding catch handler is found in the current stack frame the runtime jumps to the han…
400 If a INTERPRETER_TO_COMPILED_CODE_BRIDGE boundary stack frame is reached the runtime returns to the…
402 …s to the boundary frame. The return address is stored in the following compiled code stack frame.
403 2. Set the pointer to the boundary frame into stack pointer, assign the return address determined a…
405 …e then the runtime restores values of callee-saved registers and moves to the previous stack frame.
407 Details of stack travesing are described in [Stack traversing](#stack_traversing)
409 Finding a catch handler in a compiled code stack frame is performed according meta information gene…