diff options
author | Swaroop Sridhar <swaroops@microsoft.com> | 2016-07-15 00:41:30 -0700 |
---|---|---|
committer | Swaroop Sridhar <swaroops@microsoft.com> | 2016-07-20 19:51:50 -0700 |
commit | f915aebaf5db0b829f062dc9940e23bb5c38d575 (patch) | |
tree | f1eafbb504ba2a0fa0253ffcce362ed81a0add80 /src/debug | |
parent | 34e1626bc3a49b50900ca192bed1f97524d81e6a (diff) | |
download | coreclr-f915aebaf5db0b829f062dc9940e23bb5c38d575.tar.gz coreclr-f915aebaf5db0b829f062dc9940e23bb5c38d575.tar.bz2 coreclr-f915aebaf5db0b829f062dc9940e23bb5c38d575.zip |
GCInfo: Support versioning.
This change enables the VM to support multiple versions GCInfo concurrently.
This is necessary in light of upcoming work to add ReturnType and other
modifications to the GCInfo format -- so that existing ReadyToRun images
will continue to run correctly.
The version# is not stored in the GcInfo structure -- because it is
wasteful to store the version once for every method. Instead, it is
tracked per range-section of generated/loaded methods.
The GCInfo version is computed as:
1) The current GCINFO_VERSION for JITted and Ngened images
2) A function of the Ready-to-run major version stored in READYTORUN_HEADER
for ready-to-run images. ReadyToRunJitManager::JitTokenToGCInfoVersion()
provides the GcInfo version for any Method. Currently, there's only one
version of GCInfo.
An abstraction GCInfoToken is added to the GcInfo interface, which tracks the
{GcInfo, Version} pair in-memory. Several GcInfo APIs are
modified to use GCInfoToken in place of GcInfo pointers.
Notes:
1) SOS GcDump: The GCDump API has separate dump routines for Header and the
pointer-liveness information (DumpGCTable and DumpGCHeader) each of which
advance a pointer to the GCInfo block. These APIs are not changed to
recieve a GCInfoToken in place of the GcInfo block pointer. Instead, they
recieve the GcInfo version at the time of construction.
2) Some routines that are specific to x86 gcInfo (ex: crackMethodInfoHdr)
are not yet updated to use versioning, since the development plan is to
update the Non-x86 GcInfo structure first.
3) The x86 specific structs defining GcInfo headers are moved to GcInfoTypes.h,
along with the non-x86 GcInfo type definitions.
Diffstat (limited to 'src/debug')
-rw-r--r-- | src/debug/daccess/daccess.cpp | 2 | ||||
-rw-r--r-- | src/debug/daccess/enummem.cpp | 5 | ||||
-rw-r--r-- | src/debug/daccess/nidump.cpp | 13 | ||||
-rw-r--r-- | src/debug/daccess/request.cpp | 2 |
4 files changed, 12 insertions, 10 deletions
diff --git a/src/debug/daccess/daccess.cpp b/src/debug/daccess/daccess.cpp index 4f500d9e6a..dfe7909c2b 100644 --- a/src/debug/daccess/daccess.cpp +++ b/src/debug/daccess/daccess.cpp @@ -6012,7 +6012,7 @@ ClrDataAccess::GetMethodExtents(MethodDesc* methodDesc, EECodeInfo codeInfo(methodStart); _ASSERTE(codeInfo.IsValid()); - TADDR codeSize = codeInfo.GetCodeManager()->GetFunctionSize(codeInfo.GetGCInfo()); + TADDR codeSize = codeInfo.GetCodeManager()->GetFunctionSize(codeInfo.GetGCInfoToken()); *extents = new (nothrow) METH_EXTENTS; if (!*extents) diff --git a/src/debug/daccess/enummem.cpp b/src/debug/daccess/enummem.cpp index f88fb628ba..068c2f2b13 100644 --- a/src/debug/daccess/enummem.cpp +++ b/src/debug/daccess/enummem.cpp @@ -979,10 +979,11 @@ HRESULT ClrDataAccess::EnumMemWalkStackHelper(CLRDataEnumMemoryFlags flags, codeInfo.GetJitManager()->IsFilterFunclet(&codeInfo); // The stackwalker needs GC info to find the parent 'stack pointer' or PSP - PTR_BYTE pGCInfo = dac_cast<PTR_BYTE>(codeInfo.GetGCInfo()); + GCInfoToken gcInfoToken = codeInfo.GetGCInfoToken(); + PTR_BYTE pGCInfo = dac_cast<PTR_BYTE>(gcInfoToken.Info); if (pGCInfo != NULL) { - GcInfoDecoder gcDecoder(pGCInfo, DECODE_PSP_SYM, 0); + GcInfoDecoder gcDecoder(gcInfoToken, DECODE_PSP_SYM, 0); DacEnumMemoryRegion(dac_cast<TADDR>(pGCInfo), gcDecoder.GetNumBytesRead(), true); } } diff --git a/src/debug/daccess/nidump.cpp b/src/debug/daccess/nidump.cpp index 6de9ec0b94..d151a54212 100644 --- a/src/debug/daccess/nidump.cpp +++ b/src/debug/daccess/nidump.cpp @@ -3093,7 +3093,8 @@ void NativeImageDumper::DumpCompleteMethod(PTR_Module module, MethodIterator& mi unsigned gcInfoSize = UINT_MAX; //parse GCInfo for size information. - PTR_CBYTE gcInfo = dac_cast<PTR_CBYTE>(mi.GetGCInfo()); + GCInfoToken gcInfoToken = mi.GetGCInfoToken(); + PTR_CBYTE gcInfo = dac_cast<PTR_CBYTE>(gcInfoToken.Info); void (* stringOutFn)(const char *, ...); IF_OPT(GC_INFO) @@ -3108,10 +3109,10 @@ void NativeImageDumper::DumpCompleteMethod(PTR_Module module, MethodIterator& mi { PTR_CBYTE curGCInfoPtr = gcInfo; g_holdStringOutData.Clear(); - GCDump gcDump; + GCDump gcDump(gcInfoToken.Version); gcDump.gcPrintf = stringOutFn; #if !defined(_TARGET_X86_) && defined(USE_GC_INFO_DECODER) - GcInfoDecoder gcInfoDecoder(curGCInfoPtr, DECODE_CODE_LENGTH, 0); + GcInfoDecoder gcInfoDecoder(gcInfoToken, DECODE_CODE_LENGTH, 0); methodSize = gcInfoDecoder.GetCodeLength(); #endif @@ -3119,7 +3120,7 @@ void NativeImageDumper::DumpCompleteMethod(PTR_Module module, MethodIterator& mi #ifdef _TARGET_X86_ InfoHdr hdr; stringOutFn( "method info Block:\n" ); - curGCInfoPtr += gcDump.DumpInfoHdr(curGCInfoPtr, &hdr, &methodSize, 0); + curGCInfoPtr += gcDump.DumpInfoHdr(PTR_CBYTE(gcInfoToken.Info), &hdr, &methodSize, 0); stringOutFn( "\n" ); #endif @@ -9436,10 +9437,10 @@ void NativeImageDumper::DumpReadyToRunMethod(PCODE pEntryPoint, PTR_RUNTIME_FUNC { PTR_CBYTE curGCInfoPtr = gcInfo; g_holdStringOutData.Clear(); - GCDump gcDump; + GCDump gcDump(GCINFO_VERSION); gcDump.gcPrintf = stringOutFn; #if !defined(_TARGET_X86_) && defined(USE_GC_INFO_DECODER) - GcInfoDecoder gcInfoDecoder(curGCInfoPtr, DECODE_CODE_LENGTH, 0); + GcInfoDecoder gcInfoDecoder({ curGCInfoPtr, GCINFO_VERSION }, DECODE_CODE_LENGTH, 0); methodSize = gcInfoDecoder.GetCodeLength(); #endif diff --git a/src/debug/daccess/request.cpp b/src/debug/daccess/request.cpp index 9e864769c4..62dd5f51f9 100644 --- a/src/debug/daccess/request.cpp +++ b/src/debug/daccess/request.cpp @@ -1148,7 +1148,7 @@ ClrDataAccess::GetCodeHeaderData(CLRDATA_ADDRESS ip, struct DacpCodeHeaderData * codeHeaderData->MethodStart = (CLRDATA_ADDRESS) codeInfo.GetStartAddress(); - size_t methodSize = codeInfo.GetCodeManager()->GetFunctionSize(codeInfo.GetGCInfo()); + size_t methodSize = codeInfo.GetCodeManager()->GetFunctionSize(codeInfo.GetGCInfoToken()); _ASSERTE(FitsIn<DWORD>(methodSize)); codeHeaderData->MethodSize = static_cast<DWORD>(methodSize); |