| 1 | """ |
| 2 | |
| 3 | PyPy PPC Stackframe |
| 4 | |
| 5 | OLD FRAME |
| 6 | | BACK CHAIN | |
| 7 | - - - - - --------------------------- - - - - -- - - - - - - - - - |
| 8 | | | | CURRENT FRAME |
| 9 | | FPR SAVE AREA | |>> len(NONVOLATILES_FPR) * DOUBLEWORD |
| 10 | | | | |
| 11 | --------------------------- -- |
| 12 | | | | |
| 13 | | GPR SAVE AREA | |>> len(NONVOLATILES) * WORD |
| 14 | | | | |
| 15 | --------------------------- -- |
| 16 | | | | |
| 17 | | FLOAT/INT CONVERSION | |>> 1 * WORD |
| 18 | | | | |
| 19 | --------------------------- -- |
| 20 | | FORCE INDEX | WORD |>> 1 WORD |
| 21 | --------------------------- -- |
| 22 | | | | |
| 23 | | ENCODING AREA | |>> len(MANAGED_REGS) * WORD |
| 24 | | (ALLOCA AREA) | | |
| 25 | SPP -> --------------------------- -- |
| 26 | | | | |
| 27 | | SPILLING AREA | |>> regalloc.frame_manager.frame_depth * WORD |
| 28 | | (LOCAL VARIABLE SPACE) | | |
| 29 | --------------------------- -- |
| 30 | | | | |
| 31 | | PARAMETER SAVE AREA | |>> max_stack_params * WORD |
| 32 | | | | |
| 33 | --------------------------- -- |
| 34 | (64 Bit) | TOC POINTER | WORD | |
| 35 | --------------------------- -- |
| 36 | | | | |
| 37 | (64 Bit) | RESERVED FOR COMPILER | |>> 2 * WORD |
| 38 | | AND LINKER | | |
| 39 | --------------------------- -- |
| 40 | | SAVED LR | WORD | |
| 41 | --------------------------- |>> 3 WORDS (64 Bit) |
| 42 | (64 Bit) | SAVED CR | WORD | 2 WORDS (32 Bit) |
| 43 | --------------------------- | |
| 44 | | BACK CHAIN | WORD | |
| 45 | SP -> --------------------------- -- |
| 46 | |
| 47 | |
| 48 | Minimum PPC64 ABI stack frame: |
| 49 | |
| 50 | OLD FRAME |
| 51 | | BACK CHAIN | |
| 52 | - - - - - --------------------------- - - - - -- - - - - - - - - - |
| 53 | | | | CURRENT FRAME |
| 54 | | PARAMETER SAVE AREA | |>> max_stack_params * WORD |
| 55 | | | | |
| 56 | --------------------------- -- |
| 57 | (64 Bit) | TOC POINTER | WORD | |
| 58 | --------------------------- -- |
| 59 | | | | |
| 60 | (64 Bit) | RESERVED FOR COMPILER | |>> 2 * WORD |
| 61 | | AND LINKER | | |
| 62 | --------------------------- -- |
| 63 | | SAVED LR | WORD | |
| 64 | --------------------------- |>> 3 WORDS (64 Bit) |
| 65 | (64 Bit) | SAVED CR | WORD | 2 WORDS (32 Bit) |
| 66 | --------------------------- | |
| 67 | | BACK CHAIN | WORD | |
| 68 | SP -> --------------------------- -- |
| 69 | |
| 70 | PARAM AREA = 8 doublewords = 64 bytes |
| 71 | FIXED AREA = 6 doublewords = 48 bytes |
| 72 | TOTAL = 14 doublewords = 112 bytes |
| 73 | |
| 74 | *ALL* of the locations may be left empty. Some of the locations may be |
| 75 | written by child function. |
| 76 | |
| 77 | TOC POINTER is used to restore addressibility of globals, but may be |
| 78 | restored independently. |
| 79 | |
| 80 | SAVED LR is used to restore the return address, but the return address |
| 81 | link register may be preserved using another method or control transferred |
| 82 | in a different manner. |
| 83 | |
| 84 | BACK CHAIN stores previous stack pointer to permit walking the stack frames, |
| 85 | but stack may be allocated and deallocated without storing it. |
| 86 | |
| 87 | Decrementing the stack pointer by 112 bytes at the beginning of a function |
| 88 | and incrementing the stack pointer by the complementary amount is sufficient |
| 89 | to interact with other ABI-compliant functions. |
| 90 | |
| 91 | """ |