Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust logic in cor.h, corhdr.h, corinfo.h, corjit.h and such so that they may be included without the PAL #46055

Merged
merged 9 commits into from
Feb 18, 2021
Next Next commit
Complete conversion to "standard" types for jit interface
Convert most implementation to the standard types

Rerun generation tool

It actually builds!

Fix ifdef

Fix CorSigUncompressData duplication on Unix

Remove pointless use of specstring.h header

Packing doesn't need to be specified:

specstrings tweaks

stdcall tweak

Use standard sized int types in more places

Fix non-x64 arch issues

Apply formatting patch
  • Loading branch information
davidwrighton committed Jan 27, 2021
commit 027974814905ee6990e889b1f773b8f39e2f637b
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ void CompileResult::repAllocGCInfo(size_t* size, void** retval)
*retval = (void*)AllocGCInfo->GetBuffer(value.retval_offset);
}

void CompileResult::recCompileMethod(BYTE** nativeEntry, ULONG* nativeSizeOfCode, CorJitResult result)
void CompileResult::recCompileMethod(uint8_t** nativeEntry, uint32_t* nativeSizeOfCode, CorJitResult result)
{
if (CompileMethod == nullptr)
CompileMethod = new LightWeightMap<DWORD, Agnostic_CompileMethodResults>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class CompileResult
void dmpAllocGCInfo(DWORD key, const Agnostic_AllocGCInfo& value);
void repAllocGCInfo(size_t* size, void** retval);

void recCompileMethod(BYTE** nativeEntry, ULONG* nativeSizeOfCode, CorJitResult result);
void recCompileMethod(uint8_t** nativeEntry, uint32_t* nativeSizeOfCode, CorJitResult result);
void dmpCompileMethod(DWORD key, const Agnostic_CompileMethodResults& value);
void repCompileMethod(BYTE** nativeEntry, ULONG* nativeSizeOfCode, CorJitResult* result);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
CorJitResult __stdcall compileMethod(ICorJitInfo* comp, /* IN */
struct CORINFO_METHOD_INFO* info, /* IN */
unsigned /* code:CorJitFlag */ flags, /* IN */
BYTE** nativeEntry, /* OUT */
ULONG* nativeSizeOfCode /* OUT */
uint8_t** nativeEntry, /* OUT */
uint32_t* nativeSizeOfCode /* OUT */
);

// Do any appropriate work at process shutdown. Default impl is to do nothing.
Expand Down
30 changes: 15 additions & 15 deletions src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,7 @@ void MethodContext::repGetVars(CORINFO_METHOD_HANDLE ftn,
// Note - the jit will call freearray on the array we give back....
void MethodContext::recGetBoundaries(CORINFO_METHOD_HANDLE ftn,
unsigned int* cILOffsets,
DWORD** pILOffsets,
uint32_t** pILOffsets,
ICorDebugInfo::BoundaryTypes* implictBoundaries)
{
if (GetBoundaries == nullptr)
Expand Down Expand Up @@ -846,7 +846,7 @@ void MethodContext::dmpGetBoundaries(DWORDLONG key, const Agnostic_GetBoundaries
}
void MethodContext::repGetBoundaries(CORINFO_METHOD_HANDLE ftn,
unsigned int* cILOffsets,
DWORD** pILOffsets,
uint32_t** pILOffsets,
ICorDebugInfo::BoundaryTypes* implictBoundaries)
{
Agnostic_GetBoundaries value;
Expand All @@ -855,7 +855,7 @@ void MethodContext::repGetBoundaries(CORINFO_METHOD_HANDLE ftn,

*cILOffsets = (unsigned int)value.cILOffsets;
if (*cILOffsets > 0)
*pILOffsets = (DWORD*)GetBoundaries->GetBuffer(value.pILOffset_offset);
*pILOffsets = (uint32_t*)GetBoundaries->GetBuffer(value.pILOffset_offset);
*implictBoundaries = (ICorDebugInfo::BoundaryTypes)value.implicitBoundaries;

DEBUG_REP(dmpGetBoundaries(CastHandle(ftn), value));
Expand Down Expand Up @@ -1128,7 +1128,7 @@ LPCWSTR MethodContext::repGetJitTimeLogFilename()

void MethodContext::recCanInline(CORINFO_METHOD_HANDLE callerHnd,
CORINFO_METHOD_HANDLE calleeHnd,
DWORD* pRestrictions,
uint32_t* pRestrictions,
CorInfoInline response,
DWORD exceptionCode)
{
Expand Down Expand Up @@ -1160,7 +1160,7 @@ void MethodContext::dmpCanInline(DLDL key, const Agnostic_CanInline& value)
}
CorInfoInline MethodContext::repCanInline(CORINFO_METHOD_HANDLE callerHnd,
CORINFO_METHOD_HANDLE calleeHnd,
DWORD* pRestrictions,
uint32_t* pRestrictions,
DWORD* exceptionCode)
{
DLDL key;
Expand Down Expand Up @@ -4035,7 +4035,7 @@ const void* MethodContext::repGetInlinedCallFrameVptr(void** ppIndirection)
return (const void*)value.B;
}

void MethodContext::recGetAddrOfCaptureThreadGlobal(void** ppIndirection, LONG* result)
void MethodContext::recGetAddrOfCaptureThreadGlobal(void** ppIndirection, int32_t* result)
{
if (GetAddrOfCaptureThreadGlobal == nullptr)
GetAddrOfCaptureThreadGlobal = new LightWeightMap<DWORD, DLDL>();
Expand All @@ -4055,15 +4055,15 @@ void MethodContext::dmpGetAddrOfCaptureThreadGlobal(DWORD key, DLDL value)
{
printf("GetAddrOfCaptureThreadGlobal key %u, value ppi-%016llX res-%016llX", key, value.A, value.B);
}
LONG* MethodContext::repGetAddrOfCaptureThreadGlobal(void** ppIndirection)
int32_t* MethodContext::repGetAddrOfCaptureThreadGlobal(void** ppIndirection)
{
DLDL value;

if ((GetAddrOfCaptureThreadGlobal == nullptr) || (GetAddrOfCaptureThreadGlobal->GetIndex((DWORD)0) == -1))
{
#ifdef sparseMC
LogDebug("Sparse - repGetAddrOfCaptureThreadGlobal returning 0xCAFE0001");
return (LONG*)(size_t)0xCAFE0001;
return (int32_t*)(size_t)0xCAFE0001;
#else
LogException(EXCEPTIONCODE_MC, "Didn't find anything for GetAddrOfCaptureThreadGlobal", "");
#endif
Expand All @@ -4073,7 +4073,7 @@ LONG* MethodContext::repGetAddrOfCaptureThreadGlobal(void** ppIndirection)
if (ppIndirection != nullptr)
*ppIndirection = (void*)value.A;
DEBUG_REP(dmpGetAddrOfCaptureThreadGlobal((DWORD)0, value));
return (LONG*)value.B;
return (int32_t*)value.B;
}

void MethodContext::recGetClassDomainID(CORINFO_CLASS_HANDLE cls, void** ppIndirection, unsigned result)
Expand Down Expand Up @@ -4458,7 +4458,7 @@ bool MethodContext::repIsValidStringRef(CORINFO_MODULE_HANDLE module, unsigned m
}


void MethodContext::recGetStringLiteral(CORINFO_MODULE_HANDLE module, unsigned metaTOK, int length, LPCWSTR result)
void MethodContext::recGetStringLiteral(CORINFO_MODULE_HANDLE module, unsigned metaTOK, int length, const char16_t* result)
{
if (GetStringLiteral == nullptr)
GetStringLiteral = new LightWeightMap<DLD, DD>();
Expand All @@ -4472,7 +4472,7 @@ void MethodContext::recGetStringLiteral(CORINFO_MODULE_HANDLE module, unsigned m

DWORD strBuf = (DWORD)-1;
if (result != nullptr)
strBuf = (DWORD)GetStringLiteral->AddBuffer((unsigned char*)result, (unsigned int)((wcslen(result) * 2) + 2));
strBuf = (DWORD)GetStringLiteral->AddBuffer((unsigned char*)result, (unsigned int)((wcslen((LPCWSTR)result) * 2) + 2));

DD value;
value.A = (DWORD)length;
Expand All @@ -4487,7 +4487,7 @@ void MethodContext::dmpGetStringLiteral(DLD key, DD value)
GetStringLiteral->GetBuffer(value.B), value.A);
}

LPCWSTR MethodContext::repGetStringLiteral(CORINFO_MODULE_HANDLE module, unsigned metaTOK, int* length)
const char16_t* MethodContext::repGetStringLiteral(CORINFO_MODULE_HANDLE module, unsigned metaTOK, int* length)
{
if (GetStringLiteral == nullptr)
{
Expand All @@ -4512,7 +4512,7 @@ LPCWSTR MethodContext::repGetStringLiteral(CORINFO_MODULE_HANDLE module, unsigne
{
DD result = GetStringLiteral->Get(key);
*length = (int)result.A;
return (LPCWSTR)GetStringLiteral->GetBuffer(itemIndex);
return (const char16_t*)GetStringLiteral->GetBuffer(itemIndex);
}
}

Expand Down Expand Up @@ -6058,7 +6058,7 @@ CORINFO_CLASS_HANDLE MethodContext::repGetTypeInstantiationArgument(CORINFO_CLAS
}

void MethodContext::recAppendClassName(
CORINFO_CLASS_HANDLE cls, bool fNamespace, bool fFullInst, bool fAssembly, const WCHAR* result)
CORINFO_CLASS_HANDLE cls, bool fNamespace, bool fFullInst, bool fAssembly, const char16_t* result)
{
if (AppendClassName == nullptr)
AppendClassName = new LightWeightMap<Agnostic_AppendClassName, DWORD>();
Expand All @@ -6073,7 +6073,7 @@ void MethodContext::recAppendClassName(

DWORD temp = (DWORD)-1;
if (result != nullptr)
temp = (DWORD)AppendClassName->AddBuffer((unsigned char*)result, (unsigned int)((wcslen(result) * 2) + 2));
temp = (DWORD)AppendClassName->AddBuffer((unsigned char*)result, (unsigned int)((wcslen((LPCWSTR)result) * 2) + 2));

AppendClassName->Add(key, (DWORD)temp);
DEBUG_REC(dmpAppendClassName(key, (DWORD)temp));
Expand Down
18 changes: 9 additions & 9 deletions src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ class MethodContext

void recGetBoundaries(CORINFO_METHOD_HANDLE ftn,
unsigned int* cILOffsets,
DWORD** pILOffsets,
uint32_t** pILOffsets,
ICorDebugInfo::BoundaryTypes* implictBoundaries);
void dmpGetBoundaries(DWORDLONG key, const Agnostic_GetBoundaries& value);
void repGetBoundaries(CORINFO_METHOD_HANDLE ftn,
unsigned int* cILOffsets,
DWORD** pILOffsets,
uint32_t** pILOffsets,
ICorDebugInfo::BoundaryTypes* implictBoundaries);

void recInitClass(CORINFO_FIELD_HANDLE field,
Expand Down Expand Up @@ -133,13 +133,13 @@ class MethodContext

void recCanInline(CORINFO_METHOD_HANDLE callerHnd,
CORINFO_METHOD_HANDLE calleeHnd,
DWORD* pRestrictions,
uint32_t* pRestrictions,
CorInfoInline response,
DWORD exceptionCode);
void dmpCanInline(DLDL key, const Agnostic_CanInline& value);
CorInfoInline repCanInline(CORINFO_METHOD_HANDLE callerHnd,
CORINFO_METHOD_HANDLE calleeHnd,
DWORD* pRestrictions,
uint32_t* pRestrictions,
DWORD* exceptionCode);

void recResolveToken(CORINFO_RESOLVED_TOKEN* pResolvedToken, DWORD exceptionCode);
Expand Down Expand Up @@ -484,9 +484,9 @@ class MethodContext
void dmpGetInlinedCallFrameVptr(DWORD key, DLDL value);
const void* repGetInlinedCallFrameVptr(void** ppIndirection);

void recGetAddrOfCaptureThreadGlobal(void** ppIndirection, LONG* result);
void recGetAddrOfCaptureThreadGlobal(void** ppIndirection, int32_t* result);
void dmpGetAddrOfCaptureThreadGlobal(DWORD key, DLDL value);
LONG* repGetAddrOfCaptureThreadGlobal(void** ppIndirection);
int32_t* repGetAddrOfCaptureThreadGlobal(void** ppIndirection);

void recGetClassDomainID(CORINFO_CLASS_HANDLE cls, void** ppIndirection, unsigned result);
void dmpGetClassDomainID(DWORDLONG key, DLD value);
Expand Down Expand Up @@ -542,9 +542,9 @@ class MethodContext
void dmpIsValidStringRef(DLD key, DWORD value);
bool repIsValidStringRef(CORINFO_MODULE_HANDLE module, unsigned metaTOK);

void recGetStringLiteral(CORINFO_MODULE_HANDLE module, unsigned metaTOK, int length, LPCWSTR result);
void recGetStringLiteral(CORINFO_MODULE_HANDLE module, unsigned metaTOK, int length, const char16_t* result);
void dmpGetStringLiteral(DLD key, DD value);
LPCWSTR repGetStringLiteral(CORINFO_MODULE_HANDLE module, unsigned metaTOK, int* length);
const char16_t* repGetStringLiteral(CORINFO_MODULE_HANDLE module, unsigned metaTOK, int* length);

void recGetHelperName(CorInfoHelpFunc funcNum, const char* result);
void dmpGetHelperName(DWORD key, DWORD value);
Expand Down Expand Up @@ -729,7 +729,7 @@ class MethodContext
CORINFO_CLASS_HANDLE repGetTypeInstantiationArgument(CORINFO_CLASS_HANDLE cls, unsigned index);

void recAppendClassName(
CORINFO_CLASS_HANDLE cls, bool fNamespace, bool fFullInst, bool fAssembly, const WCHAR* result);
CORINFO_CLASS_HANDLE cls, bool fNamespace, bool fFullInst, bool fAssembly, const char16_t* result);
void dmpAppendClassName(const Agnostic_AppendClassName& key, DWORD value);
const WCHAR* repAppendClassName(CORINFO_CLASS_HANDLE cls, bool fNamespace, bool fFullInst, bool fAssembly);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
CorJitResult __stdcall interceptor_ICJC::compileMethod(ICorJitInfo* comp, /* IN */
struct CORINFO_METHOD_INFO* info, /* IN */
unsigned /* code:CorJitFlag */ flags, /* IN */
BYTE** nativeEntry, /* OUT */
ULONG* nativeSizeOfCode /* OUT */
uint8_t** nativeEntry, /* OUT */
uint32_t* nativeSizeOfCode /* OUT */
)
{
interceptor_ICJI our_ICorJitInfo;
Expand Down
Loading