* src/vm/jit/code.c (code_get_stack_frame_size): Implement stack alignment
[cacao.git] / doc / stack_frames.txt
index 23b2b8c2ec49181a93a87d4bd7a844da0f341f5d..7855d10e9830a50516464055d612955043d7120e 100644 (file)
@@ -14,20 +14,101 @@ tries to collect the stack frame layouts used on the various architectures.
 i386 stack frames
 -----------------
 
->>>> sp in method (after initial sub) <<<<
+,--memory address rising
+|
+V   >>>> sp in method (after initial sub) <<<<
+|          
+|   u4[]  v  arguments for calling methods              \__ rd->memuse slots
+V   u4[]  v  local variable slots allocated on stack    /
+|
+|   u4[1..2] synchronized object / saved return value       (only for synched methods)
+V
+|   u8[]  ^  callee-saved float registers
+|   u4[]  ^  callee-saved integer registers
+V          
+|   >>>> sp on method entry, stack base for replacement <<<<
+|
+V   u4       return address
+|   u4[]     arguments on stack
+|
+V
 
-u4[]     arguments for calling methods              \__ rd->memuse slots
-u4[]     local variable slots allocated on stack    /
 
-u4[1..2] synchronized object / saved return value       (only for synched methods)
+x86_64 stack frames
+-----------------
+
+,--memory address rising
+|
+V   >>>> sp in method (after initial sub) (16-byte aligned in non-leaf methods) <<<<
+|          
+|   u8[]  v  arguments for calling methods              \__ rd->memuse slots
+V   u8[]  v  local variable slots allocated on stack    /
+|
+|   u8    v  synchronized object / saved return value       (only for synched methods)
+V   u8[0..1] alignment dummy slot                           (in non-leaf methods to ensure
+|                                                            16-byte alignment of stack)
+|   u8[]  ^  callee-saved float registers
+V   u8[]  ^  callee-saved integer registers
+|          
+|   >>>> sp on method entry, stack base for replacement  (16-byte aligned) <<<<
+V
+|   u8       return address
+|   u8[]     arguments on stack
+V
+
 
-u8[]     callee-saved float registers
-u4[]     callee-saved integer registers
 
->>>> sp on method entry <<<<
+alpha stack frames
+------------------
 
-u4    return address
-u4[]  arguments on stack
+XXX currently the stack on alpha is not 16-byte aligned!
 
+,--memory address rising
+|
+V   >>>> sp in method (after initial sub) <<<<
+|          
+|   u8[]  v  arguments for calling methods              \__ rd->memuse slots
+V   u8[]  v  local variable slots allocated on stack    /
+|
+|   u8       synchronized object / saved return value       (only for synched methods)
+V
+|   u8[]  ^  callee-saved float registers
+|   u8[]  ^  callee-saved integer registers
+V
+|     >>>> !!!replacement code regards this point as stack base!!! <<<<
+|                
+V   u8    ^  saved return address                           (only for non-leaf methods)
+|
+|   >>>> sp on method entry <<<<
+V
+|   u8[]     arguments on stack
+|
+V
+
+
+mips stack frames
+-----------------
 
+,--memory address rising
+|
+V   >>>> sp in method (after initial sub) (16-byte aligned) <<<<
+|          
+|   u8[]  v  arguments for calling methods              \__ rd->memuse slots
+V   u8[]  v  local variable slots allocated on stack    /
+|
+|   u8       synchronized object / saved return value       (only for synched methods)
+|   u8[0..1] alignment dummy-slot                           (to ensure 16-byte alignment of sp)
+V
+|   u8[]  ^  callee-saved float registers
+|   u8[]  ^  callee-saved integer registers
+V
+|     >>>> !!!replacement code regards this point as stack base!!!  <<<<
+|                
+V   u8    ^  saved return address                           (only for non-leaf methods)
+|
+|   >>>> sp on method entry (16-byte aligned) <<<<
+V
+|   u8[]     arguments on stack
+|
+V