mirror of
https://github.com/VSadov/Satori.git
synced 2025-06-10 18:11:04 +09:00
Remove slotNum argument from recordRelocation
This commit is contained in:
parent
51d1a138a6
commit
9d73664d77
18 changed files with 35 additions and 57 deletions
|
@ -471,12 +471,11 @@ public:
|
|||
// A relocation is recorded if we are pre-jitting.
|
||||
// A jump thunk may be inserted if we are jitting
|
||||
virtual void recordRelocation(
|
||||
void * location, /* IN */
|
||||
void * locationRW, /* IN */
|
||||
void * target, /* IN */
|
||||
uint16_t fRelocType, /* IN */
|
||||
uint16_t slotNum = 0, /* IN */
|
||||
int32_t addlDelta = 0 /* IN */
|
||||
void * location, /* IN */
|
||||
void * locationRW, /* IN */
|
||||
void * target, /* IN */
|
||||
uint16_t fRelocType, /* IN */
|
||||
int32_t addlDelta = 0 /* IN */
|
||||
) = 0;
|
||||
|
||||
virtual uint16_t getRelocTypeHint(void * target) = 0;
|
||||
|
|
|
@ -699,7 +699,6 @@ void recordRelocation(
|
|||
void* locationRW,
|
||||
void* target,
|
||||
uint16_t fRelocType,
|
||||
uint16_t slotNum,
|
||||
int32_t addlDelta) override;
|
||||
|
||||
uint16_t getRelocTypeHint(
|
||||
|
|
|
@ -1632,11 +1632,10 @@ void WrapICorJitInfo::recordRelocation(
|
|||
void* locationRW,
|
||||
void* target,
|
||||
uint16_t fRelocType,
|
||||
uint16_t slotNum,
|
||||
int32_t addlDelta)
|
||||
{
|
||||
API_ENTER(recordRelocation);
|
||||
wrapHnd->recordRelocation(location, locationRW, target, fRelocType, slotNum, addlDelta);
|
||||
wrapHnd->recordRelocation(location, locationRW, target, fRelocType, addlDelta);
|
||||
API_LEAVE(recordRelocation);
|
||||
}
|
||||
|
||||
|
|
|
@ -10084,8 +10084,7 @@ void emitter::emitRecordRelocation(void* location, /* IN */
|
|||
// late disassembly; maybe we'll need it?
|
||||
if (emitComp->info.compMatchedVM)
|
||||
{
|
||||
// slotNum is unused on all supported platforms.
|
||||
emitCmpHandle->recordRelocation(location, locationRW, target, fRelocType, /* slotNum */ 0, addlDelta);
|
||||
emitCmpHandle->recordRelocation(location, locationRW, target, fRelocType, addlDelta);
|
||||
}
|
||||
#if defined(LATE_DISASM)
|
||||
codeGen->getDisAssembler().disRecordRelocation((size_t)location, (size_t)target);
|
||||
|
|
|
@ -10222,10 +10222,10 @@ BYTE* emitter::emitOutputLJ(insGroup* ig, BYTE* dst, instrDesc* i)
|
|||
|
||||
assert(fmt == IF_BI_0A);
|
||||
assert((distVal & 1) == 0);
|
||||
code_t code = emitInsCode(ins, fmt);
|
||||
const bool recordRelocation = emitComp->opts.compReloc && emitJumpCrossHotColdBoundary(srcOffs, dstOffs);
|
||||
code_t code = emitInsCode(ins, fmt);
|
||||
const bool doRecordRelocation = emitComp->opts.compReloc && emitJumpCrossHotColdBoundary(srcOffs, dstOffs);
|
||||
|
||||
if (recordRelocation)
|
||||
if (doRecordRelocation)
|
||||
{
|
||||
// dst isn't an actual final target location, just some intermediate
|
||||
// location. Thus we cannot make any guarantees about distVal (not
|
||||
|
@ -10246,7 +10246,7 @@ BYTE* emitter::emitOutputLJ(insGroup* ig, BYTE* dst, instrDesc* i)
|
|||
|
||||
const unsigned instrSize = emitOutput_Instr(dst, code);
|
||||
|
||||
if (recordRelocation)
|
||||
if (doRecordRelocation)
|
||||
{
|
||||
assert(id->idjKeepLong);
|
||||
if (emitComp->info.compMatchedVM)
|
||||
|
|
|
@ -3645,11 +3645,8 @@ namespace Internal.JitInterface
|
|||
}
|
||||
}
|
||||
|
||||
private void recordRelocation(void* location, void* locationRW, void* target, ushort fRelocType, ushort slotNum, int addlDelta)
|
||||
private void recordRelocation(void* location, void* locationRW, void* target, ushort fRelocType, int addlDelta)
|
||||
{
|
||||
// slotNum is not used
|
||||
Debug.Assert(slotNum == 0);
|
||||
|
||||
int relocOffset;
|
||||
BlockType locationBlock = findKnownBlock(location, out relocOffset);
|
||||
Debug.Assert(locationBlock != BlockType.Unknown, "BlockType.Unknown not expected");
|
||||
|
|
|
@ -2431,12 +2431,12 @@ namespace Internal.JitInterface
|
|||
}
|
||||
|
||||
[UnmanagedCallersOnly]
|
||||
private static void _recordRelocation(IntPtr thisHandle, IntPtr* ppException, void* location, void* locationRW, void* target, ushort fRelocType, ushort slotNum, int addlDelta)
|
||||
private static void _recordRelocation(IntPtr thisHandle, IntPtr* ppException, void* location, void* locationRW, void* target, ushort fRelocType, int addlDelta)
|
||||
{
|
||||
var _this = GetThis(thisHandle);
|
||||
try
|
||||
{
|
||||
_this.recordRelocation(location, locationRW, target, fRelocType, slotNum, addlDelta);
|
||||
_this.recordRelocation(location, locationRW, target, fRelocType, addlDelta);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -2658,7 +2658,7 @@ namespace Internal.JitInterface
|
|||
callbacks[161] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_METHOD_STRUCT_*, PgoInstrumentationSchema**, uint*, byte**, PgoSource*, HRESULT>)&_getPgoInstrumentationResults;
|
||||
callbacks[162] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_METHOD_STRUCT_*, PgoInstrumentationSchema*, uint, byte**, HRESULT>)&_allocPgoInstrumentationBySchema;
|
||||
callbacks[163] = (delegate* unmanaged<IntPtr, IntPtr*, uint, CORINFO_SIG_INFO*, CORINFO_METHOD_STRUCT_*, void>)&_recordCallSite;
|
||||
callbacks[164] = (delegate* unmanaged<IntPtr, IntPtr*, void*, void*, void*, ushort, ushort, int, void>)&_recordRelocation;
|
||||
callbacks[164] = (delegate* unmanaged<IntPtr, IntPtr*, void*, void*, void*, ushort, int, void>)&_recordRelocation;
|
||||
callbacks[165] = (delegate* unmanaged<IntPtr, IntPtr*, void*, ushort>)&_getRelocTypeHint;
|
||||
callbacks[166] = (delegate* unmanaged<IntPtr, IntPtr*, uint>)&_getExpectedTargetArchitecture;
|
||||
callbacks[167] = (delegate* unmanaged<IntPtr, IntPtr*, CORJIT_FLAGS*, uint, uint>)&_getJitFlags;
|
||||
|
|
|
@ -323,7 +323,7 @@ FUNCTIONS
|
|||
JITINTERFACE_HRESULT getPgoInstrumentationResults(CORINFO_METHOD_HANDLE ftnHnd, ICorJitInfo::PgoInstrumentationSchema** pSchema, uint32_t* pCountSchemaItems, uint8_t**pInstrumentationData, ICorJitInfo::PgoSource* pgoSource)
|
||||
JITINTERFACE_HRESULT allocPgoInstrumentationBySchema(CORINFO_METHOD_HANDLE ftnHnd, ICorJitInfo::PgoInstrumentationSchema* pSchema, uint32_t countSchemaItems, uint8_t** pInstrumentationData)
|
||||
void recordCallSite(uint32_t instrOffset, CORINFO_SIG_INFO* callSig, CORINFO_METHOD_HANDLE methodHandle)
|
||||
void recordRelocation(void* location, void* locationRW, void* target, uint16_t fRelocType, uint16_t slotNum, int32_t addlDelta)
|
||||
void recordRelocation(void* location, void* locationRW, void* target, uint16_t fRelocType, int32_t addlDelta)
|
||||
uint16_t getRelocTypeHint(void* target)
|
||||
uint32_t getExpectedTargetArchitecture()
|
||||
uint32_t getJitFlags(CORJIT_FLAGS* flags, uint32_t sizeInBytes)
|
||||
|
|
|
@ -175,7 +175,7 @@ struct JitInterfaceCallbacks
|
|||
JITINTERFACE_HRESULT (* getPgoInstrumentationResults)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_METHOD_HANDLE ftnHnd, ICorJitInfo::PgoInstrumentationSchema** pSchema, uint32_t* pCountSchemaItems, uint8_t** pInstrumentationData, ICorJitInfo::PgoSource* pgoSource);
|
||||
JITINTERFACE_HRESULT (* allocPgoInstrumentationBySchema)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_METHOD_HANDLE ftnHnd, ICorJitInfo::PgoInstrumentationSchema* pSchema, uint32_t countSchemaItems, uint8_t** pInstrumentationData);
|
||||
void (* recordCallSite)(void * thisHandle, CorInfoExceptionClass** ppException, uint32_t instrOffset, CORINFO_SIG_INFO* callSig, CORINFO_METHOD_HANDLE methodHandle);
|
||||
void (* recordRelocation)(void * thisHandle, CorInfoExceptionClass** ppException, void* location, void* locationRW, void* target, uint16_t fRelocType, uint16_t slotNum, int32_t addlDelta);
|
||||
void (* recordRelocation)(void * thisHandle, CorInfoExceptionClass** ppException, void* location, void* locationRW, void* target, uint16_t fRelocType, int32_t addlDelta);
|
||||
uint16_t (* getRelocTypeHint)(void * thisHandle, CorInfoExceptionClass** ppException, void* target);
|
||||
uint32_t (* getExpectedTargetArchitecture)(void * thisHandle, CorInfoExceptionClass** ppException);
|
||||
uint32_t (* getJitFlags)(void * thisHandle, CorInfoExceptionClass** ppException, CORJIT_FLAGS* flags, uint32_t sizeInBytes);
|
||||
|
@ -1802,11 +1802,10 @@ public:
|
|||
void* locationRW,
|
||||
void* target,
|
||||
uint16_t fRelocType,
|
||||
uint16_t slotNum,
|
||||
int32_t addlDelta)
|
||||
{
|
||||
CorInfoExceptionClass* pException = nullptr;
|
||||
_callbacks->recordRelocation(_thisHandle, &pException, location, locationRW, target, fRelocType, slotNum, addlDelta);
|
||||
_callbacks->recordRelocation(_thisHandle, &pException, location, locationRW, target, fRelocType, addlDelta);
|
||||
if (pException != nullptr) throw pException;
|
||||
}
|
||||
|
||||
|
|
|
@ -661,7 +661,6 @@ struct Agnostic_RecordRelocation
|
|||
DWORDLONG location;
|
||||
DWORDLONG target;
|
||||
DWORD fRelocType;
|
||||
DWORD slotNum;
|
||||
DWORD addlDelta;
|
||||
};
|
||||
|
||||
|
|
|
@ -645,9 +645,9 @@ void CompileResult::dmpReportFatalError(DWORD key, DWORD value)
|
|||
printf("ReportFatalError key Count-%u, value result-%08X", key, value);
|
||||
}
|
||||
|
||||
void CompileResult::recRecordRelocation(void* location, void* target, uint16_t fRelocType, uint16_t slotNum, int32_t addlDelta)
|
||||
void CompileResult::recRecordRelocation(void* location, void* target, uint16_t fRelocType, int32_t addlDelta)
|
||||
{
|
||||
repRecordRelocation(location, target, fRelocType, slotNum, addlDelta);
|
||||
repRecordRelocation(location, target, fRelocType, addlDelta);
|
||||
}
|
||||
|
||||
const char* relocationTypeToString(uint16_t fRelocType)
|
||||
|
@ -679,11 +679,11 @@ const char* relocationTypeToString(uint16_t fRelocType)
|
|||
}
|
||||
void CompileResult::dmpRecordRelocation(DWORD key, const Agnostic_RecordRelocation& value)
|
||||
{
|
||||
printf("RecordRelocation key %u, value loc-%016" PRIX64 " tgt-%016" PRIX64 " fRelocType-%u(%s) slotNum-%u addlDelta:%d", key,
|
||||
printf("RecordRelocation key %u, value loc-%016" PRIX64 " tgt-%016" PRIX64 " fRelocType-%u(%s) addlDelta:%d", key,
|
||||
value.location, value.target, value.fRelocType, relocationTypeToString((uint16_t)value.fRelocType),
|
||||
value.slotNum, (int32_t)value.addlDelta);
|
||||
(int32_t)value.addlDelta);
|
||||
}
|
||||
void CompileResult::repRecordRelocation(void* location, void* target, uint16_t fRelocType, uint16_t slotNum, int32_t addlDelta)
|
||||
void CompileResult::repRecordRelocation(void* location, void* target, uint16_t fRelocType, int32_t addlDelta)
|
||||
{
|
||||
if (RecordRelocation == nullptr)
|
||||
RecordRelocation = new DenseLightWeightMap<Agnostic_RecordRelocation>();
|
||||
|
@ -693,11 +693,8 @@ void CompileResult::repRecordRelocation(void* location, void* target, uint16_t f
|
|||
value.location = CastPointer(location);
|
||||
value.target = CastPointer(target);
|
||||
value.fRelocType = (DWORD)fRelocType;
|
||||
value.slotNum = (DWORD)slotNum;
|
||||
value.addlDelta = (DWORD)addlDelta;
|
||||
|
||||
Assert(value.slotNum == 0);
|
||||
|
||||
RecordRelocation->Append(value);
|
||||
}
|
||||
|
||||
|
@ -872,7 +869,7 @@ void CompileResult::applyRelocs(RelocContext* rc, unsigned char* block1, ULONG b
|
|||
{
|
||||
if (relocType == IMAGE_REL_BASED_DIR64)
|
||||
{
|
||||
DWORDLONG fixupLocation = tmp.location + tmp.slotNum;
|
||||
DWORDLONG fixupLocation = tmp.location;
|
||||
|
||||
// Write 64-bits into location
|
||||
size_t address = section_begin + (size_t)fixupLocation - (size_t)originalAddr;
|
||||
|
@ -893,7 +890,7 @@ void CompileResult::applyRelocs(RelocContext* rc, unsigned char* block1, ULONG b
|
|||
// Now do all-platform relocations.
|
||||
if (tmp.fRelocType == IMAGE_REL_BASED_REL32)
|
||||
{
|
||||
DWORDLONG fixupLocation = tmp.location + tmp.slotNum;
|
||||
DWORDLONG fixupLocation = tmp.location;
|
||||
|
||||
size_t address = section_begin + (size_t)fixupLocation - (size_t)originalAddr;
|
||||
if ((section_begin <= address) && (address < section_end)) // A reloc for our section?
|
||||
|
|
|
@ -178,9 +178,9 @@ public:
|
|||
void recReportFatalError(CorJitResult result);
|
||||
void dmpReportFatalError(DWORD key, DWORD value);
|
||||
|
||||
void recRecordRelocation(void* location, void* target, uint16_t fRelocType, uint16_t slotNum, int32_t addlDelta);
|
||||
void recRecordRelocation(void* location, void* target, uint16_t fRelocType, int32_t addlDelta);
|
||||
void dmpRecordRelocation(DWORD key, const Agnostic_RecordRelocation& value);
|
||||
void repRecordRelocation(void* location, void* target, uint16_t fRelocType, uint16_t slotNum, int32_t addlDelta);
|
||||
void repRecordRelocation(void* location, void* target, uint16_t fRelocType, int32_t addlDelta);
|
||||
void applyRelocs(RelocContext* rc, unsigned char* block1, ULONG blocksize1, void* originalAddr);
|
||||
|
||||
void recProcessName(const char* name);
|
||||
|
|
|
@ -1900,13 +1900,12 @@ void interceptor_ICJI::recordRelocation(void* location, /* IN */
|
|||
void* locationRW, /* IN */
|
||||
void* target, /* IN */
|
||||
uint16_t fRelocType, /* IN */
|
||||
uint16_t slotNum, /* IN */
|
||||
int32_t addlDelta /* IN */
|
||||
)
|
||||
{
|
||||
mc->cr->AddCall("recordRelocation");
|
||||
original_ICorJitInfo->recordRelocation(location, locationRW, target, fRelocType, slotNum, addlDelta);
|
||||
mc->cr->recRecordRelocation(location, target, fRelocType, slotNum, addlDelta);
|
||||
original_ICorJitInfo->recordRelocation(location, locationRW, target, fRelocType, addlDelta);
|
||||
mc->cr->recRecordRelocation(location, target, fRelocType, addlDelta);
|
||||
}
|
||||
|
||||
uint16_t interceptor_ICJI::getRelocTypeHint(void* target)
|
||||
|
|
|
@ -1346,11 +1346,10 @@ void interceptor_ICJI::recordRelocation(
|
|||
void* locationRW,
|
||||
void* target,
|
||||
uint16_t fRelocType,
|
||||
uint16_t slotNum,
|
||||
int32_t addlDelta)
|
||||
{
|
||||
mcs->AddCall("recordRelocation");
|
||||
original_ICorJitInfo->recordRelocation(location, locationRW, target, fRelocType, slotNum, addlDelta);
|
||||
original_ICorJitInfo->recordRelocation(location, locationRW, target, fRelocType, addlDelta);
|
||||
}
|
||||
|
||||
uint16_t interceptor_ICJI::getRelocTypeHint(
|
||||
|
|
|
@ -1182,10 +1182,9 @@ void interceptor_ICJI::recordRelocation(
|
|||
void* locationRW,
|
||||
void* target,
|
||||
uint16_t fRelocType,
|
||||
uint16_t slotNum,
|
||||
int32_t addlDelta)
|
||||
{
|
||||
original_ICorJitInfo->recordRelocation(location, locationRW, target, fRelocType, slotNum, addlDelta);
|
||||
original_ICorJitInfo->recordRelocation(location, locationRW, target, fRelocType, addlDelta);
|
||||
}
|
||||
|
||||
uint16_t interceptor_ICJI::getRelocTypeHint(
|
||||
|
|
|
@ -1752,12 +1752,11 @@ void MyICJI::recordRelocation(void* location, /* IN */
|
|||
void* locationRW, /* IN */
|
||||
void* target, /* IN */
|
||||
uint16_t fRelocType, /* IN */
|
||||
uint16_t slotNum, /* IN */
|
||||
int32_t addlDelta /* IN */
|
||||
)
|
||||
{
|
||||
jitInstance->mc->cr->AddCall("recordRelocation");
|
||||
jitInstance->mc->cr->repRecordRelocation(location, target, fRelocType, slotNum, addlDelta);
|
||||
jitInstance->mc->cr->repRecordRelocation(location, target, fRelocType, addlDelta);
|
||||
}
|
||||
|
||||
uint16_t MyICJI::getRelocTypeHint(void* target)
|
||||
|
|
|
@ -11062,7 +11062,6 @@ void CEEJitInfo::recordRelocation(void * location,
|
|||
void * locationRW,
|
||||
void * target,
|
||||
WORD fRelocType,
|
||||
WORD slot,
|
||||
INT32 addlDelta)
|
||||
{
|
||||
CONTRACTL {
|
||||
|
@ -11080,7 +11079,7 @@ void CEEJitInfo::recordRelocation(void * location,
|
|||
{
|
||||
case IMAGE_REL_BASED_DIR64:
|
||||
// Write 64-bits into location
|
||||
*((UINT64 *) ((BYTE *) locationRW + slot)) = (UINT64) target;
|
||||
*((UINT64 *) locationRW) = (UINT64) target;
|
||||
break;
|
||||
|
||||
#ifdef TARGET_AMD64
|
||||
|
@ -11088,8 +11087,8 @@ void CEEJitInfo::recordRelocation(void * location,
|
|||
{
|
||||
target = (BYTE *)target + addlDelta;
|
||||
|
||||
INT32 * fixupLocation = (INT32 *) ((BYTE *) location + slot);
|
||||
INT32 * fixupLocationRW = (INT32 *) ((BYTE *) locationRW + slot);
|
||||
INT32 * fixupLocation = (INT32 *) location;
|
||||
INT32 * fixupLocationRW = (INT32 *) locationRW;
|
||||
BYTE * baseAddr = (BYTE *)fixupLocation + sizeof(INT32);
|
||||
|
||||
delta = (INT64)((BYTE *)target - baseAddr);
|
||||
|
@ -11143,7 +11142,6 @@ void CEEJitInfo::recordRelocation(void * location,
|
|||
#ifdef TARGET_ARM64
|
||||
case IMAGE_REL_ARM64_BRANCH26: // 26 bit offset << 2 & sign ext, for B and BL
|
||||
{
|
||||
_ASSERTE(slot == 0);
|
||||
_ASSERTE(addlDelta == 0);
|
||||
|
||||
PCODE branchTarget = (PCODE) target;
|
||||
|
@ -11220,7 +11218,6 @@ void CEEJitInfo::recordRelocation(void * location,
|
|||
|
||||
case IMAGE_REL_ARM64_PAGEBASE_REL21:
|
||||
{
|
||||
_ASSERTE(slot == 0);
|
||||
_ASSERTE(addlDelta == 0);
|
||||
|
||||
// Write the 21 bits pc-relative page address into location.
|
||||
|
@ -11234,7 +11231,6 @@ void CEEJitInfo::recordRelocation(void * location,
|
|||
|
||||
case IMAGE_REL_ARM64_PAGEOFFSET_12A:
|
||||
{
|
||||
_ASSERTE(slot == 0);
|
||||
_ASSERTE(addlDelta == 0);
|
||||
|
||||
// Write the 12 bits page offset into location.
|
||||
|
@ -14078,7 +14074,6 @@ void CEEInfo::recordRelocation(
|
|||
void * locationRW, /* IN */
|
||||
void * target, /* IN */
|
||||
WORD fRelocType, /* IN */
|
||||
WORD slotNum, /* IN */
|
||||
INT32 addlDelta /* IN */
|
||||
)
|
||||
{
|
||||
|
|
|
@ -653,7 +653,6 @@ public:
|
|||
void *locationRW,
|
||||
void *target,
|
||||
uint16_t fRelocType,
|
||||
uint16_t slot,
|
||||
int32_t addlDelta) override final;
|
||||
|
||||
uint16_t getRelocTypeHint(void * target) override final;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue