diff options
Diffstat (limited to 'src/vm/gcinfodecoder.cpp')
-rw-r--r-- | src/vm/gcinfodecoder.cpp | 197 |
1 files changed, 36 insertions, 161 deletions
diff --git a/src/vm/gcinfodecoder.cpp b/src/vm/gcinfodecoder.cpp index ef237a2768..89f470499e 100644 --- a/src/vm/gcinfodecoder.cpp +++ b/src/vm/gcinfodecoder.cpp @@ -4,6 +4,7 @@ #include "common.h" + #include "gcinfodecoder.h" #ifdef USE_GC_INFO_DECODER @@ -17,7 +18,7 @@ #endif #ifndef GCINFODECODER_CONTRACT -#define GCINFODECODER_CONTRACT(contract) contract +#define GCINFODECODER_CONTRACT LIMITED_METHOD_CONTRACT #endif // !GCINFODECODER_CONTRACT @@ -68,7 +69,7 @@ } #endif // !LOG_PIPTR -bool GcInfoDecoder::SetIsInterruptibleCB (UINT32 startOffset, UINT32 stopOffset, LPVOID hCallback) +bool GcInfoDecoder::SetIsInterruptibleCB (UINT32 startOffset, UINT32 stopOffset, void * hCallback) { GcInfoDecoder *pThis = (GcInfoDecoder*)hCallback; @@ -282,11 +283,11 @@ GcInfoDecoder::GcInfoDecoder( if (hasReversePInvokeFrame) { - m_ReversePInvokeFrameSlot = (INT32)m_Reader.DecodeVarLengthSigned(REVERSE_PINVOKE_FRAME_ENCBASE); + m_ReversePInvokeFrameStackSlot = (INT32)m_Reader.DecodeVarLengthSigned(REVERSE_PINVOKE_FRAME_ENCBASE); } else { - m_ReversePInvokeFrameSlot = NO_REVERSE_PINVOKE_FRAME; + m_ReversePInvokeFrameStackSlot = NO_REVERSE_PINVOKE_FRAME; } @@ -426,14 +427,14 @@ UINT32 GcInfoDecoder::FindSafePoint(UINT32 breakOffset) return result; } -void GcInfoDecoder::EnumerateSafePoints(EnumerateSafePointsCallback *pCallback, LPVOID hCallback) +void GcInfoDecoder::EnumerateSafePoints(EnumerateSafePointsCallback *pCallback, void * hCallback) { if(m_NumSafePoints == 0) return; const UINT32 numBitsPerOffset = CeilOfLog2(NORMALIZE_CODE_OFFSET(m_CodeLength)); - for(UINT i = 0; i < m_NumSafePoints; i++) + for(UINT32 i = 0; i < m_NumSafePoints; i++) { UINT32 normOffset = (UINT32)m_Reader.Read(numBitsPerOffset); UINT32 offset = DENORMALIZE_CODE_OFFSET(normOffset) + 2; @@ -450,7 +451,7 @@ void GcInfoDecoder::EnumerateSafePoints(EnumerateSafePointsCallback *pCallback, void GcInfoDecoder::EnumerateInterruptibleRanges ( EnumerateInterruptibleRangesCallback *pCallback, - LPVOID hCallback) + void * hCallback) { // If no info is found for the call site, we default to fully-interruptbile LOG((LF_GCROOTS, LL_INFO1000000, "No GC info found for call site at offset %x. Defaulting to fully-interruptible information.\n", (int) m_InstructionOffset)); @@ -488,10 +489,10 @@ INT32 GcInfoDecoder::GetGSCookieStackSlot() return m_GSCookieStackSlot; } -INT32 GcInfoDecoder::GetReversePInvokeStackSlot() +INT32 GcInfoDecoder::GetReversePInvokeFrameStackSlot() { _ASSERTE(m_Flags & DECODE_REVERSE_PINVOKE_VAR); - return m_ReversePInvokeStackSlot; + return m_ReversePInvokeFrameStackSlot; } UINT32 GcInfoDecoder::GetGSCookieValidRangeStart() @@ -581,7 +582,7 @@ bool GcInfoDecoder::EnumerateLiveSlots( bool reportScratchSlots, unsigned inputFlags, GCEnumCallback pCallBack, - LPVOID hCallBack + void * hCallBack ) { @@ -615,24 +616,6 @@ bool GcInfoDecoder::EnumerateLiveSlots( UINT32 normBreakOffset = NORMALIZE_CODE_OFFSET(m_InstructionOffset); -#if 0 - // This is currently disabled because sometimes on IA64 we need - // to make call sites non-interruptible - // TODO: review this -#ifdef _DEBUG - if(!executionAborted) - { - GcInfoDecoder _decoder2( - m_GcInfoAddress, - DECODE_INTERRUPTIBILITY, - m_InstructionOffset - ); - - _ASSERTE(_decoder2.IsInterruptible()); - } -#endif -#endif - // Normalized break offset // Relative to interruptible ranges #if PARTIALLY_INTERRUPTIBLE_GC_SUPPORTED #ifdef PARTIALLY_INTERRUPTIBLE_GC_SUPPORTED @@ -645,48 +628,6 @@ bool GcInfoDecoder::EnumerateLiveSlots( #ifdef PARTIALLY_INTERRUPTIBLE_GC_SUPPORTED -#ifndef DISABLE_EH_VECTORS - if(m_SafePointIndex < m_NumSafePoints || executionAborted) - { - // Skip interruptibility information - for(UINT32 i=0; i<m_NumInterruptibleRanges; i++) - { - m_Reader.DecodeVarLengthUnsigned( INTERRUPTIBLE_RANGE_DELTA1_ENCBASE ); - m_Reader.DecodeVarLengthUnsigned( INTERRUPTIBLE_RANGE_DELTA2_ENCBASE ); - } - } - else - { - // - // We didn't find the break offset in the list of call sites - // and are not in an executionAborted frame - // So we must have fully-interruptible information - // - _ASSERTE(m_NumInterruptibleRanges); - -#ifdef _DEBUG - int dbgCountIntersections = 0; -#endif - UINT32 lastNormStop = 0; - for(UINT32 i=0; i<m_NumInterruptibleRanges; i++) - { - UINT32 normStartDelta = (UINT32) m_Reader.DecodeVarLengthUnsigned( INTERRUPTIBLE_RANGE_DELTA1_ENCBASE ); - UINT32 normStopDelta = (UINT32) m_Reader.DecodeVarLengthUnsigned( INTERRUPTIBLE_RANGE_DELTA2_ENCBASE ) + 1; - - UINT32 normStart = lastNormStop + normStartDelta; - UINT32 normStop = normStart + normStopDelta; - if(normBreakOffset >= normStart && normBreakOffset < normStop) - { - _ASSERTE(pseudoBreakOffset == 0); - _ASSERTE(dbgCountIntersections++ == 0); - pseudoBreakOffset = numInterruptibleLength + normBreakOffset - normStart; - } - numInterruptibleLength += normStopDelta; - lastNormStop = normStop; - } - _ASSERTE(dbgCountIntersections == 1); - } -#else // DISABLE_EH_VECTORS if(m_SafePointIndex < m_NumSafePoints && !executionAborted) { // Skip interruptibility information @@ -736,7 +677,6 @@ bool GcInfoDecoder::EnumerateLiveSlots( goto ExitSuccess; } } -#endif // DISABLE_EH_VECTORS #else // !PARTIALLY_INTERRUPTIBLE_GC_SUPPORTED // Skip interruptibility information @@ -778,52 +718,8 @@ bool GcInfoDecoder::EnumerateLiveSlots( if(executionAborted) { -#ifndef DISABLE_EH_VECTORS - m_Reader.Skip(m_NumSafePoints * numSlots); - - UINT32 numClauses = (UINT32) m_Reader.DecodeVarLengthUnsigned(NUM_EH_CLAUSES_ENCBASE); - - if(numClauses) - { - UINT32 numBitsPerOffset = CeilOfLog2(NORMALIZE_CODE_OFFSET(m_CodeLength)); - - for(UINT32 i = 0; i < numClauses; i++) - { - UINT32 startOffset = (UINT32) DENORMALIZE_CODE_OFFSET(m_Reader.Read(numBitsPerOffset)); - UINT32 stopOffset = (UINT32) DENORMALIZE_CODE_OFFSET(m_Reader.Read(numBitsPerOffset) + 1); - - if(m_InstructionOffset >= startOffset - && m_InstructionOffset < stopOffset) - { - for(UINT32 slotIndex = 0; slotIndex < numSlots; slotIndex++) - { - if(m_Reader.ReadOneFast()) - { - ReportSlotToGC( - slotDecoder, - slotIndex, - pRD, - reportScratchSlots, - inputFlags, - pCallBack, - hCallBack - ); - } - } - } - else - { - m_Reader.Skip(numSlots); - } - } - } - goto ReportUntracked; -#else //DISABLE_EH_VECTORS - _ASSERTE(m_NumSafePoints == 0); m_Reader.Skip(m_NumSafePoints * numSlots); - -#endif //DISABLE_EH_VECTORS } else if( m_SafePointIndex != m_NumSafePoints ) { @@ -891,15 +787,7 @@ bool GcInfoDecoder::EnumerateLiveSlots( else { m_Reader.Skip(m_NumSafePoints * numSlots); - -#ifndef DISABLE_EH_VECTORS - UINT32 numClauses = (UINT32) m_Reader.DecodeVarLengthUnsigned(NUM_EH_CLAUSES_ENCBASE); - UINT32 numBitsPerOffset = CeilOfLog2(NORMALIZE_CODE_OFFSET(m_CodeLength)); - - m_Reader.Skip((numBitsPerOffset * 2 + numSlots) * numClauses); -#endif //DISABLE_EH_VECTORS - } - + } #endif // PARTIALLY_INTERRUPTIBLE_GC_SUPPORTED _ASSERTE(m_NumInterruptibleRanges); @@ -1069,9 +957,7 @@ ReportUntracked: ReportUntrackedSlots(slotDecoder, pRD, inputFlags, pCallBack, hCallBack); } -#ifdef DISABLE_EH_VECTORS ExitSuccess: -#endif return true; } @@ -1080,7 +966,7 @@ void GcInfoDecoder::EnumerateUntrackedSlots( PREGDISPLAY pRD, unsigned inputFlags, GCEnumCallback pCallBack, - LPVOID hCallBack + void * hCallBack ) { _ASSERTE(GC_SLOT_INTERIOR == GC_CALL_INTERIOR); @@ -1114,7 +1000,7 @@ void GcInfoDecoder::ReportUntrackedSlots( PREGDISPLAY pRD, unsigned inputFlags, GCEnumCallback pCallBack, - LPVOID hCallBack + void * hCallBack ) { for(UINT32 slotIndex = slotDecoder.GetNumTracked(); slotIndex < slotDecoder.GetNumSlots(); slotIndex++) @@ -1455,11 +1341,15 @@ OBJECTREF* GcInfoDecoder::GetRegisterSlot( _ASSERTE(regNum >= 0 && regNum <= 16); _ASSERTE(regNum != 4); // rsp +#ifdef FEATURE_REDHAWK + PTR_UIntNative* ppRax = &pRD->pRax; + if (regNum > 4) regNum--; // rsp is skipped in Redhawk RegDisplay +#else // The fields of KNONVOLATILE_CONTEXT_POINTERS are in the same order as // the processor encoding numbers. - ULONGLONG **ppRax; - ppRax = &pRD->pCurrentContextPointers->Rax; + ULONGLONG **ppRax = &pRD->pCurrentContextPointers->Rax; +#endif return (OBJECTREF*)*(ppRax + regNum); } @@ -1476,8 +1366,7 @@ OBJECTREF* GcInfoDecoder::GetCapturedRegister( // The fields of CONTEXT are in the same order as // the processor encoding numbers. - ULONGLONG *pRax; - pRax = &pRD->pCurrentContext->Rax; + ULONGLONG *pRax = &pRD->pCurrentContext->Rax; return (OBJECTREF*)(pRax + regNum); } @@ -1509,7 +1398,7 @@ bool GcInfoDecoder::IsScratchStackSlot(INT32 spOffset, GcStackSlotBase spBase, P #ifdef FIXED_STACK_PARAMETER_SCRATCH_AREA _ASSERTE( m_Flags & DECODE_GC_LIFETIMES ); - ULONGLONG pSlot = (ULONGLONG) GetStackSlot(spOffset, spBase, pRD); + TADDR pSlot = (TADDR) GetStackSlot(spOffset, spBase, pRD); _ASSERTE(pSlot >= pRD->SP); return (pSlot < pRD->SP + m_SizeOfStackOutgoingAndScratchArea); @@ -1525,12 +1414,9 @@ void GcInfoDecoder::ReportRegisterToGC( // AMD64 PREGDISPLAY pRD, unsigned flags, GCEnumCallback pCallBack, - LPVOID hCallBack) + void * hCallBack) { - GCINFODECODER_CONTRACT(CONTRACTL { - NOTHROW; - GC_NOTRIGGER; - } CONTRACTL_END); + GCINFODECODER_CONTRACT; _ASSERTE(regNum >= 0 && regNum <= 16); _ASSERTE(regNum != 4); // rsp @@ -1624,8 +1510,7 @@ OBJECTREF* GcInfoDecoder::GetCapturedRegister( // The fields of CONTEXT are in the same order as // the processor encoding numbers. - ULONG *pR0; - pR0 = &pRD->pCurrentContext->R0; + ULONG *pR0 = &pRD->pCurrentContext->R0; return (OBJECTREF*)(pR0 + regNum); } @@ -1646,7 +1531,7 @@ bool GcInfoDecoder::IsScratchStackSlot(INT32 spOffset, GcStackSlotBase spBase, P #ifdef FIXED_STACK_PARAMETER_SCRATCH_AREA _ASSERTE( m_Flags & DECODE_GC_LIFETIMES ); - DWORD pSlot = (DWORD) GetStackSlot(spOffset, spBase, pRD); + TADDR pSlot = (TADDR) GetStackSlot(spOffset, spBase, pRD); _ASSERTE(pSlot >= pRD->SP); return (pSlot < pRD->SP + m_SizeOfStackOutgoingAndScratchArea); @@ -1662,12 +1547,9 @@ void GcInfoDecoder::ReportRegisterToGC( // ARM PREGDISPLAY pRD, unsigned flags, GCEnumCallback pCallBack, - LPVOID hCallBack) + void * hCallBack) { - GCINFODECODER_CONTRACT(CONTRACTL { - NOTHROW; - GC_NOTRIGGER; - } CONTRACTL_END); + GCINFODECODER_CONTRACT; _ASSERTE(regNum >= 0 && regNum <= 14); _ASSERTE(regNum != 13); // sp @@ -1740,7 +1622,7 @@ bool GcInfoDecoder::IsScratchStackSlot(INT32 spOffset, GcStackSlotBase spBase, P #ifdef FIXED_STACK_PARAMETER_SCRATCH_AREA _ASSERTE( m_Flags & DECODE_GC_LIFETIMES ); - ULONGLONG pSlot = (ULONGLONG) GetStackSlot(spOffset, spBase, pRD); + TADDR pSlot = (TADDR) GetStackSlot(spOffset, spBase, pRD); _ASSERTE(pSlot >= pRD->SP); return (pSlot < pRD->SP + m_SizeOfStackOutgoingAndScratchArea); @@ -1756,12 +1638,9 @@ void GcInfoDecoder::ReportRegisterToGC( // ARM64 PREGDISPLAY pRD, unsigned flags, GCEnumCallback pCallBack, - LPVOID hCallBack) + void * hCallBack) { - GCINFODECODER_CONTRACT(CONTRACTL { - NOTHROW; - GC_NOTRIGGER; - } CONTRACTL_END); + GCINFODECODER_CONTRACT; _ASSERTE(regNum >= 0 && regNum <= 30); _ASSERTE(regNum != 18); @@ -1801,8 +1680,7 @@ OBJECTREF* GcInfoDecoder::GetCapturedRegister( // The fields of CONTEXT are in the same order as // the processor encoding numbers. - DWORD64 *pX0; - pX0 = &pRD->pCurrentContext->X0; + DWORD64 *pX0 = &pRD->pCurrentContext->X0; return (OBJECTREF*)(pX0 + regNum); } @@ -1837,7 +1715,7 @@ void GcInfoDecoder::ReportRegisterToGC( PREGDISPLAY pRD, unsigned flags, GCEnumCallback pCallBack, - LPVOID hCallBack) + void * hCallBack) { _ASSERTE( !"NYI" ); } @@ -1859,7 +1737,7 @@ OBJECTREF* GcInfoDecoder::GetStackSlot( if( GC_SP_REL == spBase ) { - pObjRef = (OBJECTREF*) ((SIZE_T)GetRegdisplaySP(pRD) + spOffset); + pObjRef = (OBJECTREF*) ((SIZE_T)pRD->SP + spOffset); } else if( GC_CALLER_SP_REL == spBase ) { @@ -1916,12 +1794,9 @@ void GcInfoDecoder::ReportStackSlotToGC( PREGDISPLAY pRD, unsigned flags, GCEnumCallback pCallBack, - LPVOID hCallBack) + void * hCallBack) { - GCINFODECODER_CONTRACT(CONTRACTL { - NOTHROW; - GC_NOTRIGGER; - } CONTRACTL_END); + GCINFODECODER_CONTRACT; OBJECTREF* pObjRef = GetStackSlot(spOffset, spBase, pRD); _ASSERTE( IS_ALIGNED( pObjRef, sizeof( Object* ) ) ); |