Bug 912264 - Reset OSI-regs flags before the implicit interrupt check. r=

This commit is contained in:
Nicolas B. Pierron 2013-09-30 10:25:13 -07:00
parent 498d8e53fa
commit 476005ce83
3 changed files with 28 additions and 11 deletions

View File

@ -881,6 +881,14 @@ class OutOfLineInterruptCheckImplicit : public OutOfLineCodeBase<CodeGenerator>
bool bool
CodeGenerator::visitOutOfLineInterruptCheckImplicit(OutOfLineInterruptCheckImplicit *ool) CodeGenerator::visitOutOfLineInterruptCheckImplicit(OutOfLineInterruptCheckImplicit *ool)
{ {
#ifdef CHECK_OSIPOINT_REGISTERS
// This is path is entered from the patched back-edge of the loop. This
// means that the JitAtivation flags used for checking the validity of the
// OSI points are not reseted by the path generated by generateBody, so we
// have to reset it here.
resetOsiPointRegs(ool->lir->safepoint());
#endif
LInstructionIterator iter = ool->block->begin(); LInstructionIterator iter = ool->block->begin();
for (; iter != ool->block->end(); iter++) { for (; iter != ool->block->end(); iter++) {
if (iter->isLabel()) { if (iter->isLabel()) {
@ -2766,17 +2774,8 @@ CodeGenerator::generateBody()
} }
#ifdef CHECK_OSIPOINT_REGISTERS #ifdef CHECK_OSIPOINT_REGISTERS
if (iter->safepoint() && shouldVerifyOsiPointRegs(iter->safepoint())) { if (iter->safepoint())
// Set checkRegs to 0. If we perform a VM call, the instruction resetOsiPointRegs(iter->safepoint());
// will set it to 1.
GeneralRegisterSet allRegs(GeneralRegisterSet::All());
Register scratch = allRegs.takeAny();
masm.push(scratch);
masm.loadJitActivation(scratch);
Address checkRegs(scratch, JitActivation::offsetOfCheckRegs());
masm.store32(Imm32(0), checkRegs);
masm.pop(scratch);
}
#endif #endif
if (!callTraceLIR(i, *iter)) if (!callTraceLIR(i, *iter))

View File

@ -591,6 +591,23 @@ CodeGeneratorShared::shouldVerifyOsiPointRegs(LSafepoint *safepoint)
return true; return true;
} }
void
CodeGeneratorShared::resetOsiPointRegs(LSafepoint *safepoint)
{
if (!shouldVerifyOsiPointRegs(safepoint))
return;
// Set checkRegs to 0. If we perform a VM call, the instruction
// will set it to 1.
GeneralRegisterSet allRegs(GeneralRegisterSet::All());
Register scratch = allRegs.takeAny();
masm.push(scratch);
masm.loadJitActivation(scratch);
Address checkRegs(scratch, JitActivation::offsetOfCheckRegs());
masm.store32(Imm32(0), checkRegs);
masm.pop(scratch);
}
#endif #endif
// Before doing any call to Cpp, you should ensure that volatile // Before doing any call to Cpp, you should ensure that volatile

View File

@ -200,6 +200,7 @@ class CodeGeneratorShared : public LInstructionVisitor
} }
#ifdef CHECK_OSIPOINT_REGISTERS #ifdef CHECK_OSIPOINT_REGISTERS
void resetOsiPointRegs(LSafepoint *safepoint);
bool shouldVerifyOsiPointRegs(LSafepoint *safepoint); bool shouldVerifyOsiPointRegs(LSafepoint *safepoint);
void verifyOsiPointRegs(LSafepoint *safepoint); void verifyOsiPointRegs(LSafepoint *safepoint);
#endif #endif