Skip to content

Commit

Permalink
vm_x64.dasc: Fixes to ensure g.lasttrace is a trace number
Browse files Browse the repository at this point in the history
Had previously been clobbered by VM states in some cases.
  • Loading branch information
lukego committed Nov 24, 2017
1 parent c1659d9 commit ae5c6aa
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/vm_x64.dasc
Original file line number Diff line number Diff line change
Expand Up @@ -2018,6 +2018,7 @@ static void build_subroutines(BuildCtx *ctx)
| set_vmstate EXIT
| mov [DISPATCH+DISPATCH_J(exitno)], RCd
| mov [DISPATCH+DISPATCH_J(parent)], RAd
| mov dword [DISPATCH+DISPATCH_GL(lasttrace)], RAd
| sub rsp, 16*8 // Room for SSE regs.
| add rbp, -128
| movsd qword [rbp-8], xmm15; movsd qword [rbp-16], xmm14
Expand Down Expand Up @@ -2048,6 +2049,11 @@ static void build_subroutines(BuildCtx *ctx)
| // RD = MULTRES or negated error code, BASE, PC and DISPATCH set.
| // Restore additional callee-save registers only used in compiled code.
| lea RA, [rsp+16]
| // Record which trace exited to the interpreter (if called from a trace)
| mov TMPRd, dword [DISPATCH+DISPATCH_GL(vmstate)]
| cmp TMPRd, 1
| jb >1
| mov dword [DISPATCH+DISPATCH_GL(lasttrace)], TMPRd
|1:
| mov r13, [RA-8]
| mov r12, [RA]
Expand All @@ -2062,9 +2068,6 @@ static void build_subroutines(BuildCtx *ctx)
| mov L:RB->base, BASE
| mov qword [DISPATCH+DISPATCH_GL(jit_base)], 0
| mov TMPRd, dword [DISPATCH+DISPATCH_GL(vmstate)]
| // Record which trace exited to the interpreter, then switch state
| mov TMPRd, dword [DISPATCH+DISPATCH_GL(vmstate)]
| mov dword [DISPATCH+DISPATCH_GL(lasttrace)], TMPRd
| set_vmstate INTERP
| // Modified copy of ins_next which handles function header dispatch, too.
| mov RCd, [PC]
Expand Down

0 comments on commit ae5c6aa

Please sign in to comment.