summaryrefslogtreecommitdiff
path: root/src/gcdump
diff options
context:
space:
mode:
authorSwaroop Sridhar <swaroops@microsoft.com>2016-07-15 00:41:30 -0700
committerSwaroop Sridhar <swaroops@microsoft.com>2016-07-20 19:51:50 -0700
commitf915aebaf5db0b829f062dc9940e23bb5c38d575 (patch)
treef1eafbb504ba2a0fa0253ffcce362ed81a0add80 /src/gcdump
parent34e1626bc3a49b50900ca192bed1f97524d81e6a (diff)
downloadcoreclr-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/gcdump')
-rw-r--r--src/gcdump/gcdump.cpp11
-rw-r--r--src/gcdump/gcdumpnonx86.cpp12
2 files changed, 13 insertions, 10 deletions
diff --git a/src/gcdump/gcdump.cpp b/src/gcdump/gcdump.cpp
index d2fda049fc..1c512c88e0 100644
--- a/src/gcdump/gcdump.cpp
+++ b/src/gcdump/gcdump.cpp
@@ -18,8 +18,9 @@
-GCDump::GCDump(bool encBytes, unsigned maxEncBytes, bool dumpCodeOffs)
- : fDumpEncBytes (encBytes ),
+GCDump::GCDump(UINT32 gcInfoVer, bool encBytes, unsigned maxEncBytes, bool dumpCodeOffs)
+ : gcInfoVersion (gcInfoVer),
+ fDumpEncBytes (encBytes ),
cMaxEncBytes (maxEncBytes ),
fDumpCodeOffsets(dumpCodeOffs)
{
@@ -32,7 +33,7 @@ GCDump::GCDump(bool encBytes, unsigned maxEncBytes, bool dumpCodeOffs)
* Display the byte encodings for the given range of the GC tables.
*/
-PTR_CBYTE GCDump::DumpEncoding(PTR_CBYTE table, int cDumpBytes)
+PTR_CBYTE GCDump::DumpEncoding(PTR_CBYTE gcInfoBlock, int cDumpBytes)
{
_ASSERTE((cDumpBytes >= 0) && (cMaxEncBytes < 256));
@@ -42,7 +43,7 @@ PTR_CBYTE GCDump::DumpEncoding(PTR_CBYTE table, int cDumpBytes)
unsigned count;
int cBytesLeft;
- for (count = cMaxEncBytes, cBytesLeft = cDumpBytes, pCurPos = table;
+ for (count = cMaxEncBytes, cBytesLeft = cDumpBytes, pCurPos = gcInfoBlock;
count > 0;
count--, pCurPos++, cBytesLeft--)
{
@@ -60,7 +61,7 @@ PTR_CBYTE GCDump::DumpEncoding(PTR_CBYTE table, int cDumpBytes)
gcPrintf("| ");
}
- return table + cDumpBytes;
+ return gcInfoBlock + cDumpBytes;
}
/*****************************************************************************/
diff --git a/src/gcdump/gcdumpnonx86.cpp b/src/gcdump/gcdumpnonx86.cpp
index 8167d3abd8..b6562d9892 100644
--- a/src/gcdump/gcdumpnonx86.cpp
+++ b/src/gcdump/gcdumpnonx86.cpp
@@ -78,8 +78,9 @@ PCSTR GetRegName (UINT32 regnum)
/*****************************************************************************/
-GCDump::GCDump(bool encBytes, unsigned maxEncBytes, bool dumpCodeOffs)
- : fDumpEncBytes (encBytes ),
+GCDump::GCDump(UINT32 gcInfoVer, bool encBytes, unsigned maxEncBytes, bool dumpCodeOffs)
+ : gcInfoVersion(gcInfoVer),
+ fDumpEncBytes (encBytes ),
cMaxEncBytes (maxEncBytes ),
fDumpCodeOffsets(dumpCodeOffs)
{
@@ -270,11 +271,12 @@ BOOL StackSlotStateChangeCallback (
}
-size_t GCDump::DumpGCTable(PTR_CBYTE table,
+size_t GCDump::DumpGCTable(PTR_CBYTE gcInfoBlock,
unsigned methodSize,
bool verifyGCTables)
{
- GcInfoDecoder hdrdecoder(table,
+ GCInfoToken gcInfoToken = { dac_cast<PTR_VOID>(gcInfoBlock), gcInfoVersion };
+ GcInfoDecoder hdrdecoder(gcInfoToken,
(GcInfoDecoderFlags)( DECODE_SECURITY_OBJECT
| DECODE_GS_COOKIE
| DECODE_CODE_LENGTH
@@ -439,7 +441,7 @@ size_t GCDump::DumpGCTable(PTR_CBYTE table,
UINT32 cbEncodedMethodSize = hdrdecoder.GetCodeLength();
gcPrintf("Code size: %x\n", cbEncodedMethodSize);
- GcInfoDumper dumper(table);
+ GcInfoDumper dumper(gcInfoToken);
GcInfoDumpState state;
state.LastCodeOffset = -1;