Skip to content

Commit

Permalink
Delete support for old GCInfo version from the runtime (#33202)
Browse files Browse the repository at this point in the history
We do not support old R2R images anymore
  • Loading branch information
jkotas committed Mar 5, 2020
1 parent 34905f0 commit ecd8378
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 69 deletions.
12 changes: 2 additions & 10 deletions src/coreclr/src/inc/gcdecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ PTR_CBYTE FASTCALL decodeHeader(PTR_CBYTE table, UINT32 version, InfoHdr* header
header->syncStartOffset ^= HAS_SYNC_OFFSET;
break;
case FLIP_REV_PINVOKE_FRAME:
_ASSERTE(GCInfoEncodesRevPInvokeFrame(version));
header->revPInvokeOffset ^= HAS_REV_PINVOKE_FRAME_OFFSET;
break;

Expand All @@ -206,15 +205,8 @@ PTR_CBYTE FASTCALL decodeHeader(PTR_CBYTE table, UINT32 version, InfoHdr* header
encoding = nextByte & ADJ_ENCODING_MAX;
// encoding here always corresponds to codes in InfoHdrAdjust2 set

if (encoding < SET_RET_KIND_MAX)
{
_ASSERTE(GCInfoEncodesReturnKind(version));
header->returnKind = (ReturnKind)encoding;
}
else
{
assert(!"Unexpected encoding");
}
_ASSERTE(encoding < SET_RET_KIND_MAX);
header->returnKind = (ReturnKind)encoding;
break;
}
}
Expand Down
25 changes: 1 addition & 24 deletions src/coreclr/src/inc/gcinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,6 @@ const unsigned this_OFFSET_FLAG = 0x2; // the offset is "this"

#define GCINFO_VERSION 2

#define MIN_GCINFO_VERSION_WITH_RETURN_KIND 2
#define MIN_GCINFO_VERSION_WITH_REV_PINVOKE_FRAME 2

inline BOOL GCInfoEncodesReturnKind(UINT32 version=GCINFO_VERSION)
{
return version >= MIN_GCINFO_VERSION_WITH_RETURN_KIND;
}

inline BOOL GCInfoEncodesRevPInvokeFrame(UINT32 version=GCINFO_VERSION)
{
return version >= MIN_GCINFO_VERSION_WITH_REV_PINVOKE_FRAME;
}

//-----------------------------------------------------------------------------
// GCInfoToken: A wrapper that contains the GcInfo data and version number.
//
Expand All @@ -73,20 +60,10 @@ struct GCInfoToken
PTR_VOID Info;
UINT32 Version;

BOOL IsReturnKindAvailable()
{
return GCInfoEncodesReturnKind(Version);
}
BOOL IsReversePInvokeFrameAvailable()
{
return GCInfoEncodesRevPInvokeFrame(Version);
}

static UINT32 ReadyToRunVersionToGcInfoVersion(UINT32 readyToRunMajorVersion)
{
// GcInfo version is 1 up to ReadyTorun version 1.x
// GcInfo version is current from ReadyToRun version 2.0
return (readyToRunMajorVersion == 1) ? 1 : GCINFO_VERSION;
return GCINFO_VERSION;
}
};

Expand Down
17 changes: 7 additions & 10 deletions src/coreclr/src/jit/gcencode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,7 @@ BYTE FASTCALL encodeHeaderNext(const InfoHdr& header, InfoHdr* state, BYTE& code
goto DO_RETURN;
}

if (GCInfoEncodesReturnKind() && (state->returnKind != header.returnKind))
if (state->returnKind != header.returnKind)
{
state->returnKind = header.returnKind;
codeSet = 2; // Two byte encoding
Expand Down Expand Up @@ -973,7 +973,7 @@ BYTE FASTCALL encodeHeaderNext(const InfoHdr& header, InfoHdr* state, BYTE& code
}
}

if (GCInfoEncodesRevPInvokeFrame() && (state->revPInvokeOffset != header.revPInvokeOffset))
if (state->revPInvokeOffset != header.revPInvokeOffset)
{
assert(state->revPInvokeOffset == INVALID_REV_PINVOKE_OFFSET ||
state->revPInvokeOffset == HAS_REV_PINVOKE_FRAME_OFFSET);
Expand Down Expand Up @@ -1587,14 +1587,11 @@ size_t GCInfo::gcInfoBlockHdrSave(
header->genericsContextIsMethodDesc =
header->genericsContext && (compiler->info.compMethodInfo->options & (CORINFO_GENERICS_CTXT_FROM_METHODDESC));

if (GCInfoEncodesReturnKind())
{
ReturnKind returnKind = getReturnKind();
_ASSERTE(IsValidReturnKind(returnKind) && "Return Kind must be valid");
_ASSERTE(!IsStructReturnKind(returnKind) && "Struct Return Kinds Unexpected for JIT32");
_ASSERTE(((int)returnKind < (int)SET_RET_KIND_MAX) && "ReturnKind has no legal encoding");
header->returnKind = returnKind;
}
ReturnKind returnKind = getReturnKind();
_ASSERTE(IsValidReturnKind(returnKind) && "Return Kind must be valid");
_ASSERTE(!IsStructReturnKind(returnKind) && "Struct Return Kinds Unexpected for JIT32");
_ASSERTE(((int)returnKind < (int)SET_RET_KIND_MAX) && "ReturnKind has no legal encoding");
header->returnKind = returnKind;

header->gsCookieOffset = INVALID_GS_COOKIE_OFFSET;
if (compiler->getNeedsGSSecurityCookie())
Expand Down
5 changes: 0 additions & 5 deletions src/coreclr/src/vm/eetwain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5741,11 +5741,6 @@ ReturnKind EECodeManager::GetReturnKind(GCInfoToken gcInfoToken)
SUPPORTS_DAC;
} CONTRACTL_END;

if (!gcInfoToken.IsReturnKindAvailable())
{
return RT_Illegal;
}

#ifndef USE_GC_INFO_DECODER
hdrInfo info;

Expand Down
22 changes: 4 additions & 18 deletions src/coreclr/src/vm/gcinfodecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,25 +138,11 @@ GcInfoDecoder::GcInfoDecoder(
m_HasTailCalls = ((headerFlags & GC_INFO_HAS_TAILCALLS) != 0);
#endif // TARGET_AMD64
int hasSizeOfEditAndContinuePreservedArea = headerFlags & GC_INFO_HAS_EDIT_AND_CONTINUE_PRESERVED_SLOTS;
int hasReversePInvokeFrame = headerFlags & GC_INFO_REVERSE_PINVOKE_FRAME;

int hasReversePInvokeFrame = false;
if (gcInfoToken.IsReversePInvokeFrameAvailable())
{
hasReversePInvokeFrame = headerFlags & GC_INFO_REVERSE_PINVOKE_FRAME;
}

if (gcInfoToken.IsReturnKindAvailable())
{
int returnKindBits = (slimHeader) ? SIZE_OF_RETURN_KIND_IN_SLIM_HEADER : SIZE_OF_RETURN_KIND_IN_FAT_HEADER;
m_ReturnKind =
(ReturnKind)((UINT32)m_Reader.Read(returnKindBits));
}
else
{
#ifndef TARGET_X86
m_ReturnKind = RT_Unset;
#endif // ! TARGET_X86
}
int returnKindBits = (slimHeader) ? SIZE_OF_RETURN_KIND_IN_SLIM_HEADER : SIZE_OF_RETURN_KIND_IN_FAT_HEADER;
m_ReturnKind =
(ReturnKind)((UINT32)m_Reader.Read(returnKindBits));

if (flags == DECODE_RETURN_KIND) {
// Bail, if we've decoded enough,
Expand Down
2 changes: 0 additions & 2 deletions src/coreclr/src/vm/threads.h
Original file line number Diff line number Diff line change
Expand Up @@ -4708,8 +4708,6 @@ class Thread

// By the time a frame is scanned by the runtime, m_pHijackReturnKind always
// identifies the gc-ness of the return register(s)
// If the ReturnKind information is not available from the GcInfo, the runtime
// computes it using the return types's class handle.

ReturnKind m_HijackReturnKind;

Expand Down

0 comments on commit ecd8378

Please sign in to comment.