'stack' - performs forming of stack memory for a method.
The transformation performs forming of stack memory for a method, e.g. allocates memory for stack variables and input arguments, inserts saving/restoring callee-save registers. Also it fills StackInfo object for runtime access to information about stack layout
This transformer ensures that
1) All input argument operands and stack memory operands have appropriate
displacements from stack pointer
2) There are save/restore instructions for all callee-save registers
3) There are save/restore instructions for all caller-save registers for
all calls in method
4) ESP has appropriate value throughout whole method
Stack layout illustration:
+-------------------------------+ inargEnd | | | | | | +-------------------------------+ inargBase, eipEnd | eip | +-------------------------------+ eipBase,icalleeEnd <--- "virtual" ESP | EBX | | EBP | | ESI | | EDI | +-------------------------------+ icalleeBase, fcalleeEnd | | | | | | +-------------------------------+ fcalleeBase, acalleeEnd | | | | | | +-------------------------------+ acalleeBase, localEnd | | | | | | +-------------------------------+ localBase | alignment padding | |-------------------------------+ <--- "real" ESP | EAX | | ECX | | EDX | +-------------------------------+ base of caller-save regs
implementation file: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32StackLayout.cpp