Set the deopt flag after adjusting the stack pointer.
One should not write to something below the stack pointer, or
it could be overwritten during an interrupt.
Test: test.py
Change-Id: Ie6c997b9f7548ca5844303d6a3fc0c531f469c6e
diff --git a/compiler/optimizing/code_generator_x86.cc b/compiler/optimizing/code_generator_x86.cc
index 83a261d..79fccfe 100644
--- a/compiler/optimizing/code_generator_x86.cc
+++ b/compiler/optimizing/code_generator_x86.cc
@@ -1086,11 +1086,6 @@
}
}
- if (GetGraph()->HasShouldDeoptimizeFlag()) {
- // Initialize should_deoptimize flag to 0.
- __ movl(Address(ESP, -kShouldDeoptimizeFlagSize), Immediate(0));
- }
-
int adjust = GetFrameSize() - FrameEntrySpillSize();
__ subl(ESP, Immediate(adjust));
__ cfi().AdjustCFAOffset(adjust);
@@ -1100,6 +1095,11 @@
if (RequiresCurrentMethod()) {
__ movl(Address(ESP, kCurrentMethodStackOffset), kMethodRegisterArgument);
}
+
+ if (GetGraph()->HasShouldDeoptimizeFlag()) {
+ // Initialize should_deoptimize flag to 0.
+ __ movl(Address(ESP, GetStackOffsetOfShouldDeoptimizeFlag()), Immediate(0));
+ }
}
void CodeGeneratorX86::GenerateFrameExit() {