diff options
Diffstat (limited to 'src/vm')
-rw-r--r-- | src/vm/i386/cgenx86.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/vm/i386/cgenx86.cpp b/src/vm/i386/cgenx86.cpp index 9b8960a6eb..3b523c9c28 100644 --- a/src/vm/i386/cgenx86.cpp +++ b/src/vm/i386/cgenx86.cpp @@ -378,7 +378,30 @@ void HelperMethodFrame::UpdateRegDisplay(const PREGDISPLAY pRD) pRD->IsCallerSPValid = FALSE; // Don't add usage of this field. This is only temporary. #ifdef DACCESS_COMPILE - PORTABILITY_ASSERT("HelperMethodFrame::UpdateRegDisplay"); + // For DAC, we may get here when the HMF is still uninitialized. + // So we may need to unwind here. + if (!m_MachState.isValid()) + { + // This allocation throws on OOM. + MachState* pUnwoundState = (MachState*)DacAllocHostOnlyInstance(sizeof(*pUnwoundState), true); + + InsureInit(false, pUnwoundState); + + pRD->pCurrentContext->Eip = pRD->ControlPC = pUnwoundState->GetRetAddr(); + pRD->pCurrentContext->Esp = pRD->SP = pUnwoundState->esp(); + +#define CALLEE_SAVED_REGISTER(regname) pRD->pCurrentContext->regname = *((DWORD*) pUnwoundState->p##regname()); + ENUM_CALLEE_SAVED_REGISTERS(); +#undef CALLEE_SAVED_REGISTER + +#define CALLEE_SAVED_REGISTER(regname) pRD->pCurrentContextPointers->regname = (DWORD*) pUnwoundState->p##regname(); + ENUM_CALLEE_SAVED_REGISTERS(); +#undef CALLEE_SAVED_REGISTER + + ClearRegDisplayArgumentAndScratchRegisters(pRD); + + return; + } #endif // DACCESS_COMPILE pRD->pCurrentContext->Eip = pRD->ControlPC = m_MachState.GetRetAddr(); |