summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGleb Balykov <g.balykov@samsung.com>2020-09-24 12:33:53 +0300
committerAlexander Soldatov/Platform Lab /SRR/Staff Engineer/Samsung Electronics <soldatov.a@samsung.com>2020-10-05 14:16:35 +0300
commit45574c33d63efde3d02485278e9b33746f2578d0 (patch)
treea829f4f009a9475d99cf844ec34e86af699656b1
parent66a3b803910b389de38703ce349695a247146f5b (diff)
downloadcoreclr-45574c33d63efde3d02485278e9b33746f2578d0.tar.gz
coreclr-45574c33d63efde3d02485278e9b33746f2578d0.tar.bz2
coreclr-45574c33d63efde3d02485278e9b33746f2578d0.zip
[Tizen] Add RelativeStubPrecode for arm64, which replaces StubPrecode in FNV images
-rw-r--r--src/debug/daccess/daccess.cpp8
-rw-r--r--src/debug/daccess/nidump.cpp29
-rw-r--r--src/vm/arm64/cgencpu.h96
-rw-r--r--src/vm/arm64/stubs.cpp59
-rw-r--r--src/vm/method.cpp11
-rw-r--r--src/vm/precode.cpp71
-rw-r--r--src/vm/precode.h16
-rw-r--r--src/vm/stubmgr.cpp5
8 files changed, 276 insertions, 19 deletions
diff --git a/src/debug/daccess/daccess.cpp b/src/debug/daccess/daccess.cpp
index 3b0eb7e81e..89dfe30fa2 100644
--- a/src/debug/daccess/daccess.cpp
+++ b/src/debug/daccess/daccess.cpp
@@ -5854,6 +5854,14 @@ ClrDataAccess::RawGetMethodName(
SIZE_T maxPrecodeSize = sizeof(StubPrecode);
+#ifdef HAS_RELATIVE_STUB_PRECODE
+ maxPrecodeSize = max(maxPrecodeSize, sizeof(RelativeStubPrecode));
+#endif
+
+#ifdef HAS_RELATIVE_FIXUP_PRECODE
+ maxPrecodeSize = max(maxPrecodeSize, sizeof(RelativeFixupPrecode));
+#endif
+
#ifdef HAS_THISPTR_RETBUF_PRECODE
maxPrecodeSize = max(maxPrecodeSize, sizeof(ThisPtrRetBufPrecode));
#endif
diff --git a/src/debug/daccess/nidump.cpp b/src/debug/daccess/nidump.cpp
index 7812bd72f0..dca36b97eb 100644
--- a/src/debug/daccess/nidump.cpp
+++ b/src/debug/daccess/nidump.cpp
@@ -3479,7 +3479,15 @@ size_t NativeImageDumper::TranslateSymbol(IXCLRDisassemblySupport *dis,
case PRECODE_INVALID:
precodeName = "InvalidPrecode"; break;
case PRECODE_STUB:
+#ifdef HAS_RELATIVE_STUB_PRECODE
+ _ASSERTE(!"unreachable"); break;
+#else // HAS_RELATIVE_STUB_PRECODE
precodeName = "StubPrecode"; break;
+#endif // HAS_RELATIVE_STUB_PRECODE
+#ifdef HAS_RELATIVE_STUB_PRECODE
+ case PRECODE_RELATIVE_STUB:
+ precodeName = "RelativeStubPrecode"; break;
+#endif // HAS_RELATIVE_STUB_PRECODE
#ifdef HAS_NDIRECT_IMPORT_PRECODE
case PRECODE_NDIRECT_IMPORT:
precodeName = "NDirectImportPrecode"; break;
@@ -7490,15 +7498,16 @@ void NativeImageDumper::DumpPrecode( PTR_Precode precode, PTR_Module module )
PrecodeType pType = precode->GetType();
switch(pType)
{
-#define DISPLAY_PRECODE(type) \
+#define DISPLAY_PRECODE(type, field) \
IF_OPT_AND(PRECODES, METHODDESCS) \
{ \
PTR_ ## type p( precode->As ## type () ); \
DisplayStartStructure( # type, \
DPtrToPreferredAddr(p), \
sizeof(*p), ALWAYS ); \
- WriteFieldMethodDesc( m_pMethodDesc, \
- p->m_pMethodDesc, \
+ PTR_MethodDesc precodeMD(p->GetMethodDesc()); \
+ WriteFieldMethodDesc( field, \
+ precodeMD, \
type, ALWAYS ); \
TADDR target = p->GetTarget(); \
DisplayWriteElementPointer("Target",\
@@ -7508,10 +7517,18 @@ void NativeImageDumper::DumpPrecode( PTR_Precode precode, PTR_Module module )
}
case PRECODE_STUB:
- DISPLAY_PRECODE(StubPrecode); break;
+#ifdef HAS_RELATIVE_STUB_PRECODE
+ _ASSERTE(!"unreachable"); break;
+#else // HAS_RELATIVE_STUB_PRECODE
+ DISPLAY_PRECODE(StubPrecode, m_pMethodDesc); break;
+#endif // HAS_RELATIVE_STUB_PRECODE
+#ifdef HAS_RELATIVE_STUB_PRECODE
+ case PRECODE_RELATIVE_STUB:
+ DISPLAY_PRECODE(RelativeStubPrecode, m_pMethodDescOffset); break;
+#endif // HAS_RELATIVE_STUB_PRECODE
#ifdef HAS_NDIRECT_IMPORT_PRECODE
case PRECODE_NDIRECT_IMPORT:
- DISPLAY_PRECODE(NDirectImportPrecode); break;
+ DISPLAY_PRECODE(NDirectImportPrecode, m_pMethodDesc); break;
#endif
#ifdef HAS_FIXUP_PRECODE
case PRECODE_FIXUP:
@@ -7621,7 +7638,7 @@ void NativeImageDumper::DumpPrecode( PTR_Precode precode, PTR_Module module )
#endif // HAS_RELATIVE_FIXUP_PRECODE
#ifdef HAS_THISPTR_RETBUF_PRECODE
case PRECODE_THISPTR_RETBUF:
- DISPLAY_PRECODE(ThisPtrRetBufPrecode); break;
+ DISPLAY_PRECODE(ThisPtrRetBufPrecode, m_pMethodDesc); break;
#endif
default:
_ASSERTE( !"Unsupported precode type" );
diff --git a/src/vm/arm64/cgencpu.h b/src/vm/arm64/cgencpu.h
index 7d01f9d6ff..ea5fe7b4fc 100644
--- a/src/vm/arm64/cgencpu.h
+++ b/src/vm/arm64/cgencpu.h
@@ -48,6 +48,8 @@ extern PCODE GetPreStubEntryPoint();
#define HAS_RELATIVE_FIXUP_PRECODE 1
#endif
+#define HAS_RELATIVE_STUB_PRECODE 1
+
// ThisPtrRetBufPrecode one is necessary for closed delegates over static methods with return buffer
#define HAS_THISPTR_RETBUF_PRECODE 1
@@ -627,6 +629,15 @@ struct StubPrecode {
(LONGLONG*)&m_pTarget, (TADDR)target, (TADDR)expected) == expected;
}
+ static BOOL IsStubPrecodeByASM(PCODE addr)
+ {
+ PTR_DWORD pInstr = dac_cast<PTR_DWORD>(PCODEToPINSTR(addr));
+ return
+ (pInstr[0] == 0x10000089) &&
+ (pInstr[1] == 0xA940312A) &&
+ (pInstr[2] == 0xD61F0140);
+ }
+
#ifdef FEATURE_PREJIT
void Fixup(DataImage *image);
#endif
@@ -634,6 +645,91 @@ struct StubPrecode {
typedef DPTR(StubPrecode) PTR_StubPrecode;
+struct RelativeStubPrecode {
+
+ static const int Type = 0xC9;
+
+ // adr x9, #24
+ // ldp x10,x12,[x9] ; =m_pTargetOffset,m_pMethodDescOffset
+ // add x12,x12,x9
+ // add x10,x10,x9
+ // br x10
+ // 4 byte padding for 8 byte allignement
+ // dcd m_pTargetOffset ; m_pTargetOffset is relative to itself
+ // dcd m_pMethodDescOffset ; m_pMethodDescOffset is relative to location of m_pTargetOffset
+
+ DWORD m_rgCode[6];
+ TADDR m_pTargetOffset;
+ TADDR m_pMethodDescOffset;
+
+ void Init(MethodDesc* pMD, LoaderAllocator *pLoaderAllocator);
+
+ static TADDR GetTargetOffset()
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+ return offsetof(RelativeStubPrecode, m_pTargetOffset);
+ }
+
+ TADDR GetMethodDesc()
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+ return dac_cast<TADDR>(this) + GetTargetOffset() + m_pMethodDescOffset;
+ }
+
+ PCODE GetTarget()
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+ return dac_cast<TADDR>(this) + GetTargetOffset() + m_pTargetOffset;
+ }
+
+ void ResetTargetInterlocked()
+ {
+ CONTRACTL
+ {
+ THROWS;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+
+ EnsureWritableExecutablePages(&m_pTargetOffset);
+ TADDR addr = (TADDR)GetPreStubEntryPoint() - (TADDR)(this) - GetTargetOffset();
+ InterlockedExchange64((LONGLONG*)&m_pTargetOffset, addr);
+ }
+
+ BOOL SetTargetInterlocked(TADDR target, TADDR expected)
+ {
+ CONTRACTL
+ {
+ THROWS;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+
+ EnsureWritableExecutablePages(&m_pTargetOffset);
+ TADDR addrExpected = expected - (TADDR)(this) - GetTargetOffset();
+ TADDR addrTarget = target - (TADDR)(this) - GetTargetOffset();
+ return (TADDR)InterlockedCompareExchange64(
+ (LONGLONG*)&m_pTargetOffset, addrTarget, addrExpected) == addrExpected;
+ }
+
+ static BOOL IsRelativeStubPrecodeByASM(PCODE addr)
+ {
+ PTR_DWORD pInstr = dac_cast<PTR_DWORD>(PCODEToPINSTR(addr));
+ return
+ (pInstr[0] == 0x100000C9) &&
+ (pInstr[1] == 0xA940312A) &&
+ (pInstr[2] == 0x8B09018C) &&
+ (pInstr[3] == 0x8B09014A) &&
+ (pInstr[4] == 0xD61F0140);
+ }
+
+#ifdef FEATURE_PREJIT
+ void Fixup(DataImage *image);
+#endif
+};
+typedef DPTR(RelativeStubPrecode) PTR_RelativeStubPrecode;
+
+
struct NDirectImportPrecode {
static const int Type = 0x8B;
diff --git a/src/vm/arm64/stubs.cpp b/src/vm/arm64/stubs.cpp
index b25dc4d531..6061654fdc 100644
--- a/src/vm/arm64/stubs.cpp
+++ b/src/vm/arm64/stubs.cpp
@@ -612,11 +612,33 @@ void StubPrecode::Init(MethodDesc* pMD, LoaderAllocator *pLoaderAllocator)
m_pMethodDesc = (TADDR)pMD;
}
+void RelativeStubPrecode::Init(MethodDesc* pMD, LoaderAllocator *pLoaderAllocator)
+{
+ WRAPPER_NO_CONTRACT;
+
+ int n = 0;
+
+ m_rgCode[n++] = 0x100000C9; // adr x9, #24
+ m_rgCode[n++] = 0xA940312A; // ldp x10,x12,[x9]
+ m_rgCode[n++] = 0x8B09018C; // add x12,x12,x9
+ m_rgCode[n++] = 0x8B09014A; // add x10,x10,x9
+ m_rgCode[n++] = 0xD61F0140; // br x10
+
+ _ASSERTE(n+1 == _countof(m_rgCode));
+
+ m_pTargetOffset = GetPreStubEntryPoint() - (TADDR)this - RelativeStubPrecode::GetTargetOffset();
+ m_pMethodDescOffset = (TADDR)pMD - (TADDR)this - RelativeStubPrecode::GetTargetOffset();
+}
+
#ifdef FEATURE_NATIVE_IMAGE_GENERATION
void StubPrecode::Fixup(DataImage *image)
{
WRAPPER_NO_CONTRACT;
+#ifdef HAS_RELATIVE_STUB_PRECODE
+ // StubPrecode is not saved to image in this case
+ _ASSERTE(!"StubPrecode is not saved to NGENed image, RelativeStubPrecode is instead");
+#else // HAS_RELATIVE_STUB_PRECODE
image->FixupFieldToNode(this, offsetof(StubPrecode, m_pTarget),
image->GetHelperThunk(CORINFO_HELP_EE_PRESTUB),
0,
@@ -626,6 +648,24 @@ void StubPrecode::Fixup(DataImage *image)
(void*)GetMethodDesc(),
0,
IMAGE_REL_BASED_PTR);
+#endif // HAS_RELATIVE_STUB_PRECODE
+}
+
+void RelativeStubPrecode::Fixup(DataImage *image)
+{
+ WRAPPER_NO_CONTRACT;
+
+ image->FixupFieldToNode(this,
+ offsetof(RelativeStubPrecode, m_pTargetOffset),
+ image->GetHelperThunk(CORINFO_HELP_EE_PRESTUB),
+ offsetof(RelativeStubPrecode, m_pTargetOffset) - RelativeStubPrecode::GetTargetOffset(),
+ IMAGE_REL_BASED_RELPTR);
+
+ image->FixupField(this,
+ offsetof(RelativeStubPrecode, m_pMethodDescOffset),
+ (void*)GetMethodDesc(),
+ offsetof(RelativeStubPrecode, m_pMethodDescOffset) - RelativeStubPrecode::GetTargetOffset(),
+ IMAGE_REL_BASED_RELPTR);
}
#endif // FEATURE_NATIVE_IMAGE_GENERATION
@@ -886,9 +926,7 @@ BOOL DoesSlotCallPrestub(PCODE pCode)
#endif // HAS_RELATIVE_FIXUP_PRECODE
// StubPrecode
- if (pInstr[0] == 0x10000089 && // adr x9, #16
- pInstr[1] == 0xA940312A && // ldp x10,x12,[x9]
- pInstr[2] == 0xD61F0140) // br x10
+ if (StubPrecode::IsStubPrecodeByASM(pCode))
{
PCODE pTarget = dac_cast<PTR_StubPrecode>(pInstr)->m_pTarget;
@@ -900,6 +938,21 @@ BOOL DoesSlotCallPrestub(PCODE pCode)
return pTarget == GetPreStubEntryPoint();
}
+ // RelativeStubPrecode
+#if defined(HAS_RELATIVE_STUB_PRECODE)
+ if (RelativeStubPrecode::IsRelativeStubPrecodeByASM(pCode))
+ {
+ PCODE pTarget = dac_cast<PTR_RelativeStubPrecode>(pInstr)->GetTarget();
+
+ if (isJump(pTarget))
+ {
+ pTarget = decodeJump(pTarget);
+ }
+
+ return pTarget == GetPreStubEntryPoint();
+ }
+#endif // HAS_RELATIVE_STUB_PRECODE
+
return FALSE;
}
diff --git a/src/vm/method.cpp b/src/vm/method.cpp
index 923cfc1a1c..d903c9026a 100644
--- a/src/vm/method.cpp
+++ b/src/vm/method.cpp
@@ -5761,7 +5761,16 @@ PrecodeType MethodDesc::GetPrecodeType()
else
#endif // HAS_FIXUP_PRECODE
{
- precodeType = PRECODE_STUB;
+#ifdef HAS_RELATIVE_STUB_PRECODE
+ if (IsZapped())
+ {
+ precodeType = PRECODE_RELATIVE_STUB;
+ }
+ else
+#endif // HAS_RELATIVE_STUB_PRECODE
+ {
+ precodeType = PRECODE_STUB;
+ }
}
return precodeType;
diff --git a/src/vm/precode.cpp b/src/vm/precode.cpp
index 5ab4ca8637..1909773cff 100644
--- a/src/vm/precode.cpp
+++ b/src/vm/precode.cpp
@@ -29,6 +29,9 @@ BOOL Precode::IsValidType(PrecodeType t)
switch (t) {
case PRECODE_STUB:
+#ifdef HAS_RELATIVE_STUB_PRECODE
+ case PRECODE_RELATIVE_STUB:
+#endif // HAS_RELATIVE_STUB_PRECODE
#ifdef HAS_NDIRECT_IMPORT_PRECODE
case PRECODE_NDIRECT_IMPORT:
#endif // HAS_NDIRECT_IMPORT_PRECODE
@@ -56,6 +59,10 @@ SIZE_T Precode::SizeOf(PrecodeType t)
{
case PRECODE_STUB:
return sizeof(StubPrecode);
+#ifdef HAS_RELATIVE_STUB_PRECODE
+ case PRECODE_RELATIVE_STUB:
+ return sizeof(RelativeStubPrecode);
+#endif // HAS_RELATIVE_STUB_PRECODE
#ifdef HAS_NDIRECT_IMPORT_PRECODE
case PRECODE_NDIRECT_IMPORT:
return sizeof(NDirectImportPrecode);
@@ -94,6 +101,11 @@ PCODE Precode::GetTarget()
case PRECODE_STUB:
target = AsStubPrecode()->GetTarget();
break;
+#ifdef HAS_RELATIVE_STUB_PRECODE
+ case PRECODE_RELATIVE_STUB:
+ target = AsRelativeStubPrecode()->GetTarget();
+ break;
+#endif // HAS_RELATIVE_STUB_PRECODE
#ifdef HAS_FIXUP_PRECODE
case PRECODE_FIXUP:
target = AsFixupPrecode()->GetTarget();
@@ -133,6 +145,11 @@ MethodDesc* Precode::GetMethodDesc(BOOL fSpeculative /*= FALSE*/)
case PRECODE_STUB:
pMD = AsStubPrecode()->GetMethodDesc();
break;
+#ifdef HAS_RELATIVE_STUB_PRECODE
+ case PRECODE_RELATIVE_STUB:
+ pMD = AsRelativeStubPrecode()->GetMethodDesc();
+ break;
+#endif // HAS_RELATIVE_STUB_PRECODE
#ifdef HAS_NDIRECT_IMPORT_PRECODE
case PRECODE_NDIRECT_IMPORT:
pMD = AsNDirectImportPrecode()->GetMethodDesc();
@@ -166,13 +183,6 @@ MethodDesc* Precode::GetMethodDesc(BOOL fSpeculative /*= FALSE*/)
UnexpectedPrecodeType("Precode::GetMethodDesc", precodeType);
}
-#ifdef HAS_RELATIVE_FIXUP_PRECODE
- if (precodeType == PRECODE_RELATIVE_FIXUP)
- {
- _ASSERTE(dac_cast<PTR_MethodDesc>(pMD)->IsZapped());
- }
-#endif // HAS_RELATIVE_FIXUP_PRECODE
-
// GetMethodDesc() on platform specific precode types returns TADDR. It should return
// PTR_MethodDesc instead. It is a workaround to resolve cyclic dependency between headers.
// Once we headers factoring of headers cleaned up, we should be able to get rid of it.
@@ -322,6 +332,10 @@ Precode* Precode::GetPrecodeForTemporaryEntryPoint(TADDR temporaryEntryPoints, i
_ASSERTE(t != PRECODE_RELATIVE_FIXUP);
#endif
+#ifdef HAS_RELATIVE_STUB_PRECODE
+ _ASSERTE(t != PRECODE_RELATIVE_STUB);
+#endif
+
SIZE_T oneSize = SizeOfTemporaryEntryPoint(t);
return PTR_Precode(temporaryEntryPoints + index * oneSize);
}
@@ -361,6 +375,10 @@ SIZE_T Precode::SizeOfTemporaryEntryPoints(PrecodeType t, bool preallocateJumpSt
_ASSERTE(t != PRECODE_RELATIVE_FIXUP);
#endif
+#ifdef HAS_RELATIVE_STUB_PRECODE
+ _ASSERTE(t != PRECODE_RELATIVE_STUB);
+#endif
+
SIZE_T oneSize = SizeOfTemporaryEntryPoint(t);
return count * oneSize;
}
@@ -401,6 +419,10 @@ Precode* Precode::Allocate(PrecodeType t, MethodDesc* pMD,
_ASSERTE(t != PRECODE_RELATIVE_FIXUP);
#endif
+#ifdef HAS_RELATIVE_STUB_PRECODE
+ _ASSERTE(t != PRECODE_RELATIVE_STUB);
+#endif
+
#ifdef HAS_FIXUP_PRECODE_CHUNKS
if (t == PRECODE_FIXUP)
{
@@ -430,6 +452,11 @@ void Precode::Init(PrecodeType t, MethodDesc* pMD, LoaderAllocator *pLoaderAlloc
case PRECODE_STUB:
((StubPrecode*)this)->Init(pMD, pLoaderAllocator);
break;
+#ifdef HAS_RELATIVE_STUB_PRECODE
+ case PRECODE_RELATIVE_STUB:
+ ((RelativeStubPrecode*)this)->Init(pMD, pLoaderAllocator);
+ break;
+#endif // HAS_RELATIVE_STUB_PRECODE
#ifdef HAS_NDIRECT_IMPORT_PRECODE
case PRECODE_NDIRECT_IMPORT:
((NDirectImportPrecode*)this)->Init(pMD, pLoaderAllocator);
@@ -469,6 +496,11 @@ void Precode::ResetTargetInterlocked()
AsStubPrecode()->ResetTargetInterlocked();
break;
+#ifdef HAS_RELATIVE_STUB_PRECODE
+ case PRECODE_RELATIVE_STUB:
+ AsRelativeStubPrecode()->ResetTargetInterlocked();
+#endif // HAS_RELATIVE_STUB_PRECODE
+
#ifdef HAS_FIXUP_PRECODE
case PRECODE_FIXUP:
AsFixupPrecode()->ResetTargetInterlocked();
@@ -510,6 +542,12 @@ BOOL Precode::SetTargetInterlocked(PCODE target, BOOL fOnlyRedirectFromPrestub)
ret = AsStubPrecode()->SetTargetInterlocked(target, expected);
break;
+#ifdef HAS_RELATIVE_STUB_PRECODE
+ case PRECODE_RELATIVE_STUB:
+ ret = AsRelativeStubPrecode()->SetTargetInterlocked(target, expected);
+ break;
+#endif // HAS_RELATIVE_STUB_PRECODE
+
#ifdef HAS_FIXUP_PRECODE
case PRECODE_FIXUP:
ret = AsFixupPrecode()->SetTargetInterlocked(target, expected);
@@ -786,9 +824,15 @@ void Precode::Fixup(DataImage *image, MethodDesc * pMD)
}
switch (precodeType) {
+#ifdef HAS_RELATIVE_STUB_PRECODE
+ case PRECODE_RELATIVE_STUB:
+ AsRelativeStubPrecode()->Fixup(image);
+ break;
+#else // HAS_RELATIVE_STUB_PRECODE
case PRECODE_STUB:
AsStubPrecode()->Fixup(image);
break;
+#endif // HAS_RELATIVE_STUB_PRECODE
#ifdef HAS_NDIRECT_IMPORT_PRECODE
case PRECODE_NDIRECT_IMPORT:
AsNDirectImportPrecode()->Fixup(image);
@@ -837,9 +881,18 @@ void Precode::SaveChunk::Save(DataImage* image, MethodDesc * pMD)
_ASSERTE(precodeType != PRECODE_RELATIVE_FIXUP);
#endif // HAS_RELATIVE_FIXUP_PRECODE
- SIZE_T size = Precode::SizeOf(precodeType);
+ PrecodeType savedPrecodeType = precodeType;
+
+#ifdef HAS_RELATIVE_STUB_PRECODE
+ if (precodeType == PRECODE_STUB)
+ {
+ savedPrecodeType = PRECODE_RELATIVE_STUB;
+ }
+#endif // HAS_RELATIVE_STUB_PRECODE
+
+ SIZE_T size = Precode::SizeOf(savedPrecodeType);
Precode* pPrecode = (Precode *)new (image->GetHeap()) BYTE[size];
- pPrecode->Init(precodeType, pMD, NULL);
+ pPrecode->Init(savedPrecodeType, pMD, NULL);
pPrecode->Save(image);
// Alias the temporary entrypoint
diff --git a/src/vm/precode.h b/src/vm/precode.h
index ba51f22256..e8a0d5d01e 100644
--- a/src/vm/precode.h
+++ b/src/vm/precode.h
@@ -19,6 +19,9 @@ typedef DPTR(class Precode) PTR_Precode;
enum PrecodeType {
PRECODE_INVALID = InvalidPrecode::Type,
PRECODE_STUB = StubPrecode::Type,
+#ifdef HAS_RELATIVE_STUB_PRECODE
+ PRECODE_RELATIVE_STUB = RelativeStubPrecode::Type,
+#endif // HAS_RELATIVE_STUB_PRECODE
#ifdef HAS_NDIRECT_IMPORT_PRECODE
PRECODE_NDIRECT_IMPORT = NDirectImportPrecode::Type,
#endif // HAS_NDIRECT_IMPORT_PRECODE
@@ -49,6 +52,16 @@ class Precode {
return dac_cast<PTR_StubPrecode>(this);
}
+#ifdef HAS_RELATIVE_STUB_PRECODE
+ RelativeStubPrecode* AsRelativeStubPrecode()
+ {
+ LIMITED_METHOD_CONTRACT;
+ SUPPORTS_DAC;
+
+ return dac_cast<PTR_RelativeStubPrecode>(this);
+ }
+#endif // HAS_RELATIVE_STUB_PRECODE
+
#ifdef HAS_NDIRECT_IMPORT_PRECODE
public:
// Fake precodes has to be exposed
@@ -309,6 +322,9 @@ public:
#ifdef HAS_RELATIVE_FIXUP_PRECODE
_ASSERTE(t != PRECODE_RELATIVE_FIXUP);
#endif // HAS_RELATIVE_FIXUP_PRECODE
+#ifdef HAS_RELATIVE_STUB_PRECODE
+ _ASSERTE(t != PRECODE_RELATIVE_STUB);
+#endif // HAS_RELATIVE_STUB_PRECODE
return ALIGN_UP(SizeOf(t), AlignOf(t));
}
diff --git a/src/vm/stubmgr.cpp b/src/vm/stubmgr.cpp
index ea863c0c91..0e26695b19 100644
--- a/src/vm/stubmgr.cpp
+++ b/src/vm/stubmgr.cpp
@@ -1042,6 +1042,11 @@ BOOL PrecodeStubManager::DoTraceStub(PCODE stubStartAddress,
case PRECODE_STUB:
break;
+#ifdef HAS_RELATIVE_STUB_PRECODE
+ case PRECODE_RELATIVE_STUB:
+ break;
+#endif // HAS_RELATIVE_STUB_PRECODE
+
#ifdef HAS_NDIRECT_IMPORT_PRECODE
case PRECODE_NDIRECT_IMPORT:
#ifndef DACCESS_COMPILE