diff options
Diffstat (limited to 'src/buildvm_ppc.dasc')
-rw-r--r-- | src/buildvm_ppc.dasc | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/src/buildvm_ppc.dasc b/src/buildvm_ppc.dasc index c0a461cd..aa133dcc 100644 --- a/src/buildvm_ppc.dasc +++ b/src/buildvm_ppc.dasc | |||
@@ -25,8 +25,7 @@ | |||
25 | |.define DISPATCH, r17 // Opcode dispatch table. | 25 | |.define DISPATCH, r17 // Opcode dispatch table. |
26 | |.define LREG, r18 // Register holding lua_State (also in SAVE_L). | 26 | |.define LREG, r18 // Register holding lua_State (also in SAVE_L). |
27 | |.define MULTRES, r19 // Size of multi-result: (nresults+1)*8. | 27 | |.define MULTRES, r19 // Size of multi-result: (nresults+1)*8. |
28 | |.define JGL, r30 // On-trace: global_State + 32768. | 28 | |.define JGL, r31 // On-trace: global_State + 32768. |
29 | |.define JTR, r31 // On-trace: trace number. | ||
30 | | | 29 | | |
31 | |// Constants for type-comparisons, stores and conversions. C callee-save. | 30 | |// Constants for type-comparisons, stores and conversions. C callee-save. |
32 | |.define TISNUM, r22 | 31 | |.define TISNUM, r22 |
@@ -2318,6 +2317,7 @@ static void build_subroutines(BuildCtx *ctx) | |||
2318 | | sub NARGS8:RC, TMP0, BASE | 2317 | | sub NARGS8:RC, TMP0, BASE |
2319 | | add RA, BASE, RA | 2318 | | add RA, BASE, RA |
2320 | | lwz LFUNC:RB, FRAME_FUNC(BASE) | 2319 | | lwz LFUNC:RB, FRAME_FUNC(BASE) |
2320 | | lwz INS, -4(PC) | ||
2321 | | mtctr CRET1 | 2321 | | mtctr CRET1 |
2322 | | bctr | 2322 | | bctr |
2323 | | | 2323 | | |
@@ -2353,7 +2353,7 @@ static void build_subroutines(BuildCtx *ctx) | |||
2353 | | savex_ 16,17,18,19 | 2353 | | savex_ 16,17,18,19 |
2354 | | stw TMP1, 16+32*8+0*4(sp) // Clear RID_TMP. | 2354 | | stw TMP1, 16+32*8+0*4(sp) // Clear RID_TMP. |
2355 | | savex_ 20,21,22,23 | 2355 | | savex_ 20,21,22,23 |
2356 | | lwz CARG4, 0(CARG3) // Load exit stub group offset. | 2356 | | lhz CARG4, 2(CARG3) // Load trace number. |
2357 | | savex_ 24,25,26,27 | 2357 | | savex_ 24,25,26,27 |
2358 | | lwz L, DISPATCH_GL(jit_L)(DISPATCH) | 2358 | | lwz L, DISPATCH_GL(jit_L)(DISPATCH) |
2359 | | savex_ 28,29,30,31 | 2359 | | savex_ 28,29,30,31 |
@@ -2363,12 +2363,11 @@ static void build_subroutines(BuildCtx *ctx) | |||
2363 | | stw L, DISPATCH_J(L)(DISPATCH) | 2363 | | stw L, DISPATCH_J(L)(DISPATCH) |
2364 | | subi CARG3, CARG3, 2 | 2364 | | subi CARG3, CARG3, 2 |
2365 | | stw TMP1, DISPATCH_GL(jit_L)(DISPATCH) | 2365 | | stw TMP1, DISPATCH_GL(jit_L)(DISPATCH) |
2366 | | add CARG3, CARG4, CARG3 | 2366 | | stw CARG4, DISPATCH_J(parent)(DISPATCH) |
2367 | | stw BASE, L->base | 2367 | | stw BASE, L->base |
2368 | | addi CARG1, DISPATCH, GG_DISP2J | 2368 | | addi CARG1, DISPATCH, GG_DISP2J |
2369 | | stw CARG3, DISPATCH_J(exitno)(DISPATCH) | 2369 | | stw CARG3, DISPATCH_J(exitno)(DISPATCH) |
2370 | | addi CARG2, sp, 16 | 2370 | | addi CARG2, sp, 16 |
2371 | | stw JTR, DISPATCH_J(parent)(DISPATCH) | ||
2372 | | bl extern lj_trace_exit // (jit_State *J, ExitState *ex) | 2371 | | bl extern lj_trace_exit // (jit_State *J, ExitState *ex) |
2373 | | // Returns MULTRES (unscaled) or negated error code. | 2372 | | // Returns MULTRES (unscaled) or negated error code. |
2374 | | lwz TMP1, L->cframe | 2373 | | lwz TMP1, L->cframe |
@@ -2416,13 +2415,14 @@ static void build_subroutines(BuildCtx *ctx) | |||
2416 | | decode_RA8 RA, INS | 2415 | | decode_RA8 RA, INS |
2417 | | lwzx TMP0, DISPATCH, TMP1 | 2416 | | lwzx TMP0, DISPATCH, TMP1 |
2418 | | mtctr TMP0 | 2417 | | mtctr TMP0 |
2419 | | cmpwi TMP1, BC_FUNCF*4 // Function header? | 2418 | | cmplwi TMP1, BC_FUNCF*4 // Function header? |
2420 | | beq >2 | 2419 | | bge >2 |
2421 | | decode_RB8 RB, INS | 2420 | | decode_RB8 RB, INS |
2422 | | decode_RD8 RD, INS | 2421 | | decode_RD8 RD, INS |
2423 | | decode_RC8 RC, INS | 2422 | | decode_RC8 RC, INS |
2424 | | bctr | 2423 | | bctr |
2425 | |2: | 2424 | |2: |
2425 | | subi RC, MULTRES, 8 | ||
2426 | | add RA, RA, BASE | 2426 | | add RA, RA, BASE |
2427 | | bctr | 2427 | | bctr |
2428 | | | 2428 | | |
@@ -4348,12 +4348,12 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
4348 | | bgt >3 // See FP loop below. | 4348 | | bgt >3 // See FP loop below. |
4349 | } else if (op == BC_JFORI) { | 4349 | } else if (op == BC_JFORI) { |
4350 | | addis PC, RD, -(BCBIAS_J*4 >> 16) | 4350 | | addis PC, RD, -(BCBIAS_J*4 >> 16) |
4351 | | ble =>BC_JLOOP | 4351 | | bley >7 |
4352 | } else if (op == BC_IFORL) { | 4352 | } else if (op == BC_IFORL) { |
4353 | | bgt >2 | 4353 | | bgt >2 |
4354 | | addis PC, RD, -(BCBIAS_J*4 >> 16) | 4354 | | addis PC, RD, -(BCBIAS_J*4 >> 16) |
4355 | } else { | 4355 | } else { |
4356 | | ble =>BC_JLOOP | 4356 | | bley =>BC_JLOOP |
4357 | } | 4357 | } |
4358 | |2: | 4358 | |2: |
4359 | | ins_next | 4359 | | ins_next |
@@ -4419,8 +4419,10 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
4419 | } | 4419 | } |
4420 | |1: | 4420 | |1: |
4421 | | addis PC, RD, -(BCBIAS_J*4 >> 16) | 4421 | | addis PC, RD, -(BCBIAS_J*4 >> 16) |
4422 | } else if (op == BC_JFORI) { | ||
4423 | | bley >7 | ||
4422 | } else { | 4424 | } else { |
4423 | | ble =>BC_JLOOP | 4425 | | bley =>BC_JLOOP |
4424 | } | 4426 | } |
4425 | if (LJ_DUALNUM) { | 4427 | if (LJ_DUALNUM) { |
4426 | | b <2 | 4428 | | b <2 |
@@ -4435,10 +4437,18 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
4435 | | addis PC, RD, -(BCBIAS_J*4 >> 16) | 4437 | | addis PC, RD, -(BCBIAS_J*4 >> 16) |
4436 | } else if (op == BC_IFORL) { | 4438 | } else if (op == BC_IFORL) { |
4437 | | bgey <1 | 4439 | | bgey <1 |
4440 | } else if (op == BC_JFORI) { | ||
4441 | | bgey >7 | ||
4438 | } else { | 4442 | } else { |
4439 | | bge =>BC_JLOOP | 4443 | | bgey =>BC_JLOOP |
4440 | } | 4444 | } |
4441 | | b <2 | 4445 | | b <2 |
4446 | if (op == BC_JFORI) { | ||
4447 | |7: | ||
4448 | | lwz INS, -4(PC) | ||
4449 | | decode_RD8 RD, INS | ||
4450 | | b =>BC_JLOOP | ||
4451 | } | ||
4442 | break; | 4452 | break; |
4443 | 4453 | ||
4444 | case BC_ITERL: | 4454 | case BC_ITERL: |
@@ -4490,6 +4500,8 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
4490 | | // RA = base*8 (ignored), RD = traceno*8 | 4500 | | // RA = base*8 (ignored), RD = traceno*8 |
4491 | | lwz TMP1, DISPATCH_J(trace)(DISPATCH) | 4501 | | lwz TMP1, DISPATCH_J(trace)(DISPATCH) |
4492 | | srwi RD, RD, 1 | 4502 | | srwi RD, RD, 1 |
4503 | | // Traces on PPC don't store the trace number, so use 0. | ||
4504 | | stw ZERO, DISPATCH_GL(vmstate)(DISPATCH) | ||
4493 | | lwzx TRACE:TMP2, TMP1, RD | 4505 | | lwzx TRACE:TMP2, TMP1, RD |
4494 | | mcrxr cr0 // Clear SO flag. | 4506 | | mcrxr cr0 // Clear SO flag. |
4495 | | lwz TMP2, TRACE:TMP2->mcode | 4507 | | lwz TMP2, TRACE:TMP2->mcode |