diff options
author | Mike Pall <mike> | 2016-03-28 22:31:18 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2016-03-28 22:31:18 +0200 |
commit | c24c8e5312003da5ac0643645e321e84a672fea3 (patch) | |
tree | 58bec5d57f235249c64793d287548dcfb6c8ed9c /src | |
parent | d7145616aef77dd8b74bdfe4b3caad985ee3c713 (diff) | |
download | luajit-c24c8e5312003da5ac0643645e321e84a672fea3.tar.gz luajit-c24c8e5312003da5ac0643645e321e84a672fea3.tar.bz2 luajit-c24c8e5312003da5ac0643645e321e84a672fea3.zip |
x64/LJ_GC64: Fix JIT glue code in interpreter.
Thanks to Peter Cawley.
Diffstat (limited to 'src')
-rw-r--r-- | src/vm_x64.dasc | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/vm_x64.dasc b/src/vm_x64.dasc index 63ed2cb7..bc2419c1 100644 --- a/src/vm_x64.dasc +++ b/src/vm_x64.dasc | |||
@@ -2325,7 +2325,8 @@ static void build_subroutines(BuildCtx *ctx) | |||
2325 | |->cont_stitch: // Trace stitching. | 2325 | |->cont_stitch: // Trace stitching. |
2326 | |.if JIT | 2326 | |.if JIT |
2327 | | // BASE = base, RC = result, RB = mbase | 2327 | | // BASE = base, RC = result, RB = mbase |
2328 | | mov ITYPEd, [RB-24] // Save previous trace number. | 2328 | | mov TRACE:ITYPE, [RB-40] // Save previous trace. |
2329 | | cleartp TRACE:ITYPE | ||
2329 | | mov TMPRd, MULTRES | 2330 | | mov TMPRd, MULTRES |
2330 | | movzx RAd, PC_RA | 2331 | | movzx RAd, PC_RA |
2331 | | lea RA, [BASE+RA*8] // Call base. | 2332 | | lea RA, [BASE+RA*8] // Call base. |
@@ -2347,11 +2348,10 @@ static void build_subroutines(BuildCtx *ctx) | |||
2347 | | cmp RC, RA | 2348 | | cmp RC, RA |
2348 | | ja >9 // More results wanted? | 2349 | | ja >9 // More results wanted? |
2349 | | | 2350 | | |
2350 | | mov RA, [DISPATCH+DISPATCH_J(trace)] | 2351 | | test TRACE:ITYPE, TRACE:ITYPE |
2351 | | mov TRACE:RD, [RA+ITYPE*8] | ||
2352 | | test TRACE:RD, TRACE:RD | ||
2353 | | jz ->cont_nop | 2352 | | jz ->cont_nop |
2354 | | movzx RDd, word TRACE:RD->link | 2353 | | movzx RBd, word TRACE:ITYPE->traceno |
2354 | | movzx RDd, word TRACE:ITYPE->link | ||
2355 | | cmp RDd, RBd | 2355 | | cmp RDd, RBd |
2356 | | je ->cont_nop // Blacklisted. | 2356 | | je ->cont_nop // Blacklisted. |
2357 | | test RDd, RDd | 2357 | | test RDd, RDd |
@@ -2404,10 +2404,10 @@ static void build_subroutines(BuildCtx *ctx) | |||
2404 | | mov [rbp-8], r15; mov [rbp-16], r14 | 2404 | | mov [rbp-8], r15; mov [rbp-16], r14 |
2405 | | // Caveat: DISPATCH is rbx. | 2405 | | // Caveat: DISPATCH is rbx. |
2406 | | mov DISPATCH, [ebp] | 2406 | | mov DISPATCH, [ebp] |
2407 | | mov RA, [DISPATCH+DISPATCH_GL(vmstate)] // Get trace number. | 2407 | | mov RAd, [DISPATCH+DISPATCH_GL(vmstate)] // Get trace number. |
2408 | | set_vmstate EXIT | 2408 | | set_vmstate EXIT |
2409 | | mov [DISPATCH+DISPATCH_J(exitno)], RC | 2409 | | mov [DISPATCH+DISPATCH_J(exitno)], RCd |
2410 | | mov [DISPATCH+DISPATCH_J(parent)], RA | 2410 | | mov [DISPATCH+DISPATCH_J(parent)], RAd |
2411 | |.if X64WIN | 2411 | |.if X64WIN |
2412 | | sub rsp, 16*8+4*8 // Room for SSE regs + save area. | 2412 | | sub rsp, 16*8+4*8 // Room for SSE regs + save area. |
2413 | |.else | 2413 | |.else |
@@ -2433,7 +2433,7 @@ static void build_subroutines(BuildCtx *ctx) | |||
2433 | | mov CARG2, rsp | 2433 | | mov CARG2, rsp |
2434 | |.endif | 2434 | |.endif |
2435 | | lea CARG1, [DISPATCH+GG_DISP2J] | 2435 | | lea CARG1, [DISPATCH+GG_DISP2J] |
2436 | | mov dword [DISPATCH+DISPATCH_GL(jit_base)], 0 | 2436 | | mov qword [DISPATCH+DISPATCH_GL(jit_base)], 0 |
2437 | | call extern lj_trace_exit // (jit_State *J, ExitState *ex) | 2437 | | call extern lj_trace_exit // (jit_State *J, ExitState *ex) |
2438 | | // MULTRES or negated error code returned in eax (RD). | 2438 | | // MULTRES or negated error code returned in eax (RD). |
2439 | | mov RA, L:RB->cframe | 2439 | | mov RA, L:RB->cframe |
@@ -2480,7 +2480,7 @@ static void build_subroutines(BuildCtx *ctx) | |||
2480 | | mov KBASE, LFUNC:KBASE->pc | 2480 | | mov KBASE, LFUNC:KBASE->pc |
2481 | | mov KBASE, [KBASE+PC2PROTO(k)] | 2481 | | mov KBASE, [KBASE+PC2PROTO(k)] |
2482 | | mov L:RB->base, BASE | 2482 | | mov L:RB->base, BASE |
2483 | | mov dword [DISPATCH+DISPATCH_GL(jit_base)], 0 | 2483 | | mov qword [DISPATCH+DISPATCH_GL(jit_base)], 0 |
2484 | | set_vmstate INTERP | 2484 | | set_vmstate INTERP |
2485 | | // Modified copy of ins_next which handles function header dispatch, too. | 2485 | | // Modified copy of ins_next which handles function header dispatch, too. |
2486 | | mov RCd, [PC] | 2486 | | mov RCd, [PC] |
@@ -2504,7 +2504,7 @@ static void build_subroutines(BuildCtx *ctx) | |||
2504 | | // Otherwise set KBASE for Lua function below fast function. | 2504 | | // Otherwise set KBASE for Lua function below fast function. |
2505 | | movzx RCd, byte [RC-3] | 2505 | | movzx RCd, byte [RC-3] |
2506 | | neg RC | 2506 | | neg RC |
2507 | | mov LFUNC:KBASE, [BASE+RC*8-24] | 2507 | | mov LFUNC:KBASE, [BASE+RC*8-32] |
2508 | | cleartp LFUNC:KBASE | 2508 | | cleartp LFUNC:KBASE |
2509 | | mov KBASE, LFUNC:KBASE->pc | 2509 | | mov KBASE, LFUNC:KBASE->pc |
2510 | | mov KBASE, [KBASE+PC2PROTO(k)] | 2510 | | mov KBASE, [KBASE+PC2PROTO(k)] |
@@ -4050,7 +4050,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
4050 | | mov RC, [RA-24] // Copy control var. fb[1] = fb[-3]. | 4050 | | mov RC, [RA-24] // Copy control var. fb[1] = fb[-3]. |
4051 | | mov [RA], RB | 4051 | | mov [RA], RB |
4052 | | mov [RA+8], RC | 4052 | | mov [RA+8], RC |
4053 | | mov LFUNC:RB, [RA-40] // Copy callable. fb[-1] = fb[-5] | 4053 | | mov LFUNC:RB, [RA-40] // Copy callable. fb[-2] = fb[-5] |
4054 | | mov [RA-16], LFUNC:RB | 4054 | | mov [RA-16], LFUNC:RB |
4055 | | mov NARGS:RDd, 2+1 // Handle like a regular 2-arg call. | 4055 | | mov NARGS:RDd, 2+1 // Handle like a regular 2-arg call. |
4056 | | checkfunc LFUNC:RB, ->vmeta_call | 4056 | | checkfunc LFUNC:RB, ->vmeta_call |