Fix trace builder to not confuse self-verification.
diff --git a/vm/interp/Jit.c b/vm/interp/Jit.c
index aca5fff..5147e9c 100644
--- a/vm/interp/Jit.c
+++ b/vm/interp/Jit.c
@@ -514,13 +514,6 @@
|| gDvm.activeProfilers
#endif
);
-
- /* First instruction - just remember the PC and exit */
- if (interpState->lastPC == NULL) {
- interpState->lastPC = pc;
- return switchInterp;
- }
-
/* Prepare to handle last PC and stage the current PC */
const u2 *lastPC = interpState->lastPC;
interpState->lastPC = pc;
@@ -531,6 +524,8 @@
int offset;
DecodedInstruction decInsn;
case kJitTSelect:
+ /* First instruction - just remember the PC and exit */
+ if (lastPC == NULL) break;
/* Grow the trace around the last PC if jitState is kJitTSelect */
dexDecodeInstruction(gDvm.instrFormat, lastPC, &decInsn);
#if defined(SHOW_TRACE)
diff --git a/vm/mterp/c/gotoTargets.c b/vm/mterp/c/gotoTargets.c
index c34d6c4..67b3299 100644
--- a/vm/mterp/c/gotoTargets.c
+++ b/vm/mterp/c/gotoTargets.c
@@ -578,7 +578,9 @@
#if defined(WITH_JIT)
// Something threw during trace selection - abort the current trace
- interpState->jitState = kJitTSelectEnd;
+ if (interpState->jitState == kJitTSelect) {
+ interpState->jitState = kJitTSelectEnd;
+ }
#endif
/*
* We save off the exception and clear the exception status. While
diff --git a/vm/mterp/out/InterpC-allstubs.c b/vm/mterp/out/InterpC-allstubs.c
index 81e7165..1d31227 100644
--- a/vm/mterp/out/InterpC-allstubs.c
+++ b/vm/mterp/out/InterpC-allstubs.c
@@ -3611,7 +3611,9 @@
#if defined(WITH_JIT)
// Something threw during trace selection - abort the current trace
- interpState->jitState = kJitTSelectEnd;
+ if (interpState->jitState == kJitTSelect) {
+ interpState->jitState = kJitTSelectEnd;
+ }
#endif
/*
* We save off the exception and clear the exception status. While
diff --git a/vm/mterp/out/InterpC-portdbg.c b/vm/mterp/out/InterpC-portdbg.c
index 45a18da..c2ae63c 100644
--- a/vm/mterp/out/InterpC-portdbg.c
+++ b/vm/mterp/out/InterpC-portdbg.c
@@ -3911,7 +3911,9 @@
#if defined(WITH_JIT)
// Something threw during trace selection - abort the current trace
- interpState->jitState = kJitTSelectEnd;
+ if (interpState->jitState == kJitTSelect) {
+ interpState->jitState = kJitTSelectEnd;
+ }
#endif
/*
* We save off the exception and clear the exception status. While
diff --git a/vm/mterp/out/InterpC-portstd.c b/vm/mterp/out/InterpC-portstd.c
index 3576608..b695b43 100644
--- a/vm/mterp/out/InterpC-portstd.c
+++ b/vm/mterp/out/InterpC-portstd.c
@@ -3625,7 +3625,9 @@
#if defined(WITH_JIT)
// Something threw during trace selection - abort the current trace
- interpState->jitState = kJitTSelectEnd;
+ if (interpState->jitState == kJitTSelect) {
+ interpState->jitState = kJitTSelectEnd;
+ }
#endif
/*
* We save off the exception and clear the exception status. While
diff --git a/vm/mterp/out/InterpC-x86.c b/vm/mterp/out/InterpC-x86.c
index 6492daf..fa2dfa8 100644
--- a/vm/mterp/out/InterpC-x86.c
+++ b/vm/mterp/out/InterpC-x86.c
@@ -1766,7 +1766,9 @@
#if defined(WITH_JIT)
// Something threw during trace selection - abort the current trace
- interpState->jitState = kJitTSelectEnd;
+ if (interpState->jitState == kJitTSelect) {
+ interpState->jitState = kJitTSelectEnd;
+ }
#endif
/*
* We save off the exception and clear the exception status. While