diff options
| -rw-r--r-- | src/buildvm_ppc.dasc | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/src/buildvm_ppc.dasc b/src/buildvm_ppc.dasc index 76374446..e5ad8c46 100644 --- a/src/buildvm_ppc.dasc +++ b/src/buildvm_ppc.dasc | |||
| @@ -28,18 +28,19 @@ | |||
| 28 | |.define PC, r16 // Next PC. | 28 | |.define PC, r16 // Next PC. |
| 29 | |.define DISPATCH, r17 // Opcode dispatch table. | 29 | |.define DISPATCH, r17 // Opcode dispatch table. |
| 30 | |.define LREG, r18 // Register holding lua_State (also in SAVE_L). | 30 | |.define LREG, r18 // Register holding lua_State (also in SAVE_L). |
| 31 | |.define MULTRES, r19 // Size of multi-result: (nresults+1)*8. | ||
| 31 | | | 32 | | |
| 32 | |// Constants for vectorized type-comparisons (hi+low GPR). C callee-save. | 33 | |// Constants for vectorized type-comparisons (hi+low GPR). C callee-save. |
| 33 | |.define TISNUM, r21 | 34 | |.define TISNUM, r22 |
| 34 | |.if SPE | 35 | |.if SPE |
| 35 | |.define TISSTR, r22 | 36 | |.define TISSTR, r23 |
| 36 | |.define TISTAB, r23 | 37 | |.define TISTAB, r24 |
| 37 | |.define TISFUNC, r24 | 38 | |.define TISFUNC, r25 |
| 38 | |.define TISNIL, r25 | 39 | |.define TISNIL, r26 |
| 39 | |.endif | 40 | |.endif |
| 40 | | | 41 | | |
| 41 | |// The following temporaries are not saved across C calls, except for RA. | 42 | |// The following temporaries are not saved across C calls, except for RA. |
| 42 | |.define RA, r19 // Callee-save. | 43 | |.define RA, r20 // Callee-save. |
| 43 | |.define RB, r10 | 44 | |.define RB, r10 |
| 44 | |.define RC, r11 | 45 | |.define RC, r11 |
| 45 | |.define RD, r12 | 46 | |.define RD, r12 |
| @@ -51,7 +52,7 @@ | |||
| 51 | |.define TMP3, r6 // Overlaps CARG4. | 52 | |.define TMP3, r6 // Overlaps CARG4. |
| 52 | | | 53 | | |
| 53 | |// Saved temporaries. | 54 | |// Saved temporaries. |
| 54 | |.define SAVE0, r20 | 55 | |.define SAVE0, r21 |
| 55 | | | 56 | | |
| 56 | |// Calling conventions. | 57 | |// Calling conventions. |
| 57 | |.define CARG1, r3 | 58 | |.define CARG1, r3 |
| @@ -284,7 +285,7 @@ static void build_subroutines(BuildCtx *ctx) | |||
| 284 | |->vm_returnc: | 285 | |->vm_returnc: |
| 285 | | andi. TMP0, PC, FRAME_TYPE | 286 | | andi. TMP0, PC, FRAME_TYPE |
| 286 | | addi RD, RD, 8 // RD = (nresults+1)*8. | 287 | | addi RD, RD, 8 // RD = (nresults+1)*8. |
| 287 | | stw RD, SAVE_MULTRES | 288 | | mr MULTRES, RD |
| 288 | | beq ->BC_RET_Z // Handle regular return to Lua. | 289 | | beq ->BC_RET_Z // Handle regular return to Lua. |
| 289 | | | 290 | | |
| 290 | |->vm_return: | 291 | |->vm_return: |
| @@ -2010,8 +2011,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
| 2010 | 2011 | ||
| 2011 | case BC_CALLM: | 2012 | case BC_CALLM: |
| 2012 | | // RA = base*8, (RB = (nresults+1)*8,) RC = extra_nargs*8 | 2013 | | // RA = base*8, (RB = (nresults+1)*8,) RC = extra_nargs*8 |
| 2013 | | lwz TMP0, SAVE_MULTRES | 2014 | | add NARGS8:RC, NARGS8:RC, MULTRES |
| 2014 | | add NARGS8:RC, NARGS8:RC, TMP0 | ||
| 2015 | | // Fall through. Assumes BC_CALL follows. | 2015 | | // Fall through. Assumes BC_CALL follows. |
| 2016 | break; | 2016 | break; |
| 2017 | case BC_CALL: | 2017 | case BC_CALL: |
| @@ -2028,8 +2028,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
| 2028 | 2028 | ||
| 2029 | case BC_CALLMT: | 2029 | case BC_CALLMT: |
| 2030 | | // RA = base*8, (RB = 0,) RC = extra_nargs*8 | 2030 | | // RA = base*8, (RB = 0,) RC = extra_nargs*8 |
| 2031 | | lwz TMP0, SAVE_MULTRES | 2031 | | add NARGS8:RC, NARGS8:RC, MULTRES |
| 2032 | | add NARGS8:RC, NARGS8:RC, TMP0 | ||
| 2033 | | // Fall through. Assumes BC_CALLT follows. | 2032 | | // Fall through. Assumes BC_CALLT follows. |
| 2034 | break; | 2033 | break; |
| 2035 | case BC_CALLT: | 2034 | case BC_CALLT: |
| @@ -2109,8 +2108,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
| 2109 | 2108 | ||
| 2110 | case BC_RETM: | 2109 | case BC_RETM: |
| 2111 | | // RA = results*8, RD = extra_nresults*8 | 2110 | | // RA = results*8, RD = extra_nresults*8 |
| 2112 | | lwz TMP0, SAVE_MULTRES | 2111 | | add RD, RD, MULTRES // MULTRES >= 8, so RD >= 8. |
| 2113 | | add RD, RD, TMP0 // SAVE_MULTRES >= 8, so RD >= 8. | ||
| 2114 | | // Fall through. Assumes BC_RET follows. | 2112 | | // Fall through. Assumes BC_RET follows. |
| 2115 | break; | 2113 | break; |
| 2116 | 2114 | ||
| @@ -2118,7 +2116,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
| 2118 | | // RA = results*8, RD = (nresults+1)*8 | 2116 | | // RA = results*8, RD = (nresults+1)*8 |
| 2119 | | lwz PC, FRAME_PC(BASE) | 2117 | | lwz PC, FRAME_PC(BASE) |
| 2120 | | add RA, BASE, RA | 2118 | | add RA, BASE, RA |
| 2121 | | stw RD, SAVE_MULTRES | 2119 | | mr MULTRES, RD |
| 2122 | |1: | 2120 | |1: |
| 2123 | | andi. TMP0, PC, FRAME_TYPE | 2121 | | andi. TMP0, PC, FRAME_TYPE |
| 2124 | | xori TMP1, PC, FRAME_VARG | 2122 | | xori TMP1, PC, FRAME_VARG |
| @@ -2173,7 +2171,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
| 2173 | | // RA = results*8, RD = (nresults+1)*8 | 2171 | | // RA = results*8, RD = (nresults+1)*8 |
| 2174 | | lwz PC, FRAME_PC(BASE) | 2172 | | lwz PC, FRAME_PC(BASE) |
| 2175 | | add RA, BASE, RA | 2173 | | add RA, BASE, RA |
| 2176 | | stw RD, SAVE_MULTRES | 2174 | | mr MULTRES, RD |
| 2177 | | andi. TMP0, PC, FRAME_TYPE | 2175 | | andi. TMP0, PC, FRAME_TYPE |
| 2178 | | xori TMP1, PC, FRAME_VARG | 2176 | | xori TMP1, PC, FRAME_VARG |
| 2179 | | bne ->BC_RETV_Z | 2177 | | bne ->BC_RETV_Z |
