From e91c55bdc514bc3901f0ad46d64d95ea092de933 Mon Sep 17 00:00:00 2001 From: Rattenkrieg Date: Sat, 12 Dec 2020 23:12:09 +0300 Subject: [PATCH] rebased on master --- .../superpmi-shared/icorjitinfoimpl.h | 4 +- .../superpmi/superpmi-shared/lwmlist.h | 2 +- .../superpmi-shared/methodcontext.cpp | 133 +- .../superpmi/superpmi-shared/methodcontext.h | 50 +- .../superpmi-shim-collector/icorjitinfo.cpp | 16 +- .../superpmi-shim-counter/icorjitinfo.cpp | 6 +- .../superpmi-shim-simple/icorjitinfo.cpp | 6 +- src/coreclr/inc/corinfo.h | 59 +- src/coreclr/jit/ICorJitInfo_API_wrapper.hpp | 16 +- src/coreclr/jit/compiler.cpp | 6 +- src/coreclr/jit/compiler.hpp | 10 +- src/coreclr/jit/importer.cpp | 60 +- .../superpmi-shared/icorjitinfoimpl.h | 1029 ---------- .../superpmi-shim-counter/icorjitinfo.cpp | 1671 ----------------- .../superpmi-shim-simple/icorjitinfo.cpp | 1484 --------------- .../src/tools/aot/jitinterface/jitinterface.h | 1655 ---------------- .../tools/Common/JitInterface/CorInfoBase.cs | 6 +- .../tools/Common/JitInterface/CorInfoImpl.cs | 91 +- .../tools/Common/JitInterface/CorInfoTypes.cs | 32 +- .../ThunkGenerator/ThunkInput.txt | 10 +- .../tools/aot/jitinterface/jitinterface.h | 143 +- src/coreclr/vm/jitinterface.cpp | 121 +- src/coreclr/vm/jitinterface.h | 35 +- src/coreclr/zap/zapinfo.cpp | 82 +- src/coreclr/zap/zapinfo.h | 16 +- 25 files changed, 429 insertions(+), 6314 deletions(-) delete mode 100644 src/coreclr/src/ToolBox/superpmi/superpmi-shared/icorjitinfoimpl.h delete mode 100644 src/coreclr/src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp delete mode 100644 src/coreclr/src/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp delete mode 100644 src/coreclr/src/tools/aot/jitinterface/jitinterface.h diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shared/icorjitinfoimpl.h b/src/coreclr/ToolBox/superpmi/superpmi-shared/icorjitinfoimpl.h index 9693846a6f3b9..7763f2181b6bb 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi-shared/icorjitinfoimpl.h +++ b/src/coreclr/ToolBox/superpmi/superpmi-shared/icorjitinfoimpl.h @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // DO NOT EDIT THIS FILE! IT IS AUTOGENERATED -// To regenerate run the gen script in src/coreclr/tools/Common/JitInterface/ThunkGenerator +// To regenerate run the gen script in src/coreclr/src/tools/Common/JitInterface/ThunkGenerator // and follow the instructions in docs/project/updating-jitinterface.md #ifndef _ICorJitInfoImpl @@ -624,7 +624,7 @@ bool convertPInvokeCalliToCall( CORINFO_RESOLVED_TOKEN* pResolvedToken, bool mustConvert); -bool notifyInstructionSetUsage( +void notifyInstructionSetUsage( CORINFO_InstructionSet instructionSet, bool supportEnabled); diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shared/lwmlist.h b/src/coreclr/ToolBox/superpmi/superpmi-shared/lwmlist.h index 717f65e1dd5aa..8aca1b1634b83 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi-shared/lwmlist.h +++ b/src/coreclr/ToolBox/superpmi/superpmi-shared/lwmlist.h @@ -151,7 +151,7 @@ LWM(MergeClasses, DLDL, DWORDLONG) LWM(IsMoreSpecificType, DLDL, DWORD) LWM(PInvokeMarshalingRequired, PInvokeMarshalingRequiredValue, DWORD) LWM(ResolveToken, Agnostic_CORINFO_RESOLVED_TOKENin, ResolveTokenValue) -LWM(TryResolveVirtualMethod, Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTin, TryResolveVirtualMethodValue) +LWM(ResolveVirtualMethod, Agnostic_ResolveVirtualMethodKey, Agnostic_ResolveVirtualMethodResult) LWM(TryResolveToken, Agnostic_CORINFO_RESOLVED_TOKENin, TryResolveTokenValue) LWM(SatisfiesClassConstraints, DWORDLONG, DWORD) LWM(SatisfiesMethodConstraints, DLDL, DWORD) diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.cpp b/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.cpp index f7e8aee34cf65..8aa81d1087cc4 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.cpp +++ b/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.cpp @@ -510,7 +510,7 @@ const char* toString(CorInfoType cit) return "undef"; case CORINFO_TYPE_VOID: return "void"; - case CORINFO_TYPE_BOOL: + case CORINFO_TYPE_bool: return "bool"; case CORINFO_TYPE_CHAR: return "char"; @@ -561,7 +561,7 @@ unsigned int toCorInfoSize(CorInfoType cit) { switch (cit) { - case CORINFO_TYPE_BOOL: + case CORINFO_TYPE_bool: case CORINFO_TYPE_BYTE: case CORINFO_TYPE_UBYTE: return 1; @@ -1273,7 +1273,7 @@ void MethodContext::recResolveToken(CORINFO_RESOLVED_TOKEN* pResolvedToken, DWOR key = SpmiRecordsHelper::CreateAgnostic_CORINFO_RESOLVED_TOKENin(pResolvedToken); ResolveTokenValue value; - value.tokenOut = SpmiRecordsHelper::StoreAgnostic_CORINFO_RESOLVED_TOKENout(pResolvedToken, ResolveToken); + value.tokenOut = SpmiRecordsHelper::StoreAgnostic_CORINFO_RESOLVED_TOKENout(pResolvedToken, TryResolveToken); value.exceptionCode = (DWORD)exceptionCode; ResolveToken->Add(key, value); @@ -1296,7 +1296,7 @@ void MethodContext::repResolveToken(CORINFO_RESOLVED_TOKEN* pResolvedToken, DWOR ResolveTokenValue value = ResolveToken->Get(key); - SpmiRecordsHelper::Restore_CORINFO_RESOLVED_TOKENout(pResolvedToken, value.tokenOut, ResolveToken); + SpmiRecordsHelper::Restore_CORINFO_RESOLVED_TOKENout(pResolvedToken, value.tokenOut, TryResolveToken); *exceptionCode = (DWORD)value.exceptionCode; DEBUG_REP(dmpResolveToken(key, value)); } @@ -1313,7 +1313,7 @@ void MethodContext::recTryResolveToken(CORINFO_RESOLVED_TOKEN* pResolvedToken, b TryResolveTokenValue value; - value.tokenOut = SpmiRecordsHelper::StoreAgnostic_CORINFO_RESOLVED_TOKENout(pResolvedToken, TryResolveToken); + value.tokenOut = SpmiRecordsHelper::StoreAgnostic_CORINFO_RESOLVED_TOKENout(pResolvedToken, ResolveToken); value.success = success ? 0 : 1; TryResolveToken->Add(key, value); @@ -1335,7 +1335,7 @@ bool MethodContext::repTryResolveToken(CORINFO_RESOLVED_TOKEN* pResolvedToken) TryResolveTokenValue value = TryResolveToken->Get(key); - SpmiRecordsHelper::Restore_CORINFO_RESOLVED_TOKENout(pResolvedToken, value.tokenOut, TryResolveToken); + SpmiRecordsHelper::Restore_CORINFO_RESOLVED_TOKENout(pResolvedToken, value.tokenOut, ResolveToken); DEBUG_REP(dmpTryResolveToken(key, value)); return (DWORD)value.success == 0; @@ -1474,9 +1474,9 @@ void MethodContext::repGetCallInfo(CORINFO_RESOLVED_TOKEN* pResolvedToken, } pResult->thisTransform = (CORINFO_THIS_TRANSFORM)value.thisTransform; pResult->kind = (CORINFO_CALL_KIND)value.kind; - pResult->nullInstanceCheck = (BOOL)value.nullInstanceCheck; + pResult->nullInstanceCheck = (bool)value.nullInstanceCheck; pResult->contextHandle = (CORINFO_CONTEXT_HANDLE)value.contextHandle; - pResult->exactContextNeedsRuntimeLookup = (BOOL)value.exactContextNeedsRuntimeLookup; + pResult->exactContextNeedsRuntimeLookup = (bool)value.exactContextNeedsRuntimeLookup; pResult->stubLookup.lookupKind.needsRuntimeLookup = value.stubLookup.lookupKind.needsRuntimeLookup != 0; pResult->stubLookup.lookupKind.runtimeLookupKind = (CORINFO_RUNTIME_LOOKUP_KIND)value.stubLookup.lookupKind.runtimeLookupKind; @@ -1496,7 +1496,7 @@ void MethodContext::repGetCallInfo(CORINFO_RESOLVED_TOKEN* pResolvedToken, } pResult->instParamLookup.accessType = (InfoAccessType)value.instParamLookup.accessType; pResult->instParamLookup.handle = (CORINFO_GENERIC_HANDLE)value.instParamLookup.handle; - pResult->wrapperDelegateInvoke = (BOOL)value.wrapperDelegateInvoke; + pResult->wrapperDelegateInvoke = (bool)value.wrapperDelegateInvoke; *exceptionCode = (DWORD)value.exceptionCode; DEBUG_REP(dmpGetCallInfo(key, value)); @@ -1619,7 +1619,7 @@ bool MethodContext::repIsIntrinsicType(CORINFO_CLASS_HANDLE cls) AssertCodeMsg(IsIntrinsicType != nullptr, EXCEPTIONCODE_MC, "Didn't find anything for %016llX", (DWORDLONG)cls); AssertCodeMsg(IsIntrinsicType->GetIndex((DWORDLONG)cls) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX", (DWORDLONG)cls); - bool result = (BOOL)IsIntrinsicType->Get((DWORDLONG)cls); + bool result = (bool)IsIntrinsicType->Get((DWORDLONG)cls); DEBUG_REP(dmpIsIntrinsicType((DWORDLONG)cls, (DWORD)result)); return result; } @@ -1691,7 +1691,7 @@ bool MethodContext::repIsValueClass(CORINFO_CLASS_HANDLE cls) AssertCodeMsg((IsValueClass != nullptr) && (IsValueClass->GetIndex((DWORDLONG)cls) != -1), EXCEPTIONCODE_MC, "Didn't find %016llX", (DWORDLONG)cls); - bool result = (BOOL)IsValueClass->Get((DWORDLONG)cls); + bool result = (bool)IsValueClass->Get((DWORDLONG)cls); DEBUG_REP(dmpIsValueClass((DWORDLONG)cls, (DWORD)result)); return result; } @@ -1715,7 +1715,7 @@ bool MethodContext::repIsStructRequiringStackAllocRetBuf(CORINFO_CLASS_HANDLE cl (DWORDLONG)cls); AssertCodeMsg(IsStructRequiringStackAllocRetBuf->GetIndex((DWORDLONG)cls) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX", (DWORDLONG)cls); - bool result = (BOOL)IsStructRequiringStackAllocRetBuf->Get((DWORDLONG)cls); + bool result = (bool)IsStructRequiringStackAllocRetBuf->Get((DWORDLONG)cls); DEBUG_REP(dmpIsStructRequiringStackAllocRetBuf((DWORDLONG)cls, (DWORD)result)); return result; } @@ -1781,7 +1781,7 @@ bool MethodContext::repCanAllocateOnStack(CORINFO_CLASS_HANDLE cls) AssertCodeMsg(CanAllocateOnStack != nullptr, EXCEPTIONCODE_MC, "Didn't find %016llX", (DWORDLONG)cls); AssertCodeMsg(CanAllocateOnStack->GetIndex((DWORDLONG)cls) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX", (DWORDLONG)cls); - bool result = (BOOL)CanAllocateOnStack->Get((DWORDLONG)cls); + bool result = (bool)CanAllocateOnStack->Get((DWORDLONG)cls); DEBUG_REP(dmpCanAllocateOnStack((DWORDLONG)cls, (DWORD)result)); return result; } @@ -1989,7 +1989,7 @@ bool MethodContext::repIsSDArray(CORINFO_CLASS_HANDLE cls) { AssertCodeMsg(IsSDArray != nullptr, EXCEPTIONCODE_MC, "Didn't find anything for %016llX", (DWORDLONG)cls); AssertCodeMsg(IsSDArray->GetIndex((DWORDLONG)cls) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX", (DWORDLONG)cls); - bool temp = (BOOL)IsSDArray->Get((DWORDLONG)cls); + bool temp = (bool)IsSDArray->Get((DWORDLONG)cls); DEBUG_REP(dmpIsSDArray((DWORDLONG)cls, (DWORD)temp)); return temp; } @@ -3073,56 +3073,51 @@ void MethodContext::repGetMethodVTableOffset(CORINFO_METHOD_HANDLE method, DEBUG_REP(dmpGetMethodVTableOffset((DWORDLONG)method, value)); } -void MethodContext::recTryResolveVirtualMethod(CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT* pResolvedMethod, bool success) +void MethodContext::recResolveVirtualMethod(CORINFO_DEVIRTUALIZATION_INFO * info, bool returnValue) { - if (TryResolveVirtualMethod == nullptr) + if (ResolveVirtualMethod == nullptr) { - TryResolveVirtualMethod = - new LightWeightMap(); + ResolveVirtualMethod = new LightWeightMap(); } - Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTin key; - ZeroMemory(&key, sizeof(Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTin)); // We use the input structs as a key and - // use memcmp to compare.. - // so we need to zero out padding too - - key = SpmiRecordsHelper::CreateAgnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTin(pResolvedMethod); - - TryResolveVirtualMethodValue value; - - value.contextOut = - SpmiRecordsHelper::StoreAgnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTout(pResolvedMethod, - TryResolveVirtualMethod); - value.success = success ? 0 : 1; - - TryResolveVirtualMethod->Add(key, value); - DEBUG_REC(dmpTryResolveVirtualMethod(key, value)); + Agnostic_ResolveVirtualMethodKey key; + key.virtualMethod = (DWORDLONG)info->virtualMethod; + key.objClass = (DWORDLONG)info->objClass; + key.context = (DWORDLONG)info->context; + Agnostic_ResolveVirtualMethodResult result; + result.returnValue = returnValue; + result.devirtualizedMethod = (DWORDLONG)info->devirtualizedMethod; + result.requiresInstMethodTableArg = info->requiresInstMethodTableArg; + result.exactContext = (DWORDLONG)info->exactContext; + ResolveVirtualMethod->Add(key, result); + DEBUG_REC(dmpResolveVirtualMethod(key, result)); } -void MethodContext::dmpTryResolveVirtualMethod(const Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTin& key, - const TryResolveVirtualMethodValue& value) + +void MethodContext::dmpResolveVirtualMethod(const Agnostic_ResolveVirtualMethodKey& key, const Agnostic_ResolveVirtualMethodResult& result) { - printf("TryResolveVirtualMethod key: %s\n", - SpmiDumpHelper::DumpAgnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTin(key).c_str()); - printf(", value: %s failed-%u", - SpmiDumpHelper::DumpAgnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTout(value.contextOut).c_str(), - value.success); + printf("ResolveVirtualMethod virtMethod-%016llX, objClass-%016llX, context-%016llX :: returnValue-%d, devirtMethod-%016llX, requiresInstArg-%d, exactContext-%016llX", + key.virtualMethod, key.objClass, key.context, result.returnValue, result.devirtualizedMethod, result.requiresInstMethodTableArg, result.exactContext); } -bool MethodContext::repTryResolveVirtualMethod(CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT* pResolvedMethod) -{ - Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTin key; - ZeroMemory(&key, sizeof(Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTin)); // We use the input structs as a key and - // use memcmp to compare.. - // so we need to zero out padding too - key = SpmiRecordsHelper::CreateAgnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTin(pResolvedMethod); +bool MethodContext::repResolveVirtualMethod(CORINFO_DEVIRTUALIZATION_INFO * info) +{ + Agnostic_ResolveVirtualMethodKey key; + key.virtualMethod = (DWORDLONG)info->virtualMethod; + key.objClass = (DWORDLONG)info->objClass; + key.context = (DWORDLONG)info->context; - TryResolveVirtualMethodValue value = TryResolveVirtualMethod->Get(key); + AssertCodeMsg(ResolveVirtualMethod != nullptr, EXCEPTIONCODE_MC, + "No ResolveVirtualMap map for %016llX-%016llX-%016llX", key.virtualMethod, key.objClass, key.context); + AssertCodeMsg(ResolveVirtualMethod->GetIndex(key) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX-%016llx-%016llX", + key.virtualMethod, key.objClass, key.context); - SpmiRecordsHelper::Restore_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTout(pResolvedMethod, value.contextOut, - TryResolveVirtualMethod); + Agnostic_ResolveVirtualMethodResult result = ResolveVirtualMethod->Get(key); + DEBUG_REP(dmpResolveVirtualMethod(key, result)); + info->devirtualizedMethod = (CORINFO_METHOD_HANDLE) result.devirtualizedMethod; + info->requiresInstMethodTableArg = result.requiresInstMethodTableArg; + info->exactContext = (CORINFO_CONTEXT_HANDLE) result.exactContext; - DEBUG_REP(dmpTryResolveVirtualMethod(key, value)); - return (DWORD)value.success == 0; + return result.returnValue; } void MethodContext::recGetUnboxedEntry(CORINFO_METHOD_HANDLE ftn, @@ -3414,7 +3409,7 @@ void MethodContext::recGetFieldAddress(CORINFO_FIELD_HANDLE field, void** ppIndi DWORDLONG scratch = 0x4242424242424242; switch (cit) { - case CORINFO_TYPE_BOOL: + case CORINFO_TYPE_bool: case CORINFO_TYPE_BYTE: case CORINFO_TYPE_UBYTE: value.fieldValue = @@ -4523,7 +4518,7 @@ bool MethodContext::repSatisfiesMethodConstraints(CORINFO_CLASS_HANDLE parent, C key.A = (DWORDLONG)parent; key.B = (DWORDLONG)method; - bool value = (BOOL)SatisfiesMethodConstraints->Get(key); + bool value = (bool)SatisfiesMethodConstraints->Get(key); return value; } @@ -4554,7 +4549,7 @@ bool MethodContext::repIsValidStringRef(CORINFO_MODULE_HANDLE module, unsigned m key.A = (DWORDLONG)module; key.B = (DWORD)metaTOK; - bool value = (BOOL)IsValidStringRef->Get(key); + bool value = (bool)IsValidStringRef->Get(key); return value; } @@ -4684,7 +4679,7 @@ bool MethodContext::repCanCast(CORINFO_CLASS_HANDLE child, CORINFO_CLASS_HANDLE (DWORDLONG)child, (DWORDLONG)parent); AssertCodeMsg(CanCast->GetIndex(key) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX, %016llX %u in map", (DWORDLONG)child, (DWORDLONG)parent, CanCast->GetCount()); - bool value = (BOOL)CanCast->Get(key); + bool value = (bool)CanCast->Get(key); DEBUG_REP(dmpCanCast(key, (DWORD)value)); return value; } @@ -4825,7 +4820,7 @@ void MethodContext::dmpSatisfiesClassConstraints(DWORDLONG key, DWORD value) } bool MethodContext::repSatisfiesClassConstraints(CORINFO_CLASS_HANDLE cls) { - return (BOOL)SatisfiesClassConstraints->Get((DWORDLONG)cls); + return (bool)SatisfiesClassConstraints->Get((DWORDLONG)cls); } void MethodContext::recGetMethodHash(CORINFO_METHOD_HANDLE ftn, unsigned result) @@ -4946,8 +4941,8 @@ bool MethodContext::repIsCompatibleDelegate(CORINFO_CLASS_HANDLE objCls, value = IsCompatibleDelegate->Get(key); - *pfIsOpenDelegate = (BOOL)value.A; - return (BOOL)value.B; + *pfIsOpenDelegate = (bool)value.A; + return (bool)value.B; } void MethodContext::recIsDelegateCreationAllowed(CORINFO_CLASS_HANDLE delegateHnd, @@ -4983,7 +4978,7 @@ bool MethodContext::repIsDelegateCreationAllowed(CORINFO_CLASS_HANDLE delegateHn value = IsDelegateCreationAllowed->Get(key); - return (BOOL)value; + return (bool)value; } void MethodContext::recFindCallSiteSig(CORINFO_MODULE_HANDLE module, @@ -5385,7 +5380,7 @@ bool MethodContext::repIsMoreSpecificType(CORINFO_CLASS_HANDLE cls1, CORINFO_CLA value = IsMoreSpecificType->Get(key); DEBUG_REP(dmpIsMoreSpecificType(key, value)); - return (BOOL)value; + return (bool)value; } void MethodContext::recGetCookieForPInvokeCalliSig(CORINFO_SIG_INFO* szMetaSig, void** ppIndirection, LPVOID result) @@ -5491,7 +5486,7 @@ bool MethodContext::repCanAccessFamily(CORINFO_METHOD_HANDLE hCaller, CORINFO_CL key.B = (DWORDLONG)hInstanceType; DWORD temp = CanAccessFamily->Get(key); - return (BOOL)temp; + return (bool)temp; } void MethodContext::recErrorList(const char* error) @@ -5537,9 +5532,9 @@ void MethodContext::repGetProfilingHandle(bool* pbHookFunction, void** pProfiler value = GetProfilingHandle->Get((DWORD)0); - *pbHookFunction = (BOOL)value.bHookFunction; + *pbHookFunction = (bool)value.bHookFunction; *pProfilerHandle = (void*)value.ProfilerHandle; - *pbIndirectedHandles = (BOOL)value.bIndirectedHandles; + *pbIndirectedHandles = (bool)value.bIndirectedHandles; DEBUG_REP(dmpGetProfilingHandle(0, value)); } @@ -5600,7 +5595,7 @@ bool MethodContext::repAreTypesEquivalent(CORINFO_CLASS_HANDLE cls1, CORINFO_CLA AssertCodeMsg(AreTypesEquivalent->GetIndex(key) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX %016llX", (DWORDLONG)cls1, (DWORDLONG)cls2); - bool value = (BOOL)AreTypesEquivalent->Get(key); + bool value = (bool)AreTypesEquivalent->Get(key); return value; } @@ -5882,7 +5877,7 @@ bool MethodContext::repIsValidToken(CORINFO_MODULE_HANDLE module, unsigned metaT key.A = (DWORDLONG)module; key.B = (DWORD)metaTOK; - bool value = (BOOL)IsValidToken->Get(key); + bool value = (bool)IsValidToken->Get(key); return value; } @@ -6214,7 +6209,7 @@ bool MethodContext::repCheckMethodModifier(CORINFO_METHOD_HANDLE hMethod, LPCSTR key.fOptional = (DWORD)fOptional; - bool value = (BOOL)CheckMethodModifier->Get(key); + bool value = (bool)CheckMethodModifier->Get(key); return value; } @@ -6251,7 +6246,7 @@ bool MethodContext::repIsFieldStatic(CORINFO_FIELD_HANDLE fhld) AssertCodeMsg(IsFieldStatic != nullptr, EXCEPTIONCODE_MC, "Didn't find anything for %016llX", (DWORDLONG)fhld); AssertCodeMsg(IsFieldStatic->GetIndex((DWORDLONG)fhld) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX", (DWORDLONG)fhld); - bool result = (BOOL)(IsFieldStatic->Get((DWORDLONG)fhld) != 0); + bool result = (bool)(IsFieldStatic->Get((DWORDLONG)fhld) != 0); DEBUG_REP(dmpIsFieldStatic((DWORDLONG)fhld, (DWORD)result)); return result; } diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.h b/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.h index c6cb4c6b48271..1678a1069447a 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.h +++ b/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.h @@ -123,18 +123,6 @@ class MethodContext DWORD pMethodSpec_Index; DWORD cbMethodSpec; }; - struct Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTin - { - DWORDLONG virtualMethod; - DWORDLONG implementingClass; - DWORDLONG ownerType; - }; - struct Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTout - { - DWORDLONG devirtualizedMethod; - DWORD requiresInstMethodTableArg; - DWORDLONG patchedOwnerType; - }; struct GetArgTypeValue { DWORD flags; @@ -207,12 +195,6 @@ class MethodContext Agnostic_CORINFO_RESOLVED_TOKENout outValue; }; - struct Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT - { - Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTin inValue; - - Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTout outValue; - }; struct Agnostic_GetFieldInfo { Agnostic_CORINFO_RESOLVED_TOKEN ResolvedToken; @@ -525,6 +507,21 @@ class MethodContext DWORD result; }; + struct Agnostic_ResolveVirtualMethodKey + { + DWORDLONG virtualMethod; + DWORDLONG objClass; + DWORDLONG context; + }; + + struct Agnostic_ResolveVirtualMethodResult + { + bool returnValue; + DWORDLONG devirtualizedMethod; + bool requiresInstMethodTableArg; + DWORDLONG exactContext; + }; + struct ResolveTokenValue { Agnostic_CORINFO_RESOLVED_TOKENout tokenOut; @@ -537,12 +534,6 @@ class MethodContext DWORD success; }; - struct TryResolveVirtualMethodValue - { - Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTout contextOut; - DWORD success; - }; - struct GetTokenTypeAsHandleValue { DWORDLONG hMethod; @@ -944,10 +935,9 @@ class MethodContext unsigned* offsetAfterIndirection, bool* isRelative); - void recTryResolveVirtualMethod(CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT* pResolvedMethod, bool success); - void dmpTryResolveVirtualMethod(const Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTin& key, - const TryResolveVirtualMethodValue& value); - bool repTryResolveVirtualMethod(CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT* pResolvedMethod); + void recResolveVirtualMethod(CORINFO_DEVIRTUALIZATION_INFO * info, bool returnValue); + void dmpResolveVirtualMethod(const Agnostic_ResolveVirtualMethodKey& key, const Agnostic_ResolveVirtualMethodResult& value); + bool repResolveVirtualMethod(CORINFO_DEVIRTUALIZATION_INFO * info); void recGetUnboxedEntry(CORINFO_METHOD_HANDLE ftn, bool* requiresInstMethodTableArg, CORINFO_METHOD_HANDLE result); void dmpGetUnboxedEntry(DWORDLONG key, DLD value); @@ -1391,7 +1381,7 @@ class MethodContext }; // ********************* Please keep this up-to-date to ease adding more *************** -// Highest packet number: 181 +// Highest packet number: 184 // ************************************************************************************* enum mcPackets { @@ -1546,7 +1536,7 @@ enum mcPackets Packet_IsMoreSpecificType = 174, // Added 2/14/2019 Packet_PInvokeMarshalingRequired = 108, Packet_ResolveToken = 109, - Packet_TryResolveVirtualMethod = 160, // Added 2/13/17 // compatibility-wise is it safe to rename? + Packet_ResolveVirtualMethod = 160, // Added 2/13/17 Packet_TryResolveToken = 158, // Added 4/26/2016 Packet_SatisfiesClassConstraints = 110, Packet_SatisfiesMethodConstraints = 111, diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp b/src/coreclr/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp index ab21d9ce7c9ad..40935680d97b9 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp +++ b/src/coreclr/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp @@ -230,14 +230,12 @@ void interceptor_ICJI::getMethodVTableOffset(CORINFO_METHOD_HANDLE method, mc->recGetMethodVTableOffset(method, offsetOfIndirection, offsetAfterIndirection, isRelative); } -// Find the virtual method in implementingClass that overrides virtualMethod. -// Return false if devirtualization is not possible. -bool interceptor_ICJI::tryResolveVirtualMethod(CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT* virtualMethodContext /* IN, OUT */) +bool interceptor_ICJI::resolveVirtualMethod(CORINFO_DEVIRTUALIZATION_INFO * info) { - mc->cr->AddCall("tryResolveVirtualMethod"); - bool success = original_ICorJitInfo->tryResolveVirtualMethod(virtualMethodContext); - mc->recTryResolveVirtualMethod(virtualMethodContext, success); - return success; + mc->cr->AddCall("resolveVirtualMethod"); + bool result = original_ICorJitInfo->resolveVirtualMethod(info); + mc->recResolveVirtualMethod(info, result); + return result; } // Get the unboxed entry point for a method, if possible. @@ -2107,7 +2105,7 @@ DWORD interceptor_ICJI::getExpectedTargetArchitecture() return original_ICorJitInfo->getExpectedTargetArchitecture(); } -bool interceptor_ICJI::notifyInstructionSetUsage(CORINFO_InstructionSet instructionSet, bool supported) +void interceptor_ICJI::notifyInstructionSetUsage(CORINFO_InstructionSet instructionSet, bool supported) { - return original_ICorJitInfo->notifyInstructionSetUsage(instructionSet, supported); + original_ICorJitInfo->notifyInstructionSetUsage(instructionSet, supported); } diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp b/src/coreclr/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp index bb32bdf36a393..68d226cc8b59f 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp +++ b/src/coreclr/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // DO NOT EDIT THIS FILE! IT IS AUTOGENERATED -// To regenerate run the gen script in src/coreclr/tools/Common/JitInterface/ThunkGenerator +// To regenerate run the gen script in src/coreclr/src/tools/Common/JitInterface/ThunkGenerator // and follow the instructions in docs/project/updating-jitinterface.md #include "standardpch.h" @@ -1225,12 +1225,12 @@ bool interceptor_ICJI::convertPInvokeCalliToCall( return original_ICorJitInfo->convertPInvokeCalliToCall(pResolvedToken, mustConvert); } -bool interceptor_ICJI::notifyInstructionSetUsage( +void interceptor_ICJI::notifyInstructionSetUsage( CORINFO_InstructionSet instructionSet, bool supportEnabled) { mcs->AddCall("notifyInstructionSetUsage"); - return original_ICorJitInfo->notifyInstructionSetUsage(instructionSet, supportEnabled); + original_ICorJitInfo->notifyInstructionSetUsage(instructionSet, supportEnabled); } void interceptor_ICJI::allocMem( diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp b/src/coreclr/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp index 64c3e0e9e8580..f32838307c10b 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp +++ b/src/coreclr/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // DO NOT EDIT THIS FILE! IT IS AUTOGENERATED -// To regenerate run the gen script in src/coreclr/tools/Common/JitInterface/ThunkGenerator +// To regenerate run the gen script in src/coreclr/src/tools/Common/JitInterface/ThunkGenerator // and follow the instructions in docs/project/updating-jitinterface.md #include "standardpch.h" @@ -1072,11 +1072,11 @@ bool interceptor_ICJI::convertPInvokeCalliToCall( return original_ICorJitInfo->convertPInvokeCalliToCall(pResolvedToken, mustConvert); } -bool interceptor_ICJI::notifyInstructionSetUsage( +void interceptor_ICJI::notifyInstructionSetUsage( CORINFO_InstructionSet instructionSet, bool supportEnabled) { - return original_ICorJitInfo->notifyInstructionSetUsage(instructionSet, supportEnabled); + original_ICorJitInfo->notifyInstructionSetUsage(instructionSet, supportEnabled); } void interceptor_ICJI::allocMem( diff --git a/src/coreclr/inc/corinfo.h b/src/coreclr/inc/corinfo.h index a66f45682f844..9ebc1f7c046fc 100644 --- a/src/coreclr/inc/corinfo.h +++ b/src/coreclr/inc/corinfo.h @@ -595,6 +595,8 @@ enum CorInfoHelpFunc CORINFO_HELP_COUNT, }; +#define CORINFO_HELP_READYTORUN_ATYPICAL_CALLSITE 0x40000000 + //This describes the signature for a helper method. enum CorInfoHelpSig { @@ -621,7 +623,7 @@ enum CorInfoType { CORINFO_TYPE_UNDEF = 0x0, CORINFO_TYPE_VOID = 0x1, - CORINFO_TYPE_BOOL = 0x2, + CORINFO_TYPE_bool = 0x2, CORINFO_TYPE_CHAR = 0x3, CORINFO_TYPE_BYTE = 0x4, CORINFO_TYPE_UBYTE = 0x5, @@ -698,25 +700,17 @@ inline bool IsCallerPop(CorInfoCallConv callConv) } #endif // UNIX_X86_ABI -// Represents the calling conventions supported with the extensible calling convention syntax -// as well as the original metadata-encoded calling conventions. enum CorInfoUnmanagedCallConv { // These correspond to CorUnmanagedCallingConvention + CORINFO_UNMANAGED_CALLCONV_UNKNOWN, CORINFO_UNMANAGED_CALLCONV_C, CORINFO_UNMANAGED_CALLCONV_STDCALL, CORINFO_UNMANAGED_CALLCONV_THISCALL, CORINFO_UNMANAGED_CALLCONV_FASTCALL - // New calling conventions supported with the extensible calling convention encoding go here. }; -// Determines whether or not this calling convention is an instance method calling convention. -inline bool callConvIsInstanceMethodCallConv(CorInfoUnmanagedCallConv callConv) -{ - return callConv == CORINFO_UNMANAGED_CALLCONV_THISCALL; -} - // These are returned from getMethodOptions enum CorInfoOptions { @@ -824,7 +818,7 @@ enum CORINFO_ACCESS_FLAGS CORINFO_ACCESS_SET = 0x0200, // Field set (stfld) CORINFO_ACCESS_ADDRESS = 0x0400, // Field address (ldflda) CORINFO_ACCESS_INIT_ARRAY = 0x0800, // Field use for InitializeArray - // UNUSED = 0x4000, + CORINFO_ACCESS_ATYPICAL_CALLSITE = 0x4000, // Atypical callsite that cannot be disassembled by delay loading helper CORINFO_ACCESS_INLINECHECK= 0x8000, // Return fieldFlags and fieldAccessor only. Used by JIT64 during inlining. }; @@ -1465,7 +1459,7 @@ enum CORINFO_CALLINFO_FLAGS CORINFO_CALLINFO_VERIFICATION = 0x0008, // Gets extra verification information. CORINFO_CALLINFO_SECURITYCHECKS = 0x0010, // Perform security checks. CORINFO_CALLINFO_LDFTN = 0x0020, // Resolving target of LDFTN - // UNUSED = 0x0040, + CORINFO_CALLINFO_ATYPICAL_CALLSITE = 0x0040, // Atypical callsite that cannot be disassembled by delay loading helper }; enum CorInfoIsAccessAllowedResult @@ -1537,29 +1531,6 @@ struct CORINFO_RESOLVED_TOKEN ULONG cbMethodSpec; }; -struct CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT -{ - // - // [In] arguments of tryResolveVirtualMethod - // - CORINFO_METHOD_HANDLE virtualMethod; - CORINFO_CLASS_HANDLE implementingClass; - CORINFO_CONTEXT_HANDLE ownerType; - - - // - // [Out] arguments of tryResolveVirtualMethod. - // - devirtualizedMethod is set to MethodDesc of devirt'ed method iff we were able to devirtualize. - // invariant is `tryResolveVirtualMethod(...) == (devirtualizedMethod != nullptr)`. - // - requiresInstMethodTableArg is set to TRUE iff jit has to pass "secret" type handle arg. - // - patchedOwnerType is set to wrapped CORINFO_CLASS_HANDLE of devirt'ed method table. - // - (!) two last out params have their meaning only when we devirt'ed into DIM. - // - CORINFO_METHOD_HANDLE devirtualizedMethod; - bool requiresInstMethodTableArg; - CORINFO_CONTEXT_HANDLE patchedOwnerType; -}; - struct CORINFO_CALL_INFO { CORINFO_METHOD_HANDLE hMethod; //target method handle @@ -2065,18 +2036,13 @@ class ICorStaticInfo // or the method in info->objClass that implements the interface method // represented by info->virtualMethod. // - // Return true if devirtualization is possible. `virtualMethodContext.ownerType` is optional - // and provides additional context for shared interface devirtualization. - virtual bool tryResolveVirtualMethod( - CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT * virtualMethodContext /* IN, OUT */ - ) = 0; - - + // Returns false if devirtualization is not possible. + virtual bool resolveVirtualMethod(CORINFO_DEVIRTUALIZATION_INFO * info) = 0; // Get the unboxed entry point for a method, if possible. virtual CORINFO_METHOD_HANDLE getUnboxedEntry( CORINFO_METHOD_HANDLE ftn, - bool* requiresInstMethodTableArg + bool* requiresInstMethodTableArg = NULL /* OUT */ ) = 0; // Given T, return the type of the default EqualityComparer. @@ -2332,7 +2298,7 @@ class ICorStaticInfo virtual unsigned getClassAlignmentRequirement ( CORINFO_CLASS_HANDLE cls, - bool fDoubleAlignHint = false + bool fDoubleAlignHint = FALSE ) = 0; // This is only called for Value classes. It returns a boolean array @@ -2369,7 +2335,7 @@ class ICorStaticInfo virtual CorInfoHelpFunc getNewHelper( CORINFO_RESOLVED_TOKEN * pResolvedToken, CORINFO_METHOD_HANDLE callerHandle, - bool * pHasSideEffects + bool * pHasSideEffects = NULL /* OUT */ ) = 0; // returns the newArr (1-Dim array) helper optimized for "arrayCls." @@ -3137,8 +3103,7 @@ class ICorDynamicInfo : public ICorStaticInfo bool fMustConvert ) = 0; - // Notify EE about intent to use or not to use instruction set in the method. Returns true if the instruction set is supported unconditionally. - virtual bool notifyInstructionSetUsage( + virtual void notifyInstructionSetUsage( CORINFO_InstructionSet instructionSet, bool supportEnabled ) = 0; diff --git a/src/coreclr/jit/ICorJitInfo_API_wrapper.hpp b/src/coreclr/jit/ICorJitInfo_API_wrapper.hpp index c4bca8a43d3bc..29f9fd9ae8def 100644 --- a/src/coreclr/jit/ICorJitInfo_API_wrapper.hpp +++ b/src/coreclr/jit/ICorJitInfo_API_wrapper.hpp @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // DO NOT EDIT THIS FILE! IT IS AUTOGENERATED -// To regenerate run the gen script in src/coreclr/tools/Common/JitInterface/ThunkGenerator +// To regenerate run the gen script in src/coreclr/src/tools/Common/JitInterface/ThunkGenerator // and follow the instructions in docs/project/updating-jitinterface.md #define API_ENTER(name) wrapComp->CLR_API_Enter(API_##name); @@ -135,11 +135,12 @@ void WrapICorJitInfo::getMethodVTableOffset( API_LEAVE(getMethodVTableOffset); } -bool WrapICorJitInfo::tryResolveVirtualMethod(CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT * virtualMethodContext /* IN, OUT */) +bool WrapICorJitInfo::resolveVirtualMethod( + CORINFO_DEVIRTUALIZATION_INFO* info) { - API_ENTER(tryResolveVirtualMethod); - bool temp = wrapHnd->tryResolveVirtualMethod(virtualMethodContext); - API_LEAVE(tryResolveVirtualMethod); + API_ENTER(resolveVirtualMethod); + bool temp = wrapHnd->resolveVirtualMethod(info); + API_LEAVE(resolveVirtualMethod); return temp; } @@ -1494,14 +1495,13 @@ bool WrapICorJitInfo::convertPInvokeCalliToCall( return temp; } -bool WrapICorJitInfo::notifyInstructionSetUsage( +void WrapICorJitInfo::notifyInstructionSetUsage( CORINFO_InstructionSet instructionSet, bool supportEnabled) { API_ENTER(notifyInstructionSetUsage); - bool temp = wrapHnd->notifyInstructionSetUsage(instructionSet, supportEnabled); + wrapHnd->notifyInstructionSetUsage(instructionSet, supportEnabled); API_LEAVE(notifyInstructionSetUsage); - return temp; } void WrapICorJitInfo::allocMem( diff --git a/src/coreclr/jit/compiler.cpp b/src/coreclr/jit/compiler.cpp index 4642388b574e4..a8d6a1450a646 100644 --- a/src/coreclr/jit/compiler.cpp +++ b/src/coreclr/jit/compiler.cpp @@ -4817,7 +4817,7 @@ void Compiler::compCompile(void** methodCodePtr, ULONG* methodCodeSize, JitFlags { // Optimize boolean conditions // - DoPhase(this, PHASE_OPTIMIZE_BOOLS, &Compiler::optOptimizeBools); + DoPhase(this, PHASE_OPTIMIZE_boolS, &Compiler::optOptimizeBools); // optOptimizeBools() might have changed the number of blocks; the dominators/reachability might be bad. } @@ -9334,9 +9334,9 @@ void cTreeFlags(Compiler* comp, GenTree* tree) { chars += printf("[DONT_CSE]"); } - if (tree->gtFlags & GTF_BOOLEAN) + if (tree->gtFlags & GTF_boolEAN) { - chars += printf("[BOOLEAN]"); + chars += printf("[boolEAN]"); } if (tree->gtFlags & GTF_UNSIGNED) { diff --git a/src/coreclr/jit/compiler.hpp b/src/coreclr/jit/compiler.hpp index d7576d6b4d608..f047182cbc55d 100644 --- a/src/coreclr/jit/compiler.hpp +++ b/src/coreclr/jit/compiler.hpp @@ -154,7 +154,7 @@ unsigned __int64 genFindHighestBit(unsigned __int64 mask) */ template -inline BOOL genMaxOneBit(T value) +inline bool genMaxOneBit(T value) { return (value & (value - 1)) == 0; } @@ -164,7 +164,7 @@ inline BOOL genMaxOneBit(T value) * Return true if the given 32-bit value has exactly zero or one bits set. */ -inline BOOL genMaxOneBit(unsigned value) +inline bool genMaxOneBit(unsigned value) { return (value & (value - 1)) == 0; } @@ -2265,11 +2265,11 @@ inline bool Compiler::lvaIsRegArgument(unsigned varNum) return varDsc->lvIsRegArg; } -inline BOOL Compiler::lvaIsOriginalThisArg(unsigned varNum) +inline bool Compiler::lvaIsOriginalThisArg(unsigned varNum) { assert(varNum < lvaCount); - BOOL isOriginalThisArg = (varNum == info.compThisArg) && (info.compIsStatic == false); + bool isOriginalThisArg = (varNum == info.compThisArg) && (info.compIsStatic == false); #ifdef DEBUG if (isOriginalThisArg) @@ -2294,7 +2294,7 @@ inline BOOL Compiler::lvaIsOriginalThisArg(unsigned varNum) return isOriginalThisArg; } -inline BOOL Compiler::lvaIsOriginalThisReadOnly() +inline bool Compiler::lvaIsOriginalThisReadOnly() { return lvaArg0Var == info.compThisArg; } diff --git a/src/coreclr/jit/importer.cpp b/src/coreclr/jit/importer.cpp index 1b460b966750a..7de5bef4a212f 100644 --- a/src/coreclr/jit/importer.cpp +++ b/src/coreclr/jit/importer.cpp @@ -20921,10 +20921,12 @@ void Compiler::impDevirtualizeCall(GenTreeCall* call, } // Ask the runtime to determine the method that would be called based on the guessed-for type. - CORINFO_CONTEXT_HANDLE ownerType = *contextHandle; - bool requiresInstMethodTableArg = false; - CORINFO_METHOD_HANDLE likelyMethod = - impResolveVirtualMethod(baseMethod, likelyClass, &requiresInstMethodTableArg, &ownerType); + CORINFO_DEVIRTUALIZATION_INFO dvInfo; + dvInfo.virtualMethod = baseMethod; + dvInfo.objClass = likelyClass; + dvInfo.context = *pContextHandle; + + bool canResolve = info.compCompHnd->resolveVirtualMethod(&dvInfo); if (!canResolve) { @@ -20955,15 +20957,8 @@ void Compiler::impDevirtualizeCall(GenTreeCall* call, JITDUMP("--- base class is interface\n"); } - // Fetch the method that would be called based on the declared type of 'this' - CORINFO_CONTEXT_HANDLE ownerType = *contextHandle; - bool requiresInstMethodTableArg = false; - CORINFO_METHOD_HANDLE derivedMethod = - impResolveVirtualMethod(baseMethod, objClass, &requiresInstMethodTableArg, &ownerType); - - // If we failed to get a handle, we can't devirtualize. This can - // happen when prejitting, if the devirtualization crosses - // servicing bubble boundaries. + // Fetch the method that would be called based on the declared type of 'this', + // and prepare to fetch the method attributes. // CORINFO_DEVIRTUALIZATION_INFO dvInfo; dvInfo.virtualMethod = baseMethod; @@ -21109,10 +21104,12 @@ void Compiler::impDevirtualizeCall(GenTreeCall* call, // Figure out which method will be called. // - CORINFO_CONTEXT_HANDLE ownerType = *contextHandle; - bool requiresInstMethodTableArg = false; - CORINFO_METHOD_HANDLE likelyMethod = - impResolveVirtualMethod(baseMethod, likelyClass, &requiresInstMethodTableArg, &ownerType); + CORINFO_DEVIRTUALIZATION_INFO dvInfo; + dvInfo.virtualMethod = baseMethod; + dvInfo.objClass = likelyClass; + dvInfo.context = *pContextHandle; + + bool canResolve = info.compCompHnd->resolveVirtualMethod(&dvInfo); if (!canResolve) { @@ -21281,7 +21278,7 @@ void Compiler::impDevirtualizeCall(GenTreeCall* call, } } // there is no unboxed entry when we got devirtualized to DIM - else if (requiresInstMethodTableArg) + else if (dvInfo.requiresInstMethodTableArg) { passExtraArgForValueType = true; } @@ -21296,7 +21293,7 @@ void Compiler::impDevirtualizeCall(GenTreeCall* call, } } // check wheter we have returned an instantiating stub for generic DIM - if ((isInterface && requiresInstMethodTableArg) || passExtraArgForValueType) + if ((isInterface && dvInfo.requiresInstMethodTableArg) || passExtraArgForValueType) { assert(((SIZE_T)ownerType & CORINFO_CONTEXTFLAGS_MASK) == CORINFO_CONTEXTFLAGS_CLASS); CORINFO_CLASS_HANDLE exactClassHandle = eeGetClassFromContext(ownerType); @@ -21340,7 +21337,7 @@ void Compiler::impDevirtualizeCall(GenTreeCall* call, } #endif // defined(DEBUG) - // Fetch the class that introduced the derived method. + // Need to update call info too. // *method = derivedMethod; *methodFlags = derivedMethodAttribs; @@ -21384,29 +21381,6 @@ void Compiler::impDevirtualizeCall(GenTreeCall* call, #endif // FEATURE_READYTORUN_COMPILER } -CORINFO_METHOD_HANDLE Compiler::impResolveVirtualMethod(CORINFO_METHOD_HANDLE virtualMethod, - CORINFO_CLASS_HANDLE implementingClass, - bool* requiresInstMethodTableArg, - CORINFO_CONTEXT_HANDLE* ownerType) -{ - CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT virtualMethodContext{}; - virtualMethodContext.virtualMethod = virtualMethod; - virtualMethodContext.implementingClass = implementingClass; - virtualMethodContext.ownerType = *ownerType; - - bool wasResolved = info.compCompHnd->tryResolveVirtualMethod(&virtualMethodContext); - - assert((wasResolved && (virtualMethodContext.devirtualizedMethod != nullptr)) || !wasResolved); - assert(((virtualMethodContext.patchedOwnerType != nullptr) && wasResolved) || - (virtualMethodContext.patchedOwnerType == nullptr)); - assert((virtualMethodContext.requiresInstMethodTableArg && wasResolved) || - !virtualMethodContext.requiresInstMethodTableArg); - - *requiresInstMethodTableArg = virtualMethodContext.requiresInstMethodTableArg; - *ownerType = virtualMethodContext.patchedOwnerType; - return virtualMethodContext.devirtualizedMethod; -} - //------------------------------------------------------------------------ // impGetSpecialIntrinsicExactReturnType: Look for special cases where a call // to an intrinsic returns an exact type diff --git a/src/coreclr/src/ToolBox/superpmi/superpmi-shared/icorjitinfoimpl.h b/src/coreclr/src/ToolBox/superpmi/superpmi-shared/icorjitinfoimpl.h deleted file mode 100644 index 344eda1a170ba..0000000000000 --- a/src/coreclr/src/ToolBox/superpmi/superpmi-shared/icorjitinfoimpl.h +++ /dev/null @@ -1,1029 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -// - -#ifndef _ICorJitInfoImpl -#define _ICorJitInfoImpl - -// ICorJitInfoImpl: declare for implementation all the members of the ICorJitInfo interface (which are -// specified as pure virtual methods). This is done once, here, and all implementations share it, -// to avoid duplicated declarations. This file is #include'd within all the ICorJitInfo implementation -// classes. -// -// NOTE: this file is in exactly the same order, with exactly the same whitespace, as the ICorJitInfo -// interface declaration (with the "virtual" and "= 0" syntax removed). This is to make it easy to compare -// against the interface declaration. - -// clang-format off - -public: -/**********************************************************************************/ -// -// ICorMethodInfo -// -/**********************************************************************************/ - -// return flags (defined above, CORINFO_FLG_PUBLIC ...) -DWORD getMethodAttribs(CORINFO_METHOD_HANDLE ftn /* IN */ - ); - -// sets private JIT flags, which can be, retrieved using getAttrib. -void setMethodAttribs(CORINFO_METHOD_HANDLE ftn, /* IN */ - CorInfoMethodRuntimeFlags attribs /* IN */ - ); - -// Given a method descriptor ftnHnd, extract signature information into sigInfo -// -// 'memberParent' is typically only set when verifying. It should be the -// result of calling getMemberParent. -void getMethodSig(CORINFO_METHOD_HANDLE ftn, /* IN */ - CORINFO_SIG_INFO* sig, /* OUT */ - CORINFO_CLASS_HANDLE memberParent = NULL /* IN */ - ); - -/********************************************************************* - * Note the following methods can only be used on functions known - * to be IL. This includes the method being compiled and any method - * that 'getMethodInfo' returns true for - *********************************************************************/ - -// return information about a method private to the implementation -// returns false if method is not IL, or is otherwise unavailable. -// This method is used to fetch data needed to inline functions -bool getMethodInfo(CORINFO_METHOD_HANDLE ftn, /* IN */ - CORINFO_METHOD_INFO* info /* OUT */ - ); - -// Decides if you have any limitations for inlining. If everything's OK, it will return -// INLINE_PASS and will fill out pRestrictions with a mask of restrictions the caller of this -// function must respect. If caller passes pRestrictions = NULL, if there are any restrictions -// INLINE_FAIL will be returned -// -// The callerHnd must be the immediate caller (i.e. when we have a chain of inlined calls) -// -// The inlined method need not be verified - -CorInfoInline canInline(CORINFO_METHOD_HANDLE callerHnd, /* IN */ - CORINFO_METHOD_HANDLE calleeHnd, /* IN */ - DWORD* pRestrictions /* OUT */ - ); - -// Reports whether or not a method can be inlined, and why. canInline is responsible for reporting all -// inlining results when it returns INLINE_FAIL and INLINE_NEVER. All other results are reported by the -// JIT. -void reportInliningDecision(CORINFO_METHOD_HANDLE inlinerHnd, - CORINFO_METHOD_HANDLE inlineeHnd, - CorInfoInline inlineResult, - const char* reason); - -// Returns false if the call is across security boundaries thus we cannot tailcall -// -// The callerHnd must be the immediate caller (i.e. when we have a chain of inlined calls) -bool canTailCall(CORINFO_METHOD_HANDLE callerHnd, /* IN */ - CORINFO_METHOD_HANDLE declaredCalleeHnd, /* IN */ - CORINFO_METHOD_HANDLE exactCalleeHnd, /* IN */ - bool fIsTailPrefix /* IN */ - ); - -// Reports whether or not a method can be tail called, and why. -// canTailCall is responsible for reporting all results when it returns -// false. All other results are reported by the JIT. -void reportTailCallDecision(CORINFO_METHOD_HANDLE callerHnd, - CORINFO_METHOD_HANDLE calleeHnd, - bool fIsTailPrefix, - CorInfoTailCall tailCallResult, - const char* reason); - -// get individual exception handler -void getEHinfo(CORINFO_METHOD_HANDLE ftn, /* IN */ - unsigned EHnumber, /* IN */ - CORINFO_EH_CLAUSE* clause /* OUT */ - ); - -// return class it belongs to -CORINFO_CLASS_HANDLE getMethodClass(CORINFO_METHOD_HANDLE method); - -// return module it belongs to -CORINFO_MODULE_HANDLE getMethodModule(CORINFO_METHOD_HANDLE method); - -// This function returns the offset of the specified method in the -// vtable of it's owning class or interface. -void getMethodVTableOffset(CORINFO_METHOD_HANDLE method, /* IN */ - unsigned* offsetOfIndirection, /* OUT */ - unsigned* offsetAfterIndirection,/* OUT */ - bool* isRelative /* OUT */ - ); - -// Find the virtual method in implementingClass that overrides virtualMethod. -// Return false if devirtualization is not possible. -bool tryResolveVirtualMethod(CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT* virtualMethodContext /* IN, OUT */); - -// Get the unboxed entry point for a method, if possible. -CORINFO_METHOD_HANDLE getUnboxedEntry( - CORINFO_METHOD_HANDLE ftn, - bool* requiresInstMethodTableArg /* OUT */); - -// Given T, return the type of the default EqualityComparer. -// Returns null if the type can't be determined exactly. -CORINFO_CLASS_HANDLE getDefaultEqualityComparerClass(CORINFO_CLASS_HANDLE elemType); - -// Given resolved token that corresponds to an intrinsic classified as -// a CORINFO_INTRINSIC_GetRawHandle intrinsic, fetch the handle associated -// with the token. If this is not possible at compile-time (because the current method's -// code is shared and the token contains generic parameters) then indicate -// how the handle should be looked up at runtime. -void expandRawHandleIntrinsic( - CORINFO_RESOLVED_TOKEN * pResolvedToken, - CORINFO_GENERICHANDLE_RESULT * pResult); - -// If a method's attributes have (getMethodAttribs) CORINFO_FLG_INTRINSIC set, -// getIntrinsicID() returns the intrinsic ID. -// *pMustExpand tells whether or not JIT must expand the intrinsic. -CorInfoIntrinsics getIntrinsicID(CORINFO_METHOD_HANDLE method, bool* pMustExpand = NULL /* OUT */); - -// Is the given type in System.Private.Corelib and marked with IntrinsicAttribute? -bool isIntrinsicType(CORINFO_CLASS_HANDLE classHnd); - -// return the unmanaged calling convention for a PInvoke -CorInfoUnmanagedCallConv getUnmanagedCallConv(CORINFO_METHOD_HANDLE method); - -// return if any marshaling is required for PInvoke methods. Note that -// method == 0 => calli. The call site sig is only needed for the varargs or calli case -BOOL pInvokeMarshalingRequired(CORINFO_METHOD_HANDLE method, CORINFO_SIG_INFO* callSiteSig); - -// Check constraints on method type arguments (only). -// The parent class should be checked separately using satisfiesClassConstraints(parent). -BOOL satisfiesMethodConstraints(CORINFO_CLASS_HANDLE parent, // the exact parent of the method - CORINFO_METHOD_HANDLE method); - -// Given a delegate target class, a target method parent class, a target method, -// a delegate class, check if the method signature is compatible with the Invoke method of the delegate -// (under the typical instantiation of any free type variables in the memberref signatures). -BOOL isCompatibleDelegate(CORINFO_CLASS_HANDLE objCls, /* type of the delegate target, if any */ - CORINFO_CLASS_HANDLE methodParentCls, /* exact parent of the target method, if any */ - CORINFO_METHOD_HANDLE method, /* (representative) target method, if any */ - CORINFO_CLASS_HANDLE delegateCls, /* exact type of the delegate */ - BOOL* pfIsOpenDelegate /* is the delegate open */ - ); - -// load and restore the method -void methodMustBeLoadedBeforeCodeIsRun(CORINFO_METHOD_HANDLE method); - -CORINFO_METHOD_HANDLE mapMethodDeclToMethodImpl(CORINFO_METHOD_HANDLE method); - -// Returns the global cookie for the /GS unsafe buffer checks -// The cookie might be a constant value (JIT), or a handle to memory location (Ngen) -void getGSCookie(GSCookie* pCookieVal, // OUT - GSCookie** ppCookieVal // OUT - ); - -// Provide patchpoint info for the method currently being jitted. -void setPatchpointInfo( - PatchpointInfo* patchpointInfo - ); - -PatchpointInfo* getOSRInfo( - unsigned * ilOffset // OUT - ); - -/**********************************************************************************/ -// -// ICorModuleInfo -// -/**********************************************************************************/ - -// Resolve metadata token into runtime method handles. This function may not -// return normally (e.g. it may throw) if it encounters invalid metadata or other -// failures during token resolution. -void resolveToken(/* IN, OUT */ CORINFO_RESOLVED_TOKEN* pResolvedToken); - -// Attempt to resolve a metadata token into a runtime method handle. Returns true -// if resolution succeeded and false otherwise (e.g. if it encounters invalid metadata -// during token reoslution). This method should be used instead of `resolveToken` in -// situations that need to be resilient to invalid metadata. -bool tryResolveToken(/* IN, OUT */ CORINFO_RESOLVED_TOKEN* pResolvedToken); - -// Signature information about the call sig -void findSig(CORINFO_MODULE_HANDLE module, /* IN */ - unsigned sigTOK, /* IN */ - CORINFO_CONTEXT_HANDLE context, /* IN */ - CORINFO_SIG_INFO* sig /* OUT */ - ); - -// for Varargs, the signature at the call site may differ from -// the signature at the definition. Thus we need a way of -// fetching the call site information -void findCallSiteSig(CORINFO_MODULE_HANDLE module, /* IN */ - unsigned methTOK, /* IN */ - CORINFO_CONTEXT_HANDLE context, /* IN */ - CORINFO_SIG_INFO* sig /* OUT */ - ); - -CORINFO_CLASS_HANDLE getTokenTypeAsHandle(CORINFO_RESOLVED_TOKEN* pResolvedToken /* IN */); - -// Checks if the given metadata token is valid -BOOL isValidToken(CORINFO_MODULE_HANDLE module, /* IN */ - unsigned metaTOK /* IN */ - ); - -// Checks if the given metadata token is valid StringRef -BOOL isValidStringRef(CORINFO_MODULE_HANDLE module, /* IN */ - unsigned metaTOK /* IN */ - ); - -LPCWSTR getStringLiteral(CORINFO_MODULE_HANDLE module, /* IN */ - unsigned metaTOK, /* IN */ - int* length /* OUT */ - ); - -/**********************************************************************************/ -// -// ICorClassInfo -// -/**********************************************************************************/ - -// If the value class 'cls' is isomorphic to a primitive type it will -// return that type, otherwise it will return CORINFO_TYPE_VALUECLASS -CorInfoType asCorInfoType(CORINFO_CLASS_HANDLE cls); - -// for completeness -const char* getClassName(CORINFO_CLASS_HANDLE cls); - -const char* getClassNameFromMetadata(CORINFO_CLASS_HANDLE cls, const char** namespaceName); - -CORINFO_CLASS_HANDLE getTypeInstantiationArgument(CORINFO_CLASS_HANDLE cls, unsigned index); - -// Append a (possibly truncated) representation of the type cls to the preallocated buffer ppBuf of length pnBufLen -// If fNamespace=TRUE, include the namespace/enclosing classes -// If fFullInst=TRUE (regardless of fNamespace and fAssembly), include namespace and assembly for any type parameters -// If fAssembly=TRUE, suffix with a comma and the full assembly qualification -// return size of representation -int appendClassName(__deref_inout_ecount(*pnBufLen) WCHAR** ppBuf, - int* pnBufLen, - CORINFO_CLASS_HANDLE cls, - BOOL fNamespace, - BOOL fFullInst, - BOOL fAssembly); - -// Quick check whether the type is a value class. Returns the same value as getClassAttribs(cls) & -// CORINFO_FLG_VALUECLASS, except faster. -BOOL isValueClass(CORINFO_CLASS_HANDLE cls); - -// Decides how the JIT should do the optimization to inline the check for -// GetTypeFromHandle(handle) == obj.GetType() (for CORINFO_INLINE_TYPECHECK_SOURCE_VTABLE) -// GetTypeFromHandle(X) == GetTypeFromHandle(Y) (for CORINFO_INLINE_TYPECHECK_SOURCE_TOKEN) -CorInfoInlineTypeCheck canInlineTypeCheck(CORINFO_CLASS_HANDLE cls, CorInfoInlineTypeCheckSource source); - -// return flags (defined above, CORINFO_FLG_PUBLIC ...) -DWORD getClassAttribs(CORINFO_CLASS_HANDLE cls); - -// Returns "TRUE" iff "cls" is a struct type such that return buffers used for returning a value -// of this type must be stack-allocated. This will generally be true only if the struct -// contains GC pointers, and does not exceed some size limit. Maintaining this as an invariant allows -// an optimization: the JIT may assume that return buffer pointers for return types for which this predicate -// returns TRUE are always stack allocated, and thus, that stores to the GC-pointer fields of such return -// buffers do not require GC write barriers. -BOOL isStructRequiringStackAllocRetBuf(CORINFO_CLASS_HANDLE cls); - -CORINFO_MODULE_HANDLE getClassModule(CORINFO_CLASS_HANDLE cls); - -// Returns the assembly that contains the module "mod". -CORINFO_ASSEMBLY_HANDLE getModuleAssembly(CORINFO_MODULE_HANDLE mod); - -// Returns the name of the assembly "assem". -const char* getAssemblyName(CORINFO_ASSEMBLY_HANDLE assem); - -// Allocate and delete process-lifetime objects. Should only be -// referred to from static fields, lest a leak occur. -// Note that "LongLifetimeFree" does not execute destructors, if "obj" -// is an array of a struct type with a destructor. -void* LongLifetimeMalloc(size_t sz); -void LongLifetimeFree(void* obj); - -size_t getClassModuleIdForStatics(CORINFO_CLASS_HANDLE cls, CORINFO_MODULE_HANDLE* pModule, void** ppIndirection); - -// return the number of bytes needed by an instance of the class -unsigned getClassSize(CORINFO_CLASS_HANDLE cls); - -// return the number of bytes needed by an instance of the class allocated on the heap -unsigned getHeapClassSize(CORINFO_CLASS_HANDLE cls); - -BOOL canAllocateOnStack(CORINFO_CLASS_HANDLE cls); - -unsigned getClassAlignmentRequirement(CORINFO_CLASS_HANDLE cls, BOOL fDoubleAlignHint = FALSE); - -// This is only called for Value classes. It returns a boolean array -// in representing of 'cls' from a GC perspective. The class is -// assumed to be an array of machine words -// (of length // getClassSize(cls) / sizeof(void*)), -// 'gcPtrs' is a pointer to an array of BYTEs of this length. -// getClassGClayout fills in this array so that gcPtrs[i] is set -// to one of the CorInfoGCType values which is the GC type of -// the i-th machine word of an object of type 'cls' -// returns the number of GC pointers in the array -unsigned getClassGClayout(CORINFO_CLASS_HANDLE cls, /* IN */ - BYTE* gcPtrs /* OUT */ - ); - -// returns the number of instance fields in a class -unsigned getClassNumInstanceFields(CORINFO_CLASS_HANDLE cls /* IN */ - ); - -CORINFO_FIELD_HANDLE getFieldInClass(CORINFO_CLASS_HANDLE clsHnd, INT num); - -BOOL checkMethodModifier(CORINFO_METHOD_HANDLE hMethod, LPCSTR modifier, BOOL fOptional); - -// returns the "NEW" helper optimized for "newCls." -CorInfoHelpFunc getNewHelper(CORINFO_RESOLVED_TOKEN* pResolvedToken, CORINFO_METHOD_HANDLE callerHandle, bool* pHasSideEffects = NULL /* OUT */); - -// returns the newArr (1-Dim array) helper optimized for "arrayCls." -CorInfoHelpFunc getNewArrHelper(CORINFO_CLASS_HANDLE arrayCls); - -// returns the optimized "IsInstanceOf" or "ChkCast" helper -CorInfoHelpFunc getCastingHelper(CORINFO_RESOLVED_TOKEN* pResolvedToken, bool fThrowing); - -// returns helper to trigger static constructor -CorInfoHelpFunc getSharedCCtorHelper(CORINFO_CLASS_HANDLE clsHnd); - -// This is not pretty. Boxing nullable actually returns -// a boxed not a boxed Nullable. This call allows the verifier -// to call back to the EE on the 'box' instruction and get the transformed -// type to use for verification. -CORINFO_CLASS_HANDLE getTypeForBox(CORINFO_CLASS_HANDLE cls); - -// returns the correct box helper for a particular class. Note -// that if this returns CORINFO_HELP_BOX, the JIT can assume -// 'standard' boxing (allocate object and copy), and optimize -CorInfoHelpFunc getBoxHelper(CORINFO_CLASS_HANDLE cls); - -// returns the unbox helper. If 'helperCopies' points to a true -// value it means the JIT is requesting a helper that unboxes the -// value into a particular location and thus has the signature -// void unboxHelper(void* dest, CORINFO_CLASS_HANDLE cls, Object* obj) -// Otherwise (it is null or points at a FALSE value) it is requesting -// a helper that returns a pointer to the unboxed data -// void* unboxHelper(CORINFO_CLASS_HANDLE cls, Object* obj) -// The EE has the option of NOT returning the copy style helper -// (But must be able to always honor the non-copy style helper) -// The EE set 'helperCopies' on return to indicate what kind of -// helper has been created. - -CorInfoHelpFunc getUnBoxHelper(CORINFO_CLASS_HANDLE cls); - -bool getReadyToRunHelper(CORINFO_RESOLVED_TOKEN* pResolvedToken, - CORINFO_LOOKUP_KIND* pGenericLookupKind, - CorInfoHelpFunc id, - CORINFO_CONST_LOOKUP* pLookup); - -void getReadyToRunDelegateCtorHelper(CORINFO_RESOLVED_TOKEN* pTargetMethod, - CORINFO_CLASS_HANDLE delegateType, - CORINFO_LOOKUP* pLookup); - -const char* getHelperName(CorInfoHelpFunc); - -// This function tries to initialize the class (run the class constructor). -// this function returns whether the JIT must insert helper calls before -// accessing static field or method. -// -// See code:ICorClassInfo#ClassConstruction. -CorInfoInitClassResult initClass(CORINFO_FIELD_HANDLE field, // Non-NULL - inquire about cctor trigger before static - // field access NULL - inquire about cctor trigger in - // method prolog - CORINFO_METHOD_HANDLE method, // Method referencing the field or prolog - CORINFO_CONTEXT_HANDLE context // Exact context of method - ); - -// This used to be called "loadClass". This records the fact -// that the class must be loaded (including restored if necessary) before we execute the -// code that we are currently generating. When jitting code -// the function loads the class immediately. When zapping code -// the zapper will if necessary use the call to record the fact that we have -// to do a fixup/restore before running the method currently being generated. -// -// This is typically used to ensure value types are loaded before zapped -// code that manipulates them is executed, so that the GC can access information -// about those value types. -void classMustBeLoadedBeforeCodeIsRun(CORINFO_CLASS_HANDLE cls); - -// returns the class handle for the special builtin classes -CORINFO_CLASS_HANDLE getBuiltinClass(CorInfoClassId classId); - -// "System.Int32" ==> CORINFO_TYPE_INT.. -CorInfoType getTypeForPrimitiveValueClass(CORINFO_CLASS_HANDLE cls); - -// "System.Int32" ==> CORINFO_TYPE_INT.. -// "System.UInt32" ==> CORINFO_TYPE_UINT.. -CorInfoType getTypeForPrimitiveNumericClass(CORINFO_CLASS_HANDLE cls); - -// TRUE if child is a subtype of parent -// if parent is an interface, then does child implement / extend parent -BOOL canCast(CORINFO_CLASS_HANDLE child, // subtype (extends parent) - CORINFO_CLASS_HANDLE parent // base type - ); - -// TRUE if cls1 and cls2 are considered equivalent types. -BOOL areTypesEquivalent(CORINFO_CLASS_HANDLE cls1, CORINFO_CLASS_HANDLE cls2); - -// See if a cast from fromClass to toClass will succeed, fail, or needs -// to be resolved at runtime. -TypeCompareState compareTypesForCast(CORINFO_CLASS_HANDLE fromClass, CORINFO_CLASS_HANDLE toClass); - -// See if types represented by cls1 and cls2 compare equal, not -// equal, or the comparison needs to be resolved at runtime. -TypeCompareState compareTypesForEquality(CORINFO_CLASS_HANDLE cls1, CORINFO_CLASS_HANDLE cls2); - -// returns the intersection of cls1 and cls2. -CORINFO_CLASS_HANDLE mergeClasses(CORINFO_CLASS_HANDLE cls1, CORINFO_CLASS_HANDLE cls2); - -// Returns true if cls2 is known to be a more specific type than cls1. -BOOL isMoreSpecificType(CORINFO_CLASS_HANDLE cls1, CORINFO_CLASS_HANDLE cls2); - -// Given a class handle, returns the Parent type. -// For COMObjectType, it returns Class Handle of System.Object. -// Returns 0 if System.Object is passed in. -CORINFO_CLASS_HANDLE getParentType(CORINFO_CLASS_HANDLE cls); - -// Returns the CorInfoType of the "child type". If the child type is -// not a primitive type, *clsRet will be set. -// Given an Array of Type Foo, returns Foo. -// Given BYREF Foo, returns Foo -CorInfoType getChildType(CORINFO_CLASS_HANDLE clsHnd, CORINFO_CLASS_HANDLE* clsRet); - -// Check constraints on type arguments of this class and parent classes -BOOL satisfiesClassConstraints(CORINFO_CLASS_HANDLE cls); - -// Check if this is a single dimensional array type -BOOL isSDArray(CORINFO_CLASS_HANDLE cls); - -// Get the numbmer of dimensions in an array -unsigned getArrayRank(CORINFO_CLASS_HANDLE cls); - -// Get static field data for an array -void* getArrayInitializationData(CORINFO_FIELD_HANDLE field, DWORD size); - -// Check Visibility rules. -CorInfoIsAccessAllowedResult canAccessClass(CORINFO_RESOLVED_TOKEN* pResolvedToken, - CORINFO_METHOD_HANDLE callerHandle, - CORINFO_HELPER_DESC* pAccessHelper /* If canAccessMethod returns something - other than ALLOWED, then this is - filled in. */ - ); - -/**********************************************************************************/ -// -// ICorFieldInfo -// -/**********************************************************************************/ - -// this function is for debugging only. It returns the field name -// and if 'moduleName' is non-null, it sets it to something that will -// says which method (a class name, or a module name) -const char* getFieldName(CORINFO_FIELD_HANDLE ftn, /* IN */ - const char** moduleName /* OUT */ - ); - -// return class it belongs to -CORINFO_CLASS_HANDLE getFieldClass(CORINFO_FIELD_HANDLE field); - -// Return the field's type, if it is CORINFO_TYPE_VALUECLASS 'structType' is set -// the field's value class (if 'structType' == 0, then don't bother -// the structure info). -// -// 'memberParent' is typically only set when verifying. It should be the -// result of calling getMemberParent. -CorInfoType getFieldType(CORINFO_FIELD_HANDLE field, - CORINFO_CLASS_HANDLE* structType = NULL, - CORINFO_CLASS_HANDLE memberParent = NULL /* IN */ - ); - -// return the data member's instance offset -unsigned getFieldOffset(CORINFO_FIELD_HANDLE field); - -void getFieldInfo(CORINFO_RESOLVED_TOKEN* pResolvedToken, - CORINFO_METHOD_HANDLE callerHandle, - CORINFO_ACCESS_FLAGS flags, - CORINFO_FIELD_INFO* pResult); - -// Returns true iff "fldHnd" represents a static field. -bool isFieldStatic(CORINFO_FIELD_HANDLE fldHnd); - -/*********************************************************************************/ -// -// ICorDebugInfo -// -/*********************************************************************************/ - -// Query the EE to find out where interesting break points -// in the code are. The native compiler will ensure that these places -// have a corresponding break point in native code. -// -// Note that unless CORJIT_FLAG_DEBUG_CODE is specified, this function will -// be used only as a hint and the native compiler should not change its -// code generation. -void getBoundaries(CORINFO_METHOD_HANDLE ftn, // [IN] method of interest - unsigned int* cILOffsets, // [OUT] size of pILOffsets - DWORD** pILOffsets, // [OUT] IL offsets of interest - // jit MUST free with freeArray! - ICorDebugInfo::BoundaryTypes* implictBoundaries // [OUT] tell jit, all boundries of this type - ); - -// Report back the mapping from IL to native code, -// this map should include all boundaries that 'getBoundaries' -// reported as interesting to the debugger. - -// Note that debugger (and profiler) is assuming that all of the -// offsets form a contiguous block of memory, and that the -// OffsetMapping is sorted in order of increasing native offset. -void setBoundaries(CORINFO_METHOD_HANDLE ftn, // [IN] method of interest - ULONG32 cMap, // [IN] size of pMap - ICorDebugInfo::OffsetMapping* pMap // [IN] map including all points of interest. - // jit allocated with allocateArray, EE frees - ); - -// Query the EE to find out the scope of local varables. -// normally the JIT would trash variables after last use, but -// under debugging, the JIT needs to keep them live over their -// entire scope so that they can be inspected. -// -// Note that unless CORJIT_FLAG_DEBUG_CODE is specified, this function will -// be used only as a hint and the native compiler should not change its -// code generation. -void getVars(CORINFO_METHOD_HANDLE ftn, // [IN] method of interest - ULONG32* cVars, // [OUT] size of 'vars' - ICorDebugInfo::ILVarInfo** vars, // [OUT] scopes of variables of interest - // jit MUST free with freeArray! - bool* extendOthers // [OUT] it TRUE, then assume the scope - // of unmentioned vars is entire method - ); - -// Report back to the EE the location of every variable. -// note that the JIT might split lifetimes into different -// locations etc. - -void setVars(CORINFO_METHOD_HANDLE ftn, // [IN] method of interest - ULONG32 cVars, // [IN] size of 'vars' - ICorDebugInfo::NativeVarInfo* vars // [IN] map telling where local vars are stored at what points - // jit allocated with allocateArray, EE frees - ); - -/*-------------------------- Misc ---------------------------------------*/ - -// Used to allocate memory that needs to handed to the EE. -// For eg, use this to allocated memory for reporting debug info, -// which will be handed to the EE by setVars() and setBoundaries() -void* allocateArray(size_t cBytes); - -// JitCompiler will free arrays passed by the EE using this -// For eg, The EE returns memory in getVars() and getBoundaries() -// to the JitCompiler, which the JitCompiler should release using -// freeArray() -void freeArray(void* array); - -/*********************************************************************************/ -// -// ICorArgInfo -// -/*********************************************************************************/ - -// advance the pointer to the argument list. -// a ptr of 0, is special and always means the first argument -CORINFO_ARG_LIST_HANDLE getArgNext(CORINFO_ARG_LIST_HANDLE args /* IN */ - ); - -// Get the type of a particular argument -// CORINFO_TYPE_UNDEF is returned when there are no more arguments -// If the type returned is a primitive type (or an enum) *vcTypeRet set to NULL -// otherwise it is set to the TypeHandle associted with the type -// Enumerations will always look their underlying type (probably should fix this) -// Otherwise vcTypeRet is the type as would be seen by the IL, -// The return value is the type that is used for calling convention purposes -// (Thus if the EE wants a value class to be passed like an int, then it will -// return CORINFO_TYPE_INT -CorInfoTypeWithMod getArgType(CORINFO_SIG_INFO* sig, /* IN */ - CORINFO_ARG_LIST_HANDLE args, /* IN */ - CORINFO_CLASS_HANDLE* vcTypeRet /* OUT */ - ); - -// If the Arg is a CORINFO_TYPE_CLASS fetch the class handle associated with it -CORINFO_CLASS_HANDLE getArgClass(CORINFO_SIG_INFO* sig, /* IN */ - CORINFO_ARG_LIST_HANDLE args /* IN */ - ); - -// Returns type of HFA for valuetype -CorInfoHFAElemType getHFAType(CORINFO_CLASS_HANDLE hClass); - -/***************************************************************************** -* ICorErrorInfo contains methods to deal with SEH exceptions being thrown -* from the corinfo interface. These methods may be called when an exception -* with code EXCEPTION_COMPLUS is caught. -*****************************************************************************/ - -// Returns the HRESULT of the current exception -HRESULT GetErrorHRESULT(struct _EXCEPTION_POINTERS* pExceptionPointers); - -// Fetches the message of the current exception -// Returns the size of the message (including terminating null). This can be -// greater than bufferLength if the buffer is insufficient. -ULONG GetErrorMessage(__inout_ecount(bufferLength) LPWSTR buffer, ULONG bufferLength); - -// returns EXCEPTION_EXECUTE_HANDLER if it is OK for the compile to handle the -// exception, abort some work (like the inlining) and continue compilation -// returns EXCEPTION_CONTINUE_SEARCH if exception must always be handled by the EE -// things like ThreadStoppedException ... -// returns EXCEPTION_CONTINUE_EXECUTION if exception is fixed up by the EE - -int FilterException(struct _EXCEPTION_POINTERS* pExceptionPointers); - -// Cleans up internal EE tracking when an exception is caught. -void HandleException(struct _EXCEPTION_POINTERS* pExceptionPointers); - -void ThrowExceptionForJitResult(HRESULT result); - -// Throws an exception defined by the given throw helper. -void ThrowExceptionForHelper(const CORINFO_HELPER_DESC* throwHelper); - -// Runs the given function under an error trap. This allows the JIT to make calls -// to interface functions that may throw exceptions without needing to be aware of -// the EH ABI, exception types, etc. Returns true if the given function completed -// successfully and false otherwise. -bool runWithErrorTrap(void (*function)(void*), // The function to run - void* parameter // The context parameter that will be passed to the function and the handler - ); - -/***************************************************************************** - * ICorStaticInfo contains EE interface methods which return values that are - * constant from invocation to invocation. Thus they may be embedded in - * persisted information like statically generated code. (This is of course - * assuming that all code versions are identical each time.) - *****************************************************************************/ - -// Return details about EE internal data structures -void getEEInfo(CORINFO_EE_INFO* pEEInfoOut); - -// Returns name of the JIT timer log -LPCWSTR getJitTimeLogFilename(); - -/*********************************************************************************/ -// -// Diagnostic methods -// -/*********************************************************************************/ - -// this function is for debugging only. Returns method token. -// Returns mdMethodDefNil for dynamic methods. -mdMethodDef getMethodDefFromMethod(CORINFO_METHOD_HANDLE hMethod); - -// this function is for debugging only. It returns the method name -// and if 'moduleName' is non-null, it sets it to something that will -// says which method (a class name, or a module name) -const char* getMethodName(CORINFO_METHOD_HANDLE ftn, /* IN */ - const char** moduleName /* OUT */ - ); - -// Return method name as in metadata, or nullptr if there is none, -// and optionally return the class name as in metadata. -// Suitable for non-debugging use. -const char* getMethodNameFromMetadata(CORINFO_METHOD_HANDLE ftn, /* IN */ - const char** className, /* OUT */ - const char** namespaceName, /* OUT */ - const char** enclosingClassName /* OUT */ - ); - -// this function is for debugging only. It returns a value that -// is will always be the same for a given method. It is used -// to implement the 'jitRange' functionality -unsigned getMethodHash(CORINFO_METHOD_HANDLE ftn /* IN */ - ); - -// this function is for debugging only. -size_t findNameOfToken(CORINFO_MODULE_HANDLE module, /* IN */ - mdToken metaTOK, /* IN */ - __out_ecount(FQNameCapacity) char* szFQName, /* OUT */ - size_t FQNameCapacity /* IN */ - ); - -// returns whether the struct is enregisterable. Only valid on a System V VM. Returns true on success, false on failure. -bool getSystemVAmd64PassStructInRegisterDescriptor( - /* IN */ CORINFO_CLASS_HANDLE structHnd, - /* OUT */ SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR* structPassInRegDescPtr); - -/***************************************************************************** - * ICorDynamicInfo contains EE interface methods which return values that may - * change from invocation to invocation. They cannot be embedded in persisted - * data; they must be requeried each time the EE is run. - *****************************************************************************/ - -// -// These methods return values to the JIT which are not constant -// from session to session. -// -// These methods take an extra parameter : void **ppIndirection. -// If a JIT supports generation of prejit code (install-o-jit), it -// must pass a non-null value for this parameter, and check the -// resulting value. If *ppIndirection is NULL, code should be -// generated normally. If non-null, then the value of -// *ppIndirection is an address in the cookie table, and the code -// generator needs to generate an indirection through the table to -// get the resulting value. In this case, the return result of the -// function must NOT be directly embedded in the generated code. -// -// Note that if a JIT does not support prejit code generation, it -// may ignore the extra parameter & pass the default of NULL - the -// prejit ICorDynamicInfo implementation will see this & generate -// an error if the jitter is used in a prejit scenario. -// - -// Return details about EE internal data structures - -DWORD getThreadTLSIndex(void** ppIndirection = NULL); - -const void* getInlinedCallFrameVptr(void** ppIndirection = NULL); - -LONG* getAddrOfCaptureThreadGlobal(void** ppIndirection = NULL); - -// return the native entry point to an EE helper (see CorInfoHelpFunc) -void* getHelperFtn(CorInfoHelpFunc ftnNum, void** ppIndirection = NULL); - -// return a callable address of the function (native code). This function -// may return a different value (depending on whether the method has -// been JITed or not. -void getFunctionEntryPoint(CORINFO_METHOD_HANDLE ftn, /* IN */ - CORINFO_CONST_LOOKUP* pResult, /* OUT */ - CORINFO_ACCESS_FLAGS accessFlags = CORINFO_ACCESS_ANY); - -// return a directly callable address. This can be used similarly to the -// value returned by getFunctionEntryPoint() except that it is -// guaranteed to be multi callable entrypoint. -void getFunctionFixedEntryPoint(CORINFO_METHOD_HANDLE ftn, CORINFO_CONST_LOOKUP* pResult); - -// get the synchronization handle that is passed to monXstatic function -void* getMethodSync(CORINFO_METHOD_HANDLE ftn, void** ppIndirection = NULL); - -// get slow lazy string literal helper to use (CORINFO_HELP_STRCNS*). -// Returns CORINFO_HELP_UNDEF if lazy string literal helper cannot be used. -CorInfoHelpFunc getLazyStringLiteralHelper(CORINFO_MODULE_HANDLE handle); - -CORINFO_MODULE_HANDLE embedModuleHandle(CORINFO_MODULE_HANDLE handle, void** ppIndirection = NULL); - -CORINFO_CLASS_HANDLE embedClassHandle(CORINFO_CLASS_HANDLE handle, void** ppIndirection = NULL); - -CORINFO_METHOD_HANDLE embedMethodHandle(CORINFO_METHOD_HANDLE handle, void** ppIndirection = NULL); - -CORINFO_FIELD_HANDLE embedFieldHandle(CORINFO_FIELD_HANDLE handle, void** ppIndirection = NULL); - -// Given a module scope (module), a method handle (context) and -// a metadata token (metaTOK), fetch the handle -// (type, field or method) associated with the token. -// If this is not possible at compile-time (because the current method's -// code is shared and the token contains generic parameters) -// then indicate how the handle should be looked up at run-time. -// -void embedGenericHandle(CORINFO_RESOLVED_TOKEN* pResolvedToken, - BOOL fEmbedParent, // TRUE - embeds parent type handle of the field/method handle - CORINFO_GENERICHANDLE_RESULT* pResult); - -// Return information used to locate the exact enclosing type of the current method. -// Used only to invoke .cctor method from code shared across generic instantiations -// !needsRuntimeLookup statically known (enclosing type of method itself) -// needsRuntimeLookup: -// CORINFO_LOOKUP_THISOBJ use vtable pointer of 'this' param -// CORINFO_LOOKUP_CLASSPARAM use vtable hidden param -// CORINFO_LOOKUP_METHODPARAM use enclosing type of method-desc hidden param -void getLocationOfThisType(CORINFO_METHOD_HANDLE context, CORINFO_LOOKUP_KIND* pLookupKind); - -// return the address of the PInvoke target. May be a fixup area in the -// case of late-bound PInvoke calls. -void getAddressOfPInvokeTarget(CORINFO_METHOD_HANDLE method, CORINFO_CONST_LOOKUP* pLookup); - -// Generate a cookie based on the signature that would needs to be passed -// to CORINFO_HELP_PINVOKE_CALLI -LPVOID GetCookieForPInvokeCalliSig(CORINFO_SIG_INFO* szMetaSig, void** ppIndirection = NULL); - -// returns true if a VM cookie can be generated for it (might be false due to cross-module -// inlining, in which case the inlining should be aborted) -bool canGetCookieForPInvokeCalliSig(CORINFO_SIG_INFO* szMetaSig); - -// Gets a handle that is checked to see if the current method is -// included in "JustMyCode" -CORINFO_JUST_MY_CODE_HANDLE getJustMyCodeHandle(CORINFO_METHOD_HANDLE method, - CORINFO_JUST_MY_CODE_HANDLE** ppIndirection = NULL); - -// Gets a method handle that can be used to correlate profiling data. -// This is the IP of a native method, or the address of the descriptor struct -// for IL. Always guaranteed to be unique per process, and not to move. */ -void GetProfilingHandle(BOOL* pbHookFunction, void** pProfilerHandle, BOOL* pbIndirectedHandles); - -// Returns instructions on how to make the call. See code:CORINFO_CALL_INFO for possible return values. -void getCallInfo( - // Token info - CORINFO_RESOLVED_TOKEN* pResolvedToken, - - // Generics info - CORINFO_RESOLVED_TOKEN* pConstrainedResolvedToken, - - // Security info - CORINFO_METHOD_HANDLE callerHandle, - - // Jit info - CORINFO_CALLINFO_FLAGS flags, - - // out params - CORINFO_CALL_INFO* pResult); - -BOOL canAccessFamily(CORINFO_METHOD_HANDLE hCaller, CORINFO_CLASS_HANDLE hInstanceType); - -// Returns TRUE if the Class Domain ID is the RID of the class (currently true for every class -// except reflection emitted classes and generics) -BOOL isRIDClassDomainID(CORINFO_CLASS_HANDLE cls); - -// returns the class's domain ID for accessing shared statics -unsigned getClassDomainID(CORINFO_CLASS_HANDLE cls, void** ppIndirection = NULL); - -// return the data's address (for static fields only) -void* getFieldAddress(CORINFO_FIELD_HANDLE field, void** ppIndirection = NULL); - -// return the class handle for the current value of a static field -CORINFO_CLASS_HANDLE getStaticFieldCurrentClass(CORINFO_FIELD_HANDLE field, bool *pIsSpeculative); - -// registers a vararg sig & returns a VM cookie for it (which can contain other stuff) -CORINFO_VARARGS_HANDLE getVarArgsHandle(CORINFO_SIG_INFO* pSig, void** ppIndirection = NULL); - -// returns true if a VM cookie can be generated for it (might be false due to cross-module -// inlining, in which case the inlining should be aborted) -bool canGetVarArgsHandle(CORINFO_SIG_INFO* pSig); - -// Allocate a string literal on the heap and return a handle to it -InfoAccessType constructStringLiteral(CORINFO_MODULE_HANDLE module, mdToken metaTok, void** ppValue); - -InfoAccessType emptyStringLiteral(void** ppValue); - -// (static fields only) given that 'field' refers to thread local store, -// return the ID (TLS index), which is used to find the beginning of the -// TLS data area for the particular DLL 'field' is associated with. -DWORD getFieldThreadLocalStoreID(CORINFO_FIELD_HANDLE field, void** ppIndirection = NULL); - -// Sets another object to intercept calls to "self" and current method being compiled -void setOverride(ICorDynamicInfo* pOverride, CORINFO_METHOD_HANDLE currentMethod); - -// Adds an active dependency from the context method's module to the given module -// This is internal callback for the EE. JIT should not call it directly. -void addActiveDependency(CORINFO_MODULE_HANDLE moduleFrom, CORINFO_MODULE_HANDLE moduleTo); - -CORINFO_METHOD_HANDLE GetDelegateCtor(CORINFO_METHOD_HANDLE methHnd, - CORINFO_CLASS_HANDLE clsHnd, - CORINFO_METHOD_HANDLE targetMethodHnd, - DelegateCtorArgs* pCtorData); - -void MethodCompileComplete(CORINFO_METHOD_HANDLE methHnd); - -bool getTailCallHelpers( - CORINFO_RESOLVED_TOKEN* callToken, - CORINFO_SIG_INFO* sig, - CORINFO_GET_TAILCALL_HELPERS_FLAGS flags, - CORINFO_TAILCALL_HELPERS* pResult); - -bool convertPInvokeCalliToCall(CORINFO_RESOLVED_TOKEN * pResolvedToken, bool fMustConvert); - -// get a block of memory for the code, readonly data, and read-write data -void allocMem(ULONG hotCodeSize, /* IN */ - ULONG coldCodeSize, /* IN */ - ULONG roDataSize, /* IN */ - ULONG xcptnsCount, /* IN */ - CorJitAllocMemFlag flag, /* IN */ - void** hotCodeBlock, /* OUT */ - void** coldCodeBlock, /* OUT */ - void** roDataBlock /* OUT */ - ); - -// Reserve memory for the method/funclet's unwind information. -// Note that this must be called before allocMem. It should be -// called once for the main method, once for every funclet, and -// once for every block of cold code for which allocUnwindInfo -// will be called. -// -// This is necessary because jitted code must allocate all the -// memory needed for the unwindInfo at the allocMem call. -// For prejitted code we split up the unwinding information into -// separate sections .rdata and .pdata. -// -void reserveUnwindInfo(BOOL isFunclet, /* IN */ - BOOL isColdCode, /* IN */ - ULONG unwindSize /* IN */ - ); - -// Allocate and initialize the .rdata and .pdata for this method or -// funclet, and get the block of memory needed for the machine-specific -// unwind information (the info for crawling the stack frame). -// Note that allocMem must be called first. -// -// Parameters: -// -// pHotCode main method code buffer, always filled in -// pColdCode cold code buffer, only filled in if this is cold code, -// null otherwise -// startOffset start of code block, relative to appropriate code buffer -// (e.g. pColdCode if cold, pHotCode if hot). -// endOffset end of code block, relative to appropriate code buffer -// unwindSize size of unwind info pointed to by pUnwindBlock -// pUnwindBlock pointer to unwind info -// funcKind type of funclet (main method code, handler, filter) -// -void allocUnwindInfo(BYTE* pHotCode, /* IN */ - BYTE* pColdCode, /* IN */ - ULONG startOffset, /* IN */ - ULONG endOffset, /* IN */ - ULONG unwindSize, /* IN */ - BYTE* pUnwindBlock, /* IN */ - CorJitFuncKind funcKind /* IN */ - ); - -// Get a block of memory needed for the code manager information, -// (the info for enumerating the GC pointers while crawling the -// stack frame). -// Note that allocMem must be called first -void* allocGCInfo(size_t size /* IN */ - ); - -// Indicate how many exception handler blocks are to be returned. -// This is guaranteed to be called before any 'setEHinfo' call. -// Note that allocMem must be called before this method can be called. -void setEHcount(unsigned cEH /* IN */ - ); - -// Set the values for one particular exception handler block. -// -// Handler regions should be lexically contiguous. -// This is because FinallyIsUnwinding() uses lexicality to -// determine if a "finally" clause is executing. -void setEHinfo(unsigned EHnumber, /* IN */ - const CORINFO_EH_CLAUSE* clause /* IN */ - ); - -// Level -> fatalError, Level 2 -> Error, Level 3 -> Warning -// Level 4 means happens 10 times in a run, level 5 means 100, level 6 means 1000 ... -// returns non-zero if the logging succeeded -BOOL logMsg(unsigned level, const char* fmt, va_list args); - -// do an assert. will return true if the code should retry (DebugBreak) -// returns false, if the assert should be igored. -int doAssert(const char* szFile, int iLine, const char* szExpr); - -void reportFatalError(CorJitResult result); - -/* -struct BlockCounts // Also defined here: code:CORBBTPROF_BLOCK_DATA -{ - UINT32 ILOffset; - UINT32 ExecutionCount; -}; -*/ - -// allocate a basic block profile buffer where execution counts will be stored -// for jitted basic blocks. -HRESULT allocMethodBlockCounts(UINT32 count, // The number of basic blocks that we have - BlockCounts** pBlockCounts); - -// get profile information to be used for optimizing the current method. The format -// of the buffer is the same as the format the JIT passes to allocMethodBlockCounts. -HRESULT getMethodBlockCounts(CORINFO_METHOD_HANDLE ftnHnd, - UINT32 * pCount, // The number of basic blocks that we have - BlockCounts** pBlockCounts, - UINT32 * pNumRuns); - -// Associates a native call site, identified by its offset in the native code stream, with -// the signature information and method handle the JIT used to lay out the call site. If -// the call site has no signature information (e.g. a helper call) or has no method handle -// (e.g. a CALLI P/Invoke), then null should be passed instead. -void recordCallSite(ULONG instrOffset, /* IN */ - CORINFO_SIG_INFO* callSig, /* IN */ - CORINFO_METHOD_HANDLE methodHandle /* IN */ - ); - -// A relocation is recorded if we are pre-jitting. -// A jump thunk may be inserted if we are jitting -void recordRelocation(void* location, /* IN */ - void* target, /* IN */ - WORD fRelocType, /* IN */ - WORD slotNum, /* IN */ - INT32 addlDelta /* IN */ - ); - -WORD getRelocTypeHint(void* target); - -// For what machine does the VM expect the JIT to generate code? The VM -// returns one of the IMAGE_FILE_MACHINE_* values. Note that if the VM -// is cross-compiling (such as the case for crossgen), it will return a -// different value than if it was compiling for the host architecture. -// -DWORD getExpectedTargetArchitecture(); - -// Fetches extended flags for a particular compilation instance. Returns -// the number of bytes written to the provided buffer. -DWORD getJitFlags(CORJIT_FLAGS* flags, /* IN: Points to a buffer that will hold the extended flags. */ - DWORD sizeInBytes /* IN: The size of the buffer. Note that this is effectively a - version number for the CORJIT_FLAGS value. */ - ); - -void notifyInstructionSetUsage(CORINFO_InstructionSet instructionSet, bool supported); -#endif // _ICorJitInfoImpl diff --git a/src/coreclr/src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp b/src/coreclr/src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp deleted file mode 100644 index ec7f48a57c979..0000000000000 --- a/src/coreclr/src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp +++ /dev/null @@ -1,1671 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -// - -#include "standardpch.h" -#include "icorjitinfo.h" -#include "superpmi-shim-counter.h" -#include "icorjitcompiler.h" -#include "spmiutil.h" - -// Stuff on ICorStaticInfo -/**********************************************************************************/ -// -// ICorMethodInfo -// -/**********************************************************************************/ -// return flags (defined above, CORINFO_FLG_PUBLIC ...) -DWORD interceptor_ICJI::getMethodAttribs(CORINFO_METHOD_HANDLE ftn /* IN */) -{ - mcs->AddCall("getMethodAttribs"); - return original_ICorJitInfo->getMethodAttribs(ftn); -} - -// sets private JIT flags, which can be, retrieved using getAttrib. -void interceptor_ICJI::setMethodAttribs(CORINFO_METHOD_HANDLE ftn, /* IN */ - CorInfoMethodRuntimeFlags attribs /* IN */) -{ - mcs->AddCall("setMethodAttribs"); - original_ICorJitInfo->setMethodAttribs(ftn, attribs); -} - -// Given a method descriptor ftnHnd, extract signature information into sigInfo -// -// 'memberParent' is typically only set when verifying. It should be the -// result of calling getMemberParent. -void interceptor_ICJI::getMethodSig(CORINFO_METHOD_HANDLE ftn, /* IN */ - CORINFO_SIG_INFO* sig, /* OUT */ - CORINFO_CLASS_HANDLE memberParent /* IN */ - ) -{ - mcs->AddCall("getMethodSig"); - original_ICorJitInfo->getMethodSig(ftn, sig, memberParent); -} - -/********************************************************************* -* Note the following methods can only be used on functions known -* to be IL. This includes the method being compiled and any method -* that 'getMethodInfo' returns true for -*********************************************************************/ - -// return information about a method private to the implementation -// returns false if method is not IL, or is otherwise unavailable. -// This method is used to fetch data needed to inline functions -bool interceptor_ICJI::getMethodInfo(CORINFO_METHOD_HANDLE ftn, /* IN */ - CORINFO_METHOD_INFO* info /* OUT */ - ) -{ - mcs->AddCall("getMethodInfo"); - return original_ICorJitInfo->getMethodInfo(ftn, info); -} - -// Decides if you have any limitations for inlining. If everything's OK, it will return -// INLINE_PASS and will fill out pRestrictions with a mask of restrictions the caller of this -// function must respect. If caller passes pRestrictions = nullptr, if there are any restrictions -// INLINE_FAIL will be returned -// -// The callerHnd must be the immediate caller (i.e. when we have a chain of inlined calls) -// -// The inlined method need not be verified - -CorInfoInline interceptor_ICJI::canInline(CORINFO_METHOD_HANDLE callerHnd, /* IN */ - CORINFO_METHOD_HANDLE calleeHnd, /* IN */ - DWORD* pRestrictions /* OUT */ - ) -{ - mcs->AddCall("canInline"); - return original_ICorJitInfo->canInline(callerHnd, calleeHnd, pRestrictions); -} - -// Reports whether or not a method can be inlined, and why. canInline is responsible for reporting all -// inlining results when it returns INLINE_FAIL and INLINE_NEVER. All other results are reported by the -// JIT. -void interceptor_ICJI::reportInliningDecision(CORINFO_METHOD_HANDLE inlinerHnd, - CORINFO_METHOD_HANDLE inlineeHnd, - CorInfoInline inlineResult, - const char* reason) -{ - mcs->AddCall("reportInliningDecision"); - original_ICorJitInfo->reportInliningDecision(inlinerHnd, inlineeHnd, inlineResult, reason); -} - -// Returns false if the call is across security boundaries thus we cannot tailcall -// -// The callerHnd must be the immediate caller (i.e. when we have a chain of inlined calls) -bool interceptor_ICJI::canTailCall(CORINFO_METHOD_HANDLE callerHnd, /* IN */ - CORINFO_METHOD_HANDLE declaredCalleeHnd, /* IN */ - CORINFO_METHOD_HANDLE exactCalleeHnd, /* IN */ - bool fIsTailPrefix /* IN */ - ) -{ - mcs->AddCall("canTailCall"); - return original_ICorJitInfo->canTailCall(callerHnd, declaredCalleeHnd, exactCalleeHnd, fIsTailPrefix); -} - -// Reports whether or not a method can be tail called, and why. -// canTailCall is responsible for reporting all results when it returns -// false. All other results are reported by the JIT. -void interceptor_ICJI::reportTailCallDecision(CORINFO_METHOD_HANDLE callerHnd, - CORINFO_METHOD_HANDLE calleeHnd, - bool fIsTailPrefix, - CorInfoTailCall tailCallResult, - const char* reason) -{ - mcs->AddCall("reportTailCallDecision"); - original_ICorJitInfo->reportTailCallDecision(callerHnd, calleeHnd, fIsTailPrefix, tailCallResult, reason); -} - -// get individual exception handler -void interceptor_ICJI::getEHinfo(CORINFO_METHOD_HANDLE ftn, /* IN */ - unsigned EHnumber, /* IN */ - CORINFO_EH_CLAUSE* clause /* OUT */ - ) -{ - mcs->AddCall("getEHinfo"); - original_ICorJitInfo->getEHinfo(ftn, EHnumber, clause); -} - -// return class it belongs to -CORINFO_CLASS_HANDLE interceptor_ICJI::getMethodClass(CORINFO_METHOD_HANDLE method) -{ - mcs->AddCall("getMethodClass"); - return original_ICorJitInfo->getMethodClass(method); -} - -// return module it belongs to -CORINFO_MODULE_HANDLE interceptor_ICJI::getMethodModule(CORINFO_METHOD_HANDLE method) -{ - mcs->AddCall("getMethodModule"); - return original_ICorJitInfo->getMethodModule(method); -} - -// This function returns the offset of the specified method in the -// vtable of it's owning class or interface. -void interceptor_ICJI::getMethodVTableOffset(CORINFO_METHOD_HANDLE method, /* IN */ - unsigned* offsetOfIndirection, /* OUT */ - unsigned* offsetAfterIndirection, /* OUT */ - bool* isRelative /* OUT */ - ) -{ - mcs->AddCall("getMethodVTableOffset"); - original_ICorJitInfo->getMethodVTableOffset(method, offsetOfIndirection, offsetAfterIndirection, isRelative); -} - -// Find the virtual method in implementingClass that overrides virtualMethod. -// Return false if devirtualization is not possible. -bool interceptor_ICJI::tryResolveVirtualMethod(CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT* virtualMethodContext /* IN, OUT */) -{ - mcs->AddCall("tryResolveVirtualMethod"); - return original_ICorJitInfo->tryResolveVirtualMethod(virtualMethodContext); -} - -// Get the unboxed entry point for a method, if possible. -CORINFO_METHOD_HANDLE interceptor_ICJI::getUnboxedEntry(CORINFO_METHOD_HANDLE ftn, bool* requiresInstMethodTableArg) -{ - mcs->AddCall("getUnboxedEntry"); - return original_ICorJitInfo->getUnboxedEntry(ftn, requiresInstMethodTableArg); -} - -// Given T, return the type of the default EqualityComparer. -// Returns null if the type can't be determined exactly. -CORINFO_CLASS_HANDLE interceptor_ICJI::getDefaultEqualityComparerClass(CORINFO_CLASS_HANDLE cls) -{ - mcs->AddCall("getDefaultEqualityComparerClass"); - return original_ICorJitInfo->getDefaultEqualityComparerClass(cls); -} - -void interceptor_ICJI::expandRawHandleIntrinsic(CORINFO_RESOLVED_TOKEN* pResolvedToken, - CORINFO_GENERICHANDLE_RESULT* pResult) -{ - mcs->AddCall("expandRawHandleIntrinsic"); - original_ICorJitInfo->expandRawHandleIntrinsic(pResolvedToken, pResult); -} - -// If a method's attributes have (getMethodAttribs) CORINFO_FLG_INTRINSIC set, -// getIntrinsicID() returns the intrinsic ID. -CorInfoIntrinsics interceptor_ICJI::getIntrinsicID(CORINFO_METHOD_HANDLE method, bool* pMustExpand /* OUT */ - ) -{ - mcs->AddCall("getIntrinsicID"); - return original_ICorJitInfo->getIntrinsicID(method, pMustExpand); -} - -// Is the given type in System.Private.Corelib and marked with IntrinsicAttribute? -bool interceptor_ICJI::isIntrinsicType(CORINFO_CLASS_HANDLE classHnd) -{ - mcs->AddCall("isIntrinsicType"); - return original_ICorJitInfo->isIntrinsicType(classHnd); -} - -// return the unmanaged calling convention for a PInvoke -CorInfoUnmanagedCallConv interceptor_ICJI::getUnmanagedCallConv(CORINFO_METHOD_HANDLE method) -{ - mcs->AddCall("getUnmanagedCallConv"); - return original_ICorJitInfo->getUnmanagedCallConv(method); -} - -// return if any marshaling is required for PInvoke methods. Note that -// method == 0 => calli. The call site sig is only needed for the varargs or calli case -BOOL interceptor_ICJI::pInvokeMarshalingRequired(CORINFO_METHOD_HANDLE method, CORINFO_SIG_INFO* callSiteSig) -{ - mcs->AddCall("pInvokeMarshalingRequired"); - return original_ICorJitInfo->pInvokeMarshalingRequired(method, callSiteSig); -} - -// Check constraints on method type arguments (only). -// The parent class should be checked separately using satisfiesClassConstraints(parent). -BOOL interceptor_ICJI::satisfiesMethodConstraints(CORINFO_CLASS_HANDLE parent, // the exact parent of the method - CORINFO_METHOD_HANDLE method) -{ - mcs->AddCall("satisfiesMethodConstraints"); - return original_ICorJitInfo->satisfiesMethodConstraints(parent, method); -} - -// Given a delegate target class, a target method parent class, a target method, -// a delegate class, check if the method signature is compatible with the Invoke method of the delegate -// (under the typical instantiation of any free type variables in the memberref signatures). -BOOL interceptor_ICJI::isCompatibleDelegate( - CORINFO_CLASS_HANDLE objCls, /* type of the delegate target, if any */ - CORINFO_CLASS_HANDLE methodParentCls, /* exact parent of the target method, if any */ - CORINFO_METHOD_HANDLE method, /* (representative) target method, if any */ - CORINFO_CLASS_HANDLE delegateCls, /* exact type of the delegate */ - BOOL* pfIsOpenDelegate /* is the delegate open */ - ) -{ - mcs->AddCall("isCompatibleDelegate"); - return original_ICorJitInfo->isCompatibleDelegate(objCls, methodParentCls, method, delegateCls, pfIsOpenDelegate); -} - -// load and restore the method -void interceptor_ICJI::methodMustBeLoadedBeforeCodeIsRun(CORINFO_METHOD_HANDLE method) -{ - mcs->AddCall("methodMustBeLoadedBeforeCodeIsRun"); - original_ICorJitInfo->methodMustBeLoadedBeforeCodeIsRun(method); -} - -CORINFO_METHOD_HANDLE interceptor_ICJI::mapMethodDeclToMethodImpl(CORINFO_METHOD_HANDLE method) -{ - mcs->AddCall("mapMethodDeclToMethodImpl"); - return original_ICorJitInfo->mapMethodDeclToMethodImpl(method); -} - -// Returns the global cookie for the /GS unsafe buffer checks -// The cookie might be a constant value (JIT), or a handle to memory location (Ngen) -void interceptor_ICJI::getGSCookie(GSCookie* pCookieVal, // OUT - GSCookie** ppCookieVal // OUT - ) -{ - mcs->AddCall("getGSCookie"); - original_ICorJitInfo->getGSCookie(pCookieVal, ppCookieVal); -} - -// Provide patchpoint info for the method currently being jitted. -void interceptor_ICJI::setPatchpointInfo(PatchpointInfo* patchpointInfo) -{ - mcs->AddCall("setPatchpointInfo"); - original_ICorJitInfo->setPatchpointInfo(patchpointInfo); -} - -// Get OSR info for the method currently being jitted -PatchpointInfo* interceptor_ICJI::getOSRInfo(unsigned* ilOffset) -{ - mcs->AddCall("getOSRInfo"); - return original_ICorJitInfo->getOSRInfo(ilOffset); -} - -/**********************************************************************************/ -// -// ICorModuleInfo -// -/**********************************************************************************/ - -// Resolve metadata token into runtime method handles. -void interceptor_ICJI::resolveToken(/* IN, OUT */ CORINFO_RESOLVED_TOKEN* pResolvedToken) -{ - mcs->AddCall("resolveToken"); - original_ICorJitInfo->resolveToken(pResolvedToken); -} - -bool interceptor_ICJI::tryResolveToken(/* IN, OUT */ CORINFO_RESOLVED_TOKEN* pResolvedToken) -{ - mcs->AddCall("tryResolveToken"); - return original_ICorJitInfo->tryResolveToken(pResolvedToken); -} - -// Signature information about the call sig -void interceptor_ICJI::findSig(CORINFO_MODULE_HANDLE module, /* IN */ - unsigned sigTOK, /* IN */ - CORINFO_CONTEXT_HANDLE context, /* IN */ - CORINFO_SIG_INFO* sig /* OUT */ - ) -{ - mcs->AddCall("findSig"); - original_ICorJitInfo->findSig(module, sigTOK, context, sig); -} - -// for Varargs, the signature at the call site may differ from -// the signature at the definition. Thus we need a way of -// fetching the call site information -void interceptor_ICJI::findCallSiteSig(CORINFO_MODULE_HANDLE module, /* IN */ - unsigned methTOK, /* IN */ - CORINFO_CONTEXT_HANDLE context, /* IN */ - CORINFO_SIG_INFO* sig /* OUT */ - ) -{ - mcs->AddCall("findCallSiteSig"); - original_ICorJitInfo->findCallSiteSig(module, methTOK, context, sig); -} - -CORINFO_CLASS_HANDLE interceptor_ICJI::getTokenTypeAsHandle(CORINFO_RESOLVED_TOKEN* pResolvedToken /* IN */) -{ - mcs->AddCall("getTokenTypeAsHandle"); - return original_ICorJitInfo->getTokenTypeAsHandle(pResolvedToken); -} - -// Returns true if the module does not require verification -// -// If fQuickCheckOnlyWithoutCommit=TRUE, the function only checks that the -// module does not currently require verification in the current AppDomain. -// This decision could change in the future, and so should not be cached. -// If it is cached, it should only be used as a hint. -// This is only used by ngen for calculating certain hints. -// - -// Checks if the given metadata token is valid -BOOL interceptor_ICJI::isValidToken(CORINFO_MODULE_HANDLE module, /* IN */ - unsigned metaTOK /* IN */ - ) -{ - mcs->AddCall("isValidToken"); - return original_ICorJitInfo->isValidToken(module, metaTOK); -} - -// Checks if the given metadata token is valid StringRef -BOOL interceptor_ICJI::isValidStringRef(CORINFO_MODULE_HANDLE module, /* IN */ - unsigned metaTOK /* IN */ - ) -{ - mcs->AddCall("isValidStringRef"); - return original_ICorJitInfo->isValidStringRef(module, metaTOK); -} - -LPCWSTR interceptor_ICJI::getStringLiteral(CORINFO_MODULE_HANDLE module, /* IN */ - unsigned metaTOK, /* IN */ - int* length /* OUT */ - ) -{ - mcs->AddCall("getStringLiteral"); - return original_ICorJitInfo->getStringLiteral(module, metaTOK, length); -} - -/**********************************************************************************/ -// -// ICorClassInfo -// -/**********************************************************************************/ - -// If the value class 'cls' is isomorphic to a primitive type it will -// return that type, otherwise it will return CORINFO_TYPE_VALUECLASS -CorInfoType interceptor_ICJI::asCorInfoType(CORINFO_CLASS_HANDLE cls) -{ - mcs->AddCall("asCorInfoType"); - return original_ICorJitInfo->asCorInfoType(cls); -} - -// for completeness -const char* interceptor_ICJI::getClassName(CORINFO_CLASS_HANDLE cls) -{ - mcs->AddCall("getClassName"); - return original_ICorJitInfo->getClassName(cls); -} - -const char* interceptor_ICJI::getClassNameFromMetadata(CORINFO_CLASS_HANDLE cls, const char** namespaceName) -{ - mcs->AddCall("getClassNameFromMetadata"); - return original_ICorJitInfo->getClassNameFromMetadata(cls, namespaceName); -} - -CORINFO_CLASS_HANDLE interceptor_ICJI::getTypeInstantiationArgument(CORINFO_CLASS_HANDLE cls, unsigned index) -{ - mcs->AddCall("getTypeInstantiationArgument"); - return original_ICorJitInfo->getTypeInstantiationArgument(cls, index); -} - -// Append a (possibly truncated) representation of the type cls to the preallocated buffer ppBuf of length pnBufLen -// If fNamespace=TRUE, include the namespace/enclosing classes -// If fFullInst=TRUE (regardless of fNamespace and fAssembly), include namespace and assembly for any type parameters -// If fAssembly=TRUE, suffix with a comma and the full assembly qualification -// return size of representation -int interceptor_ICJI::appendClassName(__deref_inout_ecount(*pnBufLen) WCHAR** ppBuf, - int* pnBufLen, - CORINFO_CLASS_HANDLE cls, - BOOL fNamespace, - BOOL fFullInst, - BOOL fAssembly) -{ - mcs->AddCall("appendClassName"); - return original_ICorJitInfo->appendClassName(ppBuf, pnBufLen, cls, fNamespace, fFullInst, fAssembly); -} - -// Quick check whether the type is a value class. Returns the same value as getClassAttribs(cls) & -// CORINFO_FLG_VALUECLASS, except faster. -BOOL interceptor_ICJI::isValueClass(CORINFO_CLASS_HANDLE cls) -{ - mcs->AddCall("isValueClass"); - return original_ICorJitInfo->isValueClass(cls); -} - -// Decides how the JIT should do the optimization to inline the check for -// GetTypeFromHandle(handle) == obj.GetType() (for CORINFO_INLINE_TYPECHECK_SOURCE_VTABLE) -// GetTypeFromHandle(X) == GetTypeFromHandle(Y) (for CORINFO_INLINE_TYPECHECK_SOURCE_TOKEN) -CorInfoInlineTypeCheck interceptor_ICJI::canInlineTypeCheck(CORINFO_CLASS_HANDLE cls, - CorInfoInlineTypeCheckSource source) -{ - mcs->AddCall("canInlineTypeCheck"); - return original_ICorJitInfo->canInlineTypeCheck(cls, source); -} - -// return flags (defined above, CORINFO_FLG_PUBLIC ...) -DWORD interceptor_ICJI::getClassAttribs(CORINFO_CLASS_HANDLE cls) -{ - mcs->AddCall("getClassAttribs"); - return original_ICorJitInfo->getClassAttribs(cls); -} - -// Returns "TRUE" iff "cls" is a struct type such that return buffers used for returning a value -// of this type must be stack-allocated. This will generally be true only if the struct -// contains GC pointers, and does not exceed some size limit. Maintaining this as an invariant allows -// an optimization: the JIT may assume that return buffer pointers for return types for which this predicate -// returns TRUE are always stack allocated, and thus, that stores to the GC-pointer fields of such return -// buffers do not require GC write barriers. -BOOL interceptor_ICJI::isStructRequiringStackAllocRetBuf(CORINFO_CLASS_HANDLE cls) -{ - mcs->AddCall("isStructRequiringStackAllocRetBuf"); - return original_ICorJitInfo->isStructRequiringStackAllocRetBuf(cls); -} - -CORINFO_MODULE_HANDLE interceptor_ICJI::getClassModule(CORINFO_CLASS_HANDLE cls) -{ - mcs->AddCall("getClassModule"); - return original_ICorJitInfo->getClassModule(cls); -} - -// Returns the assembly that contains the module "mod". -CORINFO_ASSEMBLY_HANDLE interceptor_ICJI::getModuleAssembly(CORINFO_MODULE_HANDLE mod) -{ - mcs->AddCall("getModuleAssembly"); - return original_ICorJitInfo->getModuleAssembly(mod); -} - -// Returns the name of the assembly "assem". -const char* interceptor_ICJI::getAssemblyName(CORINFO_ASSEMBLY_HANDLE assem) -{ - mcs->AddCall("getAssemblyName"); - return original_ICorJitInfo->getAssemblyName(assem); -} - -// Allocate and delete process-lifetime objects. Should only be -// referred to from static fields, lest a leak occur. -// Note that "LongLifetimeFree" does not execute destructors, if "obj" -// is an array of a struct type with a destructor. -void* interceptor_ICJI::LongLifetimeMalloc(size_t sz) -{ - mcs->AddCall("LongLifetimeMalloc"); - return original_ICorJitInfo->LongLifetimeMalloc(sz); -} - -void interceptor_ICJI::LongLifetimeFree(void* obj) -{ - mcs->AddCall("LongLifetimeFree"); - original_ICorJitInfo->LongLifetimeFree(obj); -} - -size_t interceptor_ICJI::getClassModuleIdForStatics(CORINFO_CLASS_HANDLE cls, - CORINFO_MODULE_HANDLE* pModule, - void** ppIndirection) -{ - mcs->AddCall("getClassModuleIdForStatics"); - return original_ICorJitInfo->getClassModuleIdForStatics(cls, pModule, ppIndirection); -} - -// return the number of bytes needed by an instance of the class -unsigned interceptor_ICJI::getClassSize(CORINFO_CLASS_HANDLE cls) -{ - mcs->AddCall("getClassSize"); - return original_ICorJitInfo->getClassSize(cls); -} - -// return the number of bytes needed by an instance of the class allocated on the heap -unsigned interceptor_ICJI::getHeapClassSize(CORINFO_CLASS_HANDLE cls) -{ - mcs->AddCall("getHeapClassSize"); - return original_ICorJitInfo->getHeapClassSize(cls); -} - -BOOL interceptor_ICJI::canAllocateOnStack(CORINFO_CLASS_HANDLE cls) -{ - mcs->AddCall("canAllocateOnStack"); - return original_ICorJitInfo->canAllocateOnStack(cls); -} - -unsigned interceptor_ICJI::getClassAlignmentRequirement(CORINFO_CLASS_HANDLE cls, BOOL fDoubleAlignHint) -{ - mcs->AddCall("getClassAlignmentRequirement"); - return original_ICorJitInfo->getClassAlignmentRequirement(cls, fDoubleAlignHint); -} - -// This is only called for Value classes. It returns a boolean array -// in representing of 'cls' from a GC perspective. The class is -// assumed to be an array of machine words -// (of length // getClassSize(cls) / sizeof(void*)), -// 'gcPtrs' is a pointer to an array of BYTEs of this length. -// getClassGClayout fills in this array so that gcPtrs[i] is set -// to one of the CorInfoGCType values which is the GC type of -// the i-th machine word of an object of type 'cls' -// returns the number of GC pointers in the array -unsigned interceptor_ICJI::getClassGClayout(CORINFO_CLASS_HANDLE cls, /* IN */ - BYTE* gcPtrs /* OUT */ - ) -{ - mcs->AddCall("getClassGClayout"); - return original_ICorJitInfo->getClassGClayout(cls, gcPtrs); -} - -// returns the number of instance fields in a class -unsigned interceptor_ICJI::getClassNumInstanceFields(CORINFO_CLASS_HANDLE cls /* IN */ - ) -{ - mcs->AddCall("getClassNumInstanceFields"); - return original_ICorJitInfo->getClassNumInstanceFields(cls); -} - -CORINFO_FIELD_HANDLE interceptor_ICJI::getFieldInClass(CORINFO_CLASS_HANDLE clsHnd, INT num) -{ - mcs->AddCall("getFieldInClass"); - return original_ICorJitInfo->getFieldInClass(clsHnd, num); -} - -BOOL interceptor_ICJI::checkMethodModifier(CORINFO_METHOD_HANDLE hMethod, LPCSTR modifier, BOOL fOptional) -{ - mcs->AddCall("checkMethodModifier"); - return original_ICorJitInfo->checkMethodModifier(hMethod, modifier, fOptional); -} - -// returns the "NEW" helper optimized for "newCls." -CorInfoHelpFunc interceptor_ICJI::getNewHelper(CORINFO_RESOLVED_TOKEN* pResolvedToken, - CORINFO_METHOD_HANDLE callerHandle, - bool* pHasSideEffects) -{ - mcs->AddCall("getNewHelper"); - return original_ICorJitInfo->getNewHelper(pResolvedToken, callerHandle, pHasSideEffects); -} - -// returns the newArr (1-Dim array) helper optimized for "arrayCls." -CorInfoHelpFunc interceptor_ICJI::getNewArrHelper(CORINFO_CLASS_HANDLE arrayCls) -{ - mcs->AddCall("getNewArrHelper"); - return original_ICorJitInfo->getNewArrHelper(arrayCls); -} - -// returns the optimized "IsInstanceOf" or "ChkCast" helper -CorInfoHelpFunc interceptor_ICJI::getCastingHelper(CORINFO_RESOLVED_TOKEN* pResolvedToken, bool fThrowing) -{ - mcs->AddCall("getCastingHelper"); - return original_ICorJitInfo->getCastingHelper(pResolvedToken, fThrowing); -} - -// returns helper to trigger static constructor -CorInfoHelpFunc interceptor_ICJI::getSharedCCtorHelper(CORINFO_CLASS_HANDLE clsHnd) -{ - mcs->AddCall("getSharedCCtorHelper"); - return original_ICorJitInfo->getSharedCCtorHelper(clsHnd); -} - -// This is not pretty. Boxing nullable actually returns -// a boxed not a boxed Nullable. This call allows the verifier -// to call back to the EE on the 'box' instruction and get the transformed -// type to use for verification. -CORINFO_CLASS_HANDLE interceptor_ICJI::getTypeForBox(CORINFO_CLASS_HANDLE cls) -{ - mcs->AddCall("getTypeForBox"); - return original_ICorJitInfo->getTypeForBox(cls); -} - -// returns the correct box helper for a particular class. Note -// that if this returns CORINFO_HELP_BOX, the JIT can assume -// 'standard' boxing (allocate object and copy), and optimize -CorInfoHelpFunc interceptor_ICJI::getBoxHelper(CORINFO_CLASS_HANDLE cls) -{ - mcs->AddCall("getBoxHelper"); - return original_ICorJitInfo->getBoxHelper(cls); -} - -// returns the unbox helper. If 'helperCopies' points to a true -// value it means the JIT is requesting a helper that unboxes the -// value into a particular location and thus has the signature -// void unboxHelper(void* dest, CORINFO_CLASS_HANDLE cls, Object* obj) -// Otherwise (it is null or points at a FALSE value) it is requesting -// a helper that returns a pointer to the unboxed data -// void* unboxHelper(CORINFO_CLASS_HANDLE cls, Object* obj) -// The EE has the option of NOT returning the copy style helper -// (But must be able to always honor the non-copy style helper) -// The EE set 'helperCopies' on return to indicate what kind of -// helper has been created. - -CorInfoHelpFunc interceptor_ICJI::getUnBoxHelper(CORINFO_CLASS_HANDLE cls) -{ - mcs->AddCall("getUnBoxHelper"); - return original_ICorJitInfo->getUnBoxHelper(cls); -} - -bool interceptor_ICJI::getReadyToRunHelper(CORINFO_RESOLVED_TOKEN* pResolvedToken, - CORINFO_LOOKUP_KIND* pGenericLookupKind, - CorInfoHelpFunc id, - CORINFO_CONST_LOOKUP* pLookup) -{ - mcs->AddCall("getReadyToRunHelper"); - return original_ICorJitInfo->getReadyToRunHelper(pResolvedToken, pGenericLookupKind, id, pLookup); -} - -void interceptor_ICJI::getReadyToRunDelegateCtorHelper(CORINFO_RESOLVED_TOKEN* pTargetMethod, - CORINFO_CLASS_HANDLE delegateType, - CORINFO_LOOKUP* pLookup) -{ - mcs->AddCall("getReadyToRunDelegateCtorHelper"); - original_ICorJitInfo->getReadyToRunDelegateCtorHelper(pTargetMethod, delegateType, pLookup); -} - -const char* interceptor_ICJI::getHelperName(CorInfoHelpFunc funcNum) -{ - mcs->AddCall("getHelperName"); - return original_ICorJitInfo->getHelperName(funcNum); -} - -// This function tries to initialize the class (run the class constructor). -// this function returns whether the JIT must insert helper calls before -// accessing static field or method. -// -// See code:ICorClassInfo#ClassConstruction. -CorInfoInitClassResult interceptor_ICJI::initClass( - CORINFO_FIELD_HANDLE field, // Non-nullptr - inquire about cctor trigger before static field access - // nullptr - inquire about cctor trigger in method prolog - CORINFO_METHOD_HANDLE method, // Method referencing the field or prolog - CORINFO_CONTEXT_HANDLE context // Exact context of method - ) -{ - mcs->AddCall("initClass"); - return original_ICorJitInfo->initClass(field, method, context); -} - -// This used to be called "loadClass". This records the fact -// that the class must be loaded (including restored if necessary) before we execute the -// code that we are currently generating. When jitting code -// the function loads the class immediately. When zapping code -// the zapper will if necessary use the call to record the fact that we have -// to do a fixup/restore before running the method currently being generated. -// -// This is typically used to ensure value types are loaded before zapped -// code that manipulates them is executed, so that the GC can access information -// about those value types. -void interceptor_ICJI::classMustBeLoadedBeforeCodeIsRun(CORINFO_CLASS_HANDLE cls) -{ - mcs->AddCall("classMustBeLoadedBeforeCodeIsRun"); - original_ICorJitInfo->classMustBeLoadedBeforeCodeIsRun(cls); -} - -// returns the class handle for the special builtin classes -CORINFO_CLASS_HANDLE interceptor_ICJI::getBuiltinClass(CorInfoClassId classId) -{ - mcs->AddCall("getBuiltinClass"); - return original_ICorJitInfo->getBuiltinClass(classId); -} - -// "System.Int32" ==> CORINFO_TYPE_INT.. -CorInfoType interceptor_ICJI::getTypeForPrimitiveValueClass(CORINFO_CLASS_HANDLE cls) -{ - mcs->AddCall("getTypeForPrimitiveValueClass"); - return original_ICorJitInfo->getTypeForPrimitiveValueClass(cls); -} - -// "System.Int32" ==> CORINFO_TYPE_INT.. -// "System.UInt32" ==> CORINFO_TYPE_UINT.. -CorInfoType interceptor_ICJI::getTypeForPrimitiveNumericClass(CORINFO_CLASS_HANDLE cls) -{ - mcs->AddCall("getTypeForPrimitiveNumericClass"); - return original_ICorJitInfo->getTypeForPrimitiveNumericClass(cls); -} - -// TRUE if child is a subtype of parent -// if parent is an interface, then does child implement / extend parent -BOOL interceptor_ICJI::canCast(CORINFO_CLASS_HANDLE child, // subtype (extends parent) - CORINFO_CLASS_HANDLE parent // base type - ) -{ - mcs->AddCall("canCast"); - return original_ICorJitInfo->canCast(child, parent); -} - -// TRUE if cls1 and cls2 are considered equivalent types. -BOOL interceptor_ICJI::areTypesEquivalent(CORINFO_CLASS_HANDLE cls1, CORINFO_CLASS_HANDLE cls2) -{ - mcs->AddCall("areTypesEquivalent"); - return original_ICorJitInfo->areTypesEquivalent(cls1, cls2); -} - -// See if a cast from fromClass to toClass will succeed, fail, or needs -// to be resolved at runtime. -TypeCompareState interceptor_ICJI::compareTypesForCast(CORINFO_CLASS_HANDLE fromClass, CORINFO_CLASS_HANDLE toClass) -{ - mcs->AddCall("compareTypesForCast"); - return original_ICorJitInfo->compareTypesForCast(fromClass, toClass); -} - -// See if types represented by cls1 and cls2 compare equal, not -// equal, or the comparison needs to be resolved at runtime. -TypeCompareState interceptor_ICJI::compareTypesForEquality(CORINFO_CLASS_HANDLE cls1, CORINFO_CLASS_HANDLE cls2) -{ - mcs->AddCall("compareTypesForEquality"); - return original_ICorJitInfo->compareTypesForEquality(cls1, cls2); -} - -// returns is the intersection of cls1 and cls2. -CORINFO_CLASS_HANDLE interceptor_ICJI::mergeClasses(CORINFO_CLASS_HANDLE cls1, CORINFO_CLASS_HANDLE cls2) -{ - mcs->AddCall("mergeClasses"); - return original_ICorJitInfo->mergeClasses(cls1, cls2); -} - -// Returns true if cls2 is known to be a more specific type than cls1. -BOOL interceptor_ICJI::isMoreSpecificType(CORINFO_CLASS_HANDLE cls1, CORINFO_CLASS_HANDLE cls2) -{ - mcs->AddCall("isMoreSpecificType"); - return original_ICorJitInfo->isMoreSpecificType(cls1, cls2); -} - -// Given a class handle, returns the Parent type. -// For COMObjectType, it returns Class Handle of System.Object. -// Returns 0 if System.Object is passed in. -CORINFO_CLASS_HANDLE interceptor_ICJI::getParentType(CORINFO_CLASS_HANDLE cls) -{ - mcs->AddCall("getParentType"); - return original_ICorJitInfo->getParentType(cls); -} - -// Returns the CorInfoType of the "child type". If the child type is -// not a primitive type, *clsRet will be set. -// Given an Array of Type Foo, returns Foo. -// Given BYREF Foo, returns Foo -CorInfoType interceptor_ICJI::getChildType(CORINFO_CLASS_HANDLE clsHnd, CORINFO_CLASS_HANDLE* clsRet) -{ - mcs->AddCall("getChildType"); - return original_ICorJitInfo->getChildType(clsHnd, clsRet); -} - -// Check constraints on type arguments of this class and parent classes -BOOL interceptor_ICJI::satisfiesClassConstraints(CORINFO_CLASS_HANDLE cls) -{ - mcs->AddCall("satisfiesClassConstraints"); - return original_ICorJitInfo->satisfiesClassConstraints(cls); -} - -// Check if this is a single dimensional array type -BOOL interceptor_ICJI::isSDArray(CORINFO_CLASS_HANDLE cls) -{ - mcs->AddCall("isSDArray"); - return original_ICorJitInfo->isSDArray(cls); -} - -// Get the numbmer of dimensions in an array -unsigned interceptor_ICJI::getArrayRank(CORINFO_CLASS_HANDLE cls) -{ - mcs->AddCall("getArrayRank"); - return original_ICorJitInfo->getArrayRank(cls); -} - -// Get static field data for an array -void* interceptor_ICJI::getArrayInitializationData(CORINFO_FIELD_HANDLE field, DWORD size) -{ - mcs->AddCall("getArrayInitializationData"); - return original_ICorJitInfo->getArrayInitializationData(field, size); -} - -// Check Visibility rules. -CorInfoIsAccessAllowedResult interceptor_ICJI::canAccessClass( - CORINFO_RESOLVED_TOKEN* pResolvedToken, - CORINFO_METHOD_HANDLE callerHandle, - CORINFO_HELPER_DESC* pAccessHelper /* If canAccessMethod returns something other - than ALLOWED, then this is filled in. */ - ) -{ - mcs->AddCall("canAccessClass"); - return original_ICorJitInfo->canAccessClass(pResolvedToken, callerHandle, pAccessHelper); -} - -/**********************************************************************************/ -// -// ICorFieldInfo -// -/**********************************************************************************/ - -// this function is for debugging only. It returns the field name -// and if 'moduleName' is non-null, it sets it to something that will -// says which method (a class name, or a module name) -const char* interceptor_ICJI::getFieldName(CORINFO_FIELD_HANDLE ftn, /* IN */ - const char** moduleName /* OUT */ - ) -{ - mcs->AddCall("getFieldName"); - return original_ICorJitInfo->getFieldName(ftn, moduleName); -} - -// return class it belongs to -CORINFO_CLASS_HANDLE interceptor_ICJI::getFieldClass(CORINFO_FIELD_HANDLE field) -{ - mcs->AddCall("getFieldClass"); - return original_ICorJitInfo->getFieldClass(field); -} - -// Return the field's type, if it is CORINFO_TYPE_VALUECLASS 'structType' is set -// the field's value class (if 'structType' == 0, then don't bother -// the structure info). -// -// 'memberParent' is typically only set when verifying. It should be the -// result of calling getMemberParent. -CorInfoType interceptor_ICJI::getFieldType(CORINFO_FIELD_HANDLE field, - CORINFO_CLASS_HANDLE* structType, - CORINFO_CLASS_HANDLE memberParent /* IN */ - ) -{ - mcs->AddCall("getFieldType"); - return original_ICorJitInfo->getFieldType(field, structType, memberParent); -} - -// return the data member's instance offset -unsigned interceptor_ICJI::getFieldOffset(CORINFO_FIELD_HANDLE field) -{ - mcs->AddCall("getFieldOffset"); - return original_ICorJitInfo->getFieldOffset(field); -} - -void interceptor_ICJI::getFieldInfo(CORINFO_RESOLVED_TOKEN* pResolvedToken, - CORINFO_METHOD_HANDLE callerHandle, - CORINFO_ACCESS_FLAGS flags, - CORINFO_FIELD_INFO* pResult) -{ - mcs->AddCall("getFieldInfo"); - original_ICorJitInfo->getFieldInfo(pResolvedToken, callerHandle, flags, pResult); -} - -// Returns true iff "fldHnd" represents a static field. -bool interceptor_ICJI::isFieldStatic(CORINFO_FIELD_HANDLE fldHnd) -{ - mcs->AddCall("isFieldStatic"); - return original_ICorJitInfo->isFieldStatic(fldHnd); -} - -/*********************************************************************************/ -// -// ICorDebugInfo -// -/*********************************************************************************/ - -// Query the EE to find out where interesting break points -// in the code are. The native compiler will ensure that these places -// have a corresponding break point in native code. -// -// Note that unless CORJIT_FLAG_DEBUG_CODE is specified, this function will -// be used only as a hint and the native compiler should not change its -// code generation. -void interceptor_ICJI::getBoundaries(CORINFO_METHOD_HANDLE ftn, // [IN] method of interest - unsigned int* cILOffsets, // [OUT] size of pILOffsets - DWORD** pILOffsets, // [OUT] IL offsets of interest - // jit MUST free with freeArray! - ICorDebugInfo::BoundaryTypes* implictBoundaries // [OUT] tell jit, all boundries of - // this type - ) -{ - mcs->AddCall("getBoundaries"); - original_ICorJitInfo->getBoundaries(ftn, cILOffsets, pILOffsets, implictBoundaries); -} - -// Report back the mapping from IL to native code, -// this map should include all boundaries that 'getBoundaries' -// reported as interesting to the debugger. - -// Note that debugger (and profiler) is assuming that all of the -// offsets form a contiguous block of memory, and that the -// OffsetMapping is sorted in order of increasing native offset. -void interceptor_ICJI::setBoundaries(CORINFO_METHOD_HANDLE ftn, // [IN] method of interest - ULONG32 cMap, // [IN] size of pMap - ICorDebugInfo::OffsetMapping* pMap // [IN] map including all points of interest. - // jit allocated with allocateArray, EE - // frees - ) -{ - mcs->AddCall("setBoundaries"); - original_ICorJitInfo->setBoundaries(ftn, cMap, pMap); -} - -// Query the EE to find out the scope of local varables. -// normally the JIT would trash variables after last use, but -// under debugging, the JIT needs to keep them live over their -// entire scope so that they can be inspected. -// -// Note that unless CORJIT_FLAG_DEBUG_CODE is specified, this function will -// be used only as a hint and the native compiler should not change its -// code generation. -void interceptor_ICJI::getVars(CORINFO_METHOD_HANDLE ftn, // [IN] method of interest - ULONG32* cVars, // [OUT] size of 'vars' - ICorDebugInfo::ILVarInfo** vars, // [OUT] scopes of variables of interest - // jit MUST free with freeArray! - bool* extendOthers // [OUT] it TRUE, then assume the scope - // of unmentioned vars is entire method - ) -{ - mcs->AddCall("getVars"); - original_ICorJitInfo->getVars(ftn, cVars, vars, extendOthers); -} - -// Report back to the EE the location of every variable. -// note that the JIT might split lifetimes into different -// locations etc. - -void interceptor_ICJI::setVars(CORINFO_METHOD_HANDLE ftn, // [IN] method of interest - ULONG32 cVars, // [IN] size of 'vars' - ICorDebugInfo::NativeVarInfo* vars // [IN] map telling where local vars are stored at - // what points - // jit allocated with allocateArray, EE frees - ) -{ - mcs->AddCall("setVars"); - original_ICorJitInfo->setVars(ftn, cVars, vars); -} - -/*-------------------------- Misc ---------------------------------------*/ - -// Used to allocate memory that needs to handed to the EE. -// For eg, use this to allocated memory for reporting debug info, -// which will be handed to the EE by setVars() and setBoundaries() -void* interceptor_ICJI::allocateArray(size_t cBytes) -{ - mcs->AddCall("allocateArray"); - return original_ICorJitInfo->allocateArray(cBytes); -} - -// JitCompiler will free arrays passed by the EE using this -// For eg, The EE returns memory in getVars() and getBoundaries() -// to the JitCompiler, which the JitCompiler should release using -// freeArray() -void interceptor_ICJI::freeArray(void* array) -{ - mcs->AddCall("freeArray"); - original_ICorJitInfo->freeArray(array); -} - -/*********************************************************************************/ -// -// ICorArgInfo -// -/*********************************************************************************/ - -// advance the pointer to the argument list. -// a ptr of 0, is special and always means the first argument -CORINFO_ARG_LIST_HANDLE interceptor_ICJI::getArgNext(CORINFO_ARG_LIST_HANDLE args /* IN */ - ) -{ - mcs->AddCall("getArgNext"); - return original_ICorJitInfo->getArgNext(args); -} - -// Get the type of a particular argument -// CORINFO_TYPE_UNDEF is returned when there are no more arguments -// If the type returned is a primitive type (or an enum) *vcTypeRet set to nullptr -// otherwise it is set to the TypeHandle associted with the type -// Enumerations will always look their underlying type (probably should fix this) -// Otherwise vcTypeRet is the type as would be seen by the IL, -// The return value is the type that is used for calling convention purposes -// (Thus if the EE wants a value class to be passed like an int, then it will -// return CORINFO_TYPE_INT -CorInfoTypeWithMod interceptor_ICJI::getArgType(CORINFO_SIG_INFO* sig, /* IN */ - CORINFO_ARG_LIST_HANDLE args, /* IN */ - CORINFO_CLASS_HANDLE* vcTypeRet /* OUT */ - ) -{ - mcs->AddCall("getArgType"); - return original_ICorJitInfo->getArgType(sig, args, vcTypeRet); -} - -// If the Arg is a CORINFO_TYPE_CLASS fetch the class handle associated with it -CORINFO_CLASS_HANDLE interceptor_ICJI::getArgClass(CORINFO_SIG_INFO* sig, /* IN */ - CORINFO_ARG_LIST_HANDLE args /* IN */ - ) -{ - mcs->AddCall("getArgClass"); - return original_ICorJitInfo->getArgClass(sig, args); -} - -// Returns type of HFA for valuetype -CorInfoHFAElemType interceptor_ICJI::getHFAType(CORINFO_CLASS_HANDLE hClass) -{ - mcs->AddCall("getHFAType"); - return original_ICorJitInfo->getHFAType(hClass); -} - -/***************************************************************************** -* ICorErrorInfo contains methods to deal with SEH exceptions being thrown -* from the corinfo interface. These methods may be called when an exception -* with code EXCEPTION_COMPLUS is caught. -*****************************************************************************/ - -// Returns the HRESULT of the current exception -HRESULT interceptor_ICJI::GetErrorHRESULT(struct _EXCEPTION_POINTERS* pExceptionPointers) -{ - mcs->AddCall("GetErrorHRESULT"); - return original_ICorJitInfo->GetErrorHRESULT(pExceptionPointers); -} - -// Fetches the message of the current exception -// Returns the size of the message (including terminating null). This can be -// greater than bufferLength if the buffer is insufficient. -ULONG interceptor_ICJI::GetErrorMessage(__inout_ecount(bufferLength) LPWSTR buffer, ULONG bufferLength) -{ - mcs->AddCall("GetErrorMessage"); - return original_ICorJitInfo->GetErrorMessage(buffer, bufferLength); -} - -// returns EXCEPTION_EXECUTE_HANDLER if it is OK for the compile to handle the -// exception, abort some work (like the inlining) and continue compilation -// returns EXCEPTION_CONTINUE_SEARCH if exception must always be handled by the EE -// things like ThreadStoppedException ... -// returns EXCEPTION_CONTINUE_EXECUTION if exception is fixed up by the EE - -int interceptor_ICJI::FilterException(struct _EXCEPTION_POINTERS* pExceptionPointers) -{ - mcs->AddCall("FilterException"); - return original_ICorJitInfo->FilterException(pExceptionPointers); -} - -// Cleans up internal EE tracking when an exception is caught. -void interceptor_ICJI::HandleException(struct _EXCEPTION_POINTERS* pExceptionPointers) -{ - mcs->AddCall("HandleException"); - original_ICorJitInfo->HandleException(pExceptionPointers); -} - -void interceptor_ICJI::ThrowExceptionForJitResult(HRESULT result) -{ - mcs->AddCall("ThrowExceptionForJitResult"); - original_ICorJitInfo->ThrowExceptionForJitResult(result); -} - -// Throws an exception defined by the given throw helper. -void interceptor_ICJI::ThrowExceptionForHelper(const CORINFO_HELPER_DESC* throwHelper) -{ - mcs->AddCall("ThrowExceptionForHelper"); - original_ICorJitInfo->ThrowExceptionForHelper(throwHelper); -} - -/***************************************************************************** - * ICorStaticInfo contains EE interface methods which return values that are - * constant from invocation to invocation. Thus they may be embedded in - * persisted information like statically generated code. (This is of course - * assuming that all code versions are identical each time.) - *****************************************************************************/ - -// Return details about EE internal data structures -void interceptor_ICJI::getEEInfo(CORINFO_EE_INFO* pEEInfoOut) -{ - mcs->AddCall("getEEInfo"); - original_ICorJitInfo->getEEInfo(pEEInfoOut); -} - -// Returns name of the JIT timer log -LPCWSTR interceptor_ICJI::getJitTimeLogFilename() -{ - mcs->AddCall("getJitTimeLogFilename"); - return original_ICorJitInfo->getJitTimeLogFilename(); -} - -/*********************************************************************************/ -// -// Diagnostic methods -// -/*********************************************************************************/ - -// this function is for debugging only. Returns method token. -// Returns mdMethodDefNil for dynamic methods. -mdMethodDef interceptor_ICJI::getMethodDefFromMethod(CORINFO_METHOD_HANDLE hMethod) -{ - mcs->AddCall("getMethodDefFromMethod"); - return original_ICorJitInfo->getMethodDefFromMethod(hMethod); -} - -// this function is for debugging only. It returns the method name -// and if 'moduleName' is non-null, it sets it to something that will -// says which method (a class name, or a module name) -const char* interceptor_ICJI::getMethodName(CORINFO_METHOD_HANDLE ftn, /* IN */ - const char** moduleName /* OUT */ - ) -{ - mcs->AddCall("getMethodName"); - return original_ICorJitInfo->getMethodName(ftn, moduleName); -} - -const char* interceptor_ICJI::getMethodNameFromMetadata(CORINFO_METHOD_HANDLE ftn, /* IN */ - const char** className, /* OUT */ - const char** namespaceName, /* OUT */ - const char** enclosingClassName /* OUT */ - ) -{ - mcs->AddCall("getMethodNameFromMetadata"); - return original_ICorJitInfo->getMethodNameFromMetadata(ftn, className, namespaceName, enclosingClassName); -} - -// this function is for debugging only. It returns a value that -// is will always be the same for a given method. It is used -// to implement the 'jitRange' functionality -unsigned interceptor_ICJI::getMethodHash(CORINFO_METHOD_HANDLE ftn /* IN */ - ) -{ - mcs->AddCall("getMethodHash"); - return original_ICorJitInfo->getMethodHash(ftn); -} - -// this function is for debugging only. -size_t interceptor_ICJI::findNameOfToken(CORINFO_MODULE_HANDLE module, /* IN */ - mdToken metaTOK, /* IN */ - __out_ecount(FQNameCapacity) char* szFQName, /* OUT */ - size_t FQNameCapacity /* IN */ - ) -{ - mcs->AddCall("findNameOfToken"); - return original_ICorJitInfo->findNameOfToken(module, metaTOK, szFQName, FQNameCapacity); -} - -bool interceptor_ICJI::getSystemVAmd64PassStructInRegisterDescriptor( - /* IN */ CORINFO_CLASS_HANDLE structHnd, - /* OUT */ SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR* structPassInRegDescPtr) -{ - mcs->AddCall("getSystemVAmd64PassStructInRegisterDescriptor"); - return original_ICorJitInfo->getSystemVAmd64PassStructInRegisterDescriptor(structHnd, structPassInRegDescPtr); -} - -// Stuff on ICorDynamicInfo -DWORD interceptor_ICJI::getThreadTLSIndex(void** ppIndirection) -{ - mcs->AddCall("getThreadTLSIndex"); - return original_ICorJitInfo->getThreadTLSIndex(ppIndirection); -} - -const void* interceptor_ICJI::getInlinedCallFrameVptr(void** ppIndirection) -{ - mcs->AddCall("getInlinedCallFrameVptr"); - return original_ICorJitInfo->getInlinedCallFrameVptr(ppIndirection); -} - -LONG* interceptor_ICJI::getAddrOfCaptureThreadGlobal(void** ppIndirection) -{ - mcs->AddCall("getAddrOfCaptureThreadGlobal"); - return original_ICorJitInfo->getAddrOfCaptureThreadGlobal(ppIndirection); -} - -// return the native entry point to an EE helper (see CorInfoHelpFunc) -void* interceptor_ICJI::getHelperFtn(CorInfoHelpFunc ftnNum, void** ppIndirection) -{ - mcs->AddCall("getHelperFtn"); - return original_ICorJitInfo->getHelperFtn(ftnNum, ppIndirection); -} - -// return a callable address of the function (native code). This function -// may return a different value (depending on whether the method has -// been JITed or not. -void interceptor_ICJI::getFunctionEntryPoint(CORINFO_METHOD_HANDLE ftn, /* IN */ - CORINFO_CONST_LOOKUP* pResult, /* OUT */ - CORINFO_ACCESS_FLAGS accessFlags) -{ - mcs->AddCall("getFunctionEntryPoint"); - original_ICorJitInfo->getFunctionEntryPoint(ftn, pResult, accessFlags); -} - -// return a directly callable address. This can be used similarly to the -// value returned by getFunctionEntryPoint() except that it is -// guaranteed to be multi callable entrypoint. -void interceptor_ICJI::getFunctionFixedEntryPoint(CORINFO_METHOD_HANDLE ftn, CORINFO_CONST_LOOKUP* pResult) -{ - mcs->AddCall("getFunctionFixedEntryPoint"); - original_ICorJitInfo->getFunctionFixedEntryPoint(ftn, pResult); -} - -// get the synchronization handle that is passed to monXstatic function -void* interceptor_ICJI::getMethodSync(CORINFO_METHOD_HANDLE ftn, void** ppIndirection) -{ - mcs->AddCall("getMethodSync"); - return original_ICorJitInfo->getMethodSync(ftn, ppIndirection); -} - -// These entry points must be called if a handle is being embedded in -// the code to be passed to a JIT helper function. (as opposed to just -// being passed back into the ICorInfo interface.) - -// get slow lazy string literal helper to use (CORINFO_HELP_STRCNS*). -// Returns CORINFO_HELP_UNDEF if lazy string literal helper cannot be used. -CorInfoHelpFunc interceptor_ICJI::getLazyStringLiteralHelper(CORINFO_MODULE_HANDLE handle) -{ - mcs->AddCall("getLazyStringLiteralHelper"); - return original_ICorJitInfo->getLazyStringLiteralHelper(handle); -} - -CORINFO_MODULE_HANDLE interceptor_ICJI::embedModuleHandle(CORINFO_MODULE_HANDLE handle, void** ppIndirection) -{ - mcs->AddCall("embedModuleHandle"); - return original_ICorJitInfo->embedModuleHandle(handle, ppIndirection); -} - -CORINFO_CLASS_HANDLE interceptor_ICJI::embedClassHandle(CORINFO_CLASS_HANDLE handle, void** ppIndirection) -{ - mcs->AddCall("embedClassHandle"); - return original_ICorJitInfo->embedClassHandle(handle, ppIndirection); -} - -CORINFO_METHOD_HANDLE interceptor_ICJI::embedMethodHandle(CORINFO_METHOD_HANDLE handle, void** ppIndirection) -{ - mcs->AddCall("embedMethodHandle"); - return original_ICorJitInfo->embedMethodHandle(handle, ppIndirection); -} - -CORINFO_FIELD_HANDLE interceptor_ICJI::embedFieldHandle(CORINFO_FIELD_HANDLE handle, void** ppIndirection) -{ - mcs->AddCall("embedFieldHandle"); - return original_ICorJitInfo->embedFieldHandle(handle, ppIndirection); -} - -// Given a module scope (module), a method handle (context) and -// a metadata token (metaTOK), fetch the handle -// (type, field or method) associated with the token. -// If this is not possible at compile-time (because the current method's -// code is shared and the token contains generic parameters) -// then indicate how the handle should be looked up at run-time. -// -void interceptor_ICJI::embedGenericHandle(CORINFO_RESOLVED_TOKEN* pResolvedToken, - BOOL fEmbedParent, // TRUE - embeds parent type handle of the field/method - // handle - CORINFO_GENERICHANDLE_RESULT* pResult) -{ - mcs->AddCall("embedGenericHandle"); - original_ICorJitInfo->embedGenericHandle(pResolvedToken, fEmbedParent, pResult); -} - -// Return information used to locate the exact enclosing type of the current method. -// Used only to invoke .cctor method from code shared across generic instantiations -// !needsRuntimeLookup statically known (enclosing type of method itself) -// needsRuntimeLookup: -// CORINFO_LOOKUP_THISOBJ use vtable pointer of 'this' param -// CORINFO_LOOKUP_CLASSPARAM use vtable hidden param -// CORINFO_LOOKUP_METHODPARAM use enclosing type of method-desc hidden param -void interceptor_ICJI::getLocationOfThisType(CORINFO_METHOD_HANDLE context, CORINFO_LOOKUP_KIND* pLookupKind) -{ - mcs->AddCall("getLocationOfThisType"); - original_ICorJitInfo->getLocationOfThisType(context, pLookupKind); -} - -// return address of fixup area for late-bound PInvoke calls. -void interceptor_ICJI::getAddressOfPInvokeTarget(CORINFO_METHOD_HANDLE method, CORINFO_CONST_LOOKUP* pLookup) -{ - mcs->AddCall("getAddressOfPInvokeTarget"); - original_ICorJitInfo->getAddressOfPInvokeTarget(method, pLookup); -} - -// Generate a cookie based on the signature that would needs to be passed -// to CORINFO_HELP_PINVOKE_CALLI -LPVOID interceptor_ICJI::GetCookieForPInvokeCalliSig(CORINFO_SIG_INFO* szMetaSig, void** ppIndirection) -{ - mcs->AddCall("GetCookieForPInvokeCalliSig"); - return original_ICorJitInfo->GetCookieForPInvokeCalliSig(szMetaSig, ppIndirection); -} - -// returns true if a VM cookie can be generated for it (might be false due to cross-module -// inlining, in which case the inlining should be aborted) -bool interceptor_ICJI::canGetCookieForPInvokeCalliSig(CORINFO_SIG_INFO* szMetaSig) -{ - mcs->AddCall("canGetCookieForPInvokeCalliSig"); - return original_ICorJitInfo->canGetCookieForPInvokeCalliSig(szMetaSig); -} - -// Gets a handle that is checked to see if the current method is -// included in "JustMyCode" -CORINFO_JUST_MY_CODE_HANDLE interceptor_ICJI::getJustMyCodeHandle(CORINFO_METHOD_HANDLE method, - CORINFO_JUST_MY_CODE_HANDLE** ppIndirection) -{ - mcs->AddCall("getJustMyCodeHandle"); - return original_ICorJitInfo->getJustMyCodeHandle(method, ppIndirection); -} - -// Gets a method handle that can be used to correlate profiling data. -// This is the IP of a native method, or the address of the descriptor struct -// for IL. Always guaranteed to be unique per process, and not to move. */ -void interceptor_ICJI::GetProfilingHandle(BOOL* pbHookFunction, void** pProfilerHandle, BOOL* pbIndirectedHandles) -{ - mcs->AddCall("GetProfilingHandle"); - original_ICorJitInfo->GetProfilingHandle(pbHookFunction, pProfilerHandle, pbIndirectedHandles); -} - -// Returns instructions on how to make the call. See code:CORINFO_CALL_INFO for possible return values. -void interceptor_ICJI::getCallInfo( - // Token info - CORINFO_RESOLVED_TOKEN* pResolvedToken, - - // Generics info - CORINFO_RESOLVED_TOKEN* pConstrainedResolvedToken, - - // Security info - CORINFO_METHOD_HANDLE callerHandle, - - // Jit info - CORINFO_CALLINFO_FLAGS flags, - - // out params - CORINFO_CALL_INFO* pResult) -{ - mcs->AddCall("getCallInfo"); - original_ICorJitInfo->getCallInfo(pResolvedToken, pConstrainedResolvedToken, callerHandle, flags, pResult); -} - -BOOL interceptor_ICJI::canAccessFamily(CORINFO_METHOD_HANDLE hCaller, CORINFO_CLASS_HANDLE hInstanceType) - -{ - mcs->AddCall("canAccessFamily"); - return original_ICorJitInfo->canAccessFamily(hCaller, hInstanceType); -} -// Returns TRUE if the Class Domain ID is the RID of the class (currently true for every class -// except reflection emitted classes and generics) -BOOL interceptor_ICJI::isRIDClassDomainID(CORINFO_CLASS_HANDLE cls) -{ - mcs->AddCall("isRIDClassDomainID"); - return original_ICorJitInfo->isRIDClassDomainID(cls); -} - -// returns the class's domain ID for accessing shared statics -unsigned interceptor_ICJI::getClassDomainID(CORINFO_CLASS_HANDLE cls, void** ppIndirection) -{ - mcs->AddCall("getClassDomainID"); - return original_ICorJitInfo->getClassDomainID(cls, ppIndirection); -} - -// return the data's address (for static fields only) -void* interceptor_ICJI::getFieldAddress(CORINFO_FIELD_HANDLE field, void** ppIndirection) -{ - mcs->AddCall("getFieldAddress"); - return original_ICorJitInfo->getFieldAddress(field, ppIndirection); -} - -// return the class handle for the current value of a static field -CORINFO_CLASS_HANDLE interceptor_ICJI::getStaticFieldCurrentClass(CORINFO_FIELD_HANDLE field, bool* pIsSpeculative) -{ - mcs->AddCall("getStaticFieldCurrentClass"); - return original_ICorJitInfo->getStaticFieldCurrentClass(field, pIsSpeculative); -} - -// registers a vararg sig & returns a VM cookie for it (which can contain other stuff) -CORINFO_VARARGS_HANDLE interceptor_ICJI::getVarArgsHandle(CORINFO_SIG_INFO* pSig, void** ppIndirection) -{ - mcs->AddCall("getVarArgsHandle"); - return original_ICorJitInfo->getVarArgsHandle(pSig, ppIndirection); -} - -// returns true if a VM cookie can be generated for it (might be false due to cross-module -// inlining, in which case the inlining should be aborted) -bool interceptor_ICJI::canGetVarArgsHandle(CORINFO_SIG_INFO* pSig) -{ - mcs->AddCall("canGetVarArgsHandle"); - return original_ICorJitInfo->canGetVarArgsHandle(pSig); -} - -// Allocate a string literal on the heap and return a handle to it -InfoAccessType interceptor_ICJI::constructStringLiteral(CORINFO_MODULE_HANDLE module, mdToken metaTok, void** ppValue) -{ - mcs->AddCall("constructStringLiteral"); - return original_ICorJitInfo->constructStringLiteral(module, metaTok, ppValue); -} - -bool interceptor_ICJI::convertPInvokeCalliToCall(CORINFO_RESOLVED_TOKEN* pResolvedToken, bool fMustConvert) -{ - mcs->AddCall("convertPInvokeCalliToCall"); - return original_ICorJitInfo->convertPInvokeCalliToCall(pResolvedToken, fMustConvert); -} - -InfoAccessType interceptor_ICJI::emptyStringLiteral(void** ppValue) -{ - mcs->AddCall("emptyStringLiteral"); - return original_ICorJitInfo->emptyStringLiteral(ppValue); -} - -// (static fields only) given that 'field' refers to thread local store, -// return the ID (TLS index), which is used to find the beginning of the -// TLS data area for the particular DLL 'field' is associated with. -DWORD interceptor_ICJI::getFieldThreadLocalStoreID(CORINFO_FIELD_HANDLE field, void** ppIndirection) -{ - mcs->AddCall("getFieldThreadLocalStoreID"); - return original_ICorJitInfo->getFieldThreadLocalStoreID(field, ppIndirection); -} - -// Sets another object to intercept calls to "self" and current method being compiled -void interceptor_ICJI::setOverride(ICorDynamicInfo* pOverride, CORINFO_METHOD_HANDLE currentMethod) -{ - mcs->AddCall("setOverride"); - original_ICorJitInfo->setOverride(pOverride, currentMethod); -} - -// Adds an active dependency from the context method's module to the given module -// This is internal callback for the EE. JIT should not call it directly. -void interceptor_ICJI::addActiveDependency(CORINFO_MODULE_HANDLE moduleFrom, CORINFO_MODULE_HANDLE moduleTo) -{ - mcs->AddCall("addActiveDependency"); - original_ICorJitInfo->addActiveDependency(moduleFrom, moduleTo); -} - -CORINFO_METHOD_HANDLE interceptor_ICJI::GetDelegateCtor(CORINFO_METHOD_HANDLE methHnd, - CORINFO_CLASS_HANDLE clsHnd, - CORINFO_METHOD_HANDLE targetMethodHnd, - DelegateCtorArgs* pCtorData) -{ - mcs->AddCall("GetDelegateCtor"); - return original_ICorJitInfo->GetDelegateCtor(methHnd, clsHnd, targetMethodHnd, pCtorData); -} - -void interceptor_ICJI::MethodCompileComplete(CORINFO_METHOD_HANDLE methHnd) -{ - mcs->AddCall("MethodCompileComplete"); - original_ICorJitInfo->MethodCompileComplete(methHnd); -} - -bool interceptor_ICJI::getTailCallHelpers( - CORINFO_RESOLVED_TOKEN* callToken, - CORINFO_SIG_INFO* sig, - CORINFO_GET_TAILCALL_HELPERS_FLAGS flags, - CORINFO_TAILCALL_HELPERS* pResult) -{ - mcs->AddCall("getTailCallHelpers"); - return original_ICorJitInfo->getTailCallHelpers(callToken, sig, flags, pResult); -} - -// Stuff directly on ICorJitInfo - -// Returns extended flags for a particular compilation instance. -DWORD interceptor_ICJI::getJitFlags(CORJIT_FLAGS* jitFlags, DWORD sizeInBytes) -{ - mcs->AddCall("getJitFlags"); - return original_ICorJitInfo->getJitFlags(jitFlags, sizeInBytes); -} - -// Runs the given function with the given parameter under an error trap -// and returns true if the function completes successfully. We don't -// record the results of the call: when this call gets played back, -// its result will depend on whether or not `function` calls something -// that throws at playback time rather than at capture time. -bool interceptor_ICJI::runWithErrorTrap(void (*function)(void*), void* param) -{ - mcs->AddCall("runWithErrorTrap"); - return original_ICorJitInfo->runWithErrorTrap(function, param); -} - -// get a block of memory for the code, readonly data, and read-write data -void interceptor_ICJI::allocMem(ULONG hotCodeSize, /* IN */ - ULONG coldCodeSize, /* IN */ - ULONG roDataSize, /* IN */ - ULONG xcptnsCount, /* IN */ - CorJitAllocMemFlag flag, /* IN */ - void** hotCodeBlock, /* OUT */ - void** coldCodeBlock, /* OUT */ - void** roDataBlock /* OUT */ - ) -{ - mcs->AddCall("allocMem"); - return original_ICorJitInfo->allocMem(hotCodeSize, coldCodeSize, roDataSize, xcptnsCount, flag, hotCodeBlock, - coldCodeBlock, roDataBlock); -} - -// Reserve memory for the method/funclet's unwind information. -// Note that this must be called before allocMem. It should be -// called once for the main method, once for every funclet, and -// once for every block of cold code for which allocUnwindInfo -// will be called. -// -// This is necessary because jitted code must allocate all the -// memory needed for the unwindInfo at the allocMem call. -// For prejitted code we split up the unwinding information into -// separate sections .rdata and .pdata. -// -void interceptor_ICJI::reserveUnwindInfo(BOOL isFunclet, /* IN */ - BOOL isColdCode, /* IN */ - ULONG unwindSize /* IN */ - ) -{ - mcs->AddCall("reserveUnwindInfo"); - original_ICorJitInfo->reserveUnwindInfo(isFunclet, isColdCode, unwindSize); -} - -// Allocate and initialize the .rdata and .pdata for this method or -// funclet, and get the block of memory needed for the machine-specific -// unwind information (the info for crawling the stack frame). -// Note that allocMem must be called first. -// -// Parameters: -// -// pHotCode main method code buffer, always filled in -// pColdCode cold code buffer, only filled in if this is cold code, -// null otherwise -// startOffset start of code block, relative to appropriate code buffer -// (e.g. pColdCode if cold, pHotCode if hot). -// endOffset end of code block, relative to appropriate code buffer -// unwindSize size of unwind info pointed to by pUnwindBlock -// pUnwindBlock pointer to unwind info -// funcKind type of funclet (main method code, handler, filter) -// -void interceptor_ICJI::allocUnwindInfo(BYTE* pHotCode, /* IN */ - BYTE* pColdCode, /* IN */ - ULONG startOffset, /* IN */ - ULONG endOffset, /* IN */ - ULONG unwindSize, /* IN */ - BYTE* pUnwindBlock, /* IN */ - CorJitFuncKind funcKind /* IN */ - ) -{ - mcs->AddCall("allocUnwindInfo"); - original_ICorJitInfo->allocUnwindInfo(pHotCode, pColdCode, startOffset, endOffset, unwindSize, pUnwindBlock, - funcKind); -} - -// Get a block of memory needed for the code manager information, -// (the info for enumerating the GC pointers while crawling the -// stack frame). -// Note that allocMem must be called first -void* interceptor_ICJI::allocGCInfo(size_t size /* IN */ - ) -{ - mcs->AddCall("allocGCInfo"); - return original_ICorJitInfo->allocGCInfo(size); -} - -// Indicate how many exception handler blocks are to be returned. -// This is guaranteed to be called before any 'setEHinfo' call. -// Note that allocMem must be called before this method can be called. -void interceptor_ICJI::setEHcount(unsigned cEH /* IN */ - ) -{ - mcs->AddCall("setEHcount"); - original_ICorJitInfo->setEHcount(cEH); -} - -// Set the values for one particular exception handler block. -// -// Handler regions should be lexically contiguous. -// This is because FinallyIsUnwinding() uses lexicality to -// determine if a "finally" clause is executing. -void interceptor_ICJI::setEHinfo(unsigned EHnumber, /* IN */ - const CORINFO_EH_CLAUSE* clause /* IN */ - ) -{ - mcs->AddCall("setEHinfo"); - original_ICorJitInfo->setEHinfo(EHnumber, clause); -} - -// Level 1 -> fatalError, Level 2 -> Error, Level 3 -> Warning -// Level 4 means happens 10 times in a run, level 5 means 100, level 6 means 1000 ... -// returns non-zero if the logging succeeded -BOOL interceptor_ICJI::logMsg(unsigned level, const char* fmt, va_list args) -{ - mcs->AddCall("logMsg"); - return original_ICorJitInfo->logMsg(level, fmt, args); -} - -// do an assert. will return true if the code should retry (DebugBreak) -// returns false, if the assert should be igored. -int interceptor_ICJI::doAssert(const char* szFile, int iLine, const char* szExpr) -{ - mcs->AddCall("doAssert"); - return original_ICorJitInfo->doAssert(szFile, iLine, szExpr); -} - -void interceptor_ICJI::reportFatalError(CorJitResult result) -{ - mcs->AddCall("reportFatalError"); - original_ICorJitInfo->reportFatalError(result); -} - -/* -struct BlockCounts // Also defined here: code:CORBBTPROF_BLOCK_DATA -{ - UINT32 ILOffset; - UINT32 ExecutionCount; -}; -*/ - -// allocate a basic block profile buffer where execution counts will be stored -// for jitted basic blocks. -HRESULT interceptor_ICJI::allocMethodBlockCounts(UINT32 count, // The number of basic blocks that we have - BlockCounts** pBlockCounts) -{ - mcs->AddCall("allocMethodBlockCounts"); - return original_ICorJitInfo->allocMethodBlockCounts(count, pBlockCounts); -} - -// get profile information to be used for optimizing the current method. The format -// of the buffer is the same as the format the JIT passes to allocMethodBlockCounts. -HRESULT interceptor_ICJI::getMethodBlockCounts(CORINFO_METHOD_HANDLE ftnHnd, - UINT32 * pCount, // The number of basic blocks that we have - BlockCounts** pBlockCounts, - UINT32 * pNumRuns) -{ - mcs->AddCall("getMethodBlockCounts"); - return original_ICorJitInfo->getMethodBlockCounts(ftnHnd, pCount, pBlockCounts, pNumRuns); -} - -// Associates a native call site, identified by its offset in the native code stream, with -// the signature information and method handle the JIT used to lay out the call site. If -// the call site has no signature information (e.g. a helper call) or has no method handle -// (e.g. a CALLI P/Invoke), then null should be passed instead. -void interceptor_ICJI::recordCallSite(ULONG instrOffset, /* IN */ - CORINFO_SIG_INFO* callSig, /* IN */ - CORINFO_METHOD_HANDLE methodHandle /* IN */ - ) -{ - mcs->AddCall("recordCallSite"); - return original_ICorJitInfo->recordCallSite(instrOffset, callSig, methodHandle); -} - -// A relocation is recorded if we are pre-jitting. -// A jump thunk may be inserted if we are jitting -void interceptor_ICJI::recordRelocation(void* location, /* IN */ - void* target, /* IN */ - WORD fRelocType, /* IN */ - WORD slotNum, /* IN */ - INT32 addlDelta /* IN */ - ) -{ - mcs->AddCall("recordRelocation"); - original_ICorJitInfo->recordRelocation(location, target, fRelocType, slotNum, addlDelta); -} - -WORD interceptor_ICJI::getRelocTypeHint(void* target) -{ - mcs->AddCall("getRelocTypeHint"); - return original_ICorJitInfo->getRelocTypeHint(target); -} - -// For what machine does the VM expect the JIT to generate code? The VM -// returns one of the IMAGE_FILE_MACHINE_* values. Note that if the VM -// is cross-compiling (such as the case for crossgen), it will return a -// different value than if it was compiling for the host architecture. -// -DWORD interceptor_ICJI::getExpectedTargetArchitecture() -{ - mcs->AddCall("getExpectedTargetArchitecture"); - return original_ICorJitInfo->getExpectedTargetArchitecture(); -} - -void interceptor_ICJI::notifyInstructionSetUsage(CORINFO_InstructionSet instructionSet, bool supported) -{ - mcs->AddCall("notifyInstructionSetUsage"); - original_ICorJitInfo->notifyInstructionSetUsage(instructionSet, supported); -} diff --git a/src/coreclr/src/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp b/src/coreclr/src/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp deleted file mode 100644 index eb0e26d04bf06..0000000000000 --- a/src/coreclr/src/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp +++ /dev/null @@ -1,1484 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -// - -#include "standardpch.h" -#include "icorjitinfo.h" -#include "superpmi-shim-simple.h" -#include "icorjitcompiler.h" -#include "spmiutil.h" - -// Stuff on ICorStaticInfo -/**********************************************************************************/ -// -// ICorMethodInfo -// -/**********************************************************************************/ -// return flags (defined above, CORINFO_FLG_PUBLIC ...) -DWORD interceptor_ICJI::getMethodAttribs(CORINFO_METHOD_HANDLE ftn /* IN */) -{ - return original_ICorJitInfo->getMethodAttribs(ftn); -} - -// sets private JIT flags, which can be, retrieved using getAttrib. -void interceptor_ICJI::setMethodAttribs(CORINFO_METHOD_HANDLE ftn, /* IN */ - CorInfoMethodRuntimeFlags attribs /* IN */) -{ - original_ICorJitInfo->setMethodAttribs(ftn, attribs); -} - -// Given a method descriptor ftnHnd, extract signature information into sigInfo -// -// 'memberParent' is typically only set when verifying. It should be the -// result of calling getMemberParent. -void interceptor_ICJI::getMethodSig(CORINFO_METHOD_HANDLE ftn, /* IN */ - CORINFO_SIG_INFO* sig, /* OUT */ - CORINFO_CLASS_HANDLE memberParent /* IN */ - ) -{ - original_ICorJitInfo->getMethodSig(ftn, sig, memberParent); -} - -/********************************************************************* -* Note the following methods can only be used on functions known -* to be IL. This includes the method being compiled and any method -* that 'getMethodInfo' returns true for -*********************************************************************/ - -// return information about a method private to the implementation -// returns false if method is not IL, or is otherwise unavailable. -// This method is used to fetch data needed to inline functions -bool interceptor_ICJI::getMethodInfo(CORINFO_METHOD_HANDLE ftn, /* IN */ - CORINFO_METHOD_INFO* info /* OUT */ - ) -{ - return original_ICorJitInfo->getMethodInfo(ftn, info); -} - -// Decides if you have any limitations for inlining. If everything's OK, it will return -// INLINE_PASS and will fill out pRestrictions with a mask of restrictions the caller of this -// function must respect. If caller passes pRestrictions = nullptr, if there are any restrictions -// INLINE_FAIL will be returned -// -// The callerHnd must be the immediate caller (i.e. when we have a chain of inlined calls) -// -// The inlined method need not be verified - -CorInfoInline interceptor_ICJI::canInline(CORINFO_METHOD_HANDLE callerHnd, /* IN */ - CORINFO_METHOD_HANDLE calleeHnd, /* IN */ - DWORD* pRestrictions /* OUT */ - ) -{ - return original_ICorJitInfo->canInline(callerHnd, calleeHnd, pRestrictions); -} - -// Reports whether or not a method can be inlined, and why. canInline is responsible for reporting all -// inlining results when it returns INLINE_FAIL and INLINE_NEVER. All other results are reported by the -// JIT. -void interceptor_ICJI::reportInliningDecision(CORINFO_METHOD_HANDLE inlinerHnd, - CORINFO_METHOD_HANDLE inlineeHnd, - CorInfoInline inlineResult, - const char* reason) -{ - original_ICorJitInfo->reportInliningDecision(inlinerHnd, inlineeHnd, inlineResult, reason); -} - -// Returns false if the call is across security boundaries thus we cannot tailcall -// -// The callerHnd must be the immediate caller (i.e. when we have a chain of inlined calls) -bool interceptor_ICJI::canTailCall(CORINFO_METHOD_HANDLE callerHnd, /* IN */ - CORINFO_METHOD_HANDLE declaredCalleeHnd, /* IN */ - CORINFO_METHOD_HANDLE exactCalleeHnd, /* IN */ - bool fIsTailPrefix /* IN */ - ) -{ - return original_ICorJitInfo->canTailCall(callerHnd, declaredCalleeHnd, exactCalleeHnd, fIsTailPrefix); -} - -// Reports whether or not a method can be tail called, and why. -// canTailCall is responsible for reporting all results when it returns -// false. All other results are reported by the JIT. -void interceptor_ICJI::reportTailCallDecision(CORINFO_METHOD_HANDLE callerHnd, - CORINFO_METHOD_HANDLE calleeHnd, - bool fIsTailPrefix, - CorInfoTailCall tailCallResult, - const char* reason) -{ - original_ICorJitInfo->reportTailCallDecision(callerHnd, calleeHnd, fIsTailPrefix, tailCallResult, reason); -} - -// get individual exception handler -void interceptor_ICJI::getEHinfo(CORINFO_METHOD_HANDLE ftn, /* IN */ - unsigned EHnumber, /* IN */ - CORINFO_EH_CLAUSE* clause /* OUT */ - ) -{ - original_ICorJitInfo->getEHinfo(ftn, EHnumber, clause); -} - -// return class it belongs to -CORINFO_CLASS_HANDLE interceptor_ICJI::getMethodClass(CORINFO_METHOD_HANDLE method) -{ - return original_ICorJitInfo->getMethodClass(method); -} - -// return module it belongs to -CORINFO_MODULE_HANDLE interceptor_ICJI::getMethodModule(CORINFO_METHOD_HANDLE method) -{ - return original_ICorJitInfo->getMethodModule(method); -} - -// This function returns the offset of the specified method in the -// vtable of it's owning class or interface. -void interceptor_ICJI::getMethodVTableOffset(CORINFO_METHOD_HANDLE method, /* IN */ - unsigned* offsetOfIndirection, /* OUT */ - unsigned* offsetAfterIndirection, /* OUT */ - bool* isRelative /* OUT */ - ) -{ - original_ICorJitInfo->getMethodVTableOffset(method, offsetOfIndirection, offsetAfterIndirection, isRelative); -} - -// Get the unboxed entry point for a method, if possible. -CORINFO_METHOD_HANDLE interceptor_ICJI::getUnboxedEntry(CORINFO_METHOD_HANDLE ftn, bool* requiresInstMethodTableArg) -{ - return original_ICorJitInfo->getUnboxedEntry(ftn, requiresInstMethodTableArg); -} - -// Find the virtual method in implementingClass that overrides virtualMethod. -// Return false if devirtualization is not possible. -bool interceptor_ICJI::tryResolveVirtualMethod(CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT* virtualMethodContext /* IN, OUT */) -{ - return original_ICorJitInfo->tryResolveVirtualMethod(virtualMethodContext); -} - -// Given T, return the type of the default EqualityComparer. -// Returns null if the type can't be determined exactly. -CORINFO_CLASS_HANDLE interceptor_ICJI::getDefaultEqualityComparerClass(CORINFO_CLASS_HANDLE cls) -{ - return original_ICorJitInfo->getDefaultEqualityComparerClass(cls); -} - -void interceptor_ICJI::expandRawHandleIntrinsic(CORINFO_RESOLVED_TOKEN* pResolvedToken, - CORINFO_GENERICHANDLE_RESULT* pResult) -{ - return original_ICorJitInfo->expandRawHandleIntrinsic(pResolvedToken, pResult); -} - -// If a method's attributes have (getMethodAttribs) CORINFO_FLG_INTRINSIC set, -// getIntrinsicID() returns the intrinsic ID. -CorInfoIntrinsics interceptor_ICJI::getIntrinsicID(CORINFO_METHOD_HANDLE method, bool* pMustExpand /* OUT */ - ) -{ - return original_ICorJitInfo->getIntrinsicID(method, pMustExpand); -} - -// Is the given type in System.Private.Corelib and marked with IntrinsicAttribute? -bool interceptor_ICJI::isIntrinsicType(CORINFO_CLASS_HANDLE classHnd) -{ - return original_ICorJitInfo->isIntrinsicType(classHnd); -} - -// return the unmanaged calling convention for a PInvoke -CorInfoUnmanagedCallConv interceptor_ICJI::getUnmanagedCallConv(CORINFO_METHOD_HANDLE method) -{ - return original_ICorJitInfo->getUnmanagedCallConv(method); -} - -// return if any marshaling is required for PInvoke methods. Note that -// method == 0 => calli. The call site sig is only needed for the varargs or calli case -BOOL interceptor_ICJI::pInvokeMarshalingRequired(CORINFO_METHOD_HANDLE method, CORINFO_SIG_INFO* callSiteSig) -{ - return original_ICorJitInfo->pInvokeMarshalingRequired(method, callSiteSig); -} - -// Check constraints on method type arguments (only). -// The parent class should be checked separately using satisfiesClassConstraints(parent). -BOOL interceptor_ICJI::satisfiesMethodConstraints(CORINFO_CLASS_HANDLE parent, // the exact parent of the method - CORINFO_METHOD_HANDLE method) -{ - return original_ICorJitInfo->satisfiesMethodConstraints(parent, method); -} - -// Given a delegate target class, a target method parent class, a target method, -// a delegate class, check if the method signature is compatible with the Invoke method of the delegate -// (under the typical instantiation of any free type variables in the memberref signatures). -BOOL interceptor_ICJI::isCompatibleDelegate( - CORINFO_CLASS_HANDLE objCls, /* type of the delegate target, if any */ - CORINFO_CLASS_HANDLE methodParentCls, /* exact parent of the target method, if any */ - CORINFO_METHOD_HANDLE method, /* (representative) target method, if any */ - CORINFO_CLASS_HANDLE delegateCls, /* exact type of the delegate */ - BOOL* pfIsOpenDelegate /* is the delegate open */ - ) -{ - return original_ICorJitInfo->isCompatibleDelegate(objCls, methodParentCls, method, delegateCls, pfIsOpenDelegate); -} - -// load and restore the method -void interceptor_ICJI::methodMustBeLoadedBeforeCodeIsRun(CORINFO_METHOD_HANDLE method) -{ - original_ICorJitInfo->methodMustBeLoadedBeforeCodeIsRun(method); -} - -CORINFO_METHOD_HANDLE interceptor_ICJI::mapMethodDeclToMethodImpl(CORINFO_METHOD_HANDLE method) -{ - return original_ICorJitInfo->mapMethodDeclToMethodImpl(method); -} - -// Returns the global cookie for the /GS unsafe buffer checks -// The cookie might be a constant value (JIT), or a handle to memory location (Ngen) -void interceptor_ICJI::getGSCookie(GSCookie* pCookieVal, // OUT - GSCookie** ppCookieVal // OUT - ) -{ - original_ICorJitInfo->getGSCookie(pCookieVal, ppCookieVal); -} - - -// Provide patchpoint info for the method currently being jitted. -void interceptor_ICJI::setPatchpointInfo(PatchpointInfo* patchpointInfo) -{ - original_ICorJitInfo->setPatchpointInfo(patchpointInfo); -} - -// Get OSR info for the method currently being jitted -PatchpointInfo* interceptor_ICJI::getOSRInfo(unsigned* ilOffset) -{ - return original_ICorJitInfo->getOSRInfo(ilOffset); -} - -/**********************************************************************************/ -// -// ICorModuleInfo -// -/**********************************************************************************/ - -// Resolve metadata token into runtime method handles. -void interceptor_ICJI::resolveToken(/* IN, OUT */ CORINFO_RESOLVED_TOKEN* pResolvedToken) -{ - original_ICorJitInfo->resolveToken(pResolvedToken); -} - -bool interceptor_ICJI::tryResolveToken(/* IN, OUT */ CORINFO_RESOLVED_TOKEN* pResolvedToken) -{ - return original_ICorJitInfo->tryResolveToken(pResolvedToken); -} - -// Signature information about the call sig -void interceptor_ICJI::findSig(CORINFO_MODULE_HANDLE module, /* IN */ - unsigned sigTOK, /* IN */ - CORINFO_CONTEXT_HANDLE context, /* IN */ - CORINFO_SIG_INFO* sig /* OUT */ - ) -{ - original_ICorJitInfo->findSig(module, sigTOK, context, sig); -} - -// for Varargs, the signature at the call site may differ from -// the signature at the definition. Thus we need a way of -// fetching the call site information -void interceptor_ICJI::findCallSiteSig(CORINFO_MODULE_HANDLE module, /* IN */ - unsigned methTOK, /* IN */ - CORINFO_CONTEXT_HANDLE context, /* IN */ - CORINFO_SIG_INFO* sig /* OUT */ - ) -{ - original_ICorJitInfo->findCallSiteSig(module, methTOK, context, sig); -} - -CORINFO_CLASS_HANDLE interceptor_ICJI::getTokenTypeAsHandle(CORINFO_RESOLVED_TOKEN* pResolvedToken /* IN */) -{ - return original_ICorJitInfo->getTokenTypeAsHandle(pResolvedToken); -} - -// Checks if the given metadata token is valid -BOOL interceptor_ICJI::isValidToken(CORINFO_MODULE_HANDLE module, /* IN */ - unsigned metaTOK /* IN */ - ) -{ - return original_ICorJitInfo->isValidToken(module, metaTOK); -} - -// Checks if the given metadata token is valid StringRef -BOOL interceptor_ICJI::isValidStringRef(CORINFO_MODULE_HANDLE module, /* IN */ - unsigned metaTOK /* IN */ - ) -{ - return original_ICorJitInfo->isValidStringRef(module, metaTOK); -} - -LPCWSTR interceptor_ICJI::getStringLiteral(CORINFO_MODULE_HANDLE module, /* IN */ - unsigned metaTOK, /* IN */ - int* length /* OUT */ - ) -{ - return original_ICorJitInfo->getStringLiteral(module, metaTOK, length); -} - -/**********************************************************************************/ -// -// ICorClassInfo -// -/**********************************************************************************/ - -// If the value class 'cls' is isomorphic to a primitive type it will -// return that type, otherwise it will return CORINFO_TYPE_VALUECLASS -CorInfoType interceptor_ICJI::asCorInfoType(CORINFO_CLASS_HANDLE cls) -{ - return original_ICorJitInfo->asCorInfoType(cls); -} - -// for completeness -const char* interceptor_ICJI::getClassName(CORINFO_CLASS_HANDLE cls) -{ - return original_ICorJitInfo->getClassName(cls); -} - -const char* interceptor_ICJI::getClassNameFromMetadata(CORINFO_CLASS_HANDLE cls, const char** namespaceName) -{ - return original_ICorJitInfo->getClassNameFromMetadata(cls, namespaceName); -} - -CORINFO_CLASS_HANDLE interceptor_ICJI::getTypeInstantiationArgument(CORINFO_CLASS_HANDLE cls, unsigned index) -{ - return original_ICorJitInfo->getTypeInstantiationArgument(cls, index); -} - -// Append a (possibly truncated) representation of the type cls to the preallocated buffer ppBuf of length pnBufLen -// If fNamespace=TRUE, include the namespace/enclosing classes -// If fFullInst=TRUE (regardless of fNamespace and fAssembly), include namespace and assembly for any type parameters -// If fAssembly=TRUE, suffix with a comma and the full assembly qualification -// return size of representation -int interceptor_ICJI::appendClassName(__deref_inout_ecount(*pnBufLen) WCHAR** ppBuf, - int* pnBufLen, - CORINFO_CLASS_HANDLE cls, - BOOL fNamespace, - BOOL fFullInst, - BOOL fAssembly) -{ - return original_ICorJitInfo->appendClassName(ppBuf, pnBufLen, cls, fNamespace, fFullInst, fAssembly); -} - -// Quick check whether the type is a value class. Returns the same value as getClassAttribs(cls) & -// CORINFO_FLG_VALUECLASS, except faster. -BOOL interceptor_ICJI::isValueClass(CORINFO_CLASS_HANDLE cls) -{ - return original_ICorJitInfo->isValueClass(cls); -} - -// Decides how the JIT should do the optimization to inline the check for -// GetTypeFromHandle(handle) == obj.GetType() (for CORINFO_INLINE_TYPECHECK_SOURCE_VTABLE) -// GetTypeFromHandle(X) == GetTypeFromHandle(Y) (for CORINFO_INLINE_TYPECHECK_SOURCE_TOKEN) -CorInfoInlineTypeCheck interceptor_ICJI::canInlineTypeCheck(CORINFO_CLASS_HANDLE cls, - CorInfoInlineTypeCheckSource source) -{ - return original_ICorJitInfo->canInlineTypeCheck(cls, source); -} - -// return flags (defined above, CORINFO_FLG_PUBLIC ...) -DWORD interceptor_ICJI::getClassAttribs(CORINFO_CLASS_HANDLE cls) -{ - return original_ICorJitInfo->getClassAttribs(cls); -} - -// Returns "TRUE" iff "cls" is a struct type such that return buffers used for returning a value -// of this type must be stack-allocated. This will generally be true only if the struct -// contains GC pointers, and does not exceed some size limit. Maintaining this as an invariant allows -// an optimization: the JIT may assume that return buffer pointers for return types for which this predicate -// returns TRUE are always stack allocated, and thus, that stores to the GC-pointer fields of such return -// buffers do not require GC write barriers. -BOOL interceptor_ICJI::isStructRequiringStackAllocRetBuf(CORINFO_CLASS_HANDLE cls) -{ - return original_ICorJitInfo->isStructRequiringStackAllocRetBuf(cls); -} - -CORINFO_MODULE_HANDLE interceptor_ICJI::getClassModule(CORINFO_CLASS_HANDLE cls) -{ - return original_ICorJitInfo->getClassModule(cls); -} - -// Returns the assembly that contains the module "mod". -CORINFO_ASSEMBLY_HANDLE interceptor_ICJI::getModuleAssembly(CORINFO_MODULE_HANDLE mod) -{ - return original_ICorJitInfo->getModuleAssembly(mod); -} - -// Returns the name of the assembly "assem". -const char* interceptor_ICJI::getAssemblyName(CORINFO_ASSEMBLY_HANDLE assem) -{ - return original_ICorJitInfo->getAssemblyName(assem); -} - -// Allocate and delete process-lifetime objects. Should only be -// referred to from static fields, lest a leak occur. -// Note that "LongLifetimeFree" does not execute destructors, if "obj" -// is an array of a struct type with a destructor. -void* interceptor_ICJI::LongLifetimeMalloc(size_t sz) -{ - return original_ICorJitInfo->LongLifetimeMalloc(sz); -} - -void interceptor_ICJI::LongLifetimeFree(void* obj) -{ - original_ICorJitInfo->LongLifetimeFree(obj); -} - -size_t interceptor_ICJI::getClassModuleIdForStatics(CORINFO_CLASS_HANDLE cls, - CORINFO_MODULE_HANDLE* pModule, - void** ppIndirection) -{ - return original_ICorJitInfo->getClassModuleIdForStatics(cls, pModule, ppIndirection); -} - -// return the number of bytes needed by an instance of the class -unsigned interceptor_ICJI::getClassSize(CORINFO_CLASS_HANDLE cls) -{ - return original_ICorJitInfo->getClassSize(cls); -} - -// return the number of bytes needed by an instance of the class allocated on the heap -unsigned interceptor_ICJI::getHeapClassSize(CORINFO_CLASS_HANDLE cls) -{ - return original_ICorJitInfo->getHeapClassSize(cls); -} - -BOOL interceptor_ICJI::canAllocateOnStack(CORINFO_CLASS_HANDLE cls) -{ - return original_ICorJitInfo->canAllocateOnStack(cls); -} - -unsigned interceptor_ICJI::getClassAlignmentRequirement(CORINFO_CLASS_HANDLE cls, BOOL fDoubleAlignHint) -{ - return original_ICorJitInfo->getClassAlignmentRequirement(cls, fDoubleAlignHint); -} - -// This is only called for Value classes. It returns a boolean array -// in representing of 'cls' from a GC perspective. The class is -// assumed to be an array of machine words -// (of length // getClassSize(cls) / sizeof(void*)), -// 'gcPtrs' is a pointer to an array of BYTEs of this length. -// getClassGClayout fills in this array so that gcPtrs[i] is set -// to one of the CorInfoGCType values which is the GC type of -// the i-th machine word of an object of type 'cls' -// returns the number of GC pointers in the array -unsigned interceptor_ICJI::getClassGClayout(CORINFO_CLASS_HANDLE cls, /* IN */ - BYTE* gcPtrs /* OUT */ - ) -{ - return original_ICorJitInfo->getClassGClayout(cls, gcPtrs); -} - -// returns the number of instance fields in a class -unsigned interceptor_ICJI::getClassNumInstanceFields(CORINFO_CLASS_HANDLE cls /* IN */ - ) -{ - return original_ICorJitInfo->getClassNumInstanceFields(cls); -} - -CORINFO_FIELD_HANDLE interceptor_ICJI::getFieldInClass(CORINFO_CLASS_HANDLE clsHnd, INT num) -{ - return original_ICorJitInfo->getFieldInClass(clsHnd, num); -} - -BOOL interceptor_ICJI::checkMethodModifier(CORINFO_METHOD_HANDLE hMethod, LPCSTR modifier, BOOL fOptional) -{ - return original_ICorJitInfo->checkMethodModifier(hMethod, modifier, fOptional); -} - -// returns the "NEW" helper optimized for "newCls." -CorInfoHelpFunc interceptor_ICJI::getNewHelper(CORINFO_RESOLVED_TOKEN* pResolvedToken, - CORINFO_METHOD_HANDLE callerHandle, - bool* pHasSideEffects) -{ - return original_ICorJitInfo->getNewHelper(pResolvedToken, callerHandle, pHasSideEffects); -} - -// returns the newArr (1-Dim array) helper optimized for "arrayCls." -CorInfoHelpFunc interceptor_ICJI::getNewArrHelper(CORINFO_CLASS_HANDLE arrayCls) -{ - return original_ICorJitInfo->getNewArrHelper(arrayCls); -} - -// returns the optimized "IsInstanceOf" or "ChkCast" helper -CorInfoHelpFunc interceptor_ICJI::getCastingHelper(CORINFO_RESOLVED_TOKEN* pResolvedToken, bool fThrowing) -{ - return original_ICorJitInfo->getCastingHelper(pResolvedToken, fThrowing); -} - -// returns helper to trigger static constructor -CorInfoHelpFunc interceptor_ICJI::getSharedCCtorHelper(CORINFO_CLASS_HANDLE clsHnd) -{ - return original_ICorJitInfo->getSharedCCtorHelper(clsHnd); -} - -// This is not pretty. Boxing nullable actually returns -// a boxed not a boxed Nullable. This call allows the verifier -// to call back to the EE on the 'box' instruction and get the transformed -// type to use for verification. -CORINFO_CLASS_HANDLE interceptor_ICJI::getTypeForBox(CORINFO_CLASS_HANDLE cls) -{ - return original_ICorJitInfo->getTypeForBox(cls); -} - -// returns the correct box helper for a particular class. Note -// that if this returns CORINFO_HELP_BOX, the JIT can assume -// 'standard' boxing (allocate object and copy), and optimize -CorInfoHelpFunc interceptor_ICJI::getBoxHelper(CORINFO_CLASS_HANDLE cls) -{ - return original_ICorJitInfo->getBoxHelper(cls); -} - -// returns the unbox helper. If 'helperCopies' points to a true -// value it means the JIT is requesting a helper that unboxes the -// value into a particular location and thus has the signature -// void unboxHelper(void* dest, CORINFO_CLASS_HANDLE cls, Object* obj) -// Otherwise (it is null or points at a FALSE value) it is requesting -// a helper that returns a pointer to the unboxed data -// void* unboxHelper(CORINFO_CLASS_HANDLE cls, Object* obj) -// The EE has the option of NOT returning the copy style helper -// (But must be able to always honor the non-copy style helper) -// The EE set 'helperCopies' on return to indicate what kind of -// helper has been created. - -CorInfoHelpFunc interceptor_ICJI::getUnBoxHelper(CORINFO_CLASS_HANDLE cls) -{ - return original_ICorJitInfo->getUnBoxHelper(cls); -} - -bool interceptor_ICJI::getReadyToRunHelper(CORINFO_RESOLVED_TOKEN* pResolvedToken, - CORINFO_LOOKUP_KIND* pGenericLookupKind, - CorInfoHelpFunc id, - CORINFO_CONST_LOOKUP* pLookup) -{ - return original_ICorJitInfo->getReadyToRunHelper(pResolvedToken, pGenericLookupKind, id, pLookup); -} - -void interceptor_ICJI::getReadyToRunDelegateCtorHelper(CORINFO_RESOLVED_TOKEN* pTargetMethod, - CORINFO_CLASS_HANDLE delegateType, - CORINFO_LOOKUP* pLookup) -{ - original_ICorJitInfo->getReadyToRunDelegateCtorHelper(pTargetMethod, delegateType, pLookup); -} - -const char* interceptor_ICJI::getHelperName(CorInfoHelpFunc funcNum) -{ - return original_ICorJitInfo->getHelperName(funcNum); -} - -// This function tries to initialize the class (run the class constructor). -// this function returns whether the JIT must insert helper calls before -// accessing static field or method. -// -// See code:ICorClassInfo#ClassConstruction. -CorInfoInitClassResult interceptor_ICJI::initClass( - CORINFO_FIELD_HANDLE field, // Non-nullptr - inquire about cctor trigger before static field access - // nullptr - inquire about cctor trigger in method prolog - CORINFO_METHOD_HANDLE method, // Method referencing the field or prolog - CORINFO_CONTEXT_HANDLE context // Exact context of method - ) -{ - return original_ICorJitInfo->initClass(field, method, context); -} - -// This used to be called "loadClass". This records the fact -// that the class must be loaded (including restored if necessary) before we execute the -// code that we are currently generating. When jitting code -// the function loads the class immediately. When zapping code -// the zapper will if necessary use the call to record the fact that we have -// to do a fixup/restore before running the method currently being generated. -// -// This is typically used to ensure value types are loaded before zapped -// code that manipulates them is executed, so that the GC can access information -// about those value types. -void interceptor_ICJI::classMustBeLoadedBeforeCodeIsRun(CORINFO_CLASS_HANDLE cls) -{ - original_ICorJitInfo->classMustBeLoadedBeforeCodeIsRun(cls); -} - -// returns the class handle for the special builtin classes -CORINFO_CLASS_HANDLE interceptor_ICJI::getBuiltinClass(CorInfoClassId classId) -{ - return original_ICorJitInfo->getBuiltinClass(classId); -} - -// "System.Int32" ==> CORINFO_TYPE_INT.. -CorInfoType interceptor_ICJI::getTypeForPrimitiveValueClass(CORINFO_CLASS_HANDLE cls) -{ - return original_ICorJitInfo->getTypeForPrimitiveValueClass(cls); -} - -// "System.Int32" ==> CORINFO_TYPE_INT.. -// "System.UInt32" ==> CORINFO_TYPE_UINT.. -CorInfoType interceptor_ICJI::getTypeForPrimitiveNumericClass(CORINFO_CLASS_HANDLE cls) -{ - return original_ICorJitInfo->getTypeForPrimitiveNumericClass(cls); -} - -// TRUE if child is a subtype of parent -// if parent is an interface, then does child implement / extend parent -BOOL interceptor_ICJI::canCast(CORINFO_CLASS_HANDLE child, // subtype (extends parent) - CORINFO_CLASS_HANDLE parent // base type - ) -{ - return original_ICorJitInfo->canCast(child, parent); -} - -// TRUE if cls1 and cls2 are considered equivalent types. -BOOL interceptor_ICJI::areTypesEquivalent(CORINFO_CLASS_HANDLE cls1, CORINFO_CLASS_HANDLE cls2) -{ - return original_ICorJitInfo->areTypesEquivalent(cls1, cls2); -} - -// See if a cast from fromClass to toClass will succeed, fail, or needs -// to be resolved at runtime. -TypeCompareState interceptor_ICJI::compareTypesForCast(CORINFO_CLASS_HANDLE fromClass, CORINFO_CLASS_HANDLE toClass) -{ - return original_ICorJitInfo->compareTypesForCast(fromClass, toClass); -} - -// See if types represented by cls1 and cls2 compare equal, not -// equal, or the comparison needs to be resolved at runtime. -TypeCompareState interceptor_ICJI::compareTypesForEquality(CORINFO_CLASS_HANDLE cls1, CORINFO_CLASS_HANDLE cls2) -{ - return original_ICorJitInfo->compareTypesForEquality(cls1, cls2); -} - -// returns is the intersection of cls1 and cls2. -CORINFO_CLASS_HANDLE interceptor_ICJI::mergeClasses(CORINFO_CLASS_HANDLE cls1, CORINFO_CLASS_HANDLE cls2) -{ - return original_ICorJitInfo->mergeClasses(cls1, cls2); -} - -// Returns true if cls2 is known to be a more specific type than cls1. -BOOL interceptor_ICJI::isMoreSpecificType(CORINFO_CLASS_HANDLE cls1, CORINFO_CLASS_HANDLE cls2) -{ - return original_ICorJitInfo->isMoreSpecificType(cls1, cls2); -} - -// Given a class handle, returns the Parent type. -// For COMObjectType, it returns Class Handle of System.Object. -// Returns 0 if System.Object is passed in. -CORINFO_CLASS_HANDLE interceptor_ICJI::getParentType(CORINFO_CLASS_HANDLE cls) -{ - return original_ICorJitInfo->getParentType(cls); -} - -// Returns the CorInfoType of the "child type". If the child type is -// not a primitive type, *clsRet will be set. -// Given an Array of Type Foo, returns Foo. -// Given BYREF Foo, returns Foo -CorInfoType interceptor_ICJI::getChildType(CORINFO_CLASS_HANDLE clsHnd, CORINFO_CLASS_HANDLE* clsRet) -{ - return original_ICorJitInfo->getChildType(clsHnd, clsRet); -} - -// Check constraints on type arguments of this class and parent classes -BOOL interceptor_ICJI::satisfiesClassConstraints(CORINFO_CLASS_HANDLE cls) -{ - return original_ICorJitInfo->satisfiesClassConstraints(cls); -} - -// Check if this is a single dimensional array type -BOOL interceptor_ICJI::isSDArray(CORINFO_CLASS_HANDLE cls) -{ - return original_ICorJitInfo->isSDArray(cls); -} - -// Get the numbmer of dimensions in an array -unsigned interceptor_ICJI::getArrayRank(CORINFO_CLASS_HANDLE cls) -{ - return original_ICorJitInfo->getArrayRank(cls); -} - -// Get static field data for an array -void* interceptor_ICJI::getArrayInitializationData(CORINFO_FIELD_HANDLE field, DWORD size) -{ - return original_ICorJitInfo->getArrayInitializationData(field, size); -} - -// Check Visibility rules. -CorInfoIsAccessAllowedResult interceptor_ICJI::canAccessClass( - CORINFO_RESOLVED_TOKEN* pResolvedToken, - CORINFO_METHOD_HANDLE callerHandle, - CORINFO_HELPER_DESC* pAccessHelper /* If canAccessMethod returns something other - than ALLOWED, then this is filled in. */ - ) -{ - return original_ICorJitInfo->canAccessClass(pResolvedToken, callerHandle, pAccessHelper); -} - -/**********************************************************************************/ -// -// ICorFieldInfo -// -/**********************************************************************************/ - -// this function is for debugging only. It returns the field name -// and if 'moduleName' is non-null, it sets it to something that will -// says which method (a class name, or a module name) -const char* interceptor_ICJI::getFieldName(CORINFO_FIELD_HANDLE ftn, /* IN */ - const char** moduleName /* OUT */ - ) -{ - return original_ICorJitInfo->getFieldName(ftn, moduleName); -} - -// return class it belongs to -CORINFO_CLASS_HANDLE interceptor_ICJI::getFieldClass(CORINFO_FIELD_HANDLE field) -{ - return original_ICorJitInfo->getFieldClass(field); -} - -// Return the field's type, if it is CORINFO_TYPE_VALUECLASS 'structType' is set -// the field's value class (if 'structType' == 0, then don't bother -// the structure info). -// -// 'memberParent' is typically only set when verifying. It should be the -// result of calling getMemberParent. -CorInfoType interceptor_ICJI::getFieldType(CORINFO_FIELD_HANDLE field, - CORINFO_CLASS_HANDLE* structType, - CORINFO_CLASS_HANDLE memberParent /* IN */ - ) -{ - return original_ICorJitInfo->getFieldType(field, structType, memberParent); -} - -// return the data member's instance offset -unsigned interceptor_ICJI::getFieldOffset(CORINFO_FIELD_HANDLE field) -{ - return original_ICorJitInfo->getFieldOffset(field); -} - -void interceptor_ICJI::getFieldInfo(CORINFO_RESOLVED_TOKEN* pResolvedToken, - CORINFO_METHOD_HANDLE callerHandle, - CORINFO_ACCESS_FLAGS flags, - CORINFO_FIELD_INFO* pResult) -{ - original_ICorJitInfo->getFieldInfo(pResolvedToken, callerHandle, flags, pResult); -} - -// Returns true iff "fldHnd" represents a static field. -bool interceptor_ICJI::isFieldStatic(CORINFO_FIELD_HANDLE fldHnd) -{ - // this method does exist in some forms of the jit interface... if trip into one we'll know about it - DebugBreakorAV(67); - return true; -} - -/*********************************************************************************/ -// -// ICorDebugInfo -// -/*********************************************************************************/ - -// Query the EE to find out where interesting break points -// in the code are. The native compiler will ensure that these places -// have a corresponding break point in native code. -// -// Note that unless CORJIT_FLAG_DEBUG_CODE is specified, this function will -// be used only as a hint and the native compiler should not change its -// code generation. -void interceptor_ICJI::getBoundaries(CORINFO_METHOD_HANDLE ftn, // [IN] method of interest - unsigned int* cILOffsets, // [OUT] size of pILOffsets - DWORD** pILOffsets, // [OUT] IL offsets of interest - // jit MUST free with freeArray! - ICorDebugInfo::BoundaryTypes* implictBoundaries // [OUT] tell jit, all boundries of - // this type - ) -{ - original_ICorJitInfo->getBoundaries(ftn, cILOffsets, pILOffsets, implictBoundaries); -} - -// Report back the mapping from IL to native code, -// this map should include all boundaries that 'getBoundaries' -// reported as interesting to the debugger. - -// Note that debugger (and profiler) is assuming that all of the -// offsets form a contiguous block of memory, and that the -// OffsetMapping is sorted in order of increasing native offset. -void interceptor_ICJI::setBoundaries(CORINFO_METHOD_HANDLE ftn, // [IN] method of interest - ULONG32 cMap, // [IN] size of pMap - ICorDebugInfo::OffsetMapping* pMap // [IN] map including all points of interest. - // jit allocated with allocateArray, EE - // frees - ) -{ - original_ICorJitInfo->setBoundaries(ftn, cMap, pMap); -} - -// Query the EE to find out the scope of local varables. -// normally the JIT would trash variables after last use, but -// under debugging, the JIT needs to keep them live over their -// entire scope so that they can be inspected. -// -// Note that unless CORJIT_FLAG_DEBUG_CODE is specified, this function will -// be used only as a hint and the native compiler should not change its -// code generation. -void interceptor_ICJI::getVars(CORINFO_METHOD_HANDLE ftn, // [IN] method of interest - ULONG32* cVars, // [OUT] size of 'vars' - ICorDebugInfo::ILVarInfo** vars, // [OUT] scopes of variables of interest - // jit MUST free with freeArray! - bool* extendOthers // [OUT] it TRUE, then assume the scope - // of unmentioned vars is entire method - ) -{ - original_ICorJitInfo->getVars(ftn, cVars, vars, extendOthers); -} - -// Report back to the EE the location of every variable. -// note that the JIT might split lifetimes into different -// locations etc. - -void interceptor_ICJI::setVars(CORINFO_METHOD_HANDLE ftn, // [IN] method of interest - ULONG32 cVars, // [IN] size of 'vars' - ICorDebugInfo::NativeVarInfo* vars // [IN] map telling where local vars are stored at - // what points - // jit allocated with allocateArray, EE frees - ) -{ - original_ICorJitInfo->setVars(ftn, cVars, vars); -} - -/*-------------------------- Misc ---------------------------------------*/ - -// Used to allocate memory that needs to handed to the EE. -// For eg, use this to allocated memory for reporting debug info, -// which will be handed to the EE by setVars() and setBoundaries() -void* interceptor_ICJI::allocateArray(size_t cBytes) -{ - return original_ICorJitInfo->allocateArray(cBytes); -} - -// JitCompiler will free arrays passed by the EE using this -// For eg, The EE returns memory in getVars() and getBoundaries() -// to the JitCompiler, which the JitCompiler should release using -// freeArray() -void interceptor_ICJI::freeArray(void* array) -{ - original_ICorJitInfo->freeArray(array); -} - -/*********************************************************************************/ -// -// ICorArgInfo -// -/*********************************************************************************/ - -// advance the pointer to the argument list. -// a ptr of 0, is special and always means the first argument -CORINFO_ARG_LIST_HANDLE interceptor_ICJI::getArgNext(CORINFO_ARG_LIST_HANDLE args /* IN */ - ) -{ - return original_ICorJitInfo->getArgNext(args); -} - -// Get the type of a particular argument -// CORINFO_TYPE_UNDEF is returned when there are no more arguments -// If the type returned is a primitive type (or an enum) *vcTypeRet set to nullptr -// otherwise it is set to the TypeHandle associted with the type -// Enumerations will always look their underlying type (probably should fix this) -// Otherwise vcTypeRet is the type as would be seen by the IL, -// The return value is the type that is used for calling convention purposes -// (Thus if the EE wants a value class to be passed like an int, then it will -// return CORINFO_TYPE_INT -CorInfoTypeWithMod interceptor_ICJI::getArgType(CORINFO_SIG_INFO* sig, /* IN */ - CORINFO_ARG_LIST_HANDLE args, /* IN */ - CORINFO_CLASS_HANDLE* vcTypeRet /* OUT */ - ) -{ - return original_ICorJitInfo->getArgType(sig, args, vcTypeRet); -} - -// If the Arg is a CORINFO_TYPE_CLASS fetch the class handle associated with it -CORINFO_CLASS_HANDLE interceptor_ICJI::getArgClass(CORINFO_SIG_INFO* sig, /* IN */ - CORINFO_ARG_LIST_HANDLE args /* IN */ - ) -{ - return original_ICorJitInfo->getArgClass(sig, args); -} - -// Returns type of HFA for valuetype -CorInfoHFAElemType interceptor_ICJI::getHFAType(CORINFO_CLASS_HANDLE hClass) -{ - return original_ICorJitInfo->getHFAType(hClass); -} - -/***************************************************************************** -* ICorErrorInfo contains methods to deal with SEH exceptions being thrown -* from the corinfo interface. These methods may be called when an exception -* with code EXCEPTION_COMPLUS is caught. -*****************************************************************************/ - -// Returns the HRESULT of the current exception -HRESULT interceptor_ICJI::GetErrorHRESULT(struct _EXCEPTION_POINTERS* pExceptionPointers) -{ - return original_ICorJitInfo->GetErrorHRESULT(pExceptionPointers); -} - -// Fetches the message of the current exception -// Returns the size of the message (including terminating null). This can be -// greater than bufferLength if the buffer is insufficient. -ULONG interceptor_ICJI::GetErrorMessage(__inout_ecount(bufferLength) LPWSTR buffer, ULONG bufferLength) -{ - return original_ICorJitInfo->GetErrorMessage(buffer, bufferLength); -} - -// returns EXCEPTION_EXECUTE_HANDLER if it is OK for the compile to handle the -// exception, abort some work (like the inlining) and continue compilation -// returns EXCEPTION_CONTINUE_SEARCH if exception must always be handled by the EE -// things like ThreadStoppedException ... -// returns EXCEPTION_CONTINUE_EXECUTION if exception is fixed up by the EE - -int interceptor_ICJI::FilterException(struct _EXCEPTION_POINTERS* pExceptionPointers) -{ - return original_ICorJitInfo->FilterException(pExceptionPointers); -} - -// Cleans up internal EE tracking when an exception is caught. -void interceptor_ICJI::HandleException(struct _EXCEPTION_POINTERS* pExceptionPointers) -{ - original_ICorJitInfo->HandleException(pExceptionPointers); -} - -void interceptor_ICJI::ThrowExceptionForJitResult(HRESULT result) -{ - original_ICorJitInfo->ThrowExceptionForJitResult(result); -} - -// Throws an exception defined by the given throw helper. -void interceptor_ICJI::ThrowExceptionForHelper(const CORINFO_HELPER_DESC* throwHelper) -{ - original_ICorJitInfo->ThrowExceptionForHelper(throwHelper); -} - -/***************************************************************************** - * ICorStaticInfo contains EE interface methods which return values that are - * constant from invocation to invocation. Thus they may be embedded in - * persisted information like statically generated code. (This is of course - * assuming that all code versions are identical each time.) - *****************************************************************************/ - -// Return details about EE internal data structures -void interceptor_ICJI::getEEInfo(CORINFO_EE_INFO* pEEInfoOut) -{ - original_ICorJitInfo->getEEInfo(pEEInfoOut); -} - -// Returns name of the JIT timer log -LPCWSTR interceptor_ICJI::getJitTimeLogFilename() -{ - return original_ICorJitInfo->getJitTimeLogFilename(); -} - -/*********************************************************************************/ -// -// Diagnostic methods -// -/*********************************************************************************/ - -// this function is for debugging only. Returns method token. -// Returns mdMethodDefNil for dynamic methods. -mdMethodDef interceptor_ICJI::getMethodDefFromMethod(CORINFO_METHOD_HANDLE hMethod) -{ - return original_ICorJitInfo->getMethodDefFromMethod(hMethod); -} - -// this function is for debugging only. It returns the method name -// and if 'moduleName' is non-null, it sets it to something that will -// says which method (a class name, or a module name) -const char* interceptor_ICJI::getMethodName(CORINFO_METHOD_HANDLE ftn, /* IN */ - const char** moduleName /* OUT */ - ) -{ - return original_ICorJitInfo->getMethodName(ftn, moduleName); -} - -const char* interceptor_ICJI::getMethodNameFromMetadata(CORINFO_METHOD_HANDLE ftn, /* IN */ - const char** className, /* OUT */ - const char** namespaceName, /* OUT */ - const char** enclosingClassName /* OUT */ - ) -{ - return original_ICorJitInfo->getMethodNameFromMetadata(ftn, className, namespaceName, enclosingClassName); -} - -// this function is for debugging only. It returns a value that -// is will always be the same for a given method. It is used -// to implement the 'jitRange' functionality -unsigned interceptor_ICJI::getMethodHash(CORINFO_METHOD_HANDLE ftn /* IN */ - ) -{ - return original_ICorJitInfo->getMethodHash(ftn); -} - -// this function is for debugging only. -size_t interceptor_ICJI::findNameOfToken(CORINFO_MODULE_HANDLE module, /* IN */ - mdToken metaTOK, /* IN */ - __out_ecount(FQNameCapacity) char* szFQName, /* OUT */ - size_t FQNameCapacity /* IN */ - ) -{ - return original_ICorJitInfo->findNameOfToken(module, metaTOK, szFQName, FQNameCapacity); -} - -bool interceptor_ICJI::getSystemVAmd64PassStructInRegisterDescriptor( - /* IN */ CORINFO_CLASS_HANDLE structHnd, - /* OUT */ SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR* structPassInRegDescPtr) -{ - return original_ICorJitInfo->getSystemVAmd64PassStructInRegisterDescriptor(structHnd, structPassInRegDescPtr); -} - -// Stuff on ICorDynamicInfo -DWORD interceptor_ICJI::getThreadTLSIndex(void** ppIndirection) -{ - return original_ICorJitInfo->getThreadTLSIndex(ppIndirection); -} - -const void* interceptor_ICJI::getInlinedCallFrameVptr(void** ppIndirection) -{ - return original_ICorJitInfo->getInlinedCallFrameVptr(ppIndirection); -} - -LONG* interceptor_ICJI::getAddrOfCaptureThreadGlobal(void** ppIndirection) -{ - return original_ICorJitInfo->getAddrOfCaptureThreadGlobal(ppIndirection); -} - -// return the native entry point to an EE helper (see CorInfoHelpFunc) -void* interceptor_ICJI::getHelperFtn(CorInfoHelpFunc ftnNum, void** ppIndirection) -{ - return original_ICorJitInfo->getHelperFtn(ftnNum, ppIndirection); -} - -// return a callable address of the function (native code). This function -// may return a different value (depending on whether the method has -// been JITed or not. -void interceptor_ICJI::getFunctionEntryPoint(CORINFO_METHOD_HANDLE ftn, /* IN */ - CORINFO_CONST_LOOKUP* pResult, /* OUT */ - CORINFO_ACCESS_FLAGS accessFlags) -{ - original_ICorJitInfo->getFunctionEntryPoint(ftn, pResult, accessFlags); -} - -// return a directly callable address. This can be used similarly to the -// value returned by getFunctionEntryPoint() except that it is -// guaranteed to be multi callable entrypoint. -void interceptor_ICJI::getFunctionFixedEntryPoint(CORINFO_METHOD_HANDLE ftn, CORINFO_CONST_LOOKUP* pResult) -{ - original_ICorJitInfo->getFunctionFixedEntryPoint(ftn, pResult); -} - -// get the synchronization handle that is passed to monXstatic function -void* interceptor_ICJI::getMethodSync(CORINFO_METHOD_HANDLE ftn, void** ppIndirection) -{ - return original_ICorJitInfo->getMethodSync(ftn, ppIndirection); -} - -// These entry points must be called if a handle is being embedded in -// the code to be passed to a JIT helper function. (as opposed to just -// being passed back into the ICorInfo interface.) - -// get slow lazy string literal helper to use (CORINFO_HELP_STRCNS*). -// Returns CORINFO_HELP_UNDEF if lazy string literal helper cannot be used. -CorInfoHelpFunc interceptor_ICJI::getLazyStringLiteralHelper(CORINFO_MODULE_HANDLE handle) -{ - return original_ICorJitInfo->getLazyStringLiteralHelper(handle); -} - -CORINFO_MODULE_HANDLE interceptor_ICJI::embedModuleHandle(CORINFO_MODULE_HANDLE handle, void** ppIndirection) -{ - return original_ICorJitInfo->embedModuleHandle(handle, ppIndirection); -} - -CORINFO_CLASS_HANDLE interceptor_ICJI::embedClassHandle(CORINFO_CLASS_HANDLE handle, void** ppIndirection) -{ - return original_ICorJitInfo->embedClassHandle(handle, ppIndirection); -} - -CORINFO_METHOD_HANDLE interceptor_ICJI::embedMethodHandle(CORINFO_METHOD_HANDLE handle, void** ppIndirection) -{ - return original_ICorJitInfo->embedMethodHandle(handle, ppIndirection); -} - -CORINFO_FIELD_HANDLE interceptor_ICJI::embedFieldHandle(CORINFO_FIELD_HANDLE handle, void** ppIndirection) -{ - return original_ICorJitInfo->embedFieldHandle(handle, ppIndirection); -} - -// Given a module scope (module), a method handle (context) and -// a metadata token (metaTOK), fetch the handle -// (type, field or method) associated with the token. -// If this is not possible at compile-time (because the current method's -// code is shared and the token contains generic parameters) -// then indicate how the handle should be looked up at run-time. -// -void interceptor_ICJI::embedGenericHandle(CORINFO_RESOLVED_TOKEN* pResolvedToken, - BOOL fEmbedParent, // TRUE - embeds parent type handle of the field/method - // handle - CORINFO_GENERICHANDLE_RESULT* pResult) -{ - original_ICorJitInfo->embedGenericHandle(pResolvedToken, fEmbedParent, pResult); -} - -// Return information used to locate the exact enclosing type of the current method. -// Used only to invoke .cctor method from code shared across generic instantiations -// !needsRuntimeLookup statically known (enclosing type of method itself) -// needsRuntimeLookup: -// CORINFO_LOOKUP_THISOBJ use vtable pointer of 'this' param -// CORINFO_LOOKUP_CLASSPARAM use vtable hidden param -// CORINFO_LOOKUP_METHODPARAM use enclosing type of method-desc hidden param -void interceptor_ICJI::getLocationOfThisType(CORINFO_METHOD_HANDLE context, CORINFO_LOOKUP_KIND* pLookupKind) -{ - original_ICorJitInfo->getLocationOfThisType(context, pLookupKind); -} - -// return address of fixup area for late-bound PInvoke calls. -void interceptor_ICJI::getAddressOfPInvokeTarget(CORINFO_METHOD_HANDLE method, CORINFO_CONST_LOOKUP* pLookup) -{ - original_ICorJitInfo->getAddressOfPInvokeTarget(method, pLookup); -} - -// Generate a cookie based on the signature that would needs to be passed -// to CORINFO_HELP_PINVOKE_CALLI -LPVOID interceptor_ICJI::GetCookieForPInvokeCalliSig(CORINFO_SIG_INFO* szMetaSig, void** ppIndirection) -{ - return original_ICorJitInfo->GetCookieForPInvokeCalliSig(szMetaSig, ppIndirection); -} - -// returns true if a VM cookie can be generated for it (might be false due to cross-module -// inlining, in which case the inlining should be aborted) -bool interceptor_ICJI::canGetCookieForPInvokeCalliSig(CORINFO_SIG_INFO* szMetaSig) -{ - return original_ICorJitInfo->canGetCookieForPInvokeCalliSig(szMetaSig); -} - -// Gets a handle that is checked to see if the current method is -// included in "JustMyCode" -CORINFO_JUST_MY_CODE_HANDLE interceptor_ICJI::getJustMyCodeHandle(CORINFO_METHOD_HANDLE method, - CORINFO_JUST_MY_CODE_HANDLE** ppIndirection) -{ - return original_ICorJitInfo->getJustMyCodeHandle(method, ppIndirection); -} - -// Gets a method handle that can be used to correlate profiling data. -// This is the IP of a native method, or the address of the descriptor struct -// for IL. Always guaranteed to be unique per process, and not to move. */ -void interceptor_ICJI::GetProfilingHandle(BOOL* pbHookFunction, void** pProfilerHandle, BOOL* pbIndirectedHandles) -{ - original_ICorJitInfo->GetProfilingHandle(pbHookFunction, pProfilerHandle, pbIndirectedHandles); -} - -// Returns instructions on how to make the call. See code:CORINFO_CALL_INFO for possible return values. -void interceptor_ICJI::getCallInfo( - // Token info - CORINFO_RESOLVED_TOKEN* pResolvedToken, - - // Generics info - CORINFO_RESOLVED_TOKEN* pConstrainedResolvedToken, - - // Security info - CORINFO_METHOD_HANDLE callerHandle, - - // Jit info - CORINFO_CALLINFO_FLAGS flags, - - // out params - CORINFO_CALL_INFO* pResult) -{ - original_ICorJitInfo->getCallInfo(pResolvedToken, pConstrainedResolvedToken, callerHandle, flags, pResult); -} - -BOOL interceptor_ICJI::canAccessFamily(CORINFO_METHOD_HANDLE hCaller, CORINFO_CLASS_HANDLE hInstanceType) - -{ - return original_ICorJitInfo->canAccessFamily(hCaller, hInstanceType); -} -// Returns TRUE if the Class Domain ID is the RID of the class (currently true for every class -// except reflection emitted classes and generics) -BOOL interceptor_ICJI::isRIDClassDomainID(CORINFO_CLASS_HANDLE cls) -{ - return original_ICorJitInfo->isRIDClassDomainID(cls); -} - -// returns the class's domain ID for accessing shared statics -unsigned interceptor_ICJI::getClassDomainID(CORINFO_CLASS_HANDLE cls, void** ppIndirection) -{ - return original_ICorJitInfo->getClassDomainID(cls, ppIndirection); -} - -// return the data's address (for static fields only) -void* interceptor_ICJI::getFieldAddress(CORINFO_FIELD_HANDLE field, void** ppIndirection) -{ - return original_ICorJitInfo->getFieldAddress(field, ppIndirection); -} - -// return the class handle for the current value of a static field -CORINFO_CLASS_HANDLE interceptor_ICJI::getStaticFieldCurrentClass(CORINFO_FIELD_HANDLE field, bool* pIsSpeculative) -{ - return original_ICorJitInfo->getStaticFieldCurrentClass(field, pIsSpeculative); -} - -// registers a vararg sig & returns a VM cookie for it (which can contain other stuff) -CORINFO_VARARGS_HANDLE interceptor_ICJI::getVarArgsHandle(CORINFO_SIG_INFO* pSig, void** ppIndirection) -{ - return original_ICorJitInfo->getVarArgsHandle(pSig, ppIndirection); -} - -// returns true if a VM cookie can be generated for it (might be false due to cross-module -// inlining, in which case the inlining should be aborted) -bool interceptor_ICJI::canGetVarArgsHandle(CORINFO_SIG_INFO* pSig) -{ - return original_ICorJitInfo->canGetVarArgsHandle(pSig); -} - -// Allocate a string literal on the heap and return a handle to it -InfoAccessType interceptor_ICJI::constructStringLiteral(CORINFO_MODULE_HANDLE module, mdToken metaTok, void** ppValue) -{ - return original_ICorJitInfo->constructStringLiteral(module, metaTok, ppValue); -} - -bool interceptor_ICJI::convertPInvokeCalliToCall(CORINFO_RESOLVED_TOKEN* pResolvedToken, bool fMustConvert) -{ - return original_ICorJitInfo->convertPInvokeCalliToCall(pResolvedToken, fMustConvert); -} - -InfoAccessType interceptor_ICJI::emptyStringLiteral(void** ppValue) -{ - return original_ICorJitInfo->emptyStringLiteral(ppValue); -} - -// (static fields only) given that 'field' refers to thread local store, -// return the ID (TLS index), which is used to find the beginning of the -// TLS data area for the particular DLL 'field' is associated with. -DWORD interceptor_ICJI::getFieldThreadLocalStoreID(CORINFO_FIELD_HANDLE field, void** ppIndirection) -{ - return original_ICorJitInfo->getFieldThreadLocalStoreID(field, ppIndirection); -} - -// Sets another object to intercept calls to "self" and current method being compiled -void interceptor_ICJI::setOverride(ICorDynamicInfo* pOverride, CORINFO_METHOD_HANDLE currentMethod) -{ - original_ICorJitInfo->setOverride(pOverride, currentMethod); -} - -// Adds an active dependency from the context method's module to the given module -// This is internal callback for the EE. JIT should not call it directly. -void interceptor_ICJI::addActiveDependency(CORINFO_MODULE_HANDLE moduleFrom, CORINFO_MODULE_HANDLE moduleTo) -{ - original_ICorJitInfo->addActiveDependency(moduleFrom, moduleTo); -} - -CORINFO_METHOD_HANDLE interceptor_ICJI::GetDelegateCtor(CORINFO_METHOD_HANDLE methHnd, - CORINFO_CLASS_HANDLE clsHnd, - CORINFO_METHOD_HANDLE targetMethodHnd, - DelegateCtorArgs* pCtorData) -{ - return original_ICorJitInfo->GetDelegateCtor(methHnd, clsHnd, targetMethodHnd, pCtorData); -} - -void interceptor_ICJI::MethodCompileComplete(CORINFO_METHOD_HANDLE methHnd) -{ - original_ICorJitInfo->MethodCompileComplete(methHnd); -} - -bool interceptor_ICJI::getTailCallHelpers( - CORINFO_RESOLVED_TOKEN* callToken, - CORINFO_SIG_INFO* sig, - CORINFO_GET_TAILCALL_HELPERS_FLAGS flags, - CORINFO_TAILCALL_HELPERS* pResult) -{ - return original_ICorJitInfo->getTailCallHelpers(callToken, sig, flags, pResult); -} - -// Stuff directly on ICorJitInfo - -// Returns extended flags for a particular compilation instance. -DWORD interceptor_ICJI::getJitFlags(CORJIT_FLAGS* jitFlags, DWORD sizeInBytes) -{ - return original_ICorJitInfo->getJitFlags(jitFlags, sizeInBytes); -} - -// Runs the given function with the given parameter under an error trap -// and returns true if the function completes successfully. -bool interceptor_ICJI::runWithErrorTrap(void (*function)(void*), void* param) -{ - return original_ICorJitInfo->runWithErrorTrap(function, param); -} - -// get a block of memory for the code, readonly data, and read-write data -void interceptor_ICJI::allocMem(ULONG hotCodeSize, /* IN */ - ULONG coldCodeSize, /* IN */ - ULONG roDataSize, /* IN */ - ULONG xcptnsCount, /* IN */ - CorJitAllocMemFlag flag, /* IN */ - void** hotCodeBlock, /* OUT */ - void** coldCodeBlock, /* OUT */ - void** roDataBlock /* OUT */ - ) -{ - return original_ICorJitInfo->allocMem(hotCodeSize, coldCodeSize, roDataSize, xcptnsCount, flag, hotCodeBlock, - coldCodeBlock, roDataBlock); -} - -// Reserve memory for the method/funclet's unwind information. -// Note that this must be called before allocMem. It should be -// called once for the main method, once for every funclet, and -// once for every block of cold code for which allocUnwindInfo -// will be called. -// -// This is necessary because jitted code must allocate all the -// memory needed for the unwindInfo at the allocMem call. -// For prejitted code we split up the unwinding information into -// separate sections .rdata and .pdata. -// -void interceptor_ICJI::reserveUnwindInfo(BOOL isFunclet, /* IN */ - BOOL isColdCode, /* IN */ - ULONG unwindSize /* IN */ - ) -{ - original_ICorJitInfo->reserveUnwindInfo(isFunclet, isColdCode, unwindSize); -} - -// Allocate and initialize the .rdata and .pdata for this method or -// funclet, and get the block of memory needed for the machine-specific -// unwind information (the info for crawling the stack frame). -// Note that allocMem must be called first. -// -// Parameters: -// -// pHotCode main method code buffer, always filled in -// pColdCode cold code buffer, only filled in if this is cold code, -// null otherwise -// startOffset start of code block, relative to appropriate code buffer -// (e.g. pColdCode if cold, pHotCode if hot). -// endOffset end of code block, relative to appropriate code buffer -// unwindSize size of unwind info pointed to by pUnwindBlock -// pUnwindBlock pointer to unwind info -// funcKind type of funclet (main method code, handler, filter) -// -void interceptor_ICJI::allocUnwindInfo(BYTE* pHotCode, /* IN */ - BYTE* pColdCode, /* IN */ - ULONG startOffset, /* IN */ - ULONG endOffset, /* IN */ - ULONG unwindSize, /* IN */ - BYTE* pUnwindBlock, /* IN */ - CorJitFuncKind funcKind /* IN */ - ) -{ - original_ICorJitInfo->allocUnwindInfo(pHotCode, pColdCode, startOffset, endOffset, unwindSize, pUnwindBlock, - funcKind); -} - -// Get a block of memory needed for the code manager information, -// (the info for enumerating the GC pointers while crawling the -// stack frame). -// Note that allocMem must be called first -void* interceptor_ICJI::allocGCInfo(size_t size /* IN */ - ) -{ - return original_ICorJitInfo->allocGCInfo(size); -} - -// Indicate how many exception handler blocks are to be returned. -// This is guaranteed to be called before any 'setEHinfo' call. -// Note that allocMem must be called before this method can be called. -void interceptor_ICJI::setEHcount(unsigned cEH /* IN */ - ) -{ - original_ICorJitInfo->setEHcount(cEH); -} - -// Set the values for one particular exception handler block. -// -// Handler regions should be lexically contiguous. -// This is because FinallyIsUnwinding() uses lexicality to -// determine if a "finally" clause is executing. -void interceptor_ICJI::setEHinfo(unsigned EHnumber, /* IN */ - const CORINFO_EH_CLAUSE* clause /* IN */ - ) -{ - original_ICorJitInfo->setEHinfo(EHnumber, clause); -} - -// Level 1 -> fatalError, Level 2 -> Error, Level 3 -> Warning -// Level 4 means happens 10 times in a run, level 5 means 100, level 6 means 1000 ... -// returns non-zero if the logging succeeded -BOOL interceptor_ICJI::logMsg(unsigned level, const char* fmt, va_list args) -{ - return original_ICorJitInfo->logMsg(level, fmt, args); -} - -// do an assert. will return true if the code should retry (DebugBreak) -// returns false, if the assert should be igored. -int interceptor_ICJI::doAssert(const char* szFile, int iLine, const char* szExpr) -{ - return original_ICorJitInfo->doAssert(szFile, iLine, szExpr); -} - -void interceptor_ICJI::reportFatalError(CorJitResult result) -{ - original_ICorJitInfo->reportFatalError(result); -} - -// allocate a basic block profile buffer where execution counts will be stored -// for jitted basic blocks. -HRESULT interceptor_ICJI::allocMethodBlockCounts(UINT32 count, // The number of basic blocks that we have - BlockCounts** pBlockCounts) -{ - return original_ICorJitInfo->allocMethodBlockCounts(count, pBlockCounts); -} - -// get profile information to be used for optimizing the current method. The format -// of the buffer is the same as the format the JIT passes to allocMethodBlockCounts. -HRESULT interceptor_ICJI::getMethodBlockCounts(CORINFO_METHOD_HANDLE ftnHnd, - UINT32 * pCount, // The number of basic blocks that we have - BlockCounts** pBlockCounts, - UINT32 * pNumRuns) -{ - return original_ICorJitInfo->getMethodBlockCounts(ftnHnd, pCount, pBlockCounts, pNumRuns); -} - -// Associates a native call site, identified by its offset in the native code stream, with -// the signature information and method handle the JIT used to lay out the call site. If -// the call site has no signature information (e.g. a helper call) or has no method handle -// (e.g. a CALLI P/Invoke), then null should be passed instead. -void interceptor_ICJI::recordCallSite(ULONG instrOffset, /* IN */ - CORINFO_SIG_INFO* callSig, /* IN */ - CORINFO_METHOD_HANDLE methodHandle /* IN */ - ) -{ - original_ICorJitInfo->recordCallSite(instrOffset, callSig, methodHandle); -} - -// A relocation is recorded if we are pre-jitting. -// A jump thunk may be inserted if we are jitting -void interceptor_ICJI::recordRelocation(void* location, /* IN */ - void* target, /* IN */ - WORD fRelocType, /* IN */ - WORD slotNum, /* IN */ - INT32 addlDelta /* IN */ - ) -{ - original_ICorJitInfo->recordRelocation(location, target, fRelocType, slotNum, addlDelta); -} - -WORD interceptor_ICJI::getRelocTypeHint(void* target) -{ - return original_ICorJitInfo->getRelocTypeHint(target); -} - -// For what machine does the VM expect the JIT to generate code? The VM -// returns one of the IMAGE_FILE_MACHINE_* values. Note that if the VM -// is cross-compiling (such as the case for crossgen), it will return a -// different value than if it was compiling for the host architecture. -// -DWORD interceptor_ICJI::getExpectedTargetArchitecture() -{ - return original_ICorJitInfo->getExpectedTargetArchitecture(); -} - -void interceptor_ICJI::notifyInstructionSetUsage(CORINFO_InstructionSet instructionSet, bool supported) -{ - original_ICorJitInfo->notifyInstructionSetUsage(instructionSet, supported); -} diff --git a/src/coreclr/src/tools/aot/jitinterface/jitinterface.h b/src/coreclr/src/tools/aot/jitinterface/jitinterface.h deleted file mode 100644 index cb0aeacabb57d..0000000000000 --- a/src/coreclr/src/tools/aot/jitinterface/jitinterface.h +++ /dev/null @@ -1,1655 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -// DO NOT EDIT THIS FILE! It IS AUTOGENERATED -#include "corinfoexception.h" - -struct JitInterfaceCallbacks -{ - unsigned int (* getMethodAttribs)(void * thisHandle, CorInfoException** ppException, void* ftn); - void (* setMethodAttribs)(void * thisHandle, CorInfoException** ppException, void* ftn, int attribs); - void (* getMethodSig)(void * thisHandle, CorInfoException** ppException, void* ftn, void* sig, void* memberParent); - bool (* getMethodInfo)(void * thisHandle, CorInfoException** ppException, void* ftn, void* info); - int (* canInline)(void * thisHandle, CorInfoException** ppException, void* callerHnd, void* calleeHnd, unsigned int* pRestrictions); - void (* reportInliningDecision)(void * thisHandle, CorInfoException** ppException, void* inlinerHnd, void* inlineeHnd, int inlineResult, const char* reason); - bool (* canTailCall)(void * thisHandle, CorInfoException** ppException, void* callerHnd, void* declaredCalleeHnd, void* exactCalleeHnd, bool fIsTailPrefix); - void (* reportTailCallDecision)(void * thisHandle, CorInfoException** ppException, void* callerHnd, void* calleeHnd, bool fIsTailPrefix, int tailCallResult, const char* reason); - void (* getEHinfo)(void * thisHandle, CorInfoException** ppException, void* ftn, unsigned EHnumber, void* clause); - void* (* getMethodClass)(void * thisHandle, CorInfoException** ppException, void* method); - void* (* getMethodModule)(void * thisHandle, CorInfoException** ppException, void* method); - void (* getMethodVTableOffset)(void * thisHandle, CorInfoException** ppException, void* method, unsigned* offsetOfIndirection, unsigned* offsetAfterIndirection, bool* isRelative); - bool (* tryResolveVirtualMethod)(void * thisHandle, CorInfoException** ppException, void* pResolvedMethod); - void* (* getUnboxedEntry)(void * thisHandle, CorInfoException** ppException, void* ftn, bool* requiresInstMethodTableArg); - void* (* getDefaultEqualityComparerClass)(void * thisHandle, CorInfoException** ppException, void* elemType); - void (* expandRawHandleIntrinsic)(void * thisHandle, CorInfoException** ppException, void* pResolvedToken, void* pResult); - int (* getIntrinsicID)(void * thisHandle, CorInfoException** ppException, void* method, bool* pMustExpand); - bool (* isIntrinsicType)(void * thisHandle, CorInfoException** ppException, void* classHnd); - int (* getUnmanagedCallConv)(void * thisHandle, CorInfoException** ppException, void* method); - int (* pInvokeMarshalingRequired)(void * thisHandle, CorInfoException** ppException, void* method, void* callSiteSig); - int (* satisfiesMethodConstraints)(void * thisHandle, CorInfoException** ppException, void* parent, void* method); - int (* isCompatibleDelegate)(void * thisHandle, CorInfoException** ppException, void* objCls, void* methodParentCls, void* method, void* delegateCls, int* pfIsOpenDelegate); - void (* methodMustBeLoadedBeforeCodeIsRun)(void * thisHandle, CorInfoException** ppException, void* method); - void* (* mapMethodDeclToMethodImpl)(void * thisHandle, CorInfoException** ppException, void* method); - void (* getGSCookie)(void * thisHandle, CorInfoException** ppException, void* pCookieVal, void** ppCookieVal); - void (* setPatchpointInfo)(void * thisHandle, CorInfoException** ppException, void* patchpointInfo); - void* (* getOSRInfo)(void * thisHandle, CorInfoException** ppException, unsigned* ilOffset); - void (* resolveToken)(void * thisHandle, CorInfoException** ppException, void* pResolvedToken); - bool (* tryResolveToken)(void * thisHandle, CorInfoException** ppException, void* pResolvedToken); - void (* findSig)(void * thisHandle, CorInfoException** ppException, void* module, unsigned sigTOK, void* context, void* sig); - void (* findCallSiteSig)(void * thisHandle, CorInfoException** ppException, void* module, unsigned methTOK, void* context, void* sig); - void* (* getTokenTypeAsHandle)(void * thisHandle, CorInfoException** ppException, void* pResolvedToken); - int (* isValidToken)(void * thisHandle, CorInfoException** ppException, void* module, unsigned metaTOK); - int (* isValidStringRef)(void * thisHandle, CorInfoException** ppException, void* module, unsigned metaTOK); - const wchar_t* (* getStringLiteral)(void * thisHandle, CorInfoException** ppException, void* module, unsigned metaTOK, int* length); - int (* asCorInfoType)(void * thisHandle, CorInfoException** ppException, void* cls); - const char* (* getClassName)(void * thisHandle, CorInfoException** ppException, void* cls); - const char* (* getClassNameFromMetadata)(void * thisHandle, CorInfoException** ppException, void* cls, const char** namespaceName); - void* (* getTypeInstantiationArgument)(void * thisHandle, CorInfoException** ppException, void* cls, unsigned index); - int (* appendClassName)(void * thisHandle, CorInfoException** ppException, wchar_t** ppBuf, int* pnBufLen, void* cls, int fNamespace, int fFullInst, int fAssembly); - int (* isValueClass)(void * thisHandle, CorInfoException** ppException, void* cls); - int (* canInlineTypeCheck)(void * thisHandle, CorInfoException** ppException, void* cls, int source); - unsigned int (* getClassAttribs)(void * thisHandle, CorInfoException** ppException, void* cls); - int (* isStructRequiringStackAllocRetBuf)(void * thisHandle, CorInfoException** ppException, void* cls); - void* (* getClassModule)(void * thisHandle, CorInfoException** ppException, void* cls); - void* (* getModuleAssembly)(void * thisHandle, CorInfoException** ppException, void* mod); - const char* (* getAssemblyName)(void * thisHandle, CorInfoException** ppException, void* assem); - void* (* LongLifetimeMalloc)(void * thisHandle, CorInfoException** ppException, size_t sz); - void (* LongLifetimeFree)(void * thisHandle, CorInfoException** ppException, void* obj); - size_t (* getClassModuleIdForStatics)(void * thisHandle, CorInfoException** ppException, void* cls, void* pModule, void** ppIndirection); - unsigned (* getClassSize)(void * thisHandle, CorInfoException** ppException, void* cls); - unsigned (* getHeapClassSize)(void * thisHandle, CorInfoException** ppException, void* cls); - int (* canAllocateOnStack)(void * thisHandle, CorInfoException** ppException, void* cls); - unsigned (* getClassAlignmentRequirement)(void * thisHandle, CorInfoException** ppException, void* cls, int fDoubleAlignHint); - unsigned (* getClassGClayout)(void * thisHandle, CorInfoException** ppException, void* cls, unsigned char* gcPtrs); - unsigned (* getClassNumInstanceFields)(void * thisHandle, CorInfoException** ppException, void* cls); - void* (* getFieldInClass)(void * thisHandle, CorInfoException** ppException, void* clsHnd, int num); - int (* checkMethodModifier)(void * thisHandle, CorInfoException** ppException, void* hMethod, const char* modifier, int fOptional); - int (* getNewHelper)(void * thisHandle, CorInfoException** ppException, void* pResolvedToken, void* callerHandle, bool* pHasSideEffects); - int (* getNewArrHelper)(void * thisHandle, CorInfoException** ppException, void* arrayCls); - int (* getCastingHelper)(void * thisHandle, CorInfoException** ppException, void* pResolvedToken, bool fThrowing); - int (* getSharedCCtorHelper)(void * thisHandle, CorInfoException** ppException, void* clsHnd); - void* (* getTypeForBox)(void * thisHandle, CorInfoException** ppException, void* cls); - int (* getBoxHelper)(void * thisHandle, CorInfoException** ppException, void* cls); - int (* getUnBoxHelper)(void * thisHandle, CorInfoException** ppException, void* cls); - bool (* getReadyToRunHelper)(void * thisHandle, CorInfoException** ppException, void* pResolvedToken, void* pGenericLookupKind, int id, void* pLookup); - void (* getReadyToRunDelegateCtorHelper)(void * thisHandle, CorInfoException** ppException, void* pTargetMethod, void* delegateType, void* pLookup); - const char* (* getHelperName)(void * thisHandle, CorInfoException** ppException, int helpFunc); - int (* initClass)(void * thisHandle, CorInfoException** ppException, void* field, void* method, void* context); - void (* classMustBeLoadedBeforeCodeIsRun)(void * thisHandle, CorInfoException** ppException, void* cls); - void* (* getBuiltinClass)(void * thisHandle, CorInfoException** ppException, int classId); - int (* getTypeForPrimitiveValueClass)(void * thisHandle, CorInfoException** ppException, void* cls); - int (* getTypeForPrimitiveNumericClass)(void * thisHandle, CorInfoException** ppException, void* cls); - int (* canCast)(void * thisHandle, CorInfoException** ppException, void* child, void* parent); - int (* areTypesEquivalent)(void * thisHandle, CorInfoException** ppException, void* cls1, void* cls2); - int (* compareTypesForCast)(void * thisHandle, CorInfoException** ppException, void* fromClass, void* toClass); - int (* compareTypesForEquality)(void * thisHandle, CorInfoException** ppException, void* cls1, void* cls2); - void* (* mergeClasses)(void * thisHandle, CorInfoException** ppException, void* cls1, void* cls2); - int (* isMoreSpecificType)(void * thisHandle, CorInfoException** ppException, void* cls1, void* cls2); - void* (* getParentType)(void * thisHandle, CorInfoException** ppException, void* cls); - int (* getChildType)(void * thisHandle, CorInfoException** ppException, void* clsHnd, void* clsRet); - int (* satisfiesClassConstraints)(void * thisHandle, CorInfoException** ppException, void* cls); - int (* isSDArray)(void * thisHandle, CorInfoException** ppException, void* cls); - unsigned (* getArrayRank)(void * thisHandle, CorInfoException** ppException, void* cls); - void* (* getArrayInitializationData)(void * thisHandle, CorInfoException** ppException, void* field, unsigned int size); - int (* canAccessClass)(void * thisHandle, CorInfoException** ppException, void* pResolvedToken, void* callerHandle, void* pAccessHelper); - const char* (* getFieldName)(void * thisHandle, CorInfoException** ppException, void* ftn, const char** moduleName); - void* (* getFieldClass)(void * thisHandle, CorInfoException** ppException, void* field); - int (* getFieldType)(void * thisHandle, CorInfoException** ppException, void* field, void* structType, void* memberParent); - unsigned (* getFieldOffset)(void * thisHandle, CorInfoException** ppException, void* field); - void (* getFieldInfo)(void * thisHandle, CorInfoException** ppException, void* pResolvedToken, void* callerHandle, int flags, void* pResult); - bool (* isFieldStatic)(void * thisHandle, CorInfoException** ppException, void* fldHnd); - void (* getBoundaries)(void * thisHandle, CorInfoException** ppException, void* ftn, unsigned int* cILOffsets, unsigned int** pILOffsets, void* implictBoundaries); - void (* setBoundaries)(void * thisHandle, CorInfoException** ppException, void* ftn, unsigned int cMap, void* pMap); - void (* getVars)(void * thisHandle, CorInfoException** ppException, void* ftn, unsigned int* cVars, void* vars, bool* extendOthers); - void (* setVars)(void * thisHandle, CorInfoException** ppException, void* ftn, unsigned int cVars, void* vars); - void* (* allocateArray)(void * thisHandle, CorInfoException** ppException, size_t cBytes); - void (* freeArray)(void * thisHandle, CorInfoException** ppException, void* array); - void* (* getArgNext)(void * thisHandle, CorInfoException** ppException, void* args); - int (* getArgType)(void * thisHandle, CorInfoException** ppException, void* sig, void* args, void* vcTypeRet); - void* (* getArgClass)(void * thisHandle, CorInfoException** ppException, void* sig, void* args); - int (* getHFAType)(void * thisHandle, CorInfoException** ppException, void* hClass); - int (* GetErrorHRESULT)(void * thisHandle, CorInfoException** ppException, void* pExceptionPointers); - unsigned int (* GetErrorMessage)(void * thisHandle, CorInfoException** ppException, wchar_t* buffer, unsigned int bufferLength); - int (* FilterException)(void * thisHandle, CorInfoException** ppException, void* pExceptionPointers); - void (* HandleException)(void * thisHandle, CorInfoException** ppException, void* pExceptionPointers); - void (* ThrowExceptionForJitResult)(void * thisHandle, CorInfoException** ppException, int result); - void (* ThrowExceptionForHelper)(void * thisHandle, CorInfoException** ppException, const void* throwHelper); - bool (* runWithErrorTrap)(void * thisHandle, CorInfoException** ppException, void* function, void* parameter); - void (* getEEInfo)(void * thisHandle, CorInfoException** ppException, void* pEEInfoOut); - const wchar_t* (* getJitTimeLogFilename)(void * thisHandle, CorInfoException** ppException); - unsigned int (* getMethodDefFromMethod)(void * thisHandle, CorInfoException** ppException, void* hMethod); - const char* (* getMethodName)(void * thisHandle, CorInfoException** ppException, void* ftn, const char** moduleName); - const char* (* getMethodNameFromMetadata)(void * thisHandle, CorInfoException** ppException, void* ftn, const char** className, const char** namespaceName, const char** enclosingClassName); - unsigned (* getMethodHash)(void * thisHandle, CorInfoException** ppException, void* ftn); - size_t (* findNameOfToken)(void * thisHandle, CorInfoException** ppException, void* moduleHandle, unsigned int token, char* szFQName, size_t FQNameCapacity); - bool (* getSystemVAmd64PassStructInRegisterDescriptor)(void * thisHandle, CorInfoException** ppException, void* structHnd, void* structPassInRegDescPtr); - unsigned int (* getThreadTLSIndex)(void * thisHandle, CorInfoException** ppException, void** ppIndirection); - const void* (* getInlinedCallFrameVptr)(void * thisHandle, CorInfoException** ppException, void** ppIndirection); - long* (* getAddrOfCaptureThreadGlobal)(void * thisHandle, CorInfoException** ppException, void** ppIndirection); - void* (* getHelperFtn)(void * thisHandle, CorInfoException** ppException, int ftnNum, void** ppIndirection); - void (* getFunctionEntryPoint)(void * thisHandle, CorInfoException** ppException, void* ftn, void* pResult, int accessFlags); - void (* getFunctionFixedEntryPoint)(void * thisHandle, CorInfoException** ppException, void* ftn, void* pResult); - void* (* getMethodSync)(void * thisHandle, CorInfoException** ppException, void* ftn, void** ppIndirection); - int (* getLazyStringLiteralHelper)(void * thisHandle, CorInfoException** ppException, void* handle); - void* (* embedModuleHandle)(void * thisHandle, CorInfoException** ppException, void* handle, void** ppIndirection); - void* (* embedClassHandle)(void * thisHandle, CorInfoException** ppException, void* handle, void** ppIndirection); - void* (* embedMethodHandle)(void * thisHandle, CorInfoException** ppException, void* handle, void** ppIndirection); - void* (* embedFieldHandle)(void * thisHandle, CorInfoException** ppException, void* handle, void** ppIndirection); - void (* embedGenericHandle)(void * thisHandle, CorInfoException** ppException, void* pResolvedToken, int fEmbedParent, void* pResult); - void (* getLocationOfThisType)(void * thisHandle, CorInfoException** ppException, void* context, void* pLookupKind); - void (* getAddressOfPInvokeTarget)(void * thisHandle, CorInfoException** ppException, void* method, void* pLookup); - void* (* GetCookieForPInvokeCalliSig)(void * thisHandle, CorInfoException** ppException, void* szMetaSig, void** ppIndirection); - bool (* canGetCookieForPInvokeCalliSig)(void * thisHandle, CorInfoException** ppException, void* szMetaSig); - void* (* getJustMyCodeHandle)(void * thisHandle, CorInfoException** ppException, void* method, void** ppIndirection); - void (* GetProfilingHandle)(void * thisHandle, CorInfoException** ppException, int* pbHookFunction, void** pProfilerHandle, int* pbIndirectedHandles); - void (* getCallInfo)(void * thisHandle, CorInfoException** ppException, void* pResolvedToken, void* pConstrainedResolvedToken, void* callerHandle, int flags, void* pResult); - int (* canAccessFamily)(void * thisHandle, CorInfoException** ppException, void* hCaller, void* hInstanceType); - int (* isRIDClassDomainID)(void * thisHandle, CorInfoException** ppException, void* cls); - unsigned (* getClassDomainID)(void * thisHandle, CorInfoException** ppException, void* cls, void** ppIndirection); - void* (* getFieldAddress)(void * thisHandle, CorInfoException** ppException, void* field, void** ppIndirection); - void* (* getStaticFieldCurrentClass)(void * thisHandle, CorInfoException** ppException, void* field, bool* pIsSpeculative); - void* (* getVarArgsHandle)(void * thisHandle, CorInfoException** ppException, void* pSig, void** ppIndirection); - bool (* canGetVarArgsHandle)(void * thisHandle, CorInfoException** ppException, void* pSig); - int (* constructStringLiteral)(void * thisHandle, CorInfoException** ppException, void* module, unsigned int metaTok, void** ppValue); - int (* emptyStringLiteral)(void * thisHandle, CorInfoException** ppException, void** ppValue); - unsigned int (* getFieldThreadLocalStoreID)(void * thisHandle, CorInfoException** ppException, void* field, void** ppIndirection); - void (* setOverride)(void * thisHandle, CorInfoException** ppException, void* pOverride, void* currentMethod); - void (* addActiveDependency)(void * thisHandle, CorInfoException** ppException, void* moduleFrom, void* moduleTo); - void* (* GetDelegateCtor)(void * thisHandle, CorInfoException** ppException, void* methHnd, void* clsHnd, void* targetMethodHnd, void* pCtorData); - void (* MethodCompileComplete)(void * thisHandle, CorInfoException** ppException, void* methHnd); - bool (* getTailCallHelpers)(void * thisHandle, CorInfoException** ppException, void* callToken, void* sig, int flags, void* pResult); - bool (* convertPInvokeCalliToCall)(void * thisHandle, CorInfoException** ppException, void* pResolvedToken, bool mustConvert); - void (* notifyInstructionSetUsage)(void * thisHandle, CorInfoException** ppException, int instructionSet, bool supportEnabled); - void (* allocMem)(void * thisHandle, CorInfoException** ppException, unsigned int hotCodeSize, unsigned int coldCodeSize, unsigned int roDataSize, unsigned int xcptnsCount, int flag, void** hotCodeBlock, void** coldCodeBlock, void** roDataBlock); - void (* reserveUnwindInfo)(void * thisHandle, CorInfoException** ppException, int isFunclet, int isColdCode, unsigned int unwindSize); - void (* allocUnwindInfo)(void * thisHandle, CorInfoException** ppException, unsigned char* pHotCode, unsigned char* pColdCode, unsigned int startOffset, unsigned int endOffset, unsigned int unwindSize, unsigned char* pUnwindBlock, int funcKind); - void* (* allocGCInfo)(void * thisHandle, CorInfoException** ppException, size_t size); - void (* setEHcount)(void * thisHandle, CorInfoException** ppException, unsigned cEH); - void (* setEHinfo)(void * thisHandle, CorInfoException** ppException, unsigned EHnumber, void* clause); - int (* logMsg)(void * thisHandle, CorInfoException** ppException, unsigned level, const char* fmt, va_list args); - int (* doAssert)(void * thisHandle, CorInfoException** ppException, const char* szFile, int iLine, const char* szExpr); - void (* reportFatalError)(void * thisHandle, CorInfoException** ppException, int result); - int (* allocMethodBlockCounts)(void * thisHandle, CorInfoException** ppException, unsigned int count, void** pBlockCounts); - int (* getMethodBlockCounts)(void * thisHandle, CorInfoException** ppException, void* ftnHnd, unsigned int* pCount, void** pBlockCounts, unsigned int* pNumRuns); - void (* recordCallSite)(void * thisHandle, CorInfoException** ppException, unsigned int instrOffset, void* callSig, void* methodHandle); - void (* recordRelocation)(void * thisHandle, CorInfoException** ppException, void* location, void* target, unsigned short fRelocType, unsigned short slotNum, int addlDelta); - unsigned short (* getRelocTypeHint)(void * thisHandle, CorInfoException** ppException, void* target); - unsigned int (* getExpectedTargetArchitecture)(void * thisHandle, CorInfoException** ppException); - unsigned int (* getJitFlags)(void * thisHandle, CorInfoException** ppException, void* flags, unsigned int sizeInBytes); - -}; - -class JitInterfaceWrapper -{ - void * _thisHandle; - JitInterfaceCallbacks * _callbacks; - -public: - JitInterfaceWrapper(void * thisHandle, void ** callbacks) - : _thisHandle(thisHandle), _callbacks((JitInterfaceCallbacks *)callbacks) - { - } - - virtual unsigned int getMethodAttribs(void* ftn) - { - CorInfoException* pException = nullptr; - unsigned int _ret = _callbacks->getMethodAttribs(_thisHandle, &pException, ftn); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual void setMethodAttribs(void* ftn, int attribs) - { - CorInfoException* pException = nullptr; - _callbacks->setMethodAttribs(_thisHandle, &pException, ftn, attribs); - if (pException != nullptr) - throw pException; - } - - virtual void getMethodSig(void* ftn, void* sig, void* memberParent) - { - CorInfoException* pException = nullptr; - _callbacks->getMethodSig(_thisHandle, &pException, ftn, sig, memberParent); - if (pException != nullptr) - throw pException; - } - - virtual bool getMethodInfo(void* ftn, void* info) - { - CorInfoException* pException = nullptr; - bool _ret = _callbacks->getMethodInfo(_thisHandle, &pException, ftn, info); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual int canInline(void* callerHnd, void* calleeHnd, unsigned int* pRestrictions) - { - CorInfoException* pException = nullptr; - int _ret = _callbacks->canInline(_thisHandle, &pException, callerHnd, calleeHnd, pRestrictions); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual void reportInliningDecision(void* inlinerHnd, void* inlineeHnd, int inlineResult, const char* reason) - { - CorInfoException* pException = nullptr; - _callbacks->reportInliningDecision(_thisHandle, &pException, inlinerHnd, inlineeHnd, inlineResult, reason); - if (pException != nullptr) - throw pException; - } - - virtual bool canTailCall(void* callerHnd, void* declaredCalleeHnd, void* exactCalleeHnd, bool fIsTailPrefix) - { - CorInfoException* pException = nullptr; - bool _ret = _callbacks->canTailCall(_thisHandle, &pException, callerHnd, declaredCalleeHnd, exactCalleeHnd, fIsTailPrefix); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual void reportTailCallDecision(void* callerHnd, void* calleeHnd, bool fIsTailPrefix, int tailCallResult, const char* reason) - { - CorInfoException* pException = nullptr; - _callbacks->reportTailCallDecision(_thisHandle, &pException, callerHnd, calleeHnd, fIsTailPrefix, tailCallResult, reason); - if (pException != nullptr) - throw pException; - } - - virtual void getEHinfo(void* ftn, unsigned EHnumber, void* clause) - { - CorInfoException* pException = nullptr; - _callbacks->getEHinfo(_thisHandle, &pException, ftn, EHnumber, clause); - if (pException != nullptr) - throw pException; - } - - virtual void* getMethodClass(void* method) - { - CorInfoException* pException = nullptr; - void* _ret = _callbacks->getMethodClass(_thisHandle, &pException, method); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual void* getMethodModule(void* method) - { - CorInfoException* pException = nullptr; - void* _ret = _callbacks->getMethodModule(_thisHandle, &pException, method); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual void getMethodVTableOffset(void* method, unsigned* offsetOfIndirection, unsigned* offsetAfterIndirection, bool* isRelative) - { - CorInfoException* pException = nullptr; - _callbacks->getMethodVTableOffset(_thisHandle, &pException, method, offsetOfIndirection, offsetAfterIndirection, isRelative); - if (pException != nullptr) - throw pException; - } - - virtual bool tryResolveVirtualMethod(void* pResolvedMethod) - { - CorInfoException* pException = nullptr; - bool _ret = _callbacks->tryResolveVirtualMethod(_thisHandle, &pException, pResolvedMethod); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual void* getUnboxedEntry(void* ftn, bool* requiresInstMethodTableArg) - { - CorInfoException* pException = nullptr; - void* _ret = _callbacks->getUnboxedEntry(_thisHandle, &pException, ftn, requiresInstMethodTableArg); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual void* getDefaultEqualityComparerClass(void* elemType) - { - CorInfoException* pException = nullptr; - void* _ret = _callbacks->getDefaultEqualityComparerClass(_thisHandle, &pException, elemType); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual void expandRawHandleIntrinsic(void* pResolvedToken, void* pResult) - { - CorInfoException* pException = nullptr; - _callbacks->expandRawHandleIntrinsic(_thisHandle, &pException, pResolvedToken, pResult); - if (pException != nullptr) - throw pException; - } - - virtual int getIntrinsicID(void* method, bool* pMustExpand) - { - CorInfoException* pException = nullptr; - int _ret = _callbacks->getIntrinsicID(_thisHandle, &pException, method, pMustExpand); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual bool isIntrinsicType(void* classHnd) - { - CorInfoException* pException = nullptr; - bool _ret = _callbacks->isIntrinsicType(_thisHandle, &pException, classHnd); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual int getUnmanagedCallConv(void* method) - { - CorInfoException* pException = nullptr; - int _ret = _callbacks->getUnmanagedCallConv(_thisHandle, &pException, method); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual int pInvokeMarshalingRequired(void* method, void* callSiteSig) - { - CorInfoException* pException = nullptr; - int _ret = _callbacks->pInvokeMarshalingRequired(_thisHandle, &pException, method, callSiteSig); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual int satisfiesMethodConstraints(void* parent, void* method) - { - CorInfoException* pException = nullptr; - int _ret = _callbacks->satisfiesMethodConstraints(_thisHandle, &pException, parent, method); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual int isCompatibleDelegate(void* objCls, void* methodParentCls, void* method, void* delegateCls, int* pfIsOpenDelegate) - { - CorInfoException* pException = nullptr; - int _ret = _callbacks->isCompatibleDelegate(_thisHandle, &pException, objCls, methodParentCls, method, delegateCls, pfIsOpenDelegate); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual void methodMustBeLoadedBeforeCodeIsRun(void* method) - { - CorInfoException* pException = nullptr; - _callbacks->methodMustBeLoadedBeforeCodeIsRun(_thisHandle, &pException, method); - if (pException != nullptr) - throw pException; - } - - virtual void* mapMethodDeclToMethodImpl(void* method) - { - CorInfoException* pException = nullptr; - void* _ret = _callbacks->mapMethodDeclToMethodImpl(_thisHandle, &pException, method); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual void getGSCookie(void* pCookieVal, void** ppCookieVal) - { - CorInfoException* pException = nullptr; - _callbacks->getGSCookie(_thisHandle, &pException, pCookieVal, ppCookieVal); - if (pException != nullptr) - throw pException; - } - - virtual void setPatchpointInfo(void* patchpointInfo) - { - CorInfoException* pException = nullptr; - _callbacks->setPatchpointInfo(_thisHandle, &pException, patchpointInfo); - if (pException != nullptr) - throw pException; - } - - virtual void* getOSRInfo(unsigned* ilOffset) - { - CorInfoException* pException = nullptr; - void* _ret = _callbacks->getOSRInfo(_thisHandle, &pException, ilOffset); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual void resolveToken(void* pResolvedToken) - { - CorInfoException* pException = nullptr; - _callbacks->resolveToken(_thisHandle, &pException, pResolvedToken); - if (pException != nullptr) - throw pException; - } - - virtual bool tryResolveToken(void* pResolvedToken) - { - CorInfoException* pException = nullptr; - bool _ret = _callbacks->tryResolveToken(_thisHandle, &pException, pResolvedToken); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual void findSig(void* module, unsigned sigTOK, void* context, void* sig) - { - CorInfoException* pException = nullptr; - _callbacks->findSig(_thisHandle, &pException, module, sigTOK, context, sig); - if (pException != nullptr) - throw pException; - } - - virtual void findCallSiteSig(void* module, unsigned methTOK, void* context, void* sig) - { - CorInfoException* pException = nullptr; - _callbacks->findCallSiteSig(_thisHandle, &pException, module, methTOK, context, sig); - if (pException != nullptr) - throw pException; - } - - virtual void* getTokenTypeAsHandle(void* pResolvedToken) - { - CorInfoException* pException = nullptr; - void* _ret = _callbacks->getTokenTypeAsHandle(_thisHandle, &pException, pResolvedToken); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual int isValidToken(void* module, unsigned metaTOK) - { - CorInfoException* pException = nullptr; - int _ret = _callbacks->isValidToken(_thisHandle, &pException, module, metaTOK); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual int isValidStringRef(void* module, unsigned metaTOK) - { - CorInfoException* pException = nullptr; - int _ret = _callbacks->isValidStringRef(_thisHandle, &pException, module, metaTOK); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual const wchar_t* getStringLiteral(void* module, unsigned metaTOK, int* length) - { - CorInfoException* pException = nullptr; - const wchar_t* _ret = _callbacks->getStringLiteral(_thisHandle, &pException, module, metaTOK, length); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual int asCorInfoType(void* cls) - { - CorInfoException* pException = nullptr; - int _ret = _callbacks->asCorInfoType(_thisHandle, &pException, cls); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual const char* getClassName(void* cls) - { - CorInfoException* pException = nullptr; - const char* _ret = _callbacks->getClassName(_thisHandle, &pException, cls); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual const char* getClassNameFromMetadata(void* cls, const char** namespaceName) - { - CorInfoException* pException = nullptr; - const char* _ret = _callbacks->getClassNameFromMetadata(_thisHandle, &pException, cls, namespaceName); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual void* getTypeInstantiationArgument(void* cls, unsigned index) - { - CorInfoException* pException = nullptr; - void* _ret = _callbacks->getTypeInstantiationArgument(_thisHandle, &pException, cls, index); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual int appendClassName(wchar_t** ppBuf, int* pnBufLen, void* cls, int fNamespace, int fFullInst, int fAssembly) - { - CorInfoException* pException = nullptr; - int _ret = _callbacks->appendClassName(_thisHandle, &pException, ppBuf, pnBufLen, cls, fNamespace, fFullInst, fAssembly); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual int isValueClass(void* cls) - { - CorInfoException* pException = nullptr; - int _ret = _callbacks->isValueClass(_thisHandle, &pException, cls); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual int canInlineTypeCheck(void* cls, int source) - { - CorInfoException* pException = nullptr; - int _ret = _callbacks->canInlineTypeCheck(_thisHandle, &pException, cls, source); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual unsigned int getClassAttribs(void* cls) - { - CorInfoException* pException = nullptr; - unsigned int _ret = _callbacks->getClassAttribs(_thisHandle, &pException, cls); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual int isStructRequiringStackAllocRetBuf(void* cls) - { - CorInfoException* pException = nullptr; - int _ret = _callbacks->isStructRequiringStackAllocRetBuf(_thisHandle, &pException, cls); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual void* getClassModule(void* cls) - { - CorInfoException* pException = nullptr; - void* _ret = _callbacks->getClassModule(_thisHandle, &pException, cls); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual void* getModuleAssembly(void* mod) - { - CorInfoException* pException = nullptr; - void* _ret = _callbacks->getModuleAssembly(_thisHandle, &pException, mod); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual const char* getAssemblyName(void* assem) - { - CorInfoException* pException = nullptr; - const char* _ret = _callbacks->getAssemblyName(_thisHandle, &pException, assem); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual void* LongLifetimeMalloc(size_t sz) - { - CorInfoException* pException = nullptr; - void* _ret = _callbacks->LongLifetimeMalloc(_thisHandle, &pException, sz); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual void LongLifetimeFree(void* obj) - { - CorInfoException* pException = nullptr; - _callbacks->LongLifetimeFree(_thisHandle, &pException, obj); - if (pException != nullptr) - throw pException; - } - - virtual size_t getClassModuleIdForStatics(void* cls, void* pModule, void** ppIndirection) - { - CorInfoException* pException = nullptr; - size_t _ret = _callbacks->getClassModuleIdForStatics(_thisHandle, &pException, cls, pModule, ppIndirection); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual unsigned getClassSize(void* cls) - { - CorInfoException* pException = nullptr; - unsigned _ret = _callbacks->getClassSize(_thisHandle, &pException, cls); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual unsigned getHeapClassSize(void* cls) - { - CorInfoException* pException = nullptr; - unsigned _ret = _callbacks->getHeapClassSize(_thisHandle, &pException, cls); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual int canAllocateOnStack(void* cls) - { - CorInfoException* pException = nullptr; - int _ret = _callbacks->canAllocateOnStack(_thisHandle, &pException, cls); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual unsigned getClassAlignmentRequirement(void* cls, int fDoubleAlignHint) - { - CorInfoException* pException = nullptr; - unsigned _ret = _callbacks->getClassAlignmentRequirement(_thisHandle, &pException, cls, fDoubleAlignHint); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual unsigned getClassGClayout(void* cls, unsigned char* gcPtrs) - { - CorInfoException* pException = nullptr; - unsigned _ret = _callbacks->getClassGClayout(_thisHandle, &pException, cls, gcPtrs); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual unsigned getClassNumInstanceFields(void* cls) - { - CorInfoException* pException = nullptr; - unsigned _ret = _callbacks->getClassNumInstanceFields(_thisHandle, &pException, cls); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual void* getFieldInClass(void* clsHnd, int num) - { - CorInfoException* pException = nullptr; - void* _ret = _callbacks->getFieldInClass(_thisHandle, &pException, clsHnd, num); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual int checkMethodModifier(void* hMethod, const char* modifier, int fOptional) - { - CorInfoException* pException = nullptr; - int _ret = _callbacks->checkMethodModifier(_thisHandle, &pException, hMethod, modifier, fOptional); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual int getNewHelper(void* pResolvedToken, void* callerHandle, bool* pHasSideEffects) - { - CorInfoException* pException = nullptr; - int _ret = _callbacks->getNewHelper(_thisHandle, &pException, pResolvedToken, callerHandle, pHasSideEffects); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual int getNewArrHelper(void* arrayCls) - { - CorInfoException* pException = nullptr; - int _ret = _callbacks->getNewArrHelper(_thisHandle, &pException, arrayCls); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual int getCastingHelper(void* pResolvedToken, bool fThrowing) - { - CorInfoException* pException = nullptr; - int _ret = _callbacks->getCastingHelper(_thisHandle, &pException, pResolvedToken, fThrowing); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual int getSharedCCtorHelper(void* clsHnd) - { - CorInfoException* pException = nullptr; - int _ret = _callbacks->getSharedCCtorHelper(_thisHandle, &pException, clsHnd); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual void* getTypeForBox(void* cls) - { - CorInfoException* pException = nullptr; - void* _ret = _callbacks->getTypeForBox(_thisHandle, &pException, cls); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual int getBoxHelper(void* cls) - { - CorInfoException* pException = nullptr; - int _ret = _callbacks->getBoxHelper(_thisHandle, &pException, cls); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual int getUnBoxHelper(void* cls) - { - CorInfoException* pException = nullptr; - int _ret = _callbacks->getUnBoxHelper(_thisHandle, &pException, cls); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual bool getReadyToRunHelper(void* pResolvedToken, void* pGenericLookupKind, int id, void* pLookup) - { - CorInfoException* pException = nullptr; - bool _ret = _callbacks->getReadyToRunHelper(_thisHandle, &pException, pResolvedToken, pGenericLookupKind, id, pLookup); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual void getReadyToRunDelegateCtorHelper(void* pTargetMethod, void* delegateType, void* pLookup) - { - CorInfoException* pException = nullptr; - _callbacks->getReadyToRunDelegateCtorHelper(_thisHandle, &pException, pTargetMethod, delegateType, pLookup); - if (pException != nullptr) - throw pException; - } - - virtual const char* getHelperName(int helpFunc) - { - CorInfoException* pException = nullptr; - const char* _ret = _callbacks->getHelperName(_thisHandle, &pException, helpFunc); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual int initClass(void* field, void* method, void* context) - { - CorInfoException* pException = nullptr; - int _ret = _callbacks->initClass(_thisHandle, &pException, field, method, context); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual void classMustBeLoadedBeforeCodeIsRun(void* cls) - { - CorInfoException* pException = nullptr; - _callbacks->classMustBeLoadedBeforeCodeIsRun(_thisHandle, &pException, cls); - if (pException != nullptr) - throw pException; - } - - virtual void* getBuiltinClass(int classId) - { - CorInfoException* pException = nullptr; - void* _ret = _callbacks->getBuiltinClass(_thisHandle, &pException, classId); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual int getTypeForPrimitiveValueClass(void* cls) - { - CorInfoException* pException = nullptr; - int _ret = _callbacks->getTypeForPrimitiveValueClass(_thisHandle, &pException, cls); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual int getTypeForPrimitiveNumericClass(void* cls) - { - CorInfoException* pException = nullptr; - int _ret = _callbacks->getTypeForPrimitiveNumericClass(_thisHandle, &pException, cls); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual int canCast(void* child, void* parent) - { - CorInfoException* pException = nullptr; - int _ret = _callbacks->canCast(_thisHandle, &pException, child, parent); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual int areTypesEquivalent(void* cls1, void* cls2) - { - CorInfoException* pException = nullptr; - int _ret = _callbacks->areTypesEquivalent(_thisHandle, &pException, cls1, cls2); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual int compareTypesForCast(void* fromClass, void* toClass) - { - CorInfoException* pException = nullptr; - int _ret = _callbacks->compareTypesForCast(_thisHandle, &pException, fromClass, toClass); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual int compareTypesForEquality(void* cls1, void* cls2) - { - CorInfoException* pException = nullptr; - int _ret = _callbacks->compareTypesForEquality(_thisHandle, &pException, cls1, cls2); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual void* mergeClasses(void* cls1, void* cls2) - { - CorInfoException* pException = nullptr; - void* _ret = _callbacks->mergeClasses(_thisHandle, &pException, cls1, cls2); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual int isMoreSpecificType(void* cls1, void* cls2) - { - CorInfoException* pException = nullptr; - int _ret = _callbacks->isMoreSpecificType(_thisHandle, &pException, cls1, cls2); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual void* getParentType(void* cls) - { - CorInfoException* pException = nullptr; - void* _ret = _callbacks->getParentType(_thisHandle, &pException, cls); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual int getChildType(void* clsHnd, void* clsRet) - { - CorInfoException* pException = nullptr; - int _ret = _callbacks->getChildType(_thisHandle, &pException, clsHnd, clsRet); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual int satisfiesClassConstraints(void* cls) - { - CorInfoException* pException = nullptr; - int _ret = _callbacks->satisfiesClassConstraints(_thisHandle, &pException, cls); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual int isSDArray(void* cls) - { - CorInfoException* pException = nullptr; - int _ret = _callbacks->isSDArray(_thisHandle, &pException, cls); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual unsigned getArrayRank(void* cls) - { - CorInfoException* pException = nullptr; - unsigned _ret = _callbacks->getArrayRank(_thisHandle, &pException, cls); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual void* getArrayInitializationData(void* field, unsigned int size) - { - CorInfoException* pException = nullptr; - void* _ret = _callbacks->getArrayInitializationData(_thisHandle, &pException, field, size); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual int canAccessClass(void* pResolvedToken, void* callerHandle, void* pAccessHelper) - { - CorInfoException* pException = nullptr; - int _ret = _callbacks->canAccessClass(_thisHandle, &pException, pResolvedToken, callerHandle, pAccessHelper); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual const char* getFieldName(void* ftn, const char** moduleName) - { - CorInfoException* pException = nullptr; - const char* _ret = _callbacks->getFieldName(_thisHandle, &pException, ftn, moduleName); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual void* getFieldClass(void* field) - { - CorInfoException* pException = nullptr; - void* _ret = _callbacks->getFieldClass(_thisHandle, &pException, field); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual int getFieldType(void* field, void* structType, void* memberParent) - { - CorInfoException* pException = nullptr; - int _ret = _callbacks->getFieldType(_thisHandle, &pException, field, structType, memberParent); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual unsigned getFieldOffset(void* field) - { - CorInfoException* pException = nullptr; - unsigned _ret = _callbacks->getFieldOffset(_thisHandle, &pException, field); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual void getFieldInfo(void* pResolvedToken, void* callerHandle, int flags, void* pResult) - { - CorInfoException* pException = nullptr; - _callbacks->getFieldInfo(_thisHandle, &pException, pResolvedToken, callerHandle, flags, pResult); - if (pException != nullptr) - throw pException; - } - - virtual bool isFieldStatic(void* fldHnd) - { - CorInfoException* pException = nullptr; - bool _ret = _callbacks->isFieldStatic(_thisHandle, &pException, fldHnd); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual void getBoundaries(void* ftn, unsigned int* cILOffsets, unsigned int** pILOffsets, void* implictBoundaries) - { - CorInfoException* pException = nullptr; - _callbacks->getBoundaries(_thisHandle, &pException, ftn, cILOffsets, pILOffsets, implictBoundaries); - if (pException != nullptr) - throw pException; - } - - virtual void setBoundaries(void* ftn, unsigned int cMap, void* pMap) - { - CorInfoException* pException = nullptr; - _callbacks->setBoundaries(_thisHandle, &pException, ftn, cMap, pMap); - if (pException != nullptr) - throw pException; - } - - virtual void getVars(void* ftn, unsigned int* cVars, void* vars, bool* extendOthers) - { - CorInfoException* pException = nullptr; - _callbacks->getVars(_thisHandle, &pException, ftn, cVars, vars, extendOthers); - if (pException != nullptr) - throw pException; - } - - virtual void setVars(void* ftn, unsigned int cVars, void* vars) - { - CorInfoException* pException = nullptr; - _callbacks->setVars(_thisHandle, &pException, ftn, cVars, vars); - if (pException != nullptr) - throw pException; - } - - virtual void* allocateArray(size_t cBytes) - { - CorInfoException* pException = nullptr; - void* _ret = _callbacks->allocateArray(_thisHandle, &pException, cBytes); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual void freeArray(void* array) - { - CorInfoException* pException = nullptr; - _callbacks->freeArray(_thisHandle, &pException, array); - if (pException != nullptr) - throw pException; - } - - virtual void* getArgNext(void* args) - { - CorInfoException* pException = nullptr; - void* _ret = _callbacks->getArgNext(_thisHandle, &pException, args); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual int getArgType(void* sig, void* args, void* vcTypeRet) - { - CorInfoException* pException = nullptr; - int _ret = _callbacks->getArgType(_thisHandle, &pException, sig, args, vcTypeRet); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual void* getArgClass(void* sig, void* args) - { - CorInfoException* pException = nullptr; - void* _ret = _callbacks->getArgClass(_thisHandle, &pException, sig, args); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual int getHFAType(void* hClass) - { - CorInfoException* pException = nullptr; - int _ret = _callbacks->getHFAType(_thisHandle, &pException, hClass); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual int GetErrorHRESULT(void* pExceptionPointers) - { - CorInfoException* pException = nullptr; - int _ret = _callbacks->GetErrorHRESULT(_thisHandle, &pException, pExceptionPointers); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual unsigned int GetErrorMessage(wchar_t* buffer, unsigned int bufferLength) - { - CorInfoException* pException = nullptr; - unsigned int _ret = _callbacks->GetErrorMessage(_thisHandle, &pException, buffer, bufferLength); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual int FilterException(void* pExceptionPointers); - virtual void HandleException(void* pExceptionPointers); - virtual void ThrowExceptionForJitResult(int result) - { - CorInfoException* pException = nullptr; - _callbacks->ThrowExceptionForJitResult(_thisHandle, &pException, result); - if (pException != nullptr) - throw pException; - } - - virtual void ThrowExceptionForHelper(const void* throwHelper) - { - CorInfoException* pException = nullptr; - _callbacks->ThrowExceptionForHelper(_thisHandle, &pException, throwHelper); - if (pException != nullptr) - throw pException; - } - - virtual bool runWithErrorTrap(void* function, void* parameter); - virtual void getEEInfo(void* pEEInfoOut) - { - CorInfoException* pException = nullptr; - _callbacks->getEEInfo(_thisHandle, &pException, pEEInfoOut); - if (pException != nullptr) - throw pException; - } - - virtual const wchar_t* getJitTimeLogFilename() - { - CorInfoException* pException = nullptr; - const wchar_t* _ret = _callbacks->getJitTimeLogFilename(_thisHandle, &pException); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual unsigned int getMethodDefFromMethod(void* hMethod) - { - CorInfoException* pException = nullptr; - unsigned int _ret = _callbacks->getMethodDefFromMethod(_thisHandle, &pException, hMethod); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual const char* getMethodName(void* ftn, const char** moduleName) - { - CorInfoException* pException = nullptr; - const char* _ret = _callbacks->getMethodName(_thisHandle, &pException, ftn, moduleName); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual const char* getMethodNameFromMetadata(void* ftn, const char** className, const char** namespaceName, const char** enclosingClassName) - { - CorInfoException* pException = nullptr; - const char* _ret = _callbacks->getMethodNameFromMetadata(_thisHandle, &pException, ftn, className, namespaceName, enclosingClassName); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual unsigned getMethodHash(void* ftn) - { - CorInfoException* pException = nullptr; - unsigned _ret = _callbacks->getMethodHash(_thisHandle, &pException, ftn); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual size_t findNameOfToken(void* moduleHandle, unsigned int token, char* szFQName, size_t FQNameCapacity) - { - CorInfoException* pException = nullptr; - size_t _ret = _callbacks->findNameOfToken(_thisHandle, &pException, moduleHandle, token, szFQName, FQNameCapacity); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual bool getSystemVAmd64PassStructInRegisterDescriptor(void* structHnd, void* structPassInRegDescPtr) - { - CorInfoException* pException = nullptr; - bool _ret = _callbacks->getSystemVAmd64PassStructInRegisterDescriptor(_thisHandle, &pException, structHnd, structPassInRegDescPtr); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual unsigned int getThreadTLSIndex(void** ppIndirection) - { - CorInfoException* pException = nullptr; - unsigned int _ret = _callbacks->getThreadTLSIndex(_thisHandle, &pException, ppIndirection); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual const void* getInlinedCallFrameVptr(void** ppIndirection) - { - CorInfoException* pException = nullptr; - const void* _ret = _callbacks->getInlinedCallFrameVptr(_thisHandle, &pException, ppIndirection); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual long* getAddrOfCaptureThreadGlobal(void** ppIndirection) - { - CorInfoException* pException = nullptr; - long* _ret = _callbacks->getAddrOfCaptureThreadGlobal(_thisHandle, &pException, ppIndirection); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual void* getHelperFtn(int ftnNum, void** ppIndirection) - { - CorInfoException* pException = nullptr; - void* _ret = _callbacks->getHelperFtn(_thisHandle, &pException, ftnNum, ppIndirection); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual void getFunctionEntryPoint(void* ftn, void* pResult, int accessFlags) - { - CorInfoException* pException = nullptr; - _callbacks->getFunctionEntryPoint(_thisHandle, &pException, ftn, pResult, accessFlags); - if (pException != nullptr) - throw pException; - } - - virtual void getFunctionFixedEntryPoint(void* ftn, void* pResult) - { - CorInfoException* pException = nullptr; - _callbacks->getFunctionFixedEntryPoint(_thisHandle, &pException, ftn, pResult); - if (pException != nullptr) - throw pException; - } - - virtual void* getMethodSync(void* ftn, void** ppIndirection) - { - CorInfoException* pException = nullptr; - void* _ret = _callbacks->getMethodSync(_thisHandle, &pException, ftn, ppIndirection); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual int getLazyStringLiteralHelper(void* handle) - { - CorInfoException* pException = nullptr; - int _ret = _callbacks->getLazyStringLiteralHelper(_thisHandle, &pException, handle); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual void* embedModuleHandle(void* handle, void** ppIndirection) - { - CorInfoException* pException = nullptr; - void* _ret = _callbacks->embedModuleHandle(_thisHandle, &pException, handle, ppIndirection); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual void* embedClassHandle(void* handle, void** ppIndirection) - { - CorInfoException* pException = nullptr; - void* _ret = _callbacks->embedClassHandle(_thisHandle, &pException, handle, ppIndirection); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual void* embedMethodHandle(void* handle, void** ppIndirection) - { - CorInfoException* pException = nullptr; - void* _ret = _callbacks->embedMethodHandle(_thisHandle, &pException, handle, ppIndirection); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual void* embedFieldHandle(void* handle, void** ppIndirection) - { - CorInfoException* pException = nullptr; - void* _ret = _callbacks->embedFieldHandle(_thisHandle, &pException, handle, ppIndirection); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual void embedGenericHandle(void* pResolvedToken, int fEmbedParent, void* pResult) - { - CorInfoException* pException = nullptr; - _callbacks->embedGenericHandle(_thisHandle, &pException, pResolvedToken, fEmbedParent, pResult); - if (pException != nullptr) - throw pException; - } - - virtual void getLocationOfThisType(void* context, void* pLookupKind) - { - CorInfoException* pException = nullptr; - _callbacks->getLocationOfThisType(_thisHandle, &pException, context, pLookupKind); - if (pException != nullptr) - throw pException; - } - - virtual void getAddressOfPInvokeTarget(void* method, void* pLookup) - { - CorInfoException* pException = nullptr; - _callbacks->getAddressOfPInvokeTarget(_thisHandle, &pException, method, pLookup); - if (pException != nullptr) - throw pException; - } - - virtual void* GetCookieForPInvokeCalliSig(void* szMetaSig, void** ppIndirection) - { - CorInfoException* pException = nullptr; - void* _ret = _callbacks->GetCookieForPInvokeCalliSig(_thisHandle, &pException, szMetaSig, ppIndirection); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual bool canGetCookieForPInvokeCalliSig(void* szMetaSig) - { - CorInfoException* pException = nullptr; - bool _ret = _callbacks->canGetCookieForPInvokeCalliSig(_thisHandle, &pException, szMetaSig); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual void* getJustMyCodeHandle(void* method, void** ppIndirection) - { - CorInfoException* pException = nullptr; - void* _ret = _callbacks->getJustMyCodeHandle(_thisHandle, &pException, method, ppIndirection); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual void GetProfilingHandle(int* pbHookFunction, void** pProfilerHandle, int* pbIndirectedHandles) - { - CorInfoException* pException = nullptr; - _callbacks->GetProfilingHandle(_thisHandle, &pException, pbHookFunction, pProfilerHandle, pbIndirectedHandles); - if (pException != nullptr) - throw pException; - } - - virtual void getCallInfo(void* pResolvedToken, void* pConstrainedResolvedToken, void* callerHandle, int flags, void* pResult) - { - CorInfoException* pException = nullptr; - _callbacks->getCallInfo(_thisHandle, &pException, pResolvedToken, pConstrainedResolvedToken, callerHandle, flags, pResult); - if (pException != nullptr) - throw pException; - } - - virtual int canAccessFamily(void* hCaller, void* hInstanceType) - { - CorInfoException* pException = nullptr; - int _ret = _callbacks->canAccessFamily(_thisHandle, &pException, hCaller, hInstanceType); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual int isRIDClassDomainID(void* cls) - { - CorInfoException* pException = nullptr; - int _ret = _callbacks->isRIDClassDomainID(_thisHandle, &pException, cls); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual unsigned getClassDomainID(void* cls, void** ppIndirection) - { - CorInfoException* pException = nullptr; - unsigned _ret = _callbacks->getClassDomainID(_thisHandle, &pException, cls, ppIndirection); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual void* getFieldAddress(void* field, void** ppIndirection) - { - CorInfoException* pException = nullptr; - void* _ret = _callbacks->getFieldAddress(_thisHandle, &pException, field, ppIndirection); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual void* getStaticFieldCurrentClass(void* field, bool* pIsSpeculative) - { - CorInfoException* pException = nullptr; - void* _ret = _callbacks->getStaticFieldCurrentClass(_thisHandle, &pException, field, pIsSpeculative); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual void* getVarArgsHandle(void* pSig, void** ppIndirection) - { - CorInfoException* pException = nullptr; - void* _ret = _callbacks->getVarArgsHandle(_thisHandle, &pException, pSig, ppIndirection); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual bool canGetVarArgsHandle(void* pSig) - { - CorInfoException* pException = nullptr; - bool _ret = _callbacks->canGetVarArgsHandle(_thisHandle, &pException, pSig); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual int constructStringLiteral(void* module, unsigned int metaTok, void** ppValue) - { - CorInfoException* pException = nullptr; - int _ret = _callbacks->constructStringLiteral(_thisHandle, &pException, module, metaTok, ppValue); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual int emptyStringLiteral(void** ppValue) - { - CorInfoException* pException = nullptr; - int _ret = _callbacks->emptyStringLiteral(_thisHandle, &pException, ppValue); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual unsigned int getFieldThreadLocalStoreID(void* field, void** ppIndirection) - { - CorInfoException* pException = nullptr; - unsigned int _ret = _callbacks->getFieldThreadLocalStoreID(_thisHandle, &pException, field, ppIndirection); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual void setOverride(void* pOverride, void* currentMethod) - { - CorInfoException* pException = nullptr; - _callbacks->setOverride(_thisHandle, &pException, pOverride, currentMethod); - if (pException != nullptr) - throw pException; - } - - virtual void addActiveDependency(void* moduleFrom, void* moduleTo) - { - CorInfoException* pException = nullptr; - _callbacks->addActiveDependency(_thisHandle, &pException, moduleFrom, moduleTo); - if (pException != nullptr) - throw pException; - } - - virtual void* GetDelegateCtor(void* methHnd, void* clsHnd, void* targetMethodHnd, void* pCtorData) - { - CorInfoException* pException = nullptr; - void* _ret = _callbacks->GetDelegateCtor(_thisHandle, &pException, methHnd, clsHnd, targetMethodHnd, pCtorData); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual void MethodCompileComplete(void* methHnd) - { - CorInfoException* pException = nullptr; - _callbacks->MethodCompileComplete(_thisHandle, &pException, methHnd); - if (pException != nullptr) - throw pException; - } - - virtual bool getTailCallHelpers(void* callToken, void* sig, int flags, void* pResult) - { - CorInfoException* pException = nullptr; - bool _ret = _callbacks->getTailCallHelpers(_thisHandle, &pException, callToken, sig, flags, pResult); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual bool convertPInvokeCalliToCall(void* pResolvedToken, bool mustConvert) - { - CorInfoException* pException = nullptr; - bool _ret = _callbacks->convertPInvokeCalliToCall(_thisHandle, &pException, pResolvedToken, mustConvert); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual void notifyInstructionSetUsage(int instructionSet, bool supportEnabled) - { - CorInfoException* pException = nullptr; - _callbacks->notifyInstructionSetUsage(_thisHandle, &pException, instructionSet, supportEnabled); - if (pException != nullptr) - throw pException; - } - - virtual void allocMem(unsigned int hotCodeSize, unsigned int coldCodeSize, unsigned int roDataSize, unsigned int xcptnsCount, int flag, void** hotCodeBlock, void** coldCodeBlock, void** roDataBlock) - { - CorInfoException* pException = nullptr; - _callbacks->allocMem(_thisHandle, &pException, hotCodeSize, coldCodeSize, roDataSize, xcptnsCount, flag, hotCodeBlock, coldCodeBlock, roDataBlock); - if (pException != nullptr) - throw pException; - } - - virtual void reserveUnwindInfo(int isFunclet, int isColdCode, unsigned int unwindSize) - { - CorInfoException* pException = nullptr; - _callbacks->reserveUnwindInfo(_thisHandle, &pException, isFunclet, isColdCode, unwindSize); - if (pException != nullptr) - throw pException; - } - - virtual void allocUnwindInfo(unsigned char* pHotCode, unsigned char* pColdCode, unsigned int startOffset, unsigned int endOffset, unsigned int unwindSize, unsigned char* pUnwindBlock, int funcKind) - { - CorInfoException* pException = nullptr; - _callbacks->allocUnwindInfo(_thisHandle, &pException, pHotCode, pColdCode, startOffset, endOffset, unwindSize, pUnwindBlock, funcKind); - if (pException != nullptr) - throw pException; - } - - virtual void* allocGCInfo(size_t size) - { - CorInfoException* pException = nullptr; - void* _ret = _callbacks->allocGCInfo(_thisHandle, &pException, size); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual void setEHcount(unsigned cEH) - { - CorInfoException* pException = nullptr; - _callbacks->setEHcount(_thisHandle, &pException, cEH); - if (pException != nullptr) - throw pException; - } - - virtual void setEHinfo(unsigned EHnumber, void* clause) - { - CorInfoException* pException = nullptr; - _callbacks->setEHinfo(_thisHandle, &pException, EHnumber, clause); - if (pException != nullptr) - throw pException; - } - - virtual int logMsg(unsigned level, const char* fmt, va_list args) - { - CorInfoException* pException = nullptr; - int _ret = _callbacks->logMsg(_thisHandle, &pException, level, fmt, args); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual int doAssert(const char* szFile, int iLine, const char* szExpr) - { - CorInfoException* pException = nullptr; - int _ret = _callbacks->doAssert(_thisHandle, &pException, szFile, iLine, szExpr); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual void reportFatalError(int result) - { - CorInfoException* pException = nullptr; - _callbacks->reportFatalError(_thisHandle, &pException, result); - if (pException != nullptr) - throw pException; - } - - virtual int allocMethodBlockCounts(unsigned int count, void** pBlockCounts) - { - CorInfoException* pException = nullptr; - int _ret = _callbacks->allocMethodBlockCounts(_thisHandle, &pException, count, pBlockCounts); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual int getMethodBlockCounts(void* ftnHnd, unsigned int* pCount, void** pBlockCounts, unsigned int* pNumRuns) - { - CorInfoException* pException = nullptr; - int _ret = _callbacks->getMethodBlockCounts(_thisHandle, &pException, ftnHnd, pCount, pBlockCounts, pNumRuns); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual void recordCallSite(unsigned int instrOffset, void* callSig, void* methodHandle) - { - CorInfoException* pException = nullptr; - _callbacks->recordCallSite(_thisHandle, &pException, instrOffset, callSig, methodHandle); - if (pException != nullptr) - throw pException; - } - - virtual void recordRelocation(void* location, void* target, unsigned short fRelocType, unsigned short slotNum, int addlDelta) - { - CorInfoException* pException = nullptr; - _callbacks->recordRelocation(_thisHandle, &pException, location, target, fRelocType, slotNum, addlDelta); - if (pException != nullptr) - throw pException; - } - - virtual unsigned short getRelocTypeHint(void* target) - { - CorInfoException* pException = nullptr; - unsigned short _ret = _callbacks->getRelocTypeHint(_thisHandle, &pException, target); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual unsigned int getExpectedTargetArchitecture() - { - CorInfoException* pException = nullptr; - unsigned int _ret = _callbacks->getExpectedTargetArchitecture(_thisHandle, &pException); - if (pException != nullptr) - throw pException; - return _ret; - } - - virtual unsigned int getJitFlags(void* flags, unsigned int sizeInBytes) - { - CorInfoException* pException = nullptr; - unsigned int _ret = _callbacks->getJitFlags(_thisHandle, &pException, flags, sizeInBytes); - if (pException != nullptr) - throw pException; - return _ret; - } - -}; diff --git a/src/coreclr/tools/Common/JitInterface/CorInfoBase.cs b/src/coreclr/tools/Common/JitInterface/CorInfoBase.cs index 262759b9fd9f6..f163f6a59eac4 100644 --- a/src/coreclr/tools/Common/JitInterface/CorInfoBase.cs +++ b/src/coreclr/tools/Common/JitInterface/CorInfoBase.cs @@ -187,12 +187,12 @@ static void _getMethodVTableOffset(IntPtr thisHandle, IntPtr* ppException, CORIN } [UnmanagedCallersOnly] - static byte _tryResolveVirtualMethod(IntPtr thisHandle, IntPtr* ppException, CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT* virtualMethodContext) + static byte _resolveVirtualMethod(IntPtr thisHandle, IntPtr* ppException, CORINFO_DEVIRTUALIZATION_INFO* info) { var _this = GetThis(thisHandle); try { - return _this.tryResolveVirtualMethod(ref *virtualMethodContext) ? 1 : 0; + return _this.resolveVirtualMethod(info) ? 1 : 0; } catch (Exception ex) { @@ -2550,7 +2550,7 @@ static IntPtr GetUnmanagedCallbacks() callbacks[9] = (delegate* unmanaged)&_getMethodClass; callbacks[10] = (delegate* unmanaged)&_getMethodModule; callbacks[11] = (delegate* unmanaged)&_getMethodVTableOffset; - callbacks[12] = (delegate* unmanaged)&_tryResolveVirtualMethod; + callbacks[12] = (delegate* unmanaged)&_resolveVirtualMethod; callbacks[13] = (delegate* unmanaged)&_getUnboxedEntry; callbacks[14] = (delegate* unmanaged)&_getDefaultEqualityComparerClass; callbacks[15] = (delegate* unmanaged)&_expandRawHandleIntrinsic; diff --git a/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs b/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs index cddaf20f013e9..faa066eee2110 100644 --- a/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs +++ b/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs @@ -394,9 +394,9 @@ private void CompileMethodCleanup() #if READYTORUN _profileDataNode = null; _inlinedMethods = new ArrayBuilder(); +#endif _actualInstructionSetSupported = default(InstructionSetFlags); _actualInstructionSetUnsupported = default(InstructionSetFlags); -#endif } private Dictionary _objectToHandle = new Dictionary(); @@ -683,6 +683,21 @@ private CorInfoType asCorInfoType(TypeDesc type, out TypeDesc typeIfNotPrimitive { throw new RequiresRuntimeJitException(type); } +#endif +#if READYTORUN + if (elementSize.AsInt == 4) + { + var normalizedCategory = _compilation.TypeSystemContext.NormalizedCategoryFor4ByteStructOnX86(type); + if (normalizedCategory != type.Category) + { + if (NeedsTypeLayoutCheck(type)) + { + ISymbolNode node = _compilation.SymbolNodeFactory.CheckTypeLayout(type); + _methodCodeNode.Fixups.Add(node); + } + return (CorInfoType)normalizedCategory; + } + } #endif } return CorInfoType.CORINFO_TYPE_VALUECLASS; @@ -843,7 +858,17 @@ private uint getMethodAttribsInternal(MethodDesc method) // Check for hardware intrinsics if (HardwareIntrinsicHelpers.IsHardwareIntrinsic(method)) { - result |= CorInfoFlag.CORINFO_FLG_JIT_INTRINSIC; +#if !READYTORUN + // Do not report the get_IsSupported method as an intrinsic - RyuJIT would expand it to + // a constant depending on the code generation flags passed to it, but we would like to + // do a dynamic check instead. + if ( + !HardwareIntrinsicHelpers.IsIsSupportedMethod(method) + || !_compilation.IsHardwareIntrinsicWithRuntimeDeterminedSupport(method)) +#endif + { + result |= CorInfoFlag.CORINFO_FLG_JIT_INTRINSIC; + } } return (uint)result; @@ -944,12 +969,14 @@ private void getEHinfo(CORINFO_METHOD_STRUCT_* ftn, uint EHnumber, ref CORINFO_E return (CORINFO_MODULE_STRUCT_*)ObjectToHandle(methodIL); } - // crossgen2smoke is passing now but I'm still not sure in this code - private bool tryResolveVirtualMethod(ref CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT virtualMethodContext) + private bool resolveVirtualMethod(CORINFO_DEVIRTUALIZATION_INFO* info) { - TypeDesc implType = (TypeDesc)HandleToObject((IntPtr)virtualMethodContext.implementingClass); - virtualMethodContext.requiresInstMethodTableArg = false; - virtualMethodContext.patchedOwnerType = null; + // Initialize OUT fields + info->devirtualizedMethod = null; + info->requiresInstMethodTableArg = false; + info->exactContext = null; + + TypeDesc objType = HandleToObject(info->objClass); // __Canon cannot be devirtualized if (objType.IsCanonicalDefinitionType(CanonicalFormKind.Any)) @@ -957,18 +984,18 @@ private bool tryResolveVirtualMethod(ref CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT v return false; } - MethodDesc decl = HandleToObject(virtualMethodContext.virtualMethod); + MethodDesc decl = HandleToObject(info->virtualMethod); Debug.Assert(!decl.HasInstantiation); - if (virtualMethodContext.ownerType != null) + if (info->context != null) { - TypeDesc ownerTypeDesc = typeFromContext(virtualMethodContext.ownerType); + TypeDesc ownerTypeDesc = typeFromContext(info->context); if (decl.OwningType != ownerTypeDesc) { Debug.Assert(ownerTypeDesc is InstantiatedType); decl = _compilation.TypeSystemContext.GetMethodForInstantiatedType(decl.GetTypicalMethodDefinition(), (InstantiatedType)ownerTypeDesc); - virtualMethodContext.patchedOwnerType = contextFromType(decl.OwningType); - virtualMethodContext.requiresInstMethodTableArg = true; + info->exactContext = contextFromType(decl.OwningType); + info->requiresInstMethodTableArg = true; } } @@ -979,23 +1006,35 @@ private bool tryResolveVirtualMethod(ref CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT v return false; } - virtualMethodContext.devirtualizedMethod = ObjectToHandle(impl); - return true; + if (impl.OwningType.IsValueType) + { + impl = getUnboxingThunk(impl); } - return false; + MethodDesc exactImpl = TypeSystemHelpers.FindMethodOnTypeWithMatchingTypicalMethod(objType, impl); + + info->devirtualizedMethod = ObjectToHandle(impl); + info->requiresInstMethodTableArg = false; + info->exactContext = contextFromType(exactImpl.OwningType); + + return true; } - private CORINFO_METHOD_STRUCT_* getUnboxedEntry(CORINFO_METHOD_STRUCT_* ftn, ref bool requiresInstMethodTableArg) + private CORINFO_METHOD_STRUCT_* getUnboxedEntry(CORINFO_METHOD_STRUCT_* ftn, byte* requiresInstMethodTableArg) { MethodDesc result = null; - requiresInstMethodTableArg = false; + bool requiresInstMTArg = false; MethodDesc method = HandleToObject(ftn); if (method.IsUnboxingThunk()) { result = method.GetUnboxedMethod(); - requiresInstMethodTableArg = method.RequiresInstMethodTableArg(); + requiresInstMTArg = method.RequiresInstMethodTableArg(); + } + + if (requiresInstMethodTableArg != null) + { + *requiresInstMethodTableArg = requiresInstMTArg ? (byte)1 : (byte)0; } return result != null ? ObjectToHandle(result) : null; @@ -1037,7 +1076,7 @@ private CorInfoUnmanagedCallConv getUnmanagedCallConv(CORINFO_METHOD_STRUCT_* me private bool satisfiesMethodConstraints(CORINFO_CLASS_STRUCT_* parent, CORINFO_METHOD_STRUCT_* method) { throw new NotImplementedException("satisfiesMethodConstraints"); } - private bool isCompatibleDelegate(CORINFO_CLASS_STRUCT_* objCls, CORINFO_CLASS_STRUCT_* methodParentCls, CORINFO_METHOD_STRUCT_* method, CORINFO_CLASS_STRUCT_* delegateCls, ref bool pfIsOpenDelegate) + private bool isCompatibleDelegate(CORINFO_CLASS_STRUCT_* objCls, CORINFO_CLASS_STRUCT_* methodParentCls, CORINFO_METHOD_STRUCT_* method, CORINFO_CLASS_STRUCT_* delegateCls, BOOL* pfIsOpenDelegate) { throw new NotImplementedException("isCompatibleDelegate"); } private void setPatchpointInfo(PatchpointInfo* patchpointInfo) { throw new NotImplementedException("setPatchpointInfo"); } @@ -2711,7 +2750,7 @@ private void getLocationOfThisType(CORINFO_METHOD_STRUCT_* context, ref CORINFO_ ppIndirection = null; return null; } - private void GetProfilingHandle(ref bool pbHookFunction, ref void* pProfilerHandle, ref bool pbIndirectedHandles) + private void GetProfilingHandle(BOOL* pbHookFunction, ref void* pProfilerHandle, BOOL* pbIndirectedHandles) { throw new NotImplementedException("GetProfilingHandle"); } /// @@ -3211,11 +3250,10 @@ private uint getJitFlags(ref CORJIT_FLAGS flags, uint sizeInBytes) } -#if READYTORUN InstructionSetFlags _actualInstructionSetSupported; InstructionSetFlags _actualInstructionSetUnsupported; - private bool notifyInstructionSetUsage(InstructionSet instructionSet, bool supportEnabled) + private void notifyInstructionSetUsage(InstructionSet instructionSet, bool supportEnabled) { if (supportEnabled) { @@ -3223,20 +3261,15 @@ private bool notifyInstructionSetUsage(InstructionSet instructionSet, bool suppo } else { +#if READYTORUN // By policy we code review all changes into corelib, such that failing to use an instruction // set is not a reason to not support usage of it. if (!isMethodDefinedInCoreLib()) +#endif { _actualInstructionSetUnsupported.AddInstructionSet(instructionSet); } } - return supportEnabled; } -#else - private bool notifyInstructionSetUsage(InstructionSet instructionSet, bool supportEnabled) - { - return supportEnabled ? _compilation.InstructionSetSupport.IsInstructionSetSupported(instructionSet) : false; - } -#endif } } diff --git a/src/coreclr/tools/Common/JitInterface/CorInfoTypes.cs b/src/coreclr/tools/Common/JitInterface/CorInfoTypes.cs index cd1a716a45421..bb894cf5a0e04 100644 --- a/src/coreclr/tools/Common/JitInterface/CorInfoTypes.cs +++ b/src/coreclr/tools/Common/JitInterface/CorInfoTypes.cs @@ -295,29 +295,7 @@ public unsafe struct CORINFO_RESOLVED_TOKEN public byte* pMethodSpec; public uint cbMethodSpec; } - - public unsafe struct CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT - { - // - // [In] arguments of tryResolveVirtualMethod - // - public CORINFO_METHOD_STRUCT_* virtualMethod; - public CORINFO_CLASS_STRUCT_* implementingClass; - public CORINFO_CONTEXT_STRUCT* ownerType; - // - // [Out] arguments of tryResolveVirtualMethod. - // - devirtualizedMethod is set to MethodDesc of devirt'ed method iff we were able to devirtualize. - // invariant is `tryResolveVirtualMethod(...) == (devirtualizedMethod != nullptr)`. - // - requiresInstMethodTableArg is set to TRUE iff jit has to pass "secret" type handle arg. - // - patchedOwnerType is set to wrapped CORINFO_CLASS_HANDLE of devirt'ed method table. - // - (!) two last out params have their meaning only when we devirt'ed into DIM. - // - public CORINFO_METHOD_STRUCT_* devirtualizedMethod; - public byte _requiresInstMethodTableArg; - public bool requiresInstMethodTableArg { get { return _requiresInstMethodTableArg != 0; } set { _requiresInstMethodTableArg = value ? (byte)1 : (byte)0; } } - public CORINFO_CONTEXT_STRUCT* patchedOwnerType; - } // Flags computed by a runtime compiler public enum CorInfoMethodRuntimeFlags @@ -374,7 +352,7 @@ public enum CORINFO_CALLINFO_FLAGS CORINFO_CALLINFO_VERIFICATION = 0x0008, // Gets extra verification information. CORINFO_CALLINFO_SECURITYCHECKS = 0x0010, // Perform security checks. CORINFO_CALLINFO_LDFTN = 0x0020, // Resolving target of LDFTN - // UNUSED = 0x0040, + CORINFO_CALLINFO_ATYPICAL_CALLSITE = 0x0040, // Atypical callsite that cannot be disassembled by delay loading helper } // Bit-twiddling of contexts assumes word-alignment of method handles and type handles @@ -557,7 +535,7 @@ public enum CORINFO_ACCESS_FLAGS CORINFO_ACCESS_SET = 0x0200, // Field set (stfld) CORINFO_ACCESS_ADDRESS = 0x0400, // Field address (ldflda) CORINFO_ACCESS_INIT_ARRAY = 0x0800, // Field use for InitializeArray - // UNUSED = 0x4000, + CORINFO_ACCESS_ATYPICAL_CALLSITE = 0x4000, // Atypical callsite that cannot be disassembled by delay loading helper CORINFO_ACCESS_INLINECHECK = 0x8000, // Return fieldFlags and fieldAccessor only. Used by JIT64 during inlining. } @@ -1031,13 +1009,13 @@ public unsafe struct CORINFO_CALL_INFO public CORINFO_CALL_KIND kind; - public byte _nullInstanceCheck; + public uint _nullInstanceCheck; public bool nullInstanceCheck { get { return _nullInstanceCheck != 0; } set { _nullInstanceCheck = value ? (byte)1 : (byte)0; } } // Context for inlining and hidden arg public CORINFO_CONTEXT_STRUCT* contextHandle; - public byte _exactContextNeedsRuntimeLookup; // Set if contextHandle is approx handle. Runtime lookup is required to get the exact handle. + public uint _exactContextNeedsRuntimeLookup; // Set if contextHandle is approx handle. Runtime lookup is required to get the exact handle. public bool exactContextNeedsRuntimeLookup { get { return _exactContextNeedsRuntimeLookup != 0; } set { _exactContextNeedsRuntimeLookup = value ? (byte)1 : (byte)0; } } // If kind.CORINFO_VIRTUALCALL_STUB then stubLookup will be set. @@ -1047,7 +1025,7 @@ public unsafe struct CORINFO_CALL_INFO // Used by Ready-to-Run public CORINFO_CONST_LOOKUP instParamLookup; - public byte _wrapperDelegateInvoke; + public uint _wrapperDelegateInvoke; public bool wrapperDelegateInvoke { get { return _wrapperDelegateInvoke != 0; } set { _wrapperDelegateInvoke = value ? (byte)1 : (byte)0; } } } diff --git a/src/coreclr/tools/Common/JitInterface/ThunkGenerator/ThunkInput.txt b/src/coreclr/tools/Common/JitInterface/ThunkGenerator/ThunkInput.txt index 49073e16f52b2..68f772bc74f78 100644 --- a/src/coreclr/tools/Common/JitInterface/ThunkGenerator/ThunkInput.txt +++ b/src/coreclr/tools/Common/JitInterface/ThunkGenerator/ThunkInput.txt @@ -52,6 +52,7 @@ unsigned int, uint size_t,UIntPtr SIZE_T,UIntPtr,size_t WORD,ushort,unsigned short +bool,[MarshalAs(UnmanagedType.Bool)]bool,int bool,[MarshalAs(UnmanagedType.I1)]bool const char *,byte* mdMethodDef,mdToken,unsigned int @@ -60,6 +61,7 @@ BYTE*,byte*,unsigned char* GSCookie*,IntPtr*,void* GSCookie**,IntPtr**,void** +bool*,bool*,int* bool*,ref bool BoolStar,byte*,bool*,bool* UINT32*,ref uint,unsigned int* @@ -170,7 +172,7 @@ FUNCTIONS CORINFO_CLASS_HANDLE getMethodClass( CORINFO_METHOD_HANDLE method ); CORINFO_MODULE_HANDLE getMethodModule( CORINFO_METHOD_HANDLE method ); void getMethodVTableOffset( CORINFO_METHOD_HANDLE method, unsigned* offsetOfIndirection, unsigned* offsetAfterIndirection, bool* isRelative); - bool tryResolveVirtualMethod(CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT * virtualMethodContext); + bool resolveVirtualMethod(CORINFO_DEVIRTUALIZATION_INFO* info); CORINFO_METHOD_HANDLE getUnboxedEntry(CORINFO_METHOD_HANDLE ftn, BoolStar requiresInstMethodTableArg); CORINFO_CLASS_HANDLE getDefaultEqualityComparerClass(CORINFO_CLASS_HANDLE elemType); void expandRawHandleIntrinsic(CORINFO_RESOLVED_TOKEN * pResolvedToken, CORINFO_GENERICHANDLE_RESULT * pResult); @@ -216,7 +218,7 @@ FUNCTIONS unsigned getClassNumInstanceFields(CORINFO_CLASS_HANDLE cls) CORINFO_FIELD_HANDLE getFieldInClass(CORINFO_CLASS_HANDLE clsHnd, INT num) bool checkMethodModifier(CORINFO_METHOD_HANDLE hMethod, LPCSTR modifier, bool fOptional) - CorInfoHelpFunc getNewHelper(CORINFO_RESOLVED_TOKEN* pResolvedToken, CORINFO_METHOD_HANDLE callerHandle, bool* pHasSideEffects) + CorInfoHelpFunc getNewHelper(CORINFO_RESOLVED_TOKEN* pResolvedToken, CORINFO_METHOD_HANDLE callerHandle, BoolStar pHasSideEffects) CorInfoHelpFunc getNewArrHelper(CORINFO_CLASS_HANDLE arrayCls) CorInfoHelpFunc getCastingHelper(CORINFO_RESOLVED_TOKEN* pResolvedToken, bool fThrowing) CorInfoHelpFunc getSharedCCtorHelper(CORINFO_CLASS_HANDLE clsHnd) @@ -293,7 +295,7 @@ FUNCTIONS LPVOID GetCookieForPInvokeCalliSig(CORINFO_SIG_INFO* szMetaSig, void ** ppIndirection); bool canGetCookieForPInvokeCalliSig(CORINFO_SIG_INFO* szMetaSig); CORINFO_JUST_MY_CODE_HANDLE getJustMyCodeHandle(CORINFO_METHOD_HANDLE method, CORINFO_JUST_MY_CODE_HANDLE**ppIndirection); - void GetProfilingHandle(bool* pbHookFunction, void **pProfilerHandle, bool* pbIndirectedHandles); + void GetProfilingHandle(bool *pbHookFunction, void **pProfilerHandle, bool *pbIndirectedHandles); void getCallInfo(CORINFO_RESOLVED_TOKEN * pResolvedToken, CORINFO_RESOLVED_TOKEN_PTR pConstrainedResolvedToken, CORINFO_METHOD_HANDLE callerHandle, CORINFO_CALLINFO_FLAGS flags, CORINFO_CALL_INFO *pResult); bool canAccessFamily(CORINFO_METHOD_HANDLE hCaller, CORINFO_CLASS_HANDLE hInstanceType); bool isRIDClassDomainID(CORINFO_CLASS_HANDLE cls); @@ -311,7 +313,7 @@ FUNCTIONS void MethodCompileComplete(CORINFO_METHOD_HANDLE methHnd); bool getTailCallHelpers(CORINFO_RESOLVED_TOKEN* callToken, CORINFO_SIG_INFO* sig, CORINFO_GET_TAILCALL_HELPERS_FLAGS flags, CORINFO_TAILCALL_HELPERS* pResult); bool convertPInvokeCalliToCall(CORINFO_RESOLVED_TOKEN * pResolvedToken, bool mustConvert); - bool notifyInstructionSetUsage(CORINFO_InstructionSet instructionSet,bool supportEnabled); + void notifyInstructionSetUsage(CORINFO_InstructionSet instructionSet,bool supportEnabled); void allocMem( ULONG hotCodeSize, ULONG coldCodeSize, ULONG roDataSize, ULONG xcptnsCount, CorJitAllocMemFlag flag, void** hotCodeBlock, void** coldCodeBlock, void** roDataBlock ); void reserveUnwindInfo(bool isFunclet, bool isColdCode, ULONG unwindSize) void allocUnwindInfo(BYTE* pHotCode, BYTE* pColdCode, ULONG startOffset, ULONG endOffset, ULONG unwindSize, BYTE* pUnwindBlock, CorJitFuncKind funcKind) diff --git a/src/coreclr/tools/aot/jitinterface/jitinterface.h b/src/coreclr/tools/aot/jitinterface/jitinterface.h index e7a9609b6e456..cbd3fd37044f0 100644 --- a/src/coreclr/tools/aot/jitinterface/jitinterface.h +++ b/src/coreclr/tools/aot/jitinterface/jitinterface.h @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // DO NOT EDIT THIS FILE! IT IS AUTOGENERATED -// To regenerate run the gen script in src/coreclr/tools/Common/JitInterface/ThunkGenerator +// To regenerate run the gen script in src/coreclr/src/tools/Common/JitInterface/ThunkGenerator // and follow the instructions in docs/project/updating-jitinterface.md @@ -29,9 +29,9 @@ struct JitInterfaceCallbacks int (* getIntrinsicID)(void * thisHandle, CorInfoExceptionClass** ppException, void* method, bool* pMustExpand); bool (* isIntrinsicType)(void * thisHandle, CorInfoExceptionClass** ppException, void* classHnd); int (* getUnmanagedCallConv)(void * thisHandle, CorInfoExceptionClass** ppException, void* method); - bool (* pInvokeMarshalingRequired)(void * thisHandle, CorInfoExceptionClass** ppException, void* method, void* callSiteSig); - bool (* satisfiesMethodConstraints)(void * thisHandle, CorInfoExceptionClass** ppException, void* parent, void* method); - bool (* isCompatibleDelegate)(void * thisHandle, CorInfoExceptionClass** ppException, void* objCls, void* methodParentCls, void* method, void* delegateCls, bool* pfIsOpenDelegate); + int (* pInvokeMarshalingRequired)(void * thisHandle, CorInfoExceptionClass** ppException, void* method, void* callSiteSig); + int (* satisfiesMethodConstraints)(void * thisHandle, CorInfoExceptionClass** ppException, void* parent, void* method); + int (* isCompatibleDelegate)(void * thisHandle, CorInfoExceptionClass** ppException, void* objCls, void* methodParentCls, void* method, void* delegateCls, int* pfIsOpenDelegate); void (* methodMustBeLoadedBeforeCodeIsRun)(void * thisHandle, CorInfoExceptionClass** ppException, void* method); void* (* mapMethodDeclToMethodImpl)(void * thisHandle, CorInfoExceptionClass** ppException, void* method); void (* getGSCookie)(void * thisHandle, CorInfoExceptionClass** ppException, void* pCookieVal, void** ppCookieVal); @@ -42,18 +42,18 @@ struct JitInterfaceCallbacks void (* findSig)(void * thisHandle, CorInfoExceptionClass** ppException, void* module, unsigned sigTOK, void* context, void* sig); void (* findCallSiteSig)(void * thisHandle, CorInfoExceptionClass** ppException, void* module, unsigned methTOK, void* context, void* sig); void* (* getTokenTypeAsHandle)(void * thisHandle, CorInfoExceptionClass** ppException, void* pResolvedToken); - bool (* isValidToken)(void * thisHandle, CorInfoExceptionClass** ppException, void* module, unsigned metaTOK); - bool (* isValidStringRef)(void * thisHandle, CorInfoExceptionClass** ppException, void* module, unsigned metaTOK); + int (* isValidToken)(void * thisHandle, CorInfoExceptionClass** ppException, void* module, unsigned metaTOK); + int (* isValidStringRef)(void * thisHandle, CorInfoExceptionClass** ppException, void* module, unsigned metaTOK); const wchar_t* (* getStringLiteral)(void * thisHandle, CorInfoExceptionClass** ppException, void* module, unsigned metaTOK, int* length); int (* asCorInfoType)(void * thisHandle, CorInfoExceptionClass** ppException, void* cls); const char* (* getClassName)(void * thisHandle, CorInfoExceptionClass** ppException, void* cls); const char* (* getClassNameFromMetadata)(void * thisHandle, CorInfoExceptionClass** ppException, void* cls, const char** namespaceName); void* (* getTypeInstantiationArgument)(void * thisHandle, CorInfoExceptionClass** ppException, void* cls, unsigned index); - int (* appendClassName)(void * thisHandle, CorInfoExceptionClass** ppException, wchar_t** ppBuf, int* pnBufLen, void* cls, bool fNamespace, bool fFullInst, bool fAssembly); - bool (* isValueClass)(void * thisHandle, CorInfoExceptionClass** ppException, void* cls); + int (* appendClassName)(void * thisHandle, CorInfoExceptionClass** ppException, wchar_t** ppBuf, int* pnBufLen, void* cls, int fNamespace, int fFullInst, int fAssembly); + int (* isValueClass)(void * thisHandle, CorInfoExceptionClass** ppException, void* cls); int (* canInlineTypeCheck)(void * thisHandle, CorInfoExceptionClass** ppException, void* cls, int source); unsigned int (* getClassAttribs)(void * thisHandle, CorInfoExceptionClass** ppException, void* cls); - bool (* isStructRequiringStackAllocRetBuf)(void * thisHandle, CorInfoExceptionClass** ppException, void* cls); + int (* isStructRequiringStackAllocRetBuf)(void * thisHandle, CorInfoExceptionClass** ppException, void* cls); void* (* getClassModule)(void * thisHandle, CorInfoExceptionClass** ppException, void* cls); void* (* getModuleAssembly)(void * thisHandle, CorInfoExceptionClass** ppException, void* mod); const char* (* getAssemblyName)(void * thisHandle, CorInfoExceptionClass** ppException, void* assem); @@ -62,12 +62,12 @@ struct JitInterfaceCallbacks size_t (* getClassModuleIdForStatics)(void * thisHandle, CorInfoExceptionClass** ppException, void* cls, void* pModule, void** ppIndirection); unsigned (* getClassSize)(void * thisHandle, CorInfoExceptionClass** ppException, void* cls); unsigned (* getHeapClassSize)(void * thisHandle, CorInfoExceptionClass** ppException, void* cls); - bool (* canAllocateOnStack)(void * thisHandle, CorInfoExceptionClass** ppException, void* cls); - unsigned (* getClassAlignmentRequirement)(void * thisHandle, CorInfoExceptionClass** ppException, void* cls, bool fDoubleAlignHint); + int (* canAllocateOnStack)(void * thisHandle, CorInfoExceptionClass** ppException, void* cls); + unsigned (* getClassAlignmentRequirement)(void * thisHandle, CorInfoExceptionClass** ppException, void* cls, int fDoubleAlignHint); unsigned (* getClassGClayout)(void * thisHandle, CorInfoExceptionClass** ppException, void* cls, unsigned char* gcPtrs); unsigned (* getClassNumInstanceFields)(void * thisHandle, CorInfoExceptionClass** ppException, void* cls); void* (* getFieldInClass)(void * thisHandle, CorInfoExceptionClass** ppException, void* clsHnd, int num); - bool (* checkMethodModifier)(void * thisHandle, CorInfoExceptionClass** ppException, void* hMethod, const char* modifier, bool fOptional); + int (* checkMethodModifier)(void * thisHandle, CorInfoExceptionClass** ppException, void* hMethod, const char* modifier, int fOptional); int (* getNewHelper)(void * thisHandle, CorInfoExceptionClass** ppException, void* pResolvedToken, void* callerHandle, bool* pHasSideEffects); int (* getNewArrHelper)(void * thisHandle, CorInfoExceptionClass** ppException, void* arrayCls); int (* getCastingHelper)(void * thisHandle, CorInfoExceptionClass** ppException, void* pResolvedToken, bool fThrowing); @@ -83,16 +83,16 @@ struct JitInterfaceCallbacks void* (* getBuiltinClass)(void * thisHandle, CorInfoExceptionClass** ppException, int classId); int (* getTypeForPrimitiveValueClass)(void * thisHandle, CorInfoExceptionClass** ppException, void* cls); int (* getTypeForPrimitiveNumericClass)(void * thisHandle, CorInfoExceptionClass** ppException, void* cls); - bool (* canCast)(void * thisHandle, CorInfoExceptionClass** ppException, void* child, void* parent); - bool (* areTypesEquivalent)(void * thisHandle, CorInfoExceptionClass** ppException, void* cls1, void* cls2); + int (* canCast)(void * thisHandle, CorInfoExceptionClass** ppException, void* child, void* parent); + int (* areTypesEquivalent)(void * thisHandle, CorInfoExceptionClass** ppException, void* cls1, void* cls2); int (* compareTypesForCast)(void * thisHandle, CorInfoExceptionClass** ppException, void* fromClass, void* toClass); int (* compareTypesForEquality)(void * thisHandle, CorInfoExceptionClass** ppException, void* cls1, void* cls2); void* (* mergeClasses)(void * thisHandle, CorInfoExceptionClass** ppException, void* cls1, void* cls2); - bool (* isMoreSpecificType)(void * thisHandle, CorInfoExceptionClass** ppException, void* cls1, void* cls2); + int (* isMoreSpecificType)(void * thisHandle, CorInfoExceptionClass** ppException, void* cls1, void* cls2); void* (* getParentType)(void * thisHandle, CorInfoExceptionClass** ppException, void* cls); int (* getChildType)(void * thisHandle, CorInfoExceptionClass** ppException, void* clsHnd, void* clsRet); - bool (* satisfiesClassConstraints)(void * thisHandle, CorInfoExceptionClass** ppException, void* cls); - bool (* isSDArray)(void * thisHandle, CorInfoExceptionClass** ppException, void* cls); + int (* satisfiesClassConstraints)(void * thisHandle, CorInfoExceptionClass** ppException, void* cls); + int (* isSDArray)(void * thisHandle, CorInfoExceptionClass** ppException, void* cls); unsigned (* getArrayRank)(void * thisHandle, CorInfoExceptionClass** ppException, void* cls); void* (* getArrayInitializationData)(void * thisHandle, CorInfoExceptionClass** ppException, void* field, unsigned int size); int (* canAccessClass)(void * thisHandle, CorInfoExceptionClass** ppException, void* pResolvedToken, void* callerHandle, void* pAccessHelper); @@ -139,16 +139,16 @@ struct JitInterfaceCallbacks void* (* embedClassHandle)(void * thisHandle, CorInfoExceptionClass** ppException, void* handle, void** ppIndirection); void* (* embedMethodHandle)(void * thisHandle, CorInfoExceptionClass** ppException, void* handle, void** ppIndirection); void* (* embedFieldHandle)(void * thisHandle, CorInfoExceptionClass** ppException, void* handle, void** ppIndirection); - void (* embedGenericHandle)(void * thisHandle, CorInfoExceptionClass** ppException, void* pResolvedToken, bool fEmbedParent, void* pResult); + void (* embedGenericHandle)(void * thisHandle, CorInfoExceptionClass** ppException, void* pResolvedToken, int fEmbedParent, void* pResult); void (* getLocationOfThisType)(void * thisHandle, CorInfoExceptionClass** ppException, void* context, void* pLookupKind); void (* getAddressOfPInvokeTarget)(void * thisHandle, CorInfoExceptionClass** ppException, void* method, void* pLookup); void* (* GetCookieForPInvokeCalliSig)(void * thisHandle, CorInfoExceptionClass** ppException, void* szMetaSig, void** ppIndirection); bool (* canGetCookieForPInvokeCalliSig)(void * thisHandle, CorInfoExceptionClass** ppException, void* szMetaSig); void* (* getJustMyCodeHandle)(void * thisHandle, CorInfoExceptionClass** ppException, void* method, void** ppIndirection); - void (* GetProfilingHandle)(void * thisHandle, CorInfoExceptionClass** ppException, bool* pbHookFunction, void** pProfilerHandle, bool* pbIndirectedHandles); + void (* GetProfilingHandle)(void * thisHandle, CorInfoExceptionClass** ppException, int* pbHookFunction, void** pProfilerHandle, int* pbIndirectedHandles); void (* getCallInfo)(void * thisHandle, CorInfoExceptionClass** ppException, void* pResolvedToken, void* pConstrainedResolvedToken, void* callerHandle, int flags, void* pResult); - bool (* canAccessFamily)(void * thisHandle, CorInfoExceptionClass** ppException, void* hCaller, void* hInstanceType); - bool (* isRIDClassDomainID)(void * thisHandle, CorInfoExceptionClass** ppException, void* cls); + int (* canAccessFamily)(void * thisHandle, CorInfoExceptionClass** ppException, void* hCaller, void* hInstanceType); + int (* isRIDClassDomainID)(void * thisHandle, CorInfoExceptionClass** ppException, void* cls); unsigned (* getClassDomainID)(void * thisHandle, CorInfoExceptionClass** ppException, void* cls, void** ppIndirection); void* (* getFieldAddress)(void * thisHandle, CorInfoExceptionClass** ppException, void* field, void** ppIndirection); void* (* getStaticFieldCurrentClass)(void * thisHandle, CorInfoExceptionClass** ppException, void* field, bool* pIsSpeculative); @@ -163,14 +163,14 @@ struct JitInterfaceCallbacks void (* MethodCompileComplete)(void * thisHandle, CorInfoExceptionClass** ppException, void* methHnd); bool (* getTailCallHelpers)(void * thisHandle, CorInfoExceptionClass** ppException, void* callToken, void* sig, int flags, void* pResult); bool (* convertPInvokeCalliToCall)(void * thisHandle, CorInfoExceptionClass** ppException, void* pResolvedToken, bool mustConvert); - bool (* notifyInstructionSetUsage)(void * thisHandle, CorInfoExceptionClass** ppException, int instructionSet, bool supportEnabled); + void (* notifyInstructionSetUsage)(void * thisHandle, CorInfoExceptionClass** ppException, int instructionSet, bool supportEnabled); void (* allocMem)(void * thisHandle, CorInfoExceptionClass** ppException, unsigned int hotCodeSize, unsigned int coldCodeSize, unsigned int roDataSize, unsigned int xcptnsCount, int flag, void** hotCodeBlock, void** coldCodeBlock, void** roDataBlock); - void (* reserveUnwindInfo)(void * thisHandle, CorInfoExceptionClass** ppException, bool isFunclet, bool isColdCode, unsigned int unwindSize); + void (* reserveUnwindInfo)(void * thisHandle, CorInfoExceptionClass** ppException, int isFunclet, int isColdCode, unsigned int unwindSize); void (* allocUnwindInfo)(void * thisHandle, CorInfoExceptionClass** ppException, unsigned char* pHotCode, unsigned char* pColdCode, unsigned int startOffset, unsigned int endOffset, unsigned int unwindSize, unsigned char* pUnwindBlock, int funcKind); void* (* allocGCInfo)(void * thisHandle, CorInfoExceptionClass** ppException, size_t size); void (* setEHcount)(void * thisHandle, CorInfoExceptionClass** ppException, unsigned cEH); void (* setEHinfo)(void * thisHandle, CorInfoExceptionClass** ppException, unsigned EHnumber, void* clause); - bool (* logMsg)(void * thisHandle, CorInfoExceptionClass** ppException, unsigned level, const char* fmt, va_list args); + int (* logMsg)(void * thisHandle, CorInfoExceptionClass** ppException, unsigned level, const char* fmt, va_list args); int (* doAssert)(void * thisHandle, CorInfoExceptionClass** ppException, const char* szFile, int iLine, const char* szExpr); void (* reportFatalError)(void * thisHandle, CorInfoExceptionClass** ppException, int result); int (* allocMethodBlockCounts)(void * thisHandle, CorInfoExceptionClass** ppException, unsigned int count, void** pBlockCounts); @@ -384,35 +384,35 @@ class JitInterfaceWrapper return temp; } - virtual bool pInvokeMarshalingRequired( + virtual int pInvokeMarshalingRequired( void* method, void* callSiteSig) { CorInfoExceptionClass* pException = nullptr; - bool temp = _callbacks->pInvokeMarshalingRequired(_thisHandle, &pException, method, callSiteSig); + int temp = _callbacks->pInvokeMarshalingRequired(_thisHandle, &pException, method, callSiteSig); if (pException != nullptr) throw pException; return temp; } - virtual bool satisfiesMethodConstraints( + virtual int satisfiesMethodConstraints( void* parent, void* method) { CorInfoExceptionClass* pException = nullptr; - bool temp = _callbacks->satisfiesMethodConstraints(_thisHandle, &pException, parent, method); + int temp = _callbacks->satisfiesMethodConstraints(_thisHandle, &pException, parent, method); if (pException != nullptr) throw pException; return temp; } - virtual bool isCompatibleDelegate( + virtual int isCompatibleDelegate( void* objCls, void* methodParentCls, void* method, void* delegateCls, - bool* pfIsOpenDelegate) + int* pfIsOpenDelegate) { CorInfoExceptionClass* pException = nullptr; - bool temp = _callbacks->isCompatibleDelegate(_thisHandle, &pException, objCls, methodParentCls, method, delegateCls, pfIsOpenDelegate); + int temp = _callbacks->isCompatibleDelegate(_thisHandle, &pException, objCls, methodParentCls, method, delegateCls, pfIsOpenDelegate); if (pException != nullptr) throw pException; return temp; } @@ -508,22 +508,22 @@ class JitInterfaceWrapper return temp; } - virtual bool isValidToken( + virtual int isValidToken( void* module, unsigned metaTOK) { CorInfoExceptionClass* pException = nullptr; - bool temp = _callbacks->isValidToken(_thisHandle, &pException, module, metaTOK); + int temp = _callbacks->isValidToken(_thisHandle, &pException, module, metaTOK); if (pException != nullptr) throw pException; return temp; } - virtual bool isValidStringRef( + virtual int isValidStringRef( void* module, unsigned metaTOK) { CorInfoExceptionClass* pException = nullptr; - bool temp = _callbacks->isValidStringRef(_thisHandle, &pException, module, metaTOK); + int temp = _callbacks->isValidStringRef(_thisHandle, &pException, module, metaTOK); if (pException != nullptr) throw pException; return temp; } @@ -581,9 +581,9 @@ class JitInterfaceWrapper wchar_t** ppBuf, int* pnBufLen, void* cls, - bool fNamespace, - bool fFullInst, - bool fAssembly) + int fNamespace, + int fFullInst, + int fAssembly) { CorInfoExceptionClass* pException = nullptr; int temp = _callbacks->appendClassName(_thisHandle, &pException, ppBuf, pnBufLen, cls, fNamespace, fFullInst, fAssembly); @@ -591,11 +591,11 @@ class JitInterfaceWrapper return temp; } - virtual bool isValueClass( + virtual int isValueClass( void* cls) { CorInfoExceptionClass* pException = nullptr; - bool temp = _callbacks->isValueClass(_thisHandle, &pException, cls); + int temp = _callbacks->isValueClass(_thisHandle, &pException, cls); if (pException != nullptr) throw pException; return temp; } @@ -619,11 +619,11 @@ class JitInterfaceWrapper return temp; } - virtual bool isStructRequiringStackAllocRetBuf( + virtual int isStructRequiringStackAllocRetBuf( void* cls) { CorInfoExceptionClass* pException = nullptr; - bool temp = _callbacks->isStructRequiringStackAllocRetBuf(_thisHandle, &pException, cls); + int temp = _callbacks->isStructRequiringStackAllocRetBuf(_thisHandle, &pException, cls); if (pException != nullptr) throw pException; return temp; } @@ -701,18 +701,18 @@ class JitInterfaceWrapper return temp; } - virtual bool canAllocateOnStack( + virtual int canAllocateOnStack( void* cls) { CorInfoExceptionClass* pException = nullptr; - bool temp = _callbacks->canAllocateOnStack(_thisHandle, &pException, cls); + int temp = _callbacks->canAllocateOnStack(_thisHandle, &pException, cls); if (pException != nullptr) throw pException; return temp; } virtual unsigned getClassAlignmentRequirement( void* cls, - bool fDoubleAlignHint) + int fDoubleAlignHint) { CorInfoExceptionClass* pException = nullptr; unsigned temp = _callbacks->getClassAlignmentRequirement(_thisHandle, &pException, cls, fDoubleAlignHint); @@ -749,13 +749,13 @@ class JitInterfaceWrapper return temp; } - virtual bool checkMethodModifier( + virtual int checkMethodModifier( void* hMethod, const char* modifier, - bool fOptional) + int fOptional) { CorInfoExceptionClass* pException = nullptr; - bool temp = _callbacks->checkMethodModifier(_thisHandle, &pException, hMethod, modifier, fOptional); + int temp = _callbacks->checkMethodModifier(_thisHandle, &pException, hMethod, modifier, fOptional); if (pException != nullptr) throw pException; return temp; } @@ -903,22 +903,22 @@ class JitInterfaceWrapper return temp; } - virtual bool canCast( + virtual int canCast( void* child, void* parent) { CorInfoExceptionClass* pException = nullptr; - bool temp = _callbacks->canCast(_thisHandle, &pException, child, parent); + int temp = _callbacks->canCast(_thisHandle, &pException, child, parent); if (pException != nullptr) throw pException; return temp; } - virtual bool areTypesEquivalent( + virtual int areTypesEquivalent( void* cls1, void* cls2) { CorInfoExceptionClass* pException = nullptr; - bool temp = _callbacks->areTypesEquivalent(_thisHandle, &pException, cls1, cls2); + int temp = _callbacks->areTypesEquivalent(_thisHandle, &pException, cls1, cls2); if (pException != nullptr) throw pException; return temp; } @@ -953,12 +953,12 @@ class JitInterfaceWrapper return temp; } - virtual bool isMoreSpecificType( + virtual int isMoreSpecificType( void* cls1, void* cls2) { CorInfoExceptionClass* pException = nullptr; - bool temp = _callbacks->isMoreSpecificType(_thisHandle, &pException, cls1, cls2); + int temp = _callbacks->isMoreSpecificType(_thisHandle, &pException, cls1, cls2); if (pException != nullptr) throw pException; return temp; } @@ -982,20 +982,20 @@ class JitInterfaceWrapper return temp; } - virtual bool satisfiesClassConstraints( + virtual int satisfiesClassConstraints( void* cls) { CorInfoExceptionClass* pException = nullptr; - bool temp = _callbacks->satisfiesClassConstraints(_thisHandle, &pException, cls); + int temp = _callbacks->satisfiesClassConstraints(_thisHandle, &pException, cls); if (pException != nullptr) throw pException; return temp; } - virtual bool isSDArray( + virtual int isSDArray( void* cls) { CorInfoExceptionClass* pException = nullptr; - bool temp = _callbacks->isSDArray(_thisHandle, &pException, cls); + int temp = _callbacks->isSDArray(_thisHandle, &pException, cls); if (pException != nullptr) throw pException; return temp; } @@ -1427,7 +1427,7 @@ class JitInterfaceWrapper virtual void embedGenericHandle( void* pResolvedToken, - bool fEmbedParent, + int fEmbedParent, void* pResult) { CorInfoExceptionClass* pException = nullptr; @@ -1483,9 +1483,9 @@ class JitInterfaceWrapper } virtual void GetProfilingHandle( - bool* pbHookFunction, + int* pbHookFunction, void** pProfilerHandle, - bool* pbIndirectedHandles) + int* pbIndirectedHandles) { CorInfoExceptionClass* pException = nullptr; _callbacks->GetProfilingHandle(_thisHandle, &pException, pbHookFunction, pProfilerHandle, pbIndirectedHandles); @@ -1504,21 +1504,21 @@ class JitInterfaceWrapper if (pException != nullptr) throw pException; } - virtual bool canAccessFamily( + virtual int canAccessFamily( void* hCaller, void* hInstanceType) { CorInfoExceptionClass* pException = nullptr; - bool temp = _callbacks->canAccessFamily(_thisHandle, &pException, hCaller, hInstanceType); + int temp = _callbacks->canAccessFamily(_thisHandle, &pException, hCaller, hInstanceType); if (pException != nullptr) throw pException; return temp; } - virtual bool isRIDClassDomainID( + virtual int isRIDClassDomainID( void* cls) { CorInfoExceptionClass* pException = nullptr; - bool temp = _callbacks->isRIDClassDomainID(_thisHandle, &pException, cls); + int temp = _callbacks->isRIDClassDomainID(_thisHandle, &pException, cls); if (pException != nullptr) throw pException; return temp; } @@ -1662,14 +1662,13 @@ class JitInterfaceWrapper return temp; } - virtual bool notifyInstructionSetUsage( + virtual void notifyInstructionSetUsage( int instructionSet, bool supportEnabled) { CorInfoExceptionClass* pException = nullptr; - bool temp = _callbacks->notifyInstructionSetUsage(_thisHandle, &pException, instructionSet, supportEnabled); + _callbacks->notifyInstructionSetUsage(_thisHandle, &pException, instructionSet, supportEnabled); if (pException != nullptr) throw pException; - return temp; } virtual void allocMem( @@ -1688,8 +1687,8 @@ class JitInterfaceWrapper } virtual void reserveUnwindInfo( - bool isFunclet, - bool isColdCode, + int isFunclet, + int isColdCode, unsigned int unwindSize) { CorInfoExceptionClass* pException = nullptr; @@ -1737,13 +1736,13 @@ class JitInterfaceWrapper if (pException != nullptr) throw pException; } - virtual bool logMsg( + virtual int logMsg( unsigned level, const char* fmt, va_list args) { CorInfoExceptionClass* pException = nullptr; - bool temp = _callbacks->logMsg(_thisHandle, &pException, level, fmt, args); + int temp = _callbacks->logMsg(_thisHandle, &pException, level, fmt, args); if (pException != nullptr) throw pException; return temp; } diff --git a/src/coreclr/vm/jitinterface.cpp b/src/coreclr/vm/jitinterface.cpp index 5f15c938c84ef..82705f094c06a 100644 --- a/src/coreclr/vm/jitinterface.cpp +++ b/src/coreclr/vm/jitinterface.cpp @@ -139,7 +139,7 @@ inline CORINFO_MODULE_HANDLE GetScopeHandle(MethodDesc* method) } //This is common refactored code from within several of the access check functions. -BOOL ModifyCheckForDynamicMethod(DynamicResolver *pResolver, +bool ModifyCheckForDynamicMethod(DynamicResolver *pResolver, TypeHandle *pOwnerTypeForSecurity, AccessCheckOptions::AccessCheckType *pAccessCheckType, DynamicResolver** ppAccessContext) @@ -153,7 +153,7 @@ BOOL ModifyCheckForDynamicMethod(DynamicResolver *pResolver, PRECONDITION(*pAccessCheckType == AccessCheckOptions::kNormalAccessibilityChecks); } CONTRACTL_END; - BOOL doAccessCheck = TRUE; + bool doAccessCheck = TRUE; //Do not blindly initialize fields, since they've already got important values. DynamicResolver::SecurityControlFlags dwSecurityFlags = DynamicResolver::Default; @@ -250,7 +250,7 @@ void CEEInfo::GetTypeContext(CORINFO_CONTEXT_HANDLE context, SigTypeContext *pTy } // Returns true if context is providing any generic variables -BOOL CEEInfo::ContextIsInstantiated(CORINFO_CONTEXT_HANDLE context) +bool CEEInfo::ContextIsInstantiated(CORINFO_CONTEXT_HANDLE context) { LIMITED_METHOD_CONTRACT; MethodDesc* pMD = GetMethodFromContext(context); @@ -1644,7 +1644,7 @@ void CEEInfo::getFieldInfo (CORINFO_RESOLVED_TOKEN * pResolvedToken, } else { - BOOL fInstanceHelper = FALSE; + bool fInstanceHelper = FALSE; if (fInstanceHelper) { @@ -1722,7 +1722,7 @@ void CEEInfo::getFieldInfo (CORINFO_RESOLVED_TOKEN * pResolvedToken, } } - BOOL doAccessCheck = TRUE; + bool doAccessCheck = TRUE; AccessCheckOptions::AccessCheckType accessCheckType = AccessCheckOptions::kNormalAccessibilityChecks; DynamicResolver * pAccessContext = NULL; @@ -1752,7 +1752,7 @@ void CEEInfo::getFieldInfo (CORINFO_RESOLVED_TOKEN * pResolvedToken, _ASSERTE(pCallerForSecurity != NULL && callerTypeForSecurity != NULL); AccessCheckContext accessContext(pCallerForSecurity, callerTypeForSecurity.GetMethodTable()); - BOOL canAccess = ClassLoader::CanAccess( + bool canAccess = ClassLoader::CanAccess( &accessContext, fieldTypeForSecurity.GetMethodTable(), fieldTypeForSecurity.GetAssembly(), @@ -2287,7 +2287,7 @@ unsigned CEEInfo::getClassGClayoutStatic(TypeHandle VMClsHnd, BYTE* gcPtrs) { _ASSERTE(sizeof(BYTE) == 1); - BOOL isValueClass = pMT->IsValueType(); + bool isValueClass = pMT->IsValueType(); #ifdef FEATURE_READYTORUN_COMPILER _ASSERTE(isValueClass || !IsReadyToRunCompilation() || pMT->IsInheritanceChainLayoutFixedInCurrentVersionBubble()); @@ -2606,7 +2606,7 @@ void CEEInfo::embedGenericHandle( JIT_TO_EE_TRANSITION(); - BOOL fRuntimeLookup; + bool fRuntimeLookup; MethodDesc * pTemplateMD = NULL; if (!fEmbedParent && pResolvedToken->hMethod != NULL) @@ -3084,7 +3084,7 @@ void CEEInfo::ComputeRuntimeLookupForSharedGenericToken(DictionaryEntryKind entr if (!pContextMD->IsSharedByGenericInstantiations()) COMPlusThrow(kInvalidProgramException); - BOOL fInstrument = FALSE; + bool fInstrument = FALSE; #ifdef FEATURE_NATIVE_IMAGE_GENERATION // This will make sure that when IBC logging is turned on we will go through a version @@ -3388,7 +3388,7 @@ void CEEInfo::ComputeRuntimeLookupForSharedGenericToken(DictionaryEntryKind entr // Check for non-NULL method spec first. We can encode the method instantiation only if we have one in method spec to start with. Note that there are weird cases // like instantiating stub for generic method definition that do not have method spec but that won't be caught by the later conditions either. - BOOL fMethodNeedsInstantiation = (pResolvedToken->pMethodSpec != NULL) && pTemplateMD->HasMethodInstantiation() && !pTemplateMD->IsGenericMethodDefinition(); + bool fMethodNeedsInstantiation = (pResolvedToken->pMethodSpec != NULL) && pTemplateMD->HasMethodInstantiation() && !pTemplateMD->IsGenericMethodDefinition(); if (pTemplateMD->IsUnboxingStub()) methodFlags |= ENCODE_METHOD_SIG_UnboxingStub; @@ -4004,7 +4004,7 @@ CorInfoInitClassResult CEEInfo::initClass( MethodDesc *methodBeingCompiled = m_pMethodBeingCompiled; - BOOL fMethodZappedOrNGen = methodBeingCompiled->IsZapped() || IsCompilingForNGen(); + bool fMethodZappedOrNGen = methodBeingCompiled->IsZapped() || IsCompilingForNGen(); MethodTable *pTypeToInitMT = typeToInitTH.AsMethodTable(); @@ -4546,7 +4546,7 @@ TypeCompareState CEEInfo::compareTypesForCast( if (toHnd.IsInterface()) { // Do a preliminary check. - BOOL canCast = fromHnd.CanCastTo(toHnd); + bool canCast = fromHnd.CanCastTo(toHnd); // Pass back positive results unfiltered. The unknown type // parameters in fromClass did not come into play. @@ -4729,7 +4729,7 @@ CORINFO_CLASS_HANDLE CEEInfo::mergeClasses( } /*********************************************************************/ -static BOOL isMoreSpecificTypeHelper( +static bool isMoreSpecificTypeHelper( CORINFO_CLASS_HANDLE cls1, CORINFO_CLASS_HANDLE cls2) { @@ -4751,8 +4751,8 @@ static BOOL isMoreSpecificTypeHelper( // If we have a mixture of shared and unshared types, // consider the unshared type as more specific. - BOOL isHnd1CanonSubtype = hnd1.IsCanonicalSubtype(); - BOOL isHnd2CanonSubtype = hnd2.IsCanonicalSubtype(); + bool isHnd1CanonSubtype = hnd1.IsCanonicalSubtype(); + bool isHnd2CanonSubtype = hnd2.IsCanonicalSubtype(); if (isHnd1CanonSubtype != isHnd2CanonSubtype) { // Only one of hnd1 and hnd2 is shared. @@ -5026,7 +5026,7 @@ CorInfoIsAccessAllowedResult CEEInfo::canAccessClass( INDEBUG(memset(pAccessHelper, 0xCC, sizeof(*pAccessHelper))); - BOOL doAccessCheck = TRUE; + bool doAccessCheck = TRUE; AccessCheckOptions::AccessCheckType accessCheckType = AccessCheckOptions::kNormalAccessibilityChecks; DynamicResolver * pAccessContext = NULL; @@ -5075,7 +5075,7 @@ CorInfoIsAccessAllowedResult CEEInfo::canAccessClass( _ASSERTE(pCallerForSecurity != NULL && callerTypeForSecurity != NULL); AccessCheckContext accessContext(pCallerForSecurity, callerTypeForSecurity.GetMethodTable()); - BOOL canAccessType = ClassLoader::CanAccessClass(&accessContext, + bool canAccessType = ClassLoader::CanAccessClass(&accessContext, pCalleeForSecurity.GetMethodTable(), pCalleeForSecurity.GetAssembly(), accessCheckOptions); @@ -5151,8 +5151,8 @@ void CEEInfo::getCallInfo( constrainedType = TypeHandle(pConstrainedResolvedToken->hClass); } - BOOL fResolvedConstraint = FALSE; - BOOL fForceUseRuntimeLookup = FALSE; + bool fResolvedConstraint = FALSE; + bool fForceUseRuntimeLookup = FALSE; MethodDesc * pMDAfterConstraintResolution = pMD; if (constrainedType.IsNull()) @@ -5639,8 +5639,8 @@ void CEEInfo::getCallInfo( //Passed various link-time checks. Now do access checks. - BOOL doAccessCheck = TRUE; - BOOL canAccessMethod = TRUE; + bool doAccessCheck = TRUE; + bool canAccessMethod = TRUE; AccessCheckOptions::AccessCheckType accessCheckType = AccessCheckOptions::kNormalAccessibilityChecks; DynamicResolver * pAccessContext = NULL; @@ -5773,7 +5773,7 @@ bool CEEInfo::canAccessFamily(CORINFO_METHOD_HANDLE hCaller, TypeHandle accessingType = TypeHandle(GetMethod(hCaller)->GetMethodTable()); AccessCheckOptions::AccessCheckType accessCheckOptions = AccessCheckOptions::kNormalAccessibilityChecks; DynamicResolver* pIgnored; - BOOL doCheck = TRUE; + bool doCheck = TRUE; if (GetMethod(hCaller)->IsDynamicMethod()) { //If this is a DynamicMethod, perform the check from the type to which the DynamicMethod was @@ -5986,8 +5986,8 @@ CorInfoHelpFunc CEEInfo::getNewHelperStatic(MethodTable * pMT, bool * pHasSideEf // Slow helper is the default CorInfoHelpFunc helper = CORINFO_HELP_NEWFAST; - BOOL hasFinalizer = pMT->HasFinalizer(); - BOOL isComObjectType = pMT->IsComObjectType(); + bool hasFinalizer = pMT->HasFinalizer(); + bool isComObjectType = pMT->IsComObjectType(); if (isComObjectType) { @@ -6256,7 +6256,7 @@ CorInfoHelpFunc CEEInfo::getCastingHelperStatic(TypeHandle clsHnd, bool fThrowin } #ifdef FEATURE_PREJIT - BOOL t1, t2, forceInstr; + bool t1, t2, forceInstr; SystemDomain::GetCompilationOverrides(&t1, &t2, &forceInstr); if (forceInstr) { @@ -6800,7 +6800,7 @@ void CEEInfo::setMethodAttribs ( if (attribs & CORINFO_FLG_BAD_INLINEE) { - BOOL fCacheInliningHint = TRUE; + bool fCacheInliningHint = TRUE; #ifdef FEATURE_NATIVE_IMAGE_GENERATION if (IsCompilationProcess()) @@ -7688,7 +7688,7 @@ getMethodInfoHelper( if (methInfo->options & CORINFO_GENERICS_CTXT_MASK) { #if defined(PROFILING_SUPPORTED) - BOOL fProfilerRequiresGenericsContextForEnterLeave = FALSE; + bool fProfilerRequiresGenericsContextForEnterLeave = FALSE; { BEGIN_PIN_PROFILER(CORProfilerPresent()); if (g_profControlBlock.pProfInterface->RequiresGenericsContextForEnterLeave()) @@ -8091,7 +8091,7 @@ CorInfoInline CEEInfo::canInline (CORINFO_METHOD_HANDLE hCaller, } else { - BOOL fShouldInline; + bool fShouldInline; HRESULT hr = g_profControlBlock.pProfInterface->JITInlining( (FunctionID)pCaller, (FunctionID)pCallee, @@ -8634,7 +8634,7 @@ CEEInfo::getMethodSigInternal( // JIT should not generate shared generics aware call code and insert the secret argument again at the callsite. // Otherwise we would end up with two secret generic dictionary arguments (since the stub also provides one). // - BOOL isCallSiteThatGoesThroughInstantiatingStub = + bool isCallSiteThatGoesThroughInstantiatingStub = signatureKind == SK_VIRTUAL_CALLSITE && !ftn->IsStatic() && ftn->GetMethodTable()->IsInterface(); @@ -8854,7 +8854,7 @@ void CEEInfo::getMethodVTableOffset (CORINFO_METHOD_HANDLE methodHnd, } /*********************************************************************/ -bool CEEInfo::tryResolveVirtualMethodHelper(CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT* virtualMethodContext) +bool CEEInfo::resolveVirtualMethodHelper(CORINFO_DEVIRTUALIZATION_INFO * info) { CONTRACTL { THROWS; @@ -8862,7 +8862,12 @@ bool CEEInfo::tryResolveVirtualMethodHelper(CORINFO_VIRTUAL_METHOD_CALLER_CONTEX MODE_PREEMPTIVE; } CONTRACTL_END; - MethodDesc* pBaseMD = GetMethod(virtualMethodContext->virtualMethod); + // Initialize OUT fields + info->devirtualizedMethod = NULL; + info->requiresInstMethodTableArg = false; + info->exactContext = NULL; + + MethodDesc* pBaseMD = GetMethod(info->virtualMethod); MethodTable* pBaseMT = pBaseMD->GetMethodTable(); // Method better be from a fully loaded class @@ -8876,9 +8881,9 @@ bool CEEInfo::tryResolveVirtualMethodHelper(CORINFO_VIRTUAL_METHOD_CALLER_CONTEX MethodDesc* pDevirtMD = nullptr; - TypeHandle DerivedClsHnd(virtualMethodContext->implementingClass); - MethodTable* pDerivedMT = DerivedClsHnd.GetMethodTable(); - _ASSERTE(pDerivedMT->IsRestored() && pDerivedMT->IsFullyLoaded()); + TypeHandle ObjClassHnd(info->objClass); + MethodTable* pObjMT = ObjClassHnd.GetMethodTable(); + _ASSERTE(pObjMT->IsRestored() && pObjMT->IsFullyLoaded()); // Can't devirtualize from __Canon. if (ObjClassHnd == TypeHandle(g_pCanonMethodTableClass)) @@ -8901,14 +8906,14 @@ bool CEEInfo::tryResolveVirtualMethodHelper(CORINFO_VIRTUAL_METHOD_CALLER_CONTEX // // We must ensure that pObjMT actually implements the // interface corresponding to pBaseMD. - BOOL canCastStraightForward = pDerivedMT->CanCastToInterface(pBaseMT); + bool canCastStraightForward = pObjMT->CanCastToInterface(pBaseMT); // For generic interface methods we must have context to // safely devirtualize. MethodTable* pOwnerMT = nullptr; - if (virtualMethodContext->ownerType != nullptr) + if (info->context != nullptr) { - TypeHandle OwnerClsHnd = GetTypeFromContext(virtualMethodContext->ownerType); + TypeHandle OwnerClsHnd = GetTypeFromContext(info->context); pOwnerMT = OwnerClsHnd.GetMethodTable(); if (!canCastStraightForward && !(pOwnerMT->IsInterface() && pDerivedMT->CanCastToInterface(pOwnerMT))) @@ -8949,15 +8954,15 @@ bool CEEInfo::tryResolveVirtualMethodHelper(CORINFO_VIRTUAL_METHOD_CALLER_CONTEX // either instantiating stub ie `pDevirtMD->IsWrapperStub() == true` // or non shared generic instantiation ie is _ASSERTE(pDevirtMD->IsWrapperStub() || !(pDevirtMD->GetMethodTable()->IsSharedByGenericInstantiations() || pDevirtMD->IsSharedByGenericMethodInstantiations())); - virtualMethodContext->patchedOwnerType = MAKE_CLASSCONTEXT(pDevirtMD->GetMethodTable()); + info->exactContext = MAKE_CLASSCONTEXT(pDevirtMD->GetMethodTable()); if (pDevirtMD->IsWrapperStub()) { - virtualMethodContext->requiresInstMethodTableArg = true; + info->requiresInstMethodTableArg = true; pDevirtMD = pDevirtMD->GetExistingWrappedMethodDesc(); } else { - virtualMethodContext->requiresInstMethodTableArg = false; + info->requiresInstMethodTableArg = false; } _ASSERTE(pDevirtMD->IsRestored() && pDevirtMD->GetMethodTable()->IsFullyLoaded()); } @@ -9020,14 +9025,13 @@ bool CEEInfo::tryResolveVirtualMethodHelper(CORINFO_VIRTUAL_METHOD_CALLER_CONTEX if (pApproxMT->IsInterface()) { - // As noted above, we can't yet handle generic interfaces - // with default methods. - _ASSERTE(!pDevirtMD->HasClassInstantiation()); + // Already handled above TODO refactor } else { pExactMT = pDevirtMD->GetExactDeclaringType(pObjMT); + info->exactContext = MAKE_CLASSCONTEXT((CORINFO_CLASS_HANDLE) pExactMT); } #ifdef FEATURE_READYTORUN_COMPILER @@ -9048,11 +9052,14 @@ bool CEEInfo::tryResolveVirtualMethodHelper(CORINFO_VIRTUAL_METHOD_CALLER_CONTEX } #endif - virtualMethodContext->devirtualizedMethod = (CORINFO_METHOD_HANDLE) pDevirtMD; + // Success! Pass back the results. + // + info->devirtualizedMethod = (CORINFO_METHOD_HANDLE) pDevirtMD; + return true; } -bool CEEInfo::tryResolveVirtualMethod(CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT* virtualMethodContext) +bool CEEInfo::resolveVirtualMethod(CORINFO_DEVIRTUALIZATION_INFO * info) { CONTRACTL { THROWS; @@ -9064,7 +9071,7 @@ bool CEEInfo::tryResolveVirtualMethod(CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT* vir JIT_TO_EE_TRANSITION(); - result = tryResolveVirtualMethodHelper(virtualMethodContext); + result = resolveVirtualMethod(info); EE_TO_JIT_TRANSITION(); @@ -10942,7 +10949,7 @@ void CEEJitInfo::GetProfilingHandle(bool *pbHookFunction, // We pass in the typical method definition to the function mapper because in // Whidbey all the profiling API transactions are done in terms of typical // method definitions not instantiations. - BOOL bHookFunction = TRUE; + bool bHookFunction = TRUE; void * profilerHandle = m_pMethodBeingCompiled; { @@ -12806,7 +12813,7 @@ void ThrowExceptionForJit(HRESULT res) // ******************************************************************** //#define PERF_TRACK_METHOD_JITTIMES #ifdef TARGET_AMD64 -BOOL g_fAllowRel32 = TRUE; +bool g_fAllowRel32 = TRUE; #endif @@ -12966,7 +12973,7 @@ PCODE UnsafeJitFunction(PrepareCodeConfig* config, #endif //_DEBUG #if defined(TARGET_AMD64) || defined(TARGET_ARM64) - BOOL fForceJumpStubOverflow = FALSE; + bool fForceJumpStubOverflow = FALSE; #ifdef _DEBUG // Always exercise the overflow codepath with force relocs @@ -12975,7 +12982,7 @@ PCODE UnsafeJitFunction(PrepareCodeConfig* config, #endif #if defined(TARGET_AMD64) - BOOL fAllowRel32 = (g_fAllowRel32 | fForceJumpStubOverflow); + bool fAllowRel32 = (g_fAllowRel32 | fForceJumpStubOverflow); #endif size_t reserveForJumpStubs = 0; @@ -13017,7 +13024,7 @@ PCODE UnsafeJitFunction(PrepareCodeConfig* config, AccessCheckOptions::AccessCheckType accessCheckType = AccessCheckOptions::kNormalAccessibilityChecks; TypeHandle ownerTypeForSecurity = TypeHandle(pMethodForSecurity->GetMethodTable()); DynamicResolver *pAccessContext = NULL; - BOOL doAccessCheck = TRUE; + bool doAccessCheck = TRUE; if (pMethodForSecurity->IsDynamicMethod()) { doAccessCheck = ModifyCheckForDynamicMethod(pMethodForSecurity->AsDynamicMethodDesc()->GetResolver(), @@ -13180,7 +13187,7 @@ PCODE UnsafeJitFunction(PrepareCodeConfig* config, } #ifdef _DEBUG - static BOOL fHeartbeat = -1; + static bool fHeartbeat = -1; if (fHeartbeat == -1) fHeartbeat = CLRConfig::GetConfigValue(CLRConfig::INTERNAL_JitHeartbeat); @@ -13353,7 +13360,7 @@ void ComputeGCRefMap(MethodTable * pMT, BYTE * pGCRefMap, size_t cbGCRefMap) // - Alignment // - Position of GC references // -BOOL TypeLayoutCheck(MethodTable * pMT, PCCOR_SIGNATURE pBlob) +bool TypeLayoutCheck(MethodTable * pMT, PCCOR_SIGNATURE pBlob) { STANDARD_VM_CONTRACT; @@ -13436,7 +13443,7 @@ bool IsInstructionSetSupported(CORJIT_FLAGS jitFlags, ReadyToRunInstructionSet r return jitFlags.IsSet(instructionSet); } -BOOL LoadDynamicInfoEntry(Module *currentModule, +bool LoadDynamicInfoEntry(Module *currentModule, RVA fixupRva, SIZE_T *entry) { @@ -13684,7 +13691,7 @@ BOOL LoadDynamicInfoEntry(Module *currentModule, FunctionID funId = (FunctionID)pMethod; - BOOL bHookFunction = TRUE; + bool bHookFunction = TRUE; CORINFO_PROFILING_HANDLE profilerHandle = (CORINFO_PROFILING_HANDLE)funId; { @@ -14510,14 +14517,14 @@ PTR_RUNTIME_FUNCTION EECodeInfo::GetFunctionEntry() #if defined(TARGET_AMD64) -BOOL EECodeInfo::HasFrameRegister() +bool EECodeInfo::HasFrameRegister() { LIMITED_METHOD_CONTRACT; PTR_RUNTIME_FUNCTION pFuncEntry = GetFunctionEntry(); _ASSERTE(pFuncEntry != NULL); - BOOL fHasFrameRegister = FALSE; + bool fHasFrameRegister = FALSE; PUNWIND_INFO pUnwindInfo = (PUNWIND_INFO)(GetModuleBase() + pFuncEntry->UnwindData); if (pUnwindInfo->FrameRegister != 0) { diff --git a/src/coreclr/vm/jitinterface.h b/src/coreclr/vm/jitinterface.h index 4c30e24f9bad9..c2b207690b0d9 100644 --- a/src/coreclr/vm/jitinterface.h +++ b/src/coreclr/vm/jitinterface.h @@ -87,7 +87,7 @@ void getMethodInfoILMethodHeaderHelper( ); -BOOL LoadDynamicInfoEntry(Module *currentModule, +bool LoadDynamicInfoEntry(Module *currentModule, RVA fixupRva, SIZE_T *entry); @@ -417,7 +417,7 @@ class CEEInfo : public ICorJitInfo MethodDesc* GetMethodFromContext(CORINFO_CONTEXT_HANDLE context); TypeHandle GetTypeFromContext(CORINFO_CONTEXT_HANDLE context); void GetTypeContext(CORINFO_CONTEXT_HANDLE context, SigTypeContext* pTypeContext); - BOOL ContextIsInstantiated(CORINFO_CONTEXT_HANDLE context); + bool ContextIsInstantiated(CORINFO_CONTEXT_HANDLE context); public: // ICorClassInfo stuff @@ -482,8 +482,8 @@ class CEEInfo : public ICorJitInfo // considered when checking visibility rules. - CorInfoHelpFunc getNewHelper(CORINFO_RESOLVED_TOKEN * pResolvedToken, CORINFO_METHOD_HANDLE callerHandle, bool * pHasSideEffects); - static CorInfoHelpFunc getNewHelperStatic(MethodTable * pMT, bool * pHasSideEffects); + CorInfoHelpFunc getNewHelper(CORINFO_RESOLVED_TOKEN * pResolvedToken, CORINFO_METHOD_HANDLE callerHandle, bool * pHasSideEffects = NULL); + static CorInfoHelpFunc getNewHelperStatic(MethodTable * pMT, bool * pHasSideEffects = NULL); CorInfoHelpFunc getNewArrHelper(CORINFO_CLASS_HANDLE arrayCls); static CorInfoHelpFunc getNewArrHelperStatic(TypeHandle clsHnd); @@ -732,9 +732,8 @@ class CEEInfo : public ICorJitInfo unsigned * pOffsetAfterIndirection, bool * isRelative); - bool tryResolveVirtualMethod(CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT* virtualMethodContext); - - bool tryResolveVirtualMethodHelper(CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT* virtualMethodContext); + bool resolveVirtualMethod(CORINFO_DEVIRTUALIZATION_INFO * info); + bool resolveVirtualMethodHelper(CORINFO_DEVIRTUALIZATION_INFO * info); CORINFO_METHOD_HANDLE getUnboxedEntry( CORINFO_METHOD_HANDLE ftn, @@ -917,7 +916,7 @@ class CEEInfo : public ICorJitInfo bool convertPInvokeCalliToCall(CORINFO_RESOLVED_TOKEN * pResolvedToken, bool fMustConvert); - bool notifyInstructionSetUsage(CORINFO_InstructionSet instructionSet, + void notifyInstructionSetUsage(CORINFO_InstructionSet instructionSet, bool supportEnabled); void getFunctionEntryPoint(CORINFO_METHOD_HANDLE ftn, /* IN */ @@ -1324,7 +1323,7 @@ class CEEJitInfo : public CEEInfo } #ifdef TARGET_AMD64 - void SetAllowRel32(BOOL fAllowRel32) + void SetAllowRel32(bool fAllowRel32) { LIMITED_METHOD_CONTRACT; m_fAllowRel32 = fAllowRel32; @@ -1332,19 +1331,19 @@ class CEEJitInfo : public CEEInfo #endif #if defined(TARGET_AMD64) || defined(TARGET_ARM64) - void SetJumpStubOverflow(BOOL fJumpStubOverflow) + void SetJumpStubOverflow(bool fJumpStubOverflow) { LIMITED_METHOD_CONTRACT; m_fJumpStubOverflow = fJumpStubOverflow; } - BOOL IsJumpStubOverflow() + bool IsJumpStubOverflow() { LIMITED_METHOD_CONTRACT; return m_fJumpStubOverflow; } - BOOL JitAgain() + bool JitAgain() { LIMITED_METHOD_CONTRACT; return m_fJumpStubOverflow; @@ -1362,7 +1361,7 @@ class CEEJitInfo : public CEEInfo m_reserveForJumpStubs = value; } #else - BOOL JitAgain() + bool JitAgain() { LIMITED_METHOD_CONTRACT; return FALSE; @@ -1502,10 +1501,10 @@ protected : #endif #ifdef TARGET_AMD64 - BOOL m_fAllowRel32; // Use 32-bit PC relative address modes + bool m_fAllowRel32; // Use 32-bit PC relative address modes #endif #if defined(TARGET_AMD64) || defined(TARGET_ARM64) - BOOL m_fJumpStubOverflow; // Overflow while trying to alocate jump stub slot within PC relative branch region + bool m_fJumpStubOverflow; // Overflow while trying to alocate jump stub slot within PC relative branch region // The code will need to be regenerated (with m_fRel32Allowed == FALSE for AMD64). size_t m_reserveForJumpStubs; // Space to reserve for jump stubs when allocating code #endif @@ -1610,7 +1609,7 @@ void *GenFastGetSharedStaticBase(bool bCheckCCtor); #ifdef HAVE_GCCOVER void SetupGcCoverage(NativeCodeVersion nativeCodeVersion, BYTE* nativeCode); void SetupGcCoverageForNativeImage(Module* module); -BOOL OnGcCoverageInterrupt(PT_CONTEXT regs); +bool OnGcCoverageInterrupt(PT_CONTEXT regs); void DoGcStress (PT_CONTEXT regs, NativeCodeVersion nativeCodeVersion); #endif //HAVE_GCCOVER @@ -1621,8 +1620,8 @@ OBJECTHANDLE ConstructStringLiteral(CORINFO_MODULE_HANDLE scopeHnd, mdToken meta FCDECL2(Object*, JIT_Box, CORINFO_CLASS_HANDLE type, void* data); FCDECL0(VOID, JIT_PollGC); -BOOL ObjIsInstanceOf(Object *pObject, TypeHandle toTypeHnd, BOOL throwCastException = FALSE); -BOOL ObjIsInstanceOfCore(Object* pObject, TypeHandle toTypeHnd, BOOL throwCastException = FALSE); +bool ObjIsInstanceOf(Object *pObject, TypeHandle toTypeHnd, bool throwCastException = FALSE); +bool ObjIsInstanceOfCore(Object* pObject, TypeHandle toTypeHnd, bool throwCastException = FALSE); EXTERN_C TypeHandle::CastResult STDCALL ObjIsInstanceOfCached(Object *pObject, TypeHandle toTypeHnd); diff --git a/src/coreclr/zap/zapinfo.cpp b/src/coreclr/zap/zapinfo.cpp index 5fc99640df579..986da73d2ed48 100644 --- a/src/coreclr/zap/zapinfo.cpp +++ b/src/coreclr/zap/zapinfo.cpp @@ -560,12 +560,12 @@ void ZapInfo::CompileMethod() #ifndef FEATURE_FULL_NGEN class MethodCodeComparer { - static BOOL NodeEquals(ZapNode * k1, ZapNode * k2) + static bool NodeEquals(ZapNode * k1, ZapNode * k2) { return k1 == k2; } - static BOOL BlobEquals(ZapBlob * k1, ZapBlob * k2) + static bool BlobEquals(ZapBlob * k1, ZapBlob * k2) { if (k1 == NULL && k2 == NULL) return TRUE; @@ -582,7 +582,7 @@ class MethodCodeComparer typedef ZapNode * EquivalentNodes[4][2]; - static BOOL EquivalentNode(ZapNode * k1, ZapNode * k2, EquivalentNodes & equivalentNodes) + static bool EquivalentNode(ZapNode * k1, ZapNode * k2, EquivalentNodes & equivalentNodes) { if (k1 == k2) return TRUE; @@ -596,7 +596,7 @@ class MethodCodeComparer return FALSE; } - static BOOL BlobWithRelocsEquals(ZapBlobWithRelocs * k1, ZapBlobWithRelocs * k2, EquivalentNodes & equivalentNodes) + static bool BlobWithRelocsEquals(ZapBlobWithRelocs * k1, ZapBlobWithRelocs * k2, EquivalentNodes & equivalentNodes) { if (k1 == NULL && k2 == NULL) return TRUE; @@ -630,7 +630,7 @@ class MethodCodeComparer return TRUE; } - static BOOL UnwindInfoEquals(ZapUnwindInfo * k1, ZapUnwindInfo * k2, EquivalentNodes & equivalentNodes) + static bool UnwindInfoEquals(ZapUnwindInfo * k1, ZapUnwindInfo * k2, EquivalentNodes & equivalentNodes) { if (k1 == NULL && k2 == NULL) return TRUE; @@ -643,7 +643,7 @@ class MethodCodeComparer EquivalentNode(k1->GetCode(), k2->GetCode(), equivalentNodes); } - static BOOL UnwindInfoFragmentsEquals(ZapUnwindInfo * k1, ZapUnwindInfo * k2, EquivalentNodes & equivalentNodes) + static bool UnwindInfoFragmentsEquals(ZapUnwindInfo * k1, ZapUnwindInfo * k2, EquivalentNodes & equivalentNodes) { if (k1 == NULL && k2 == NULL) return TRUE; @@ -661,7 +661,7 @@ class MethodCodeComparer return TRUE; } - static BOOL FixupListEquals(ZapImport ** k1, ZapImport ** k2) + static bool FixupListEquals(ZapImport ** k1, ZapImport ** k2) { if (k1 == NULL && k2 == NULL) return TRUE; @@ -679,7 +679,7 @@ class MethodCodeComparer } public: - static BOOL MethodCodeEquals(ZapMethodHeader * k1, ZapMethodHeader * k2) + static bool MethodCodeEquals(ZapMethodHeader * k1, ZapMethodHeader * k2) { LIMITED_METHOD_CONTRACT; @@ -730,9 +730,9 @@ class MethodCodeComparer } }; -extern BOOL CanDeduplicateCode(CORINFO_METHOD_HANDLE method, CORINFO_METHOD_HANDLE duplicateMethod); +extern bool CanDeduplicateCode(CORINFO_METHOD_HANDLE method, CORINFO_METHOD_HANDLE duplicateMethod); -BOOL ZapImage::MethodCodeTraits::Equals(key_t k1, key_t k2) +bool ZapImage::MethodCodeTraits::Equals(key_t k1, key_t k2) { if (!MethodCodeComparer::MethodCodeEquals(k1, k2)) return FALSE; @@ -1139,7 +1139,7 @@ void ZapInfo::allocMem( m_pImage->m_stats->m_nativeColdCodeSize += coldCodeSize; m_pImage->m_stats->m_nativeRODataSize += roDataSize; - BOOL haveProfileData = CurrentMethodHasProfileData(); + bool haveProfileData = CurrentMethodHasProfileData(); if (haveProfileData) { @@ -1484,7 +1484,7 @@ CORINFO_MODULE_HANDLE ZapInfo::embedModuleHandle(CORINFO_MODULE_HANDLE handle, ThrowHR(E_NOTIMPL); } - BOOL fHardbound = m_pImage->m_pPreloader->CanEmbedModuleHandle(handle); + bool fHardbound = m_pImage->m_pPreloader->CanEmbedModuleHandle(handle); if (fHardbound) { if (handle == m_pImage->m_hModule) @@ -1528,7 +1528,7 @@ CORINFO_CLASS_HANDLE ZapInfo::embedClassHandle(CORINFO_CLASS_HANDLE handle, m_pImage->m_pPreloader->AddTypeToTransitiveClosureOfInstantiations(handle); - BOOL fHardbound = m_pImage->m_pPreloader->CanEmbedClassHandle(handle); + bool fHardbound = m_pImage->m_pPreloader->CanEmbedClassHandle(handle); if (fHardbound) { CORINFO_MODULE_HANDLE moduleHandle = m_pEECompileInfo->GetLoaderModuleForEmbeddableType(handle); @@ -1567,7 +1567,7 @@ CORINFO_FIELD_HANDLE ZapInfo::embedFieldHandle(CORINFO_FIELD_HANDLE handle, m_pImage->m_pPreloader->AddTypeToTransitiveClosureOfInstantiations(m_pEEJitInfo->getFieldClass(handle)); - BOOL fHardbound = m_pImage->m_pPreloader->CanEmbedFieldHandle(handle); + bool fHardbound = m_pImage->m_pPreloader->CanEmbedFieldHandle(handle); if (fHardbound) { CORINFO_MODULE_HANDLE moduleHandle = m_pEECompileInfo->GetLoaderModuleForEmbeddableField(handle); @@ -1909,7 +1909,7 @@ void ZapInfo::AppendImport(ZapImport * pImport) // PVOID ZapInfo::embedDirectCall(CORINFO_METHOD_HANDLE ftn, CORINFO_ACCESS_FLAGS accessFlags, - BOOL fAllowThunk) + bool fAllowThunk) { if (!m_pImage->m_pPreloader->CanEmbedFunctionEntryPoint(ftn, m_currentMethodHandle, accessFlags)) { @@ -1944,9 +1944,9 @@ PVOID ZapInfo::embedDirectCall(CORINFO_METHOD_HANDLE ftn, return pEntryPointOrThunkToEmbed; } -bool ZapInfo::notifyInstructionSetUsage(CORINFO_InstructionSet instructionSet, bool supportEnabled) +void ZapInfo::notifyInstructionSetUsage(CORINFO_InstructionSet instructionSet, bool supportEnabled) { - return m_pEEJitInfo->notifyInstructionSetUsage(instructionSet, supportEnabled); + m_pEEJitInfo->notifyInstructionSetUsage(instructionSet, supportEnabled); } void ZapInfo::getFunctionEntryPoint( @@ -2457,7 +2457,7 @@ void ZapInfo::getCallInfo(CORINFO_RESOLVED_TOKEN * pResolvedToken, ZapImport * pImport; - if (flags & CORINFO_CALLINFO_LDFTN) + if (flags & (CORINFO_CALLINFO_LDFTN | CORINFO_CALLINFO_ATYPICAL_CALLSITE)) { pImport = m_pImage->GetImportTable()->GetMethodImport(ENCODE_METHOD_ENTRY, pResult->hMethod, pResolvedToken, pConstrainedResolvedToken); @@ -2495,7 +2495,10 @@ void ZapInfo::getCallInfo(CORINFO_RESOLVED_TOKEN * pResolvedToken, #ifdef FEATURE_READYTORUN_COMPILER if (IsReadyToRunCompilation() && !pResult->exactContextNeedsRuntimeLookup) { - ZapImport * pImport = m_pImage->GetImportTable()->GetDynamicHelperCell(ENCODE_VIRTUAL_ENTRY, pResult->hMethod, pResolvedToken); + DWORD fAtypicalCallsite = (flags & CORINFO_CALLINFO_ATYPICAL_CALLSITE) ? CORINFO_HELP_READYTORUN_ATYPICAL_CALLSITE : 0; + + ZapImport * pImport = m_pImage->GetImportTable()->GetDynamicHelperCell( + (CORCOMPILE_FIXUP_BLOB_KIND)(ENCODE_VIRTUAL_ENTRY | fAtypicalCallsite), pResult->hMethod, pResolvedToken); pResult->codePointerLookup.constLookup.accessType = IAT_PVALUE; pResult->codePointerLookup.constLookup.addr = pImport; @@ -3143,6 +3146,8 @@ void ZapInfo::getFieldInfo (CORINFO_RESOLVED_TOKEN * pResolvedToken, ThrowHR(E_NOTIMPL); } + DWORD fAtypicalCallsite = (flags & CORINFO_ACCESS_ATYPICAL_CALLSITE) ? CORINFO_HELP_READYTORUN_ATYPICAL_CALLSITE : 0; + switch (pResult->fieldAccessor) { case CORINFO_FIELD_INSTANCE: @@ -3250,7 +3255,8 @@ void ZapInfo::getFieldInfo (CORINFO_RESOLVED_TOKEN * pResolvedToken, UNREACHABLE_MSG("Unexpected static helper"); } - ZapImport * pImport = m_pImage->GetImportTable()->GetDynamicHelperCell(kind, pResolvedToken->hClass); + ZapImport * pImport = m_pImage->GetImportTable()->GetDynamicHelperCell( + (CORCOMPILE_FIXUP_BLOB_KIND)(kind | fAtypicalCallsite), pResolvedToken->hClass); pResult->fieldLookup.accessType = IAT_PVALUE; pResult->fieldLookup.addr = pImport; @@ -3259,7 +3265,8 @@ void ZapInfo::getFieldInfo (CORINFO_RESOLVED_TOKEN * pResolvedToken, } else { - ZapImport * pImport = m_pImage->GetImportTable()->GetDynamicHelperCell(ENCODE_FIELD_ADDRESS, pResolvedToken->hField, pResolvedToken); + ZapImport * pImport = m_pImage->GetImportTable()->GetDynamicHelperCell( + (CORCOMPILE_FIXUP_BLOB_KIND)(ENCODE_FIELD_ADDRESS | fAtypicalCallsite), pResolvedToken->hField, pResolvedToken); pResult->fieldLookup.accessType = IAT_PVALUE; pResult->fieldLookup.addr = pImport; @@ -3718,34 +3725,40 @@ bool ZapInfo::getReadyToRunHelper(CORINFO_RESOLVED_TOKEN * pResolvedToken, ZapImport * pImport = NULL; - bool ignoredSideEffects = false; + DWORD fAtypicalCallsite = (id & CORINFO_HELP_READYTORUN_ATYPICAL_CALLSITE); + id = (CorInfoHelpFunc)(id & ~CORINFO_HELP_READYTORUN_ATYPICAL_CALLSITE); + switch (id) { case CORINFO_HELP_READYTORUN_NEW: // Call CEEInfo::getNewHelper to validate the request (e.g., check for abstract class). - m_pEEJitInfo->getNewHelper(pResolvedToken, m_currentMethodHandle, &ignoredSideEffects); + m_pEEJitInfo->getNewHelper(pResolvedToken, m_currentMethodHandle); if ((getClassAttribs(pResolvedToken->hClass) & CORINFO_FLG_SHAREDINST) != 0) return false; // Requires runtime lookup. - pImport = m_pImage->GetImportTable()->GetDynamicHelperCell(ENCODE_NEW_HELPER, pResolvedToken->hClass); + pImport = m_pImage->GetImportTable()->GetDynamicHelperCell( + (CORCOMPILE_FIXUP_BLOB_KIND)(ENCODE_NEW_HELPER | fAtypicalCallsite), pResolvedToken->hClass); break; case CORINFO_HELP_READYTORUN_NEWARR_1: if ((getClassAttribs(pResolvedToken->hClass) & CORINFO_FLG_SHAREDINST) != 0) return false; // Requires runtime lookup. - pImport = m_pImage->GetImportTable()->GetDynamicHelperCell(ENCODE_NEW_ARRAY_HELPER, pResolvedToken->hClass); + pImport = m_pImage->GetImportTable()->GetDynamicHelperCell( + (CORCOMPILE_FIXUP_BLOB_KIND)(ENCODE_NEW_ARRAY_HELPER | fAtypicalCallsite), pResolvedToken->hClass); break; case CORINFO_HELP_READYTORUN_ISINSTANCEOF: if ((getClassAttribs(pResolvedToken->hClass) & CORINFO_FLG_SHAREDINST) != 0) return false; // Requires runtime lookup. - pImport = m_pImage->GetImportTable()->GetDynamicHelperCell(ENCODE_ISINSTANCEOF_HELPER, pResolvedToken->hClass); + pImport = m_pImage->GetImportTable()->GetDynamicHelperCell( + (CORCOMPILE_FIXUP_BLOB_KIND)(ENCODE_ISINSTANCEOF_HELPER | fAtypicalCallsite), pResolvedToken->hClass); break; case CORINFO_HELP_READYTORUN_CHKCAST: if ((getClassAttribs(pResolvedToken->hClass) & CORINFO_FLG_SHAREDINST) != 0) return false; // Requires runtime lookup. - pImport = m_pImage->GetImportTable()->GetDynamicHelperCell(ENCODE_CHKCAST_HELPER, pResolvedToken->hClass); + pImport = m_pImage->GetImportTable()->GetDynamicHelperCell( + (CORCOMPILE_FIXUP_BLOB_KIND)(ENCODE_CHKCAST_HELPER | fAtypicalCallsite), pResolvedToken->hClass); break; case CORINFO_HELP_READYTORUN_STATIC_BASE: @@ -3753,7 +3766,8 @@ bool ZapInfo::getReadyToRunHelper(CORINFO_RESOLVED_TOKEN * pResolvedToken, return false; // Requires runtime lookup. if (m_pImage->GetCompileInfo()->IsInCurrentVersionBubble(m_pEEJitInfo->getClassModule(pResolvedToken->hClass))) { - pImport = m_pImage->GetImportTable()->GetDynamicHelperCell(ENCODE_CCTOR_TRIGGER, pResolvedToken->hClass); + pImport = m_pImage->GetImportTable()->GetDynamicHelperCell( + (CORCOMPILE_FIXUP_BLOB_KIND)(ENCODE_CCTOR_TRIGGER | fAtypicalCallsite), pResolvedToken->hClass); } else { @@ -3769,18 +3783,18 @@ bool ZapInfo::getReadyToRunHelper(CORINFO_RESOLVED_TOKEN * pResolvedToken, if (pGenericLookupKind->runtimeLookupKind == CORINFO_LOOKUP_METHODPARAM) { pImport = m_pImage->GetImportTable()->GetDictionaryLookupCell( - ENCODE_DICTIONARY_LOOKUP_METHOD, m_currentMethodHandle, pResolvedToken, pGenericLookupKind); + (CORCOMPILE_FIXUP_BLOB_KIND)(ENCODE_DICTIONARY_LOOKUP_METHOD | fAtypicalCallsite), m_currentMethodHandle, pResolvedToken, pGenericLookupKind); } else if (pGenericLookupKind->runtimeLookupKind == CORINFO_LOOKUP_THISOBJ) { pImport = m_pImage->GetImportTable()->GetDictionaryLookupCell( - ENCODE_DICTIONARY_LOOKUP_THISOBJ, m_currentMethodHandle, pResolvedToken, pGenericLookupKind); + (CORCOMPILE_FIXUP_BLOB_KIND)(ENCODE_DICTIONARY_LOOKUP_THISOBJ | fAtypicalCallsite), m_currentMethodHandle, pResolvedToken, pGenericLookupKind); } else { _ASSERTE(pGenericLookupKind->runtimeLookupKind == CORINFO_LOOKUP_CLASSPARAM); pImport = m_pImage->GetImportTable()->GetDictionaryLookupCell( - ENCODE_DICTIONARY_LOOKUP_TYPE, m_currentMethodHandle, pResolvedToken, pGenericLookupKind); + (CORCOMPILE_FIXUP_BLOB_KIND)(ENCODE_DICTIONARY_LOOKUP_TYPE | fAtypicalCallsite), m_currentMethodHandle, pResolvedToken, pGenericLookupKind); } break; @@ -3996,9 +4010,9 @@ void ZapInfo::getMethodVTableOffset(CORINFO_METHOD_HANDLE method, m_pEEJitInfo->getMethodVTableOffset(method, pOffsetOfIndirection, pOffsetAfterIndirection, isRelative); } -bool ZapInfo::tryResolveVirtualMethod(CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT* virtualMethodContext) +bool ZapInfo::resolveVirtualMethod(CORINFO_DEVIRTUALIZATION_INFO * info) { - return m_pEEJitInfo->tryResolveVirtualMethod(virtualMethodContext); + return m_pEEJitInfo->resolveVirtualMethod(info); } CORINFO_METHOD_HANDLE ZapInfo::getUnboxedEntry( @@ -4205,7 +4219,7 @@ template<> void LoadTable::EmitLoadFixups(CORINFO_METHOD_ } } -BOOL ZapInfo::CurrentMethodHasProfileData() +bool ZapInfo::CurrentMethodHasProfileData() { WRAPPER_NO_CONTRACT; UINT32 size; diff --git a/src/coreclr/zap/zapinfo.h b/src/coreclr/zap/zapinfo.h index e1df5e920b9bf..6c95f55c1fb58 100644 --- a/src/coreclr/zap/zapinfo.h +++ b/src/coreclr/zap/zapinfo.h @@ -53,7 +53,7 @@ class LoadTable LIMITED_METHOD_CONTRACT; return e.handle; } - static BOOL Equals(key_t k1, key_t k2) + static bool Equals(key_t k1, key_t k2) { LIMITED_METHOD_CONTRACT; return k1 == k2; @@ -85,7 +85,7 @@ class LoadTable // fixed=FALSE if the caller needs an explicit fixup. We will emit an // explicit fixup for 'handle' if there are no other implicit fixups. - void Load(HandleType handle, BOOL fixed) + void Load(HandleType handle, bool fixed) { CONTRACTL { @@ -201,7 +201,7 @@ class ZapInfo LIMITED_METHOD_CONTRACT; return e.pImport; } - static BOOL Equals(key_t k1, key_t k2) + static bool Equals(key_t k1, key_t k2) { LIMITED_METHOD_CONTRACT; return k1 == k2; @@ -242,13 +242,13 @@ class ZapInfo void ProcessReferences(); - BOOL CurrentMethodHasProfileData(); + bool CurrentMethodHasProfileData(); void embedGenericSignature(CORINFO_LOOKUP * pLookup); PVOID embedDirectCall(CORINFO_METHOD_HANDLE ftn, CORINFO_ACCESS_FLAGS accessFlags, - BOOL fAllowThunk); + bool fAllowThunk); public: ZapInfo(ZapImage * pImage, mdMethodDef md, CORINFO_METHOD_HANDLE handle, CORINFO_MODULE_HANDLE module, unsigned methodProfilingDataFlags); @@ -367,7 +367,7 @@ class ZapInfo CORINFO_RESOLVED_TOKEN * pResolvedToken, bool fMustConvert); - bool notifyInstructionSetUsage(CORINFO_InstructionSet instructionSet, bool supportEnabled); + void notifyInstructionSetUsage(CORINFO_InstructionSet instructionSet, bool supportEnabled); void getFunctionEntryPoint( CORINFO_METHOD_HANDLE ftn, /* IN */ @@ -547,7 +547,7 @@ class ZapInfo unsigned getClassNumInstanceFields(CORINFO_CLASS_HANDLE cls); - CorInfoHelpFunc getNewHelper(CORINFO_RESOLVED_TOKEN * pResolvedToken, CORINFO_METHOD_HANDLE callerHandle, bool * pHasSideEffects); + CorInfoHelpFunc getNewHelper(CORINFO_RESOLVED_TOKEN * pResolvedToken, CORINFO_METHOD_HANDLE callerHandle, bool * pHasSideEffects = NULL); CorInfoHelpFunc getCastingHelper(CORINFO_RESOLVED_TOKEN * pResolvedToken, bool fThrowing); CorInfoHelpFunc getNewArrHelper(CORINFO_CLASS_HANDLE arrayCls); CorInfoHelpFunc getSharedCCtorHelper(CORINFO_CLASS_HANDLE clsHnd); @@ -675,7 +675,7 @@ class ZapInfo unsigned * pOffsetAfterIndirection, bool * isRelative); - bool tryResolveVirtualMethod(CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT* virtualMethodContext); + bool resolveVirtualMethod(CORINFO_DEVIRTUALIZATION_INFO * info); CORINFO_METHOD_HANDLE getUnboxedEntry( CORINFO_METHOD_HANDLE ftn,