From 618cfb2219cd92ce1a6c0938ad92bb38c91bfc25 Mon Sep 17 00:00:00 2001 From: Sergey Prytkov Date: Wed, 21 Oct 2020 02:02:36 +0300 Subject: [PATCH 01/29] added FindOrCreateAssociatedMethodDesc call to resolveVirtualMethodHelper --- src/coreclr/vm/jitinterface.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/coreclr/vm/jitinterface.cpp b/src/coreclr/vm/jitinterface.cpp index 8e95aaa372622..c9e6a16762732 100644 --- a/src/coreclr/vm/jitinterface.cpp +++ b/src/coreclr/vm/jitinterface.cpp @@ -8937,12 +8937,19 @@ bool CEEInfo::resolveVirtualMethodHelper(CORINFO_DEVIRTUALIZATION_INFO * info) return false; } - // If we devirtualized into a default interface method on a generic type, we should actually return an - // instantiating stub but this is not happening. - // Making this work is tracked by https://github.com/dotnet/runtime/issues/9588 if (pDevirtMD->GetMethodTable()->IsInterface() && pDevirtMD->HasClassInstantiation()) { - return false; + if (!pDevirtMD->IsInstantiatingStub()) + { + pDevirtMD = MethodDesc::FindOrCreateAssociatedMethodDesc( + pDevirtMD, + pDerivedMT, + FALSE, // forceBoxedEntryPoint + pDevirtMD->GetMethodInstantiation(), // for method themselves that are generic + FALSE, // allowInstParam + TRUE // forceRemoteableMethod + ); + } } } else From 88e6885fc9954649b38da3cc36a443da038c5a61 Mon Sep 17 00:00:00 2001 From: Sergey Prytkov Date: Wed, 21 Oct 2020 02:44:02 +0300 Subject: [PATCH 02/29] added assertion --- src/coreclr/vm/jitinterface.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/coreclr/vm/jitinterface.cpp b/src/coreclr/vm/jitinterface.cpp index c9e6a16762732..e9886409af3eb 100644 --- a/src/coreclr/vm/jitinterface.cpp +++ b/src/coreclr/vm/jitinterface.cpp @@ -8949,6 +8949,7 @@ bool CEEInfo::resolveVirtualMethodHelper(CORINFO_DEVIRTUALIZATION_INFO * info) FALSE, // allowInstParam TRUE // forceRemoteableMethod ); + _ASSERTE(pDevirtMD->IsInstantiatingStub()); } } } From f64d64197768c454329f2bedfa2d5d879f939af2 Mon Sep 17 00:00:00 2001 From: Rattenkrieg Date: Wed, 21 Oct 2020 17:04:30 +0300 Subject: [PATCH 03/29] beware of valuetypes --- src/coreclr/vm/jitinterface.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/coreclr/vm/jitinterface.cpp b/src/coreclr/vm/jitinterface.cpp index e9886409af3eb..10100e7de4f4e 100644 --- a/src/coreclr/vm/jitinterface.cpp +++ b/src/coreclr/vm/jitinterface.cpp @@ -8944,10 +8944,10 @@ bool CEEInfo::resolveVirtualMethodHelper(CORINFO_DEVIRTUALIZATION_INFO * info) pDevirtMD = MethodDesc::FindOrCreateAssociatedMethodDesc( pDevirtMD, pDerivedMT, - FALSE, // forceBoxedEntryPoint - pDevirtMD->GetMethodInstantiation(), // for method themselves that are generic - FALSE, // allowInstParam - TRUE // forceRemoteableMethod + (!pDerivedMT->IsStatic() && pDerivedMT->GetMethodTable()->IsValueType()), // forceBoxedEntryPoint + pDevirtMD->GetMethodInstantiation(), // for method themselves that are generic + FALSE, // don't want MD that requires inst. arguments + TRUE // ensure that methods on generic interfaces are returned as instantiated method descs ); _ASSERTE(pDevirtMD->IsInstantiatingStub()); } From d5d91e88031962d74253ffba9fdef9932eacc674 Mon Sep 17 00:00:00 2001 From: Rattenkrieg Date: Wed, 21 Oct 2020 17:09:17 +0300 Subject: [PATCH 04/29] fix copypaste --- src/coreclr/vm/jitinterface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/vm/jitinterface.cpp b/src/coreclr/vm/jitinterface.cpp index 10100e7de4f4e..8df5b78973ea6 100644 --- a/src/coreclr/vm/jitinterface.cpp +++ b/src/coreclr/vm/jitinterface.cpp @@ -8944,7 +8944,7 @@ bool CEEInfo::resolveVirtualMethodHelper(CORINFO_DEVIRTUALIZATION_INFO * info) pDevirtMD = MethodDesc::FindOrCreateAssociatedMethodDesc( pDevirtMD, pDerivedMT, - (!pDerivedMT->IsStatic() && pDerivedMT->GetMethodTable()->IsValueType()), // forceBoxedEntryPoint + (!pDevirtMD->IsStatic() && pDerivedMT->IsValueType()), // forceBoxedEntryPoint pDevirtMD->GetMethodInstantiation(), // for method themselves that are generic FALSE, // don't want MD that requires inst. arguments TRUE // ensure that methods on generic interfaces are returned as instantiated method descs From 88d5e9fb5b399eb48b5abcba0d10bc7891a31fc1 Mon Sep 17 00:00:00 2001 From: Rattenkrieg Date: Wed, 21 Oct 2020 17:24:57 +0300 Subject: [PATCH 05/29] fix assertion --- src/coreclr/vm/jitinterface.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/coreclr/vm/jitinterface.cpp b/src/coreclr/vm/jitinterface.cpp index 8df5b78973ea6..571cf5a39d64f 100644 --- a/src/coreclr/vm/jitinterface.cpp +++ b/src/coreclr/vm/jitinterface.cpp @@ -8945,11 +8945,11 @@ bool CEEInfo::resolveVirtualMethodHelper(CORINFO_DEVIRTUALIZATION_INFO * info) pDevirtMD, pDerivedMT, (!pDevirtMD->IsStatic() && pDerivedMT->IsValueType()), // forceBoxedEntryPoint - pDevirtMD->GetMethodInstantiation(), // for method themselves that are generic - FALSE, // don't want MD that requires inst. arguments - TRUE // ensure that methods on generic interfaces are returned as instantiated method descs + pDevirtMD->GetMethodInstantiation(), // for method themselves that are generic + FALSE, // don't want MD that requires inst. arguments + TRUE // ensure that methods on generic interfaces are returned as instantiated method descs ); - _ASSERTE(pDevirtMD->IsInstantiatingStub()); + _ASSERTE(pDevirtMD->IsWrapperStub()); } } } From a129821cc804fedd93f0dd26371c6edd48258f67 Mon Sep 17 00:00:00 2001 From: Rattenkrieg Date: Thu, 22 Oct 2020 15:12:17 +0300 Subject: [PATCH 06/29] don't create instantiating stubs for value types --- src/coreclr/vm/jitinterface.cpp | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/coreclr/vm/jitinterface.cpp b/src/coreclr/vm/jitinterface.cpp index 571cf5a39d64f..12adfe759459f 100644 --- a/src/coreclr/vm/jitinterface.cpp +++ b/src/coreclr/vm/jitinterface.cpp @@ -8941,15 +8941,22 @@ bool CEEInfo::resolveVirtualMethodHelper(CORINFO_DEVIRTUALIZATION_INFO * info) { if (!pDevirtMD->IsInstantiatingStub()) { - pDevirtMD = MethodDesc::FindOrCreateAssociatedMethodDesc( - pDevirtMD, - pDerivedMT, - (!pDevirtMD->IsStatic() && pDerivedMT->IsValueType()), // forceBoxedEntryPoint - pDevirtMD->GetMethodInstantiation(), // for method themselves that are generic - FALSE, // don't want MD that requires inst. arguments - TRUE // ensure that methods on generic interfaces are returned as instantiated method descs - ); - _ASSERTE(pDevirtMD->IsWrapperStub()); + if (pDerivedMT->IsValueType()) + { + return nullptr; + } + else + { + pDevirtMD = MethodDesc::FindOrCreateAssociatedMethodDesc( + pDevirtMD, + pDerivedMT, + FALSE, // forceBoxedEntryPoint + pDevirtMD->GetMethodInstantiation(), // for method themselves that are generic + FALSE, // don't want MD that requires inst. arguments + TRUE // ensure that methods on generic interfaces are returned as instantiated method descs + ); + _ASSERTE(pDevirtMD->IsInstantiatingStub()); + } } } } From 380351cce0fad7408edc9828e968cd2147abe95b Mon Sep 17 00:00:00 2001 From: Rattenkrieg Date: Tue, 27 Oct 2020 18:20:41 +0300 Subject: [PATCH 07/29] callsite stub generic type handle parameter passing for devirtualized methods --- .../superpmi-shared/methodcontext.cpp | 42 ++++---- .../superpmi/superpmi-shared/methodcontext.h | 28 +++--- .../superpmi-shim-collector/icorjitinfo.cpp | 12 ++- .../ToolBox/superpmi/superpmi/icorjitinfo.cpp | 10 +- src/coreclr/inc/corinfo.h | 10 +- src/coreclr/jit/ICorJitInfo_API_wrapper.hpp | 10 +- src/coreclr/jit/flowgraph.cpp | 3 +- src/coreclr/jit/importer.cpp | 98 ++++++++++++++++--- src/coreclr/jit/indirectcalltransformer.cpp | 3 +- .../ThunkGenerator/ThunkInput.txt | 4 +- src/coreclr/vm/jitinterface.cpp | 69 +++++++------ src/coreclr/vm/jitinterface.h | 15 ++- src/coreclr/vm/method.hpp | 2 +- src/coreclr/vm/methodtable.h | 1 + src/coreclr/zap/zapinfo.cpp | 8 +- src/coreclr/zap/zapinfo.h | 6 +- src/tests/JIT/devirt/precise_context.cs | 21 ++++ src/tests/JIT/devirt/precise_context.csproj | 13 +++ 18 files changed, 259 insertions(+), 96 deletions(-) create mode 100644 src/tests/JIT/devirt/precise_context.cs create mode 100644 src/tests/JIT/devirt/precise_context.csproj diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.cpp b/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.cpp index 00d88a6b10a66..5a594c685ecef 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.cpp +++ b/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.cpp @@ -3073,24 +3073,25 @@ void MethodContext::repGetMethodVTableOffset(CORINFO_METHOD_HANDLE method, DEBUG_REP(dmpGetMethodVTableOffset((DWORDLONG)method, value)); } -void MethodContext::recResolveVirtualMethod(CORINFO_DEVIRTUALIZATION_INFO * info, bool returnValue) +void MethodContext::recResolveVirtualMethod(CORINFO_METHOD_HANDLE virtMethod, + CORINFO_CLASS_HANDLE implClass, + CORINFO_CONTEXT_HANDLE ownerType, + bool* requiresInstMethodTableArg, + CORINFO_METHOD_HANDLE result) { if (ResolveVirtualMethod == nullptr) { ResolveVirtualMethod = new LightWeightMap(); } - 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)); + Agnostic_ResolveVirtualMethod key; + key.virtualMethod = (DWORDLONG)virtMethod; + key.implementingClass = (DWORDLONG)implClass; + key.ownerType = (DWORDLONG)ownerType; + key.requiresInstMethodTableArg = *requiresInstMethodTableArg ? 1 : 0; // it's out param, do we need this stuff idk + + ResolveVirtualMethod->Add(key, (DWORDLONG)result); + DEBUG_REC(dmpResolveVirtualMethod(key, (DWORDLONG)result)); } void MethodContext::dmpResolveVirtualMethod(const Agnostic_ResolveVirtualMethodKey& key, const Agnostic_ResolveVirtualMethodResult& result) @@ -3099,12 +3100,16 @@ void MethodContext::dmpResolveVirtualMethod(const Agnostic_ResolveVirtualMethodK key.virtualMethod, key.objClass, key.context, result.returnValue, result.devirtualizedMethod, result.requiresInstMethodTableArg, result.exactContext); } -bool MethodContext::repResolveVirtualMethod(CORINFO_DEVIRTUALIZATION_INFO * info) +CORINFO_METHOD_HANDLE MethodContext::repResolveVirtualMethod(CORINFO_METHOD_HANDLE virtMethod, + CORINFO_CLASS_HANDLE implClass, + CORINFO_CONTEXT_HANDLE ownerType, + bool* requiresInstMethodTableArg) { - Agnostic_ResolveVirtualMethodKey key; - key.virtualMethod = (DWORDLONG)info->virtualMethod; - key.objClass = (DWORDLONG)info->objClass; - key.context = (DWORDLONG)info->context; + Agnostic_ResolveVirtualMethod key; + key.virtualMethod = (DWORDLONG)virtMethod; + key.implementingClass = (DWORDLONG)implClass; + key.ownerType = (DWORDLONG)ownerType; + key.requiresInstMethodTableArg = *requiresInstMethodTableArg ? 1 : 0; AssertCodeMsg(ResolveVirtualMethod != nullptr, EXCEPTIONCODE_MC, "No ResolveVirtualMap map for %016llX-%016llX-%016llX", key.virtualMethod, key.objClass, key.context); @@ -3117,7 +3122,8 @@ bool MethodContext::repResolveVirtualMethod(CORINFO_DEVIRTUALIZATION_INFO * info info->requiresInstMethodTableArg = result.requiresInstMethodTableArg; info->exactContext = (CORINFO_CONTEXT_HANDLE) result.exactContext; - return result.returnValue; + *requiresInstMethodTableArg = (key.requiresInstMethodTableArg != 0); + return (CORINFO_METHOD_HANDLE)result; } void MethodContext::recGetUnboxedEntry(CORINFO_METHOD_HANDLE ftn, diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.h b/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.h index 1678a1069447a..d259f0f55a74d 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.h +++ b/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.h @@ -510,16 +510,9 @@ class MethodContext struct Agnostic_ResolveVirtualMethodKey { DWORDLONG virtualMethod; - DWORDLONG objClass; - DWORDLONG context; - }; - - struct Agnostic_ResolveVirtualMethodResult - { - bool returnValue; - DWORDLONG devirtualizedMethod; - bool requiresInstMethodTableArg; - DWORDLONG exactContext; + DWORDLONG implementingClass; + DWORDLONG ownerType; + DWORD requiresInstMethodTableArg; }; struct ResolveTokenValue @@ -935,9 +928,16 @@ class MethodContext unsigned* offsetAfterIndirection, bool* isRelative); - 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 recResolveVirtualMethod(CORINFO_METHOD_HANDLE virtMethod, + CORINFO_CLASS_HANDLE implClass, + CORINFO_CONTEXT_HANDLE ownerType, + bool* requiresInstMethodTableArg, + CORINFO_METHOD_HANDLE result); + void dmpResolveVirtualMethod(const Agnostic_ResolveVirtualMethod& key, DWORDLONG value); + CORINFO_METHOD_HANDLE repResolveVirtualMethod(CORINFO_METHOD_HANDLE virtMethod, + CORINFO_CLASS_HANDLE implClass, + CORINFO_CONTEXT_HANDLE ownerType, + bool* requiresInstMethodTableArg); void recGetUnboxedEntry(CORINFO_METHOD_HANDLE ftn, bool* requiresInstMethodTableArg, CORINFO_METHOD_HANDLE result); void dmpGetUnboxedEntry(DWORDLONG key, DLD value); @@ -1381,7 +1381,7 @@ class MethodContext }; // ********************* Please keep this up-to-date to ease adding more *************** -// Highest packet number: 184 +// Highest packet number: 180 // ************************************************************************************* enum mcPackets { diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp b/src/coreclr/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp index 90462003479c5..877fbcb260cba 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp +++ b/src/coreclr/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp @@ -230,11 +230,17 @@ void interceptor_ICJI::getMethodVTableOffset(CORINFO_METHOD_HANDLE method, mc->recGetMethodVTableOffset(method, offsetOfIndirection, offsetAfterIndirection, isRelative); } -bool interceptor_ICJI::resolveVirtualMethod(CORINFO_DEVIRTUALIZATION_INFO * info) +// Find the virtual method in implementingClass that overrides virtualMethod. +// Return null if devirtualization is not possible. +CORINFO_METHOD_HANDLE interceptor_ICJI::resolveVirtualMethod(CORINFO_METHOD_HANDLE virtualMethod, + CORINFO_CLASS_HANDLE implementingClass, + CORINFO_CONTEXT_HANDLE ownerType, + bool* requiresInstMethodTableArg) { mc->cr->AddCall("resolveVirtualMethod"); - bool result = original_ICorJitInfo->resolveVirtualMethod(info); - mc->recResolveVirtualMethod(info, result); + CORINFO_METHOD_HANDLE result = + original_ICorJitInfo->resolveVirtualMethod(virtualMethod, implementingClass, ownerType, requiresInstMethodTableArg); + mc->recResolveVirtualMethod(virtualMethod, implementingClass, ownerType, requiresInstMethodTableArg, result); return result; } diff --git a/src/coreclr/ToolBox/superpmi/superpmi/icorjitinfo.cpp b/src/coreclr/ToolBox/superpmi/superpmi/icorjitinfo.cpp index 0bbbd1f0e2532..f6414fe0765af 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi/icorjitinfo.cpp +++ b/src/coreclr/ToolBox/superpmi/superpmi/icorjitinfo.cpp @@ -171,10 +171,16 @@ void MyICJI::getMethodVTableOffset(CORINFO_METHOD_HANDLE method, jitInstance->mc->repGetMethodVTableOffset(method, offsetOfIndirection, offsetAfterIndirection, isRelative); } -bool MyICJI::resolveVirtualMethod(CORINFO_DEVIRTUALIZATION_INFO * info) +// Find the virtual method in implementingClass that overrides virtualMethod. +// Return null if devirtualization is not possible. +CORINFO_METHOD_HANDLE MyICJI::resolveVirtualMethod(CORINFO_METHOD_HANDLE virtualMethod, + CORINFO_CLASS_HANDLE implementingClass, + CORINFO_CONTEXT_HANDLE ownerType, + bool* requiresInstMethodTableArg) { jitInstance->mc->cr->AddCall("resolveVirtualMethod"); - bool result = jitInstance->mc->repResolveVirtualMethod(info); + CORINFO_METHOD_HANDLE result = + jitInstance->mc->repResolveVirtualMethod(virtualMethod, implementingClass, ownerType, requiresInstMethodTableArg); return result; } diff --git a/src/coreclr/inc/corinfo.h b/src/coreclr/inc/corinfo.h index 9992adfdb21a1..edef2e93694e7 100644 --- a/src/coreclr/inc/corinfo.h +++ b/src/coreclr/inc/corinfo.h @@ -2042,8 +2042,14 @@ class ICorStaticInfo // or the method in info->objClass that implements the interface method // represented by info->virtualMethod. // - // Returns false if devirtualization is not possible. - virtual bool resolveVirtualMethod(CORINFO_DEVIRTUALIZATION_INFO * info) = 0; + // Return null if devirtualization is not possible. Owner type is optional + // and provides additional context for shared interface devirtualization. + virtual CORINFO_METHOD_HANDLE resolveVirtualMethod( + CORINFO_METHOD_HANDLE virtualMethod, /* IN */ + CORINFO_CLASS_HANDLE implementingClass, /* IN */ + CORINFO_CONTEXT_HANDLE ownerType = NULL, /* IN */ + bool* requiresInstMethodTableArg = NULL /* OUT */ + ) = 0; // Get the unboxed entry point for a method, if possible. virtual CORINFO_METHOD_HANDLE getUnboxedEntry( diff --git a/src/coreclr/jit/ICorJitInfo_API_wrapper.hpp b/src/coreclr/jit/ICorJitInfo_API_wrapper.hpp index fb10358a4129f..cc49f2dfeb7fe 100644 --- a/src/coreclr/jit/ICorJitInfo_API_wrapper.hpp +++ b/src/coreclr/jit/ICorJitInfo_API_wrapper.hpp @@ -135,11 +135,15 @@ void WrapICorJitInfo::getMethodVTableOffset( API_LEAVE(getMethodVTableOffset); } -bool WrapICorJitInfo::resolveVirtualMethod( - CORINFO_DEVIRTUALIZATION_INFO* info) +CORINFO_METHOD_HANDLE WrapICorJitInfo::resolveVirtualMethod( + CORINFO_METHOD_HANDLE virtualMethod, /* IN */ + CORINFO_CLASS_HANDLE implementingClass, /* IN */ + CORINFO_CONTEXT_HANDLE ownerType = NULL, /* IN */ + bool* requiresInstMethodTableArg = NULL /* OUT */ + ) { API_ENTER(resolveVirtualMethod); - bool temp = wrapHnd->resolveVirtualMethod(info); + CORINFO_METHOD_HANDLE temp = wrapHnd->resolveVirtualMethod(virtualMethod, implementingClass, ownerType, requiresInstMethodTableArg); API_LEAVE(resolveVirtualMethod); return temp; } diff --git a/src/coreclr/jit/flowgraph.cpp b/src/coreclr/jit/flowgraph.cpp index f22c4cde83f81..f32eeefa911a9 100644 --- a/src/coreclr/jit/flowgraph.cpp +++ b/src/coreclr/jit/flowgraph.cpp @@ -23282,8 +23282,7 @@ Compiler::fgWalkResult Compiler::fgLateDevirtualization(GenTree** pTree, fgWalkD CORINFO_CONTEXT_HANDLE context = nullptr; const bool isLateDevirtualization = true; bool explicitTailCall = (call->AsCall()->gtCallMoreFlags & GTF_CALL_M_EXPLICIT_TAILCALL) != 0; - comp->impDevirtualizeCall(call, &method, &methodFlags, &context, nullptr, isLateDevirtualization, - explicitTailCall); + comp->impDevirtualizeCall(call, &method, &methodFlags, &context, nullptr, isLateDevirtualization, explicitTailCall); } } else if (tree->OperGet() == GT_ASG) diff --git a/src/coreclr/jit/importer.cpp b/src/coreclr/jit/importer.cpp index 20fcdfa90e347..11f1a70e79d29 100644 --- a/src/coreclr/jit/importer.cpp +++ b/src/coreclr/jit/importer.cpp @@ -8592,13 +8592,18 @@ var_types Compiler::impImportCall(OPCODE opcode, // (b) To shared-code instance methods in generic structs; the extra parameter // is the struct's type handle (a vtable ptr) // (c) To shared-code per-instantiation non-generic static methods in generic - // classes and structs; the extra parameter is the type handle + // classes, structs and default interface methods; the extra parameter is the type handle // (d) To shared-code generic methods; the extra parameter is an // exact-instantiation MethodDesc // // We also set the exact type context associated with the call so we can // inline the call correctly later on. + // after devirtulization it may appear that devirtualized method + // would require extra type handle arg + // it's tempting to reorder this branch two "ifs" below + // and generalize its logic for devirtualized method case + // but I'm afraid to break stuff if (sig->callConv & CORINFO_CALLCONV_PARAMTYPE) { assert(call->AsCall()->gtCallType == CT_USER_FUNC); @@ -20915,14 +20920,11 @@ void Compiler::impDevirtualizeCall(GenTreeCall* call, return; } - // Ask the runtime to determine the method that would be called based on the likely type. - // - CORINFO_DEVIRTUALIZATION_INFO dvInfo; - dvInfo.virtualMethod = baseMethod; - dvInfo.objClass = likelyClass; - dvInfo.context = *pContextHandle; - - bool canResolve = info.compCompHnd->resolveVirtualMethod(&dvInfo); + // 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 uniqueImplementingMethod = + info.compCompHnd->resolveVirtualMethod(baseMethod, uniqueImplementingClass, ownerType, &requiresInstMethodTableArg); if (!canResolve) { @@ -20953,8 +20955,14 @@ 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', - // and prepare to fetch the method attributes. + // 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 = info.compCompHnd->resolveVirtualMethod(baseMethod, objClass, ownerType, &requiresInstMethodTableArg); + + // If we failed to get a handle, we can't devirtualize. This can + // happen when prejitting, if the devirtualization crosses + // servicing bubble boundaries. // CORINFO_DEVIRTUALIZATION_INFO dvInfo; dvInfo.virtualMethod = baseMethod; @@ -21186,9 +21194,9 @@ void Compiler::impDevirtualizeCall(GenTreeCall* call, } // Note for some shared methods the unboxed entry point requires an extra parameter. - bool requiresInstMethodTableArg = false; + bool requiresInstMethodTableArgForUnboxedEntry = false; CORINFO_METHOD_HANDLE unboxedEntryMethod = - info.compCompHnd->getUnboxedEntry(derivedMethod, &requiresInstMethodTableArg); + info.compCompHnd->getUnboxedEntry(derivedMethod, &requiresInstMethodTableArgForUnboxedEntry); if (unboxedEntryMethod != nullptr) { @@ -21200,7 +21208,7 @@ void Compiler::impDevirtualizeCall(GenTreeCall* call, // // Ideally, we then inline the boxed method and and if it turns out not to modify // the copy, we can undo the copy too. - if (requiresInstMethodTableArg) + if (requiresInstMethodTableArgForUnboxedEntry) { // Perform a trial box removal and ask for the type handle tree. JITDUMP("Unboxed entry needs method table arg...\n"); @@ -21286,6 +21294,35 @@ void Compiler::impDevirtualizeCall(GenTreeCall* call, } } } + // there is no unboxed entry when we got devirtualized to DIM + else if (requiresInstMethodTableArg) + { + assert(((SIZE_T)ownerType & CORINFO_CONTEXTFLAGS_MASK) == CORINFO_CONTEXTFLAGS_CLASS); + CORINFO_CLASS_HANDLE exactClassHandle = eeGetClassFromContext(ownerType); + GenTree* instParam = gtNewIconEmbClsHndNode(exactClassHandle); + call->gtCallMethHnd = derivedMethod; + if ((Target::g_tgtArgOrder == Target::ARG_ORDER_R2L) || (call->gtCallArgs == nullptr)) + { + call->gtCallArgs = gtPrependNewCallArg(instParam, call->gtCallArgs); + } + // Append for non-empty L2R + else + { + GenTreeCall::Use* beforeArg = call->gtCallArgs; + while (beforeArg->GetNext() != nullptr) + { + beforeArg = beforeArg->GetNext(); + } + + beforeArg->SetNext(gtNewCallArgs(instParam)); + } + // do we need this? + for (GenTreeCall::Use& use : call->AsCall()->Args()) + { + call->gtFlags |= use.GetNode()->gtFlags & GTF_GLOB_EFFECT; + } + + } else { // Many of the low-level methods on value classes won't have unboxed entries, @@ -21296,6 +21333,39 @@ void Compiler::impDevirtualizeCall(GenTreeCall* call, JITDUMP("Sorry, failed to find unboxed entry point\n"); } } + // check wheter we have returned an instantiating stub for generic DIM + else if (isInterface) + { + if (requiresInstMethodTableArg) + { + assert(((SIZE_T)ownerType & CORINFO_CONTEXTFLAGS_MASK) == CORINFO_CONTEXTFLAGS_CLASS); + CORINFO_CLASS_HANDLE exactClassHandle = eeGetClassFromContext(ownerType); + GenTree* instParam = gtNewIconEmbClsHndNode(exactClassHandle); + call->gtCallMethHnd = derivedMethod; + if ((Target::g_tgtArgOrder == Target::ARG_ORDER_R2L) || (call->gtCallArgs == nullptr)) + { + call->gtCallArgs = gtPrependNewCallArg(instParam, call->gtCallArgs); + } + // Append for non-empty L2R + else + { + GenTreeCall::Use* beforeArg = call->gtCallArgs; + while (beforeArg->GetNext() != nullptr) + { + beforeArg = beforeArg->GetNext(); + } + + beforeArg->SetNext(gtNewCallArgs(instParam)); + } + // do we need this? + for (GenTreeCall::Use& use : call->AsCall()->Args()) + { + call->gtFlags |= use.GetNode()->gtFlags & GTF_GLOB_EFFECT; + } + } + + // should we patch call->gtCallMoreFlags ? + } // Need to update call info too. // diff --git a/src/coreclr/jit/indirectcalltransformer.cpp b/src/coreclr/jit/indirectcalltransformer.cpp index a26db2c4531c7..4473d41ca681a 100644 --- a/src/coreclr/jit/indirectcalltransformer.cpp +++ b/src/coreclr/jit/indirectcalltransformer.cpp @@ -712,8 +712,7 @@ class IndirectCallTransformer CORINFO_CONTEXT_HANDLE context = inlineInfo->exactContextHnd; const bool isLateDevirtualization = true; bool explicitTailCall = (call->AsCall()->gtCallMoreFlags & GTF_CALL_M_EXPLICIT_TAILCALL) != 0; - compiler->impDevirtualizeCall(call, &methodHnd, &methodFlags, &context, nullptr, isLateDevirtualization, - explicitTailCall); + compiler->impDevirtualizeCall(call, &methodHnd, &methodFlags, &context, nullptr, isLateDevirtualization, explicitTailCall); // Presumably devirt might fail? If so we should try and avoid // making this a guarded devirt candidate instead of ending diff --git a/src/coreclr/tools/Common/JitInterface/ThunkGenerator/ThunkInput.txt b/src/coreclr/tools/Common/JitInterface/ThunkGenerator/ThunkInput.txt index f83c4924ca240..1ab806ac32a1b 100644 --- a/src/coreclr/tools/Common/JitInterface/ThunkGenerator/ThunkInput.txt +++ b/src/coreclr/tools/Common/JitInterface/ThunkGenerator/ThunkInput.txt @@ -170,8 +170,8 @@ 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 resolveVirtualMethod(CORINFO_DEVIRTUALIZATION_INFO* info); - CORINFO_METHOD_HANDLE getUnboxedEntry(CORINFO_METHOD_HANDLE ftn, bool* requiresInstMethodTableArg); + CORINFO_METHOD_HANDLE resolveVirtualMethod( CORINFO_METHOD_HANDLE virtualMethod, CORINFO_CLASS_HANDLE implementingClass, CORINFO_CONTEXT_HANDLE ownerType, BOOL* requiresInstMethodTableArg); + 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); CorInfoIntrinsics getIntrinsicID( CORINFO_METHOD_HANDLE method , BoolStar pMustExpand); diff --git a/src/coreclr/vm/jitinterface.cpp b/src/coreclr/vm/jitinterface.cpp index 12adfe759459f..761b9d4393fbc 100644 --- a/src/coreclr/vm/jitinterface.cpp +++ b/src/coreclr/vm/jitinterface.cpp @@ -7762,7 +7762,7 @@ getMethodInfoHelper( ftn, false); - // Shared generic or static per-inst methods and shared methods on generic structs + // Shared generic or static per-inst methods, shared methods on generic structs and default interface methods // take an extra argument representing their instantiation if (ftn->RequiresInstArg()) methInfo->args.callConv = (CorInfoCallConv)(methInfo->args.callConv | CORINFO_CALLCONV_PARAMTYPE); @@ -8854,7 +8854,10 @@ void CEEInfo::getMethodVTableOffset (CORINFO_METHOD_HANDLE methodHnd, } /*********************************************************************/ -bool CEEInfo::resolveVirtualMethodHelper(CORINFO_DEVIRTUALIZATION_INFO * info) +CORINFO_METHOD_HANDLE CEEInfo::resolveVirtualMethodHelper(CORINFO_METHOD_HANDLE baseMethod, + CORINFO_CLASS_HANDLE derivedClass, + CORINFO_CONTEXT_HANDLE ownerType, + bool* requiresInstMethodTableArg) { CONTRACTL { THROWS; @@ -8906,17 +8909,20 @@ bool CEEInfo::resolveVirtualMethodHelper(CORINFO_DEVIRTUALIZATION_INFO * info) // // We must ensure that pObjMT actually implements the // interface corresponding to pBaseMD. - if (!pObjMT->CanCastToInterface(pBaseMT)) - { - return false; - } + BOOL canCastStraightForward = pDerivedMT->CanCastToInterface(pBaseMT); // For generic interface methods we must have context to // safely devirtualize. - if (info->context != nullptr) + MethodTable* pOwnerMT = nullptr; + if (ownerType != nullptr) { - TypeHandle OwnerClsHnd = GetTypeFromContext(info->context); - MethodTable* pOwnerMT = OwnerClsHnd.GetMethodTable(); + TypeHandle OwnerClsHnd = GetTypeFromContext(ownerType); + pOwnerMT = OwnerClsHnd.GetMethodTable(); + + if (!canCastStraightForward && !pOwnerMT->IsInterface() && !pDerivedMT->CanCastToInterface(pOwnerMT)) + { + return nullptr; + } // If the derived class is a shared class, make sure the // owner class is too. @@ -8927,6 +8933,10 @@ bool CEEInfo::resolveVirtualMethodHelper(CORINFO_DEVIRTUALIZATION_INFO * info) pDevirtMD = pObjMT->GetMethodDescForInterfaceMethod(TypeHandle(pOwnerMT), pBaseMD, FALSE /* throwOnConflict */); } + else if (!canCastStraightForward) + { + return nullptr; + } else if (!pBaseMD->HasClassOrMethodInstantiation()) { pDevirtMD = pObjMT->GetMethodDescForInterfaceMethod(pBaseMD, FALSE /* throwOnConflict */); @@ -8937,26 +8947,26 @@ bool CEEInfo::resolveVirtualMethodHelper(CORINFO_DEVIRTUALIZATION_INFO * info) return false; } + // default interface method + // we need to return *correct* instantiating stub + // generics over value types do not share code, so we should do nothing on caller site + // when `requiresInstMethodTableArg == false` if (pDevirtMD->GetMethodTable()->IsInterface() && pDevirtMD->HasClassInstantiation()) { - if (!pDevirtMD->IsInstantiatingStub()) + // since we are in DIM branch, that means + // call MethodTable::GetMethodDescForInterfaceMethod above returned to us + // either instantiating stub ie `pDevirtMD->IsWrapperStub() == true` + // or non shared generic instantiation ie is + _ASSERTE(pDevirtMD->IsWrapperStub() || !(pDevirtMD->GetMethodTable()->IsSharedByGenericInstantiations() || pDevirtMD->IsSharedByGenericMethodInstantiations())); + _ASSERTE(requiresInstMethodTableArg != nullptr); + if (pDevirtMD->IsWrapperStub()) { - if (pDerivedMT->IsValueType()) - { - return nullptr; - } - else - { - pDevirtMD = MethodDesc::FindOrCreateAssociatedMethodDesc( - pDevirtMD, - pDerivedMT, - FALSE, // forceBoxedEntryPoint - pDevirtMD->GetMethodInstantiation(), // for method themselves that are generic - FALSE, // don't want MD that requires inst. arguments - TRUE // ensure that methods on generic interfaces are returned as instantiated method descs - ); - _ASSERTE(pDevirtMD->IsInstantiatingStub()); - } + *requiresInstMethodTableArg = true; + pDevirtMD = pDevirtMD->GetExistingWrappedMethodDesc(); + } + else + { + *requiresInstMethodTableArg = false; } } } @@ -9055,7 +9065,10 @@ bool CEEInfo::resolveVirtualMethodHelper(CORINFO_DEVIRTUALIZATION_INFO * info) return true; } -bool CEEInfo::resolveVirtualMethod(CORINFO_DEVIRTUALIZATION_INFO * info) +CORINFO_METHOD_HANDLE CEEInfo::resolveVirtualMethod(CORINFO_METHOD_HANDLE methodHnd, + CORINFO_CLASS_HANDLE derivedClass, + CORINFO_CONTEXT_HANDLE ownerType, + bool* requiresInstMethodTableArg) { CONTRACTL { THROWS; @@ -9067,7 +9080,7 @@ bool CEEInfo::resolveVirtualMethod(CORINFO_DEVIRTUALIZATION_INFO * info) JIT_TO_EE_TRANSITION(); - result = resolveVirtualMethodHelper(info); + result = resolveVirtualMethodHelper(methodHnd, derivedClass, ownerType, requiresInstMethodTableArg); EE_TO_JIT_TRANSITION(); diff --git a/src/coreclr/vm/jitinterface.h b/src/coreclr/vm/jitinterface.h index 6ae9aa76c921c..827163d5506fc 100644 --- a/src/coreclr/vm/jitinterface.h +++ b/src/coreclr/vm/jitinterface.h @@ -732,8 +732,19 @@ class CEEInfo : public ICorJitInfo unsigned * pOffsetAfterIndirection, bool * isRelative); - bool resolveVirtualMethod(CORINFO_DEVIRTUALIZATION_INFO * info); - bool resolveVirtualMethodHelper(CORINFO_DEVIRTUALIZATION_INFO * info); + CORINFO_METHOD_HANDLE resolveVirtualMethod( + CORINFO_METHOD_HANDLE virtualMethod, + CORINFO_CLASS_HANDLE implementingClass, + CORINFO_CONTEXT_HANDLE ownerType, + bool* requiresInstMethodTableArg + ); + + CORINFO_METHOD_HANDLE resolveVirtualMethodHelper( + CORINFO_METHOD_HANDLE virtualMethod, + CORINFO_CLASS_HANDLE implementingClass, + CORINFO_CONTEXT_HANDLE ownerType, + bool* requiresInstMethodTableArg + ); CORINFO_METHOD_HANDLE getUnboxedEntry( CORINFO_METHOD_HANDLE ftn, diff --git a/src/coreclr/vm/method.hpp b/src/coreclr/vm/method.hpp index 28c6935212df7..b2f372a26df01 100644 --- a/src/coreclr/vm/method.hpp +++ b/src/coreclr/vm/method.hpp @@ -581,7 +581,7 @@ class MethodDesc // // RequiresInstMethodDescArg() // The method is itself generic and is shared between generic - // instantiations but is not itself generic. Furthermore + // instantiations but is not itself generic. WTF LOL. Furthermore // no "this" pointer is given (e.g. a value type method), so we pass in the // exact-instantiation method table as an extra argument. // i.e. shared-code instantiated generic methods diff --git a/src/coreclr/vm/methodtable.h b/src/coreclr/vm/methodtable.h index 4f05c6a1868c2..118e56467ac22 100644 --- a/src/coreclr/vm/methodtable.h +++ b/src/coreclr/vm/methodtable.h @@ -2094,6 +2094,7 @@ class MethodTable MethodDesc *GetMethodDescForInterfaceMethod(TypeHandle ownerType, MethodDesc *pInterfaceMD, BOOL throwOnConflict); MethodDesc *GetMethodDescForInterfaceMethod(MethodDesc *pInterfaceMD, BOOL throwOnConflict); // You can only use this one for non-generic interfaces + // ^-- I don't believe this is correct statement, we have PRECONDITION(!pInterfaceMD->HasClassOrMethodInstantiation()); whic implies it can be used with generic interfaces //------------------------------------------------------------------- // INTERFACE MAP. diff --git a/src/coreclr/zap/zapinfo.cpp b/src/coreclr/zap/zapinfo.cpp index 431e57ac06da8..3de017771cbf4 100644 --- a/src/coreclr/zap/zapinfo.cpp +++ b/src/coreclr/zap/zapinfo.cpp @@ -3996,9 +3996,13 @@ void ZapInfo::getMethodVTableOffset(CORINFO_METHOD_HANDLE method, m_pEEJitInfo->getMethodVTableOffset(method, pOffsetOfIndirection, pOffsetAfterIndirection, isRelative); } -bool ZapInfo::resolveVirtualMethod(CORINFO_DEVIRTUALIZATION_INFO * info) +CORINFO_METHOD_HANDLE ZapInfo::resolveVirtualMethod( + CORINFO_METHOD_HANDLE virtualMethod, + CORINFO_CLASS_HANDLE implementingClass, + CORINFO_CONTEXT_HANDLE ownerType, + bool* requiresInstMethodTableArg) { - return m_pEEJitInfo->resolveVirtualMethod(info); + return m_pEEJitInfo->resolveVirtualMethod(virtualMethod, implementingClass, ownerType, requiresInstMethodTableArg); } CORINFO_METHOD_HANDLE ZapInfo::getUnboxedEntry( diff --git a/src/coreclr/zap/zapinfo.h b/src/coreclr/zap/zapinfo.h index 8514cce6ccb29..87935a866f478 100644 --- a/src/coreclr/zap/zapinfo.h +++ b/src/coreclr/zap/zapinfo.h @@ -675,7 +675,11 @@ class ZapInfo unsigned * pOffsetAfterIndirection, bool * isRelative); - bool resolveVirtualMethod(CORINFO_DEVIRTUALIZATION_INFO * info); + CORINFO_METHOD_HANDLE resolveVirtualMethod( + CORINFO_METHOD_HANDLE virtualMethod, + CORINFO_CLASS_HANDLE implementingClass, + CORINFO_CONTEXT_HANDLE ownerType, + bool* requiresInstMethodTableArg); CORINFO_METHOD_HANDLE getUnboxedEntry( CORINFO_METHOD_HANDLE ftn, diff --git a/src/tests/JIT/devirt/precise_context.cs b/src/tests/JIT/devirt/precise_context.cs new file mode 100644 index 0000000000000..9ad481181d339 --- /dev/null +++ b/src/tests/JIT/devirt/precise_context.cs @@ -0,0 +1,21 @@ +using System; +using System.Runtime.CompilerServices; + +class G +{ + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public virtual bool MVIRT() => typeof(T) == typeof(string); + //[MethodImpl(MethodImplOptions.AggressiveInlining)] + //public bool MINST() => typeof(T) == typeof(string); +} + +class Program +{ + static int Main() + { + var g = new G(); + var mvirt = g.MVIRT() ? 50 : -1; + //var minst = g.MINST() ? 500 : -1; + return mvirt + 11; + } +} diff --git a/src/tests/JIT/devirt/precise_context.csproj b/src/tests/JIT/devirt/precise_context.csproj new file mode 100644 index 0000000000000..6aa1011be68b7 --- /dev/null +++ b/src/tests/JIT/devirt/precise_context.csproj @@ -0,0 +1,13 @@ + + + Exe + true + + + pdbonly + true + + + + + From 9162917240a15145cb1bee53b87c3f46d8967cf2 Mon Sep 17 00:00:00 2001 From: Rattenkrieg Date: Tue, 27 Oct 2020 22:43:37 +0300 Subject: [PATCH 08/29] param order swap; formatting; cleanup --- .../superpmi-shared/methodcontext.cpp | 6 +- .../superpmi/superpmi-shared/methodcontext.h | 8 +- .../superpmi-shim-collector/icorjitinfo.cpp | 10 +- .../ToolBox/superpmi/superpmi/icorjitinfo.cpp | 8 +- src/coreclr/inc/corinfo.h | 4 +- src/coreclr/jit/ICorJitInfo_API_wrapper.hpp | 6 +- src/coreclr/jit/flowgraph.cpp | 3 +- src/coreclr/jit/importer.cpp | 27 +- src/coreclr/jit/indirectcalltransformer.cpp | 3 +- .../superpmi-shared/icorjitinfoimpl.h | 1032 ++++++++++ .../superpmi-shim-counter/icorjitinfo.cpp | 1675 +++++++++++++++++ .../superpmi-shim-simple/icorjitinfo.cpp | 1488 +++++++++++++++ .../src/tools/aot/jitinterface/jitinterface.h | 1654 ++++++++++++++++ .../tools/Common/JitInterface/CorInfoBase.cs | 8 +- .../tools/Common/JitInterface/CorInfoImpl.cs | 3 +- .../ThunkGenerator/ThunkInput.txt | 2 +- src/coreclr/vm/jitinterface.cpp | 24 +- src/coreclr/vm/jitinterface.h | 8 +- src/coreclr/zap/zapinfo.cpp | 6 +- src/coreclr/zap/zapinfo.h | 4 +- 20 files changed, 5911 insertions(+), 68 deletions(-) create mode 100644 src/coreclr/src/ToolBox/superpmi/superpmi-shared/icorjitinfoimpl.h create mode 100644 src/coreclr/src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp create mode 100644 src/coreclr/src/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp create mode 100644 src/coreclr/src/tools/aot/jitinterface/jitinterface.h diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.cpp b/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.cpp index 5a594c685ecef..611be4be48e40 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.cpp +++ b/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.cpp @@ -3075,8 +3075,8 @@ void MethodContext::repGetMethodVTableOffset(CORINFO_METHOD_HANDLE method, void MethodContext::recResolveVirtualMethod(CORINFO_METHOD_HANDLE virtMethod, CORINFO_CLASS_HANDLE implClass, + bool* requiresInstMethodTableArg, CORINFO_CONTEXT_HANDLE ownerType, - bool* requiresInstMethodTableArg, CORINFO_METHOD_HANDLE result) { if (ResolveVirtualMethod == nullptr) @@ -3102,8 +3102,8 @@ void MethodContext::dmpResolveVirtualMethod(const Agnostic_ResolveVirtualMethodK CORINFO_METHOD_HANDLE MethodContext::repResolveVirtualMethod(CORINFO_METHOD_HANDLE virtMethod, CORINFO_CLASS_HANDLE implClass, - CORINFO_CONTEXT_HANDLE ownerType, - bool* requiresInstMethodTableArg) + bool* requiresInstMethodTableArg, + CORINFO_CONTEXT_HANDLE ownerType) { Agnostic_ResolveVirtualMethod key; key.virtualMethod = (DWORDLONG)virtMethod; diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.h b/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.h index d259f0f55a74d..6bbe1031ebb0e 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.h +++ b/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.h @@ -511,8 +511,8 @@ class MethodContext { DWORDLONG virtualMethod; DWORDLONG implementingClass; - DWORDLONG ownerType; DWORD requiresInstMethodTableArg; + DWORDLONG ownerType; }; struct ResolveTokenValue @@ -930,14 +930,14 @@ class MethodContext void recResolveVirtualMethod(CORINFO_METHOD_HANDLE virtMethod, CORINFO_CLASS_HANDLE implClass, - CORINFO_CONTEXT_HANDLE ownerType, bool* requiresInstMethodTableArg, + CORINFO_CONTEXT_HANDLE ownerType, CORINFO_METHOD_HANDLE result); void dmpResolveVirtualMethod(const Agnostic_ResolveVirtualMethod& key, DWORDLONG value); CORINFO_METHOD_HANDLE repResolveVirtualMethod(CORINFO_METHOD_HANDLE virtMethod, CORINFO_CLASS_HANDLE implClass, - CORINFO_CONTEXT_HANDLE ownerType, - bool* requiresInstMethodTableArg); + bool* requiresInstMethodTableArg, + CORINFO_CONTEXT_HANDLE ownerType); void recGetUnboxedEntry(CORINFO_METHOD_HANDLE ftn, bool* requiresInstMethodTableArg, CORINFO_METHOD_HANDLE result); void dmpGetUnboxedEntry(DWORDLONG key, DLD value); diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp b/src/coreclr/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp index 877fbcb260cba..f5e574ea65861 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp +++ b/src/coreclr/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp @@ -234,13 +234,13 @@ void interceptor_ICJI::getMethodVTableOffset(CORINFO_METHOD_HANDLE method, // Return null if devirtualization is not possible. CORINFO_METHOD_HANDLE interceptor_ICJI::resolveVirtualMethod(CORINFO_METHOD_HANDLE virtualMethod, CORINFO_CLASS_HANDLE implementingClass, - CORINFO_CONTEXT_HANDLE ownerType, - bool* requiresInstMethodTableArg) + bool* requiresInstMethodTableArg, + CORINFO_CONTEXT_HANDLE ownerType) { mc->cr->AddCall("resolveVirtualMethod"); - CORINFO_METHOD_HANDLE result = - original_ICorJitInfo->resolveVirtualMethod(virtualMethod, implementingClass, ownerType, requiresInstMethodTableArg); - mc->recResolveVirtualMethod(virtualMethod, implementingClass, ownerType, requiresInstMethodTableArg, result); + CORINFO_METHOD_HANDLE result = original_ICorJitInfo->resolveVirtualMethod(virtualMethod, implementingClass, + requiresInstMethodTableArg, ownerType); + mc->recResolveVirtualMethod(virtualMethod, implementingClass, requiresInstMethodTableArg, ownerType, result); return result; } diff --git a/src/coreclr/ToolBox/superpmi/superpmi/icorjitinfo.cpp b/src/coreclr/ToolBox/superpmi/superpmi/icorjitinfo.cpp index f6414fe0765af..c02d0096f701a 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi/icorjitinfo.cpp +++ b/src/coreclr/ToolBox/superpmi/superpmi/icorjitinfo.cpp @@ -175,12 +175,12 @@ void MyICJI::getMethodVTableOffset(CORINFO_METHOD_HANDLE method, // Return null if devirtualization is not possible. CORINFO_METHOD_HANDLE MyICJI::resolveVirtualMethod(CORINFO_METHOD_HANDLE virtualMethod, CORINFO_CLASS_HANDLE implementingClass, - CORINFO_CONTEXT_HANDLE ownerType, - bool* requiresInstMethodTableArg) + bool* requiresInstMethodTableArg, + CORINFO_CONTEXT_HANDLE ownerType) { jitInstance->mc->cr->AddCall("resolveVirtualMethod"); - CORINFO_METHOD_HANDLE result = - jitInstance->mc->repResolveVirtualMethod(virtualMethod, implementingClass, ownerType, requiresInstMethodTableArg); + CORINFO_METHOD_HANDLE result = jitInstance->mc->repResolveVirtualMethod(virtualMethod, implementingClass, + requiresInstMethodTableArg, ownerType); return result; } diff --git a/src/coreclr/inc/corinfo.h b/src/coreclr/inc/corinfo.h index edef2e93694e7..28917b5a479b6 100644 --- a/src/coreclr/inc/corinfo.h +++ b/src/coreclr/inc/corinfo.h @@ -2047,8 +2047,8 @@ class ICorStaticInfo virtual CORINFO_METHOD_HANDLE resolveVirtualMethod( CORINFO_METHOD_HANDLE virtualMethod, /* IN */ CORINFO_CLASS_HANDLE implementingClass, /* IN */ - CORINFO_CONTEXT_HANDLE ownerType = NULL, /* IN */ - bool* requiresInstMethodTableArg = NULL /* OUT */ + bool* requiresInstMethodTableArg, /* OUT */ + CORINFO_CONTEXT_HANDLE ownerType = NULL /* IN */ ) = 0; // Get the unboxed entry point for a method, if possible. diff --git a/src/coreclr/jit/ICorJitInfo_API_wrapper.hpp b/src/coreclr/jit/ICorJitInfo_API_wrapper.hpp index cc49f2dfeb7fe..d4a5741bd07fc 100644 --- a/src/coreclr/jit/ICorJitInfo_API_wrapper.hpp +++ b/src/coreclr/jit/ICorJitInfo_API_wrapper.hpp @@ -138,12 +138,12 @@ void WrapICorJitInfo::getMethodVTableOffset( CORINFO_METHOD_HANDLE WrapICorJitInfo::resolveVirtualMethod( CORINFO_METHOD_HANDLE virtualMethod, /* IN */ CORINFO_CLASS_HANDLE implementingClass, /* IN */ - CORINFO_CONTEXT_HANDLE ownerType = NULL, /* IN */ - bool* requiresInstMethodTableArg = NULL /* OUT */ + bool* requiresInstMethodTableArg, /* OUT */ + CORINFO_CONTEXT_HANDLE ownerType = NULL /* IN */ ) { API_ENTER(resolveVirtualMethod); - CORINFO_METHOD_HANDLE temp = wrapHnd->resolveVirtualMethod(virtualMethod, implementingClass, ownerType, requiresInstMethodTableArg); + CORINFO_METHOD_HANDLE temp = wrapHnd->resolveVirtualMethod(virtualMethod, implementingClass, requiresInstMethodTableArg, ownerType); API_LEAVE(resolveVirtualMethod); return temp; } diff --git a/src/coreclr/jit/flowgraph.cpp b/src/coreclr/jit/flowgraph.cpp index f32eeefa911a9..f22c4cde83f81 100644 --- a/src/coreclr/jit/flowgraph.cpp +++ b/src/coreclr/jit/flowgraph.cpp @@ -23282,7 +23282,8 @@ Compiler::fgWalkResult Compiler::fgLateDevirtualization(GenTree** pTree, fgWalkD CORINFO_CONTEXT_HANDLE context = nullptr; const bool isLateDevirtualization = true; bool explicitTailCall = (call->AsCall()->gtCallMoreFlags & GTF_CALL_M_EXPLICIT_TAILCALL) != 0; - comp->impDevirtualizeCall(call, &method, &methodFlags, &context, nullptr, isLateDevirtualization, explicitTailCall); + comp->impDevirtualizeCall(call, &method, &methodFlags, &context, nullptr, isLateDevirtualization, + explicitTailCall); } } else if (tree->OperGet() == GT_ASG) diff --git a/src/coreclr/jit/importer.cpp b/src/coreclr/jit/importer.cpp index 11f1a70e79d29..3be71ce427905 100644 --- a/src/coreclr/jit/importer.cpp +++ b/src/coreclr/jit/importer.cpp @@ -20921,10 +20921,11 @@ 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_CONTEXT_HANDLE ownerType = *contextHandle; + bool requiresInstMethodTableArg = false; CORINFO_METHOD_HANDLE uniqueImplementingMethod = - info.compCompHnd->resolveVirtualMethod(baseMethod, uniqueImplementingClass, ownerType, &requiresInstMethodTableArg); + info.compCompHnd->resolveVirtualMethod(baseMethod, uniqueImplementingClass, + &requiresInstMethodTableArg, ownerType); if (!canResolve) { @@ -20956,9 +20957,10 @@ void Compiler::impDevirtualizeCall(GenTreeCall* call, } // 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 = info.compCompHnd->resolveVirtualMethod(baseMethod, objClass, ownerType, &requiresInstMethodTableArg); + CORINFO_CONTEXT_HANDLE ownerType = *contextHandle; + bool requiresInstMethodTableArg = false; + CORINFO_METHOD_HANDLE derivedMethod = + info.compCompHnd->resolveVirtualMethod(baseMethod, objClass, &requiresInstMethodTableArg, ownerType); // If we failed to get a handle, we can't devirtualize. This can // happen when prejitting, if the devirtualization crosses @@ -21194,7 +21196,7 @@ void Compiler::impDevirtualizeCall(GenTreeCall* call, } // Note for some shared methods the unboxed entry point requires an extra parameter. - bool requiresInstMethodTableArgForUnboxedEntry = false; + bool requiresInstMethodTableArgForUnboxedEntry = false; CORINFO_METHOD_HANDLE unboxedEntryMethod = info.compCompHnd->getUnboxedEntry(derivedMethod, &requiresInstMethodTableArgForUnboxedEntry); @@ -21299,8 +21301,8 @@ void Compiler::impDevirtualizeCall(GenTreeCall* call, { assert(((SIZE_T)ownerType & CORINFO_CONTEXTFLAGS_MASK) == CORINFO_CONTEXTFLAGS_CLASS); CORINFO_CLASS_HANDLE exactClassHandle = eeGetClassFromContext(ownerType); - GenTree* instParam = gtNewIconEmbClsHndNode(exactClassHandle); - call->gtCallMethHnd = derivedMethod; + GenTree* instParam = gtNewIconEmbClsHndNode(exactClassHandle); + call->gtCallMethHnd = derivedMethod; if ((Target::g_tgtArgOrder == Target::ARG_ORDER_R2L) || (call->gtCallArgs == nullptr)) { call->gtCallArgs = gtPrependNewCallArg(instParam, call->gtCallArgs); @@ -21321,7 +21323,6 @@ void Compiler::impDevirtualizeCall(GenTreeCall* call, { call->gtFlags |= use.GetNode()->gtFlags & GTF_GLOB_EFFECT; } - } else { @@ -21333,15 +21334,15 @@ void Compiler::impDevirtualizeCall(GenTreeCall* call, JITDUMP("Sorry, failed to find unboxed entry point\n"); } } - // check wheter we have returned an instantiating stub for generic DIM + // check wheter we have returned an instantiating stub for generic DIM else if (isInterface) { if (requiresInstMethodTableArg) { assert(((SIZE_T)ownerType & CORINFO_CONTEXTFLAGS_MASK) == CORINFO_CONTEXTFLAGS_CLASS); CORINFO_CLASS_HANDLE exactClassHandle = eeGetClassFromContext(ownerType); - GenTree* instParam = gtNewIconEmbClsHndNode(exactClassHandle); - call->gtCallMethHnd = derivedMethod; + GenTree* instParam = gtNewIconEmbClsHndNode(exactClassHandle); + call->gtCallMethHnd = derivedMethod; if ((Target::g_tgtArgOrder == Target::ARG_ORDER_R2L) || (call->gtCallArgs == nullptr)) { call->gtCallArgs = gtPrependNewCallArg(instParam, call->gtCallArgs); diff --git a/src/coreclr/jit/indirectcalltransformer.cpp b/src/coreclr/jit/indirectcalltransformer.cpp index 4473d41ca681a..a26db2c4531c7 100644 --- a/src/coreclr/jit/indirectcalltransformer.cpp +++ b/src/coreclr/jit/indirectcalltransformer.cpp @@ -712,7 +712,8 @@ class IndirectCallTransformer CORINFO_CONTEXT_HANDLE context = inlineInfo->exactContextHnd; const bool isLateDevirtualization = true; bool explicitTailCall = (call->AsCall()->gtCallMoreFlags & GTF_CALL_M_EXPLICIT_TAILCALL) != 0; - compiler->impDevirtualizeCall(call, &methodHnd, &methodFlags, &context, nullptr, isLateDevirtualization, explicitTailCall); + compiler->impDevirtualizeCall(call, &methodHnd, &methodFlags, &context, nullptr, isLateDevirtualization, + explicitTailCall); // Presumably devirt might fail? If so we should try and avoid // making this a guarded devirt candidate instead of ending diff --git a/src/coreclr/src/ToolBox/superpmi/superpmi-shared/icorjitinfoimpl.h b/src/coreclr/src/ToolBox/superpmi/superpmi-shared/icorjitinfoimpl.h new file mode 100644 index 0000000000000..ec99ee8cf18fd --- /dev/null +++ b/src/coreclr/src/ToolBox/superpmi/superpmi-shared/icorjitinfoimpl.h @@ -0,0 +1,1032 @@ +// +// 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 null if devirtualization is not possible. +CORINFO_METHOD_HANDLE resolveVirtualMethod(CORINFO_METHOD_HANDLE virtualMethod, + CORINFO_CLASS_HANDLE implementingClass, + bool* requiresInstMethodTableArg, + CORINFO_CONTEXT_HANDLE ownerType); + +// 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 new file mode 100644 index 0000000000000..77b6214b96f41 --- /dev/null +++ b/src/coreclr/src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp @@ -0,0 +1,1675 @@ +// +// 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 null if devirtualization is not possible. +CORINFO_METHOD_HANDLE interceptor_ICJI::resolveVirtualMethod(CORINFO_METHOD_HANDLE virtualMethod, + CORINFO_CLASS_HANDLE implementingClass, + bool* requiresInstMethodTableArg, + CORINFO_CONTEXT_HANDLE ownerType) +{ + mcs->AddCall("resolveVirtualMethod"); + return original_ICorJitInfo->resolveVirtualMethod(virtualMethod, implementingClass, requiresInstMethodTableArg, + ownerType); +} + +// 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 new file mode 100644 index 0000000000000..3ff5055d254e6 --- /dev/null +++ b/src/coreclr/src/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp @@ -0,0 +1,1488 @@ +// +// 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 null if devirtualization is not possible. +CORINFO_METHOD_HANDLE interceptor_ICJI::resolveVirtualMethod(CORINFO_METHOD_HANDLE virtualMethod, + CORINFO_CLASS_HANDLE implementingClass, + bool* requiresInstMethodTableArg, + CORINFO_CONTEXT_HANDLE ownerType) +{ + return original_ICorJitInfo->resolveVirtualMethod(virtualMethod, implementingClass, requiresInstMethodTableArg, + ownerType); +} + +// 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 new file mode 100644 index 0000000000000..812836bdf5282 --- /dev/null +++ b/src/coreclr/src/tools/aot/jitinterface/jitinterface.h @@ -0,0 +1,1654 @@ +// 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); + void* (* resolveVirtualMethod)(void * thisHandle, CorInfoException** ppException, void* virtualMethod, void* implementingClass, bool* requiresInstMethodTableArg, void* ownerType); + 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); + void (* 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 void* resolveVirtualMethod(void* virtualMethod, void* implementingClass, bool* requiresInstMethodTableArg, void* ownerType) + { + CorInfoException* pException = nullptr; + void* _ret = _callbacks->resolveVirtualMethod(_thisHandle, &pException, virtualMethod, implementingClass, requiresInstMethodTableArg, ownerType); + 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 void tryResolveToken(void* pResolvedToken) + { + CorInfoException* pException = nullptr; + _callbacks->tryResolveToken(_thisHandle, &pException, pResolvedToken); + if (pException != nullptr) + throw pException; + } + + 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 2326320e34eb4..47072ed611cf7 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 _resolveVirtualMethod(IntPtr thisHandle, IntPtr* ppException, CORINFO_DEVIRTUALIZATION_INFO* info) + static CORINFO_METHOD_STRUCT_* _resolveVirtualMethod(IntPtr thisHandle, IntPtr* ppException, CORINFO_METHOD_STRUCT_* virtualMethod, CORINFO_CLASS_STRUCT_* implementingClass, bool* requiresInstMethodTableArg, CORINFO_CONTEXT_STRUCT* ownerType) { var _this = GetThis(thisHandle); try { - return _this.resolveVirtualMethod(info) ? 1 : 0; + return _this.resolveVirtualMethod(virtualMethod, implementingClass, requiresInstMethodTableArg, ownerType); } catch (Exception ex) { @@ -2550,8 +2550,8 @@ static IntPtr GetUnmanagedCallbacks() callbacks[9] = (delegate* unmanaged)&_getMethodClass; callbacks[10] = (delegate* unmanaged)&_getMethodModule; callbacks[11] = (delegate* unmanaged)&_getMethodVTableOffset; - callbacks[12] = (delegate* unmanaged)&_resolveVirtualMethod; - callbacks[13] = (delegate* unmanaged)&_getUnboxedEntry; + callbacks[12] = (delegate* unmanaged)&_resolveVirtualMethod; + callbacks[13] = (delegate* unmanaged)&_getUnboxedEntry; callbacks[14] = (delegate* unmanaged)&_getDefaultEqualityComparerClass; callbacks[15] = (delegate* unmanaged)&_expandRawHandleIntrinsic; callbacks[16] = (delegate* unmanaged)&_getIntrinsicID; diff --git a/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs b/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs index b31079430320b..830e6576d63cf 100644 --- a/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs +++ b/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs @@ -944,7 +944,8 @@ private void getEHinfo(CORINFO_METHOD_STRUCT_* ftn, uint EHnumber, ref CORINFO_E return (CORINFO_MODULE_STRUCT_*)ObjectToHandle(methodIL); } - private bool resolveVirtualMethod(CORINFO_DEVIRTUALIZATION_INFO* info) + // TODO: deal with requiresInstMethodTableArg + private CORINFO_METHOD_STRUCT_* resolveVirtualMethod(CORINFO_METHOD_STRUCT_* baseMethod, CORINFO_CLASS_STRUCT_* derivedClass, bool* requiresInstMethodTableArg, CORINFO_CONTEXT_STRUCT* ownerType) { // Initialize OUT fields info->devirtualizedMethod = null; diff --git a/src/coreclr/tools/Common/JitInterface/ThunkGenerator/ThunkInput.txt b/src/coreclr/tools/Common/JitInterface/ThunkGenerator/ThunkInput.txt index 1ab806ac32a1b..0293399e7cd75 100644 --- a/src/coreclr/tools/Common/JitInterface/ThunkGenerator/ThunkInput.txt +++ b/src/coreclr/tools/Common/JitInterface/ThunkGenerator/ThunkInput.txt @@ -170,7 +170,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); - CORINFO_METHOD_HANDLE resolveVirtualMethod( CORINFO_METHOD_HANDLE virtualMethod, CORINFO_CLASS_HANDLE implementingClass, CORINFO_CONTEXT_HANDLE ownerType, BOOL* requiresInstMethodTableArg); + CORINFO_METHOD_HANDLE resolveVirtualMethod( CORINFO_METHOD_HANDLE virtualMethod, CORINFO_CLASS_HANDLE implementingClass, BOOL* requiresInstMethodTableArg, CORINFO_CONTEXT_HANDLE ownerType); 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); diff --git a/src/coreclr/vm/jitinterface.cpp b/src/coreclr/vm/jitinterface.cpp index 761b9d4393fbc..46e522e34071e 100644 --- a/src/coreclr/vm/jitinterface.cpp +++ b/src/coreclr/vm/jitinterface.cpp @@ -8856,8 +8856,8 @@ void CEEInfo::getMethodVTableOffset (CORINFO_METHOD_HANDLE methodHnd, /*********************************************************************/ CORINFO_METHOD_HANDLE CEEInfo::resolveVirtualMethodHelper(CORINFO_METHOD_HANDLE baseMethod, CORINFO_CLASS_HANDLE derivedClass, - CORINFO_CONTEXT_HANDLE ownerType, - bool* requiresInstMethodTableArg) + bool* requiresInstMethodTableArg, + CORINFO_CONTEXT_HANDLE ownerType) { CONTRACTL { THROWS; @@ -8948,26 +8948,16 @@ CORINFO_METHOD_HANDLE CEEInfo::resolveVirtualMethodHelper(CORINFO_METHOD_HANDLE } // default interface method - // we need to return *correct* instantiating stub // generics over value types do not share code, so we should do nothing on caller site // when `requiresInstMethodTableArg == false` if (pDevirtMD->GetMethodTable()->IsInterface() && pDevirtMD->HasClassInstantiation()) { // since we are in DIM branch, that means - // call MethodTable::GetMethodDescForInterfaceMethod above returned to us + // call MethodTable::GetMethodDescForInterfaceMethod above has returned // either instantiating stub ie `pDevirtMD->IsWrapperStub() == true` // or non shared generic instantiation ie is _ASSERTE(pDevirtMD->IsWrapperStub() || !(pDevirtMD->GetMethodTable()->IsSharedByGenericInstantiations() || pDevirtMD->IsSharedByGenericMethodInstantiations())); - _ASSERTE(requiresInstMethodTableArg != nullptr); - if (pDevirtMD->IsWrapperStub()) - { - *requiresInstMethodTableArg = true; - pDevirtMD = pDevirtMD->GetExistingWrappedMethodDesc(); - } - else - { - *requiresInstMethodTableArg = false; - } + *requiresInstMethodTableArg = pDevirtMD->IsWrapperStub(); } } else @@ -9067,8 +9057,8 @@ CORINFO_METHOD_HANDLE CEEInfo::resolveVirtualMethodHelper(CORINFO_METHOD_HANDLE CORINFO_METHOD_HANDLE CEEInfo::resolveVirtualMethod(CORINFO_METHOD_HANDLE methodHnd, CORINFO_CLASS_HANDLE derivedClass, - CORINFO_CONTEXT_HANDLE ownerType, - bool* requiresInstMethodTableArg) + bool* requiresInstMethodTableArg, + CORINFO_CONTEXT_HANDLE ownerType) { CONTRACTL { THROWS; @@ -9080,7 +9070,7 @@ CORINFO_METHOD_HANDLE CEEInfo::resolveVirtualMethod(CORINFO_METHOD_HANDLE method JIT_TO_EE_TRANSITION(); - result = resolveVirtualMethodHelper(methodHnd, derivedClass, ownerType, requiresInstMethodTableArg); + result = resolveVirtualMethodHelper(methodHnd, derivedClass, requiresInstMethodTableArg, ownerType); EE_TO_JIT_TRANSITION(); diff --git a/src/coreclr/vm/jitinterface.h b/src/coreclr/vm/jitinterface.h index 827163d5506fc..88021d521d6fe 100644 --- a/src/coreclr/vm/jitinterface.h +++ b/src/coreclr/vm/jitinterface.h @@ -735,15 +735,15 @@ class CEEInfo : public ICorJitInfo CORINFO_METHOD_HANDLE resolveVirtualMethod( CORINFO_METHOD_HANDLE virtualMethod, CORINFO_CLASS_HANDLE implementingClass, - CORINFO_CONTEXT_HANDLE ownerType, - bool* requiresInstMethodTableArg + bool* requiresInstMethodTableArg, + CORINFO_CONTEXT_HANDLE ownerType ); CORINFO_METHOD_HANDLE resolveVirtualMethodHelper( CORINFO_METHOD_HANDLE virtualMethod, CORINFO_CLASS_HANDLE implementingClass, - CORINFO_CONTEXT_HANDLE ownerType, - bool* requiresInstMethodTableArg + bool* requiresInstMethodTableArg, + CORINFO_CONTEXT_HANDLE ownerType ); CORINFO_METHOD_HANDLE getUnboxedEntry( diff --git a/src/coreclr/zap/zapinfo.cpp b/src/coreclr/zap/zapinfo.cpp index 3de017771cbf4..42aecafa2bd75 100644 --- a/src/coreclr/zap/zapinfo.cpp +++ b/src/coreclr/zap/zapinfo.cpp @@ -3999,10 +3999,10 @@ void ZapInfo::getMethodVTableOffset(CORINFO_METHOD_HANDLE method, CORINFO_METHOD_HANDLE ZapInfo::resolveVirtualMethod( CORINFO_METHOD_HANDLE virtualMethod, CORINFO_CLASS_HANDLE implementingClass, - CORINFO_CONTEXT_HANDLE ownerType, - bool* requiresInstMethodTableArg) + bool* requiresInstMethodTableArg, + CORINFO_CONTEXT_HANDLE ownerType) { - return m_pEEJitInfo->resolveVirtualMethod(virtualMethod, implementingClass, ownerType, requiresInstMethodTableArg); + return m_pEEJitInfo->resolveVirtualMethod(virtualMethod, implementingClass, requiresInstMethodTableArg, ownerType); } CORINFO_METHOD_HANDLE ZapInfo::getUnboxedEntry( diff --git a/src/coreclr/zap/zapinfo.h b/src/coreclr/zap/zapinfo.h index 87935a866f478..26900e1affb73 100644 --- a/src/coreclr/zap/zapinfo.h +++ b/src/coreclr/zap/zapinfo.h @@ -678,8 +678,8 @@ class ZapInfo CORINFO_METHOD_HANDLE resolveVirtualMethod( CORINFO_METHOD_HANDLE virtualMethod, CORINFO_CLASS_HANDLE implementingClass, - CORINFO_CONTEXT_HANDLE ownerType, - bool* requiresInstMethodTableArg); + bool* requiresInstMethodTableArg, + CORINFO_CONTEXT_HANDLE ownerType); CORINFO_METHOD_HANDLE getUnboxedEntry( CORINFO_METHOD_HANDLE ftn, From 1a54185c0331b5007affe9cad21a3fc06c8a3216 Mon Sep 17 00:00:00 2001 From: Rattenkrieg Date: Wed, 28 Oct 2020 17:03:44 +0300 Subject: [PATCH 09/29] ownerType as in-out param --- .../superpmi-shared/methodcontext.cpp | 34 +++++++++--------- .../superpmi/superpmi-shared/methodcontext.h | 18 +++++----- .../superpmi-shim-collector/icorjitinfo.cpp | 8 ++--- .../ToolBox/superpmi/superpmi/icorjitinfo.cpp | 8 ++--- src/coreclr/inc/corinfo.h | 4 +-- src/coreclr/jit/ICorJitInfo_API_wrapper.hpp | 2 +- src/coreclr/jit/importer.cpp | 36 +++++++++---------- .../superpmi-shared/icorjitinfoimpl.h | 8 ++--- .../superpmi-shim-counter/icorjitinfo.cpp | 8 ++--- .../superpmi-shim-simple/icorjitinfo.cpp | 8 ++--- .../ThunkGenerator/ThunkInput.txt | 2 +- src/coreclr/vm/jitinterface.cpp | 9 ++--- src/coreclr/vm/jitinterface.h | 4 +-- src/coreclr/zap/zapinfo.cpp | 2 +- src/coreclr/zap/zapinfo.h | 2 +- 15 files changed, 78 insertions(+), 75 deletions(-) diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.cpp b/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.cpp index 611be4be48e40..6037a70249dbe 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.cpp +++ b/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.cpp @@ -3073,11 +3073,11 @@ void MethodContext::repGetMethodVTableOffset(CORINFO_METHOD_HANDLE method, DEBUG_REP(dmpGetMethodVTableOffset((DWORDLONG)method, value)); } -void MethodContext::recResolveVirtualMethod(CORINFO_METHOD_HANDLE virtMethod, - CORINFO_CLASS_HANDLE implClass, - bool* requiresInstMethodTableArg, - CORINFO_CONTEXT_HANDLE ownerType, - CORINFO_METHOD_HANDLE result) +void MethodContext::recResolveVirtualMethod(CORINFO_METHOD_HANDLE virtMethod, + CORINFO_CLASS_HANDLE implClass, + bool* requiresInstMethodTableArg, + CORINFO_CONTEXT_HANDLE* ownerType, + CORINFO_METHOD_HANDLE result) { if (ResolveVirtualMethod == nullptr) { @@ -3087,7 +3087,7 @@ void MethodContext::recResolveVirtualMethod(CORINFO_METHOD_HANDLE virtMethod, Agnostic_ResolveVirtualMethod key; key.virtualMethod = (DWORDLONG)virtMethod; key.implementingClass = (DWORDLONG)implClass; - key.ownerType = (DWORDLONG)ownerType; + key.ownerType = (DWORDLONG)(*ownerType); key.requiresInstMethodTableArg = *requiresInstMethodTableArg ? 1 : 0; // it's out param, do we need this stuff idk ResolveVirtualMethod->Add(key, (DWORDLONG)result); @@ -3096,25 +3096,27 @@ void MethodContext::recResolveVirtualMethod(CORINFO_METHOD_HANDLE virtMethod, void MethodContext::dmpResolveVirtualMethod(const Agnostic_ResolveVirtualMethodKey& key, const Agnostic_ResolveVirtualMethodResult& result) { - 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); + printf("ResolveVirtualMethod virtMethod-%016llX, implClass-%016llX, requiresInstMethodTableArg-%016lX, ownerType-%016llX, result-%016llX", + key.virtualMethod, key.implementingClass, key.requiresInstMethodTableArg, key.ownerType, value); } -CORINFO_METHOD_HANDLE MethodContext::repResolveVirtualMethod(CORINFO_METHOD_HANDLE virtMethod, - CORINFO_CLASS_HANDLE implClass, - bool* requiresInstMethodTableArg, - CORINFO_CONTEXT_HANDLE ownerType) +CORINFO_METHOD_HANDLE MethodContext::repResolveVirtualMethod(CORINFO_METHOD_HANDLE virtMethod, + CORINFO_CLASS_HANDLE implClass, + bool* requiresInstMethodTableArg, + CORINFO_CONTEXT_HANDLE* ownerType) { Agnostic_ResolveVirtualMethod key; key.virtualMethod = (DWORDLONG)virtMethod; key.implementingClass = (DWORDLONG)implClass; - key.ownerType = (DWORDLONG)ownerType; + key.ownerType = (DWORDLONG)(*ownerType); key.requiresInstMethodTableArg = *requiresInstMethodTableArg ? 1 : 0; 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); + "No ResolveVirtualMap map for %016llX-%016llX-%016llX-%016llX", key.virtualMethod, + key.implementingClass, key.requiresInstMethodTableArg, key.ownerType); + AssertCodeMsg(ResolveVirtualMethod->GetIndex(key) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX-%016llx-%016lX-%016llX", + key.virtualMethod, key.implementingClass, key.requiresInstMethodTableArg, key.ownerType); + DWORDLONG result = ResolveVirtualMethod->Get(key); Agnostic_ResolveVirtualMethodResult result = ResolveVirtualMethod->Get(key); DEBUG_REP(dmpResolveVirtualMethod(key, result)); diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.h b/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.h index 6bbe1031ebb0e..811d3ac458e98 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.h +++ b/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.h @@ -928,16 +928,16 @@ class MethodContext unsigned* offsetAfterIndirection, bool* isRelative); - void recResolveVirtualMethod(CORINFO_METHOD_HANDLE virtMethod, - CORINFO_CLASS_HANDLE implClass, - bool* requiresInstMethodTableArg, - CORINFO_CONTEXT_HANDLE ownerType, - CORINFO_METHOD_HANDLE result); + void recResolveVirtualMethod(CORINFO_METHOD_HANDLE virtMethod, + CORINFO_CLASS_HANDLE implClass, + bool* requiresInstMethodTableArg, + CORINFO_CONTEXT_HANDLE* ownerType, + CORINFO_METHOD_HANDLE result); void dmpResolveVirtualMethod(const Agnostic_ResolveVirtualMethod& key, DWORDLONG value); - CORINFO_METHOD_HANDLE repResolveVirtualMethod(CORINFO_METHOD_HANDLE virtMethod, - CORINFO_CLASS_HANDLE implClass, - bool* requiresInstMethodTableArg, - CORINFO_CONTEXT_HANDLE ownerType); + CORINFO_METHOD_HANDLE repResolveVirtualMethod(CORINFO_METHOD_HANDLE virtMethod, + CORINFO_CLASS_HANDLE implClass, + bool* requiresInstMethodTableArg, + CORINFO_CONTEXT_HANDLE* ownerType); void recGetUnboxedEntry(CORINFO_METHOD_HANDLE ftn, bool* requiresInstMethodTableArg, CORINFO_METHOD_HANDLE result); void dmpGetUnboxedEntry(DWORDLONG key, DLD value); diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp b/src/coreclr/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp index f5e574ea65861..ebfaee3b01722 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp +++ b/src/coreclr/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp @@ -232,10 +232,10 @@ void interceptor_ICJI::getMethodVTableOffset(CORINFO_METHOD_HANDLE method, // Find the virtual method in implementingClass that overrides virtualMethod. // Return null if devirtualization is not possible. -CORINFO_METHOD_HANDLE interceptor_ICJI::resolveVirtualMethod(CORINFO_METHOD_HANDLE virtualMethod, - CORINFO_CLASS_HANDLE implementingClass, - bool* requiresInstMethodTableArg, - CORINFO_CONTEXT_HANDLE ownerType) +CORINFO_METHOD_HANDLE interceptor_ICJI::resolveVirtualMethod(CORINFO_METHOD_HANDLE virtualMethod, + CORINFO_CLASS_HANDLE implementingClass, + bool* requiresInstMethodTableArg, + CORINFO_CONTEXT_HANDLE* ownerType) { mc->cr->AddCall("resolveVirtualMethod"); CORINFO_METHOD_HANDLE result = original_ICorJitInfo->resolveVirtualMethod(virtualMethod, implementingClass, diff --git a/src/coreclr/ToolBox/superpmi/superpmi/icorjitinfo.cpp b/src/coreclr/ToolBox/superpmi/superpmi/icorjitinfo.cpp index c02d0096f701a..b5605d3ff67bd 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi/icorjitinfo.cpp +++ b/src/coreclr/ToolBox/superpmi/superpmi/icorjitinfo.cpp @@ -173,10 +173,10 @@ void MyICJI::getMethodVTableOffset(CORINFO_METHOD_HANDLE method, // Find the virtual method in implementingClass that overrides virtualMethod. // Return null if devirtualization is not possible. -CORINFO_METHOD_HANDLE MyICJI::resolveVirtualMethod(CORINFO_METHOD_HANDLE virtualMethod, - CORINFO_CLASS_HANDLE implementingClass, - bool* requiresInstMethodTableArg, - CORINFO_CONTEXT_HANDLE ownerType) +CORINFO_METHOD_HANDLE MyICJI::resolveVirtualMethod(CORINFO_METHOD_HANDLE virtualMethod, + CORINFO_CLASS_HANDLE implementingClass, + bool* requiresInstMethodTableArg, + CORINFO_CONTEXT_HANDLE* ownerType) { jitInstance->mc->cr->AddCall("resolveVirtualMethod"); CORINFO_METHOD_HANDLE result = jitInstance->mc->repResolveVirtualMethod(virtualMethod, implementingClass, diff --git a/src/coreclr/inc/corinfo.h b/src/coreclr/inc/corinfo.h index 28917b5a479b6..8c427f337588b 100644 --- a/src/coreclr/inc/corinfo.h +++ b/src/coreclr/inc/corinfo.h @@ -2047,8 +2047,8 @@ class ICorStaticInfo virtual CORINFO_METHOD_HANDLE resolveVirtualMethod( CORINFO_METHOD_HANDLE virtualMethod, /* IN */ CORINFO_CLASS_HANDLE implementingClass, /* IN */ - bool* requiresInstMethodTableArg, /* OUT */ - CORINFO_CONTEXT_HANDLE ownerType = NULL /* IN */ + bool* requiresInstMethodTableArg, /* OUT */ + CORINFO_CONTEXT_HANDLE* ownerType = NULL /* IN, OUT */ ) = 0; // Get the unboxed entry point for a method, if possible. diff --git a/src/coreclr/jit/ICorJitInfo_API_wrapper.hpp b/src/coreclr/jit/ICorJitInfo_API_wrapper.hpp index d4a5741bd07fc..06c1485745cd6 100644 --- a/src/coreclr/jit/ICorJitInfo_API_wrapper.hpp +++ b/src/coreclr/jit/ICorJitInfo_API_wrapper.hpp @@ -139,7 +139,7 @@ CORINFO_METHOD_HANDLE WrapICorJitInfo::resolveVirtualMethod( CORINFO_METHOD_HANDLE virtualMethod, /* IN */ CORINFO_CLASS_HANDLE implementingClass, /* IN */ bool* requiresInstMethodTableArg, /* OUT */ - CORINFO_CONTEXT_HANDLE ownerType = NULL /* IN */ + CORINFO_CONTEXT_HANDLE* ownerType = NULL /* IN, OUT */ ) { API_ENTER(resolveVirtualMethod); diff --git a/src/coreclr/jit/importer.cpp b/src/coreclr/jit/importer.cpp index 3be71ce427905..8fcf8353af0f7 100644 --- a/src/coreclr/jit/importer.cpp +++ b/src/coreclr/jit/importer.cpp @@ -20924,8 +20924,8 @@ void Compiler::impDevirtualizeCall(GenTreeCall* call, CORINFO_CONTEXT_HANDLE ownerType = *contextHandle; bool requiresInstMethodTableArg = false; CORINFO_METHOD_HANDLE uniqueImplementingMethod = - info.compCompHnd->resolveVirtualMethod(baseMethod, uniqueImplementingClass, - &requiresInstMethodTableArg, ownerType); + info.compCompHnd->resolveVirtualMethod(baseMethod, uniqueImplementingClass, &requiresInstMethodTableArg, + &ownerType); if (!canResolve) { @@ -20960,7 +20960,7 @@ void Compiler::impDevirtualizeCall(GenTreeCall* call, CORINFO_CONTEXT_HANDLE ownerType = *contextHandle; bool requiresInstMethodTableArg = false; CORINFO_METHOD_HANDLE derivedMethod = - info.compCompHnd->resolveVirtualMethod(baseMethod, objClass, &requiresInstMethodTableArg, ownerType); + info.compCompHnd->resolveVirtualMethod(baseMethod, objClass, &requiresInstMethodTableArg, &ownerType); // If we failed to get a handle, we can't devirtualize. This can // happen when prejitting, if the devirtualization crosses @@ -21170,20 +21170,6 @@ void Compiler::impDevirtualizeCall(GenTreeCall* call, // stubs) call->gtInlineCandidateInfo = nullptr; -#if defined(DEBUG) - if (verbose) - { - printf("... after devirt...\n"); - gtDispTree(call); - } - - if (doPrint) - { - printf("Devirtualized %s call to %s:%s; now direct call to %s:%s [%s]\n", callKind, baseClassName, - baseMethodName, derivedClassName, derivedMethodName, note); - } -#endif // defined(DEBUG) - // If the 'this' object is a box, see if we can find the unboxed entry point for the call. if (thisObj->IsBoxedValue()) { @@ -21368,7 +21354,21 @@ void Compiler::impDevirtualizeCall(GenTreeCall* call, // should we patch call->gtCallMoreFlags ? } - // Need to update call info too. +#if defined(DEBUG) + if (verbose) + { + printf("... after devirt...\n"); + gtDispTree(call); + } + + if (doPrint) + { + printf("Devirtualized %s call to %s:%s; now direct call to %s:%s [%s]\n", callKind, baseClassName, + baseMethodName, derivedClassName, derivedMethodName, note); + } +#endif // defined(DEBUG) + + // Fetch the class that introduced the derived method. // *method = derivedMethod; *methodFlags = derivedMethodAttribs; diff --git a/src/coreclr/src/ToolBox/superpmi/superpmi-shared/icorjitinfoimpl.h b/src/coreclr/src/ToolBox/superpmi/superpmi-shared/icorjitinfoimpl.h index ec99ee8cf18fd..cca709d6a49ca 100644 --- a/src/coreclr/src/ToolBox/superpmi/superpmi-shared/icorjitinfoimpl.h +++ b/src/coreclr/src/ToolBox/superpmi/superpmi-shared/icorjitinfoimpl.h @@ -117,10 +117,10 @@ void getMethodVTableOffset(CORINFO_METHOD_HANDLE method, /* IN */ // Find the virtual method in implementingClass that overrides virtualMethod. // Return null if devirtualization is not possible. -CORINFO_METHOD_HANDLE resolveVirtualMethod(CORINFO_METHOD_HANDLE virtualMethod, - CORINFO_CLASS_HANDLE implementingClass, - bool* requiresInstMethodTableArg, - CORINFO_CONTEXT_HANDLE ownerType); +CORINFO_METHOD_HANDLE resolveVirtualMethod(CORINFO_METHOD_HANDLE virtualMethod, + CORINFO_CLASS_HANDLE implementingClass, + bool* requiresInstMethodTableArg, + CORINFO_CONTEXT_HANDLE* ownerType); // Get the unboxed entry point for a method, if possible. CORINFO_METHOD_HANDLE getUnboxedEntry( diff --git a/src/coreclr/src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp b/src/coreclr/src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp index 77b6214b96f41..06e2a7b60115d 100644 --- a/src/coreclr/src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp +++ b/src/coreclr/src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp @@ -154,10 +154,10 @@ void interceptor_ICJI::getMethodVTableOffset(CORINFO_METHOD_HANDLE method, // Find the virtual method in implementingClass that overrides virtualMethod. // Return null if devirtualization is not possible. -CORINFO_METHOD_HANDLE interceptor_ICJI::resolveVirtualMethod(CORINFO_METHOD_HANDLE virtualMethod, - CORINFO_CLASS_HANDLE implementingClass, - bool* requiresInstMethodTableArg, - CORINFO_CONTEXT_HANDLE ownerType) +CORINFO_METHOD_HANDLE interceptor_ICJI::resolveVirtualMethod(CORINFO_METHOD_HANDLE virtualMethod, + CORINFO_CLASS_HANDLE implementingClass, + bool* requiresInstMethodTableArg, + CORINFO_CONTEXT_HANDLE* ownerType) { mcs->AddCall("resolveVirtualMethod"); return original_ICorJitInfo->resolveVirtualMethod(virtualMethod, implementingClass, requiresInstMethodTableArg, diff --git a/src/coreclr/src/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp b/src/coreclr/src/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp index 3ff5055d254e6..5cdaa938653bd 100644 --- a/src/coreclr/src/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp +++ b/src/coreclr/src/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp @@ -148,10 +148,10 @@ CORINFO_METHOD_HANDLE interceptor_ICJI::getUnboxedEntry(CORINFO_METHOD_HANDLE ft // Find the virtual method in implementingClass that overrides virtualMethod. // Return null if devirtualization is not possible. -CORINFO_METHOD_HANDLE interceptor_ICJI::resolveVirtualMethod(CORINFO_METHOD_HANDLE virtualMethod, - CORINFO_CLASS_HANDLE implementingClass, - bool* requiresInstMethodTableArg, - CORINFO_CONTEXT_HANDLE ownerType) +CORINFO_METHOD_HANDLE interceptor_ICJI::resolveVirtualMethod(CORINFO_METHOD_HANDLE virtualMethod, + CORINFO_CLASS_HANDLE implementingClass, + bool* requiresInstMethodTableArg, + CORINFO_CONTEXT_HANDLE* ownerType) { return original_ICorJitInfo->resolveVirtualMethod(virtualMethod, implementingClass, requiresInstMethodTableArg, ownerType); diff --git a/src/coreclr/tools/Common/JitInterface/ThunkGenerator/ThunkInput.txt b/src/coreclr/tools/Common/JitInterface/ThunkGenerator/ThunkInput.txt index 0293399e7cd75..4a6af3c514e45 100644 --- a/src/coreclr/tools/Common/JitInterface/ThunkGenerator/ThunkInput.txt +++ b/src/coreclr/tools/Common/JitInterface/ThunkGenerator/ThunkInput.txt @@ -170,7 +170,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); - CORINFO_METHOD_HANDLE resolveVirtualMethod( CORINFO_METHOD_HANDLE virtualMethod, CORINFO_CLASS_HANDLE implementingClass, BOOL* requiresInstMethodTableArg, CORINFO_CONTEXT_HANDLE ownerType); + CORINFO_METHOD_HANDLE resolveVirtualMethod( CORINFO_METHOD_HANDLE virtualMethod, CORINFO_CLASS_HANDLE implementingClass, BOOL* requiresInstMethodTableArg, CORINFO_CONTEXT_HANDLE* ownerType); 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); diff --git a/src/coreclr/vm/jitinterface.cpp b/src/coreclr/vm/jitinterface.cpp index 46e522e34071e..36c59977de701 100644 --- a/src/coreclr/vm/jitinterface.cpp +++ b/src/coreclr/vm/jitinterface.cpp @@ -8857,7 +8857,7 @@ void CEEInfo::getMethodVTableOffset (CORINFO_METHOD_HANDLE methodHnd, CORINFO_METHOD_HANDLE CEEInfo::resolveVirtualMethodHelper(CORINFO_METHOD_HANDLE baseMethod, CORINFO_CLASS_HANDLE derivedClass, bool* requiresInstMethodTableArg, - CORINFO_CONTEXT_HANDLE ownerType) + CORINFO_CONTEXT_HANDLE* ownerType) { CONTRACTL { THROWS; @@ -8914,9 +8914,9 @@ CORINFO_METHOD_HANDLE CEEInfo::resolveVirtualMethodHelper(CORINFO_METHOD_HANDLE // For generic interface methods we must have context to // safely devirtualize. MethodTable* pOwnerMT = nullptr; - if (ownerType != nullptr) + if (*ownerType != nullptr) { - TypeHandle OwnerClsHnd = GetTypeFromContext(ownerType); + TypeHandle OwnerClsHnd = GetTypeFromContext(*ownerType); pOwnerMT = OwnerClsHnd.GetMethodTable(); if (!canCastStraightForward && !pOwnerMT->IsInterface() && !pDerivedMT->CanCastToInterface(pOwnerMT)) @@ -8958,6 +8958,7 @@ CORINFO_METHOD_HANDLE CEEInfo::resolveVirtualMethodHelper(CORINFO_METHOD_HANDLE // or non shared generic instantiation ie is _ASSERTE(pDevirtMD->IsWrapperStub() || !(pDevirtMD->GetMethodTable()->IsSharedByGenericInstantiations() || pDevirtMD->IsSharedByGenericMethodInstantiations())); *requiresInstMethodTableArg = pDevirtMD->IsWrapperStub(); + *ownerType = MAKE_CLASSCONTEXT(pDevirtMD->GetMethodTable()); } } else @@ -9058,7 +9059,7 @@ CORINFO_METHOD_HANDLE CEEInfo::resolveVirtualMethodHelper(CORINFO_METHOD_HANDLE CORINFO_METHOD_HANDLE CEEInfo::resolveVirtualMethod(CORINFO_METHOD_HANDLE methodHnd, CORINFO_CLASS_HANDLE derivedClass, bool* requiresInstMethodTableArg, - CORINFO_CONTEXT_HANDLE ownerType) + CORINFO_CONTEXT_HANDLE* ownerType) { CONTRACTL { THROWS; diff --git a/src/coreclr/vm/jitinterface.h b/src/coreclr/vm/jitinterface.h index 88021d521d6fe..e7906b72ff538 100644 --- a/src/coreclr/vm/jitinterface.h +++ b/src/coreclr/vm/jitinterface.h @@ -736,14 +736,14 @@ class CEEInfo : public ICorJitInfo CORINFO_METHOD_HANDLE virtualMethod, CORINFO_CLASS_HANDLE implementingClass, bool* requiresInstMethodTableArg, - CORINFO_CONTEXT_HANDLE ownerType + CORINFO_CONTEXT_HANDLE* ownerType ); CORINFO_METHOD_HANDLE resolveVirtualMethodHelper( CORINFO_METHOD_HANDLE virtualMethod, CORINFO_CLASS_HANDLE implementingClass, bool* requiresInstMethodTableArg, - CORINFO_CONTEXT_HANDLE ownerType + CORINFO_CONTEXT_HANDLE* ownerType ); CORINFO_METHOD_HANDLE getUnboxedEntry( diff --git a/src/coreclr/zap/zapinfo.cpp b/src/coreclr/zap/zapinfo.cpp index 42aecafa2bd75..2845774a60cb3 100644 --- a/src/coreclr/zap/zapinfo.cpp +++ b/src/coreclr/zap/zapinfo.cpp @@ -4000,7 +4000,7 @@ CORINFO_METHOD_HANDLE ZapInfo::resolveVirtualMethod( CORINFO_METHOD_HANDLE virtualMethod, CORINFO_CLASS_HANDLE implementingClass, bool* requiresInstMethodTableArg, - CORINFO_CONTEXT_HANDLE ownerType) + CORINFO_CONTEXT_HANDLE* ownerType) { return m_pEEJitInfo->resolveVirtualMethod(virtualMethod, implementingClass, requiresInstMethodTableArg, ownerType); } diff --git a/src/coreclr/zap/zapinfo.h b/src/coreclr/zap/zapinfo.h index 26900e1affb73..408af0643a0d2 100644 --- a/src/coreclr/zap/zapinfo.h +++ b/src/coreclr/zap/zapinfo.h @@ -679,7 +679,7 @@ class ZapInfo CORINFO_METHOD_HANDLE virtualMethod, CORINFO_CLASS_HANDLE implementingClass, bool* requiresInstMethodTableArg, - CORINFO_CONTEXT_HANDLE ownerType); + CORINFO_CONTEXT_HANDLE* ownerType); CORINFO_METHOD_HANDLE getUnboxedEntry( CORINFO_METHOD_HANDLE ftn, From 286f60648ee8e7b31aced5db2dc31402b532842a Mon Sep 17 00:00:00 2001 From: Rattenkrieg Date: Wed, 28 Oct 2020 18:55:38 +0300 Subject: [PATCH 10/29] fixed conditionals --- src/coreclr/vm/jitinterface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/vm/jitinterface.cpp b/src/coreclr/vm/jitinterface.cpp index 36c59977de701..91f76e670c785 100644 --- a/src/coreclr/vm/jitinterface.cpp +++ b/src/coreclr/vm/jitinterface.cpp @@ -8919,7 +8919,7 @@ CORINFO_METHOD_HANDLE CEEInfo::resolveVirtualMethodHelper(CORINFO_METHOD_HANDLE TypeHandle OwnerClsHnd = GetTypeFromContext(*ownerType); pOwnerMT = OwnerClsHnd.GetMethodTable(); - if (!canCastStraightForward && !pOwnerMT->IsInterface() && !pDerivedMT->CanCastToInterface(pOwnerMT)) + if (!canCastStraightForward && !(pOwnerMT->IsInterface() && pDerivedMT->CanCastToInterface(pOwnerMT))) { return nullptr; } From 46fce53b8ba8b4abea67459d5f2056d2c36dadf6 Mon Sep 17 00:00:00 2001 From: Rattenkrieg Date: Wed, 28 Oct 2020 21:39:13 +0300 Subject: [PATCH 11/29] csharp jitinterface patch --- .../tools/Common/JitInterface/CorInfoBase.cs | 4 ++-- .../tools/Common/JitInterface/CorInfoImpl.cs | 18 ++++++++---------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/coreclr/tools/Common/JitInterface/CorInfoBase.cs b/src/coreclr/tools/Common/JitInterface/CorInfoBase.cs index 47072ed611cf7..6acbdf890402d 100644 --- a/src/coreclr/tools/Common/JitInterface/CorInfoBase.cs +++ b/src/coreclr/tools/Common/JitInterface/CorInfoBase.cs @@ -187,7 +187,7 @@ static void _getMethodVTableOffset(IntPtr thisHandle, IntPtr* ppException, CORIN } [UnmanagedCallersOnly] - static CORINFO_METHOD_STRUCT_* _resolveVirtualMethod(IntPtr thisHandle, IntPtr* ppException, CORINFO_METHOD_STRUCT_* virtualMethod, CORINFO_CLASS_STRUCT_* implementingClass, bool* requiresInstMethodTableArg, CORINFO_CONTEXT_STRUCT* ownerType) + static CORINFO_METHOD_STRUCT_* _resolveVirtualMethod(IntPtr thisHandle, IntPtr* ppException, CORINFO_METHOD_STRUCT_* virtualMethod, CORINFO_CLASS_STRUCT_* implementingClass, bool* requiresInstMethodTableArg, CORINFO_CONTEXT_STRUCT** ownerType) { var _this = GetThis(thisHandle); try @@ -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)&_resolveVirtualMethod; + 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 830e6576d63cf..23c0f4e421d16 100644 --- a/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs +++ b/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs @@ -944,15 +944,11 @@ private void getEHinfo(CORINFO_METHOD_STRUCT_* ftn, uint EHnumber, ref CORINFO_E return (CORINFO_MODULE_STRUCT_*)ObjectToHandle(methodIL); } - // TODO: deal with requiresInstMethodTableArg - private CORINFO_METHOD_STRUCT_* resolveVirtualMethod(CORINFO_METHOD_STRUCT_* baseMethod, CORINFO_CLASS_STRUCT_* derivedClass, bool* requiresInstMethodTableArg, CORINFO_CONTEXT_STRUCT* ownerType) + // crossgen2smoke is passing now but I'm still not sure in this code + private CORINFO_METHOD_STRUCT_* resolveVirtualMethod(CORINFO_METHOD_STRUCT_* baseMethod, CORINFO_CLASS_STRUCT_* derivedClass, bool* requiresInstMethodTableArg, CORINFO_CONTEXT_STRUCT** ownerType) { - // Initialize OUT fields - info->devirtualizedMethod = null; - info->requiresInstMethodTableArg = false; - info->exactContext = null; - - TypeDesc objType = HandleToObject(info->objClass); + TypeDesc implType = HandleToObject(derivedClass); + *requiresInstMethodTableArg = false; // __Canon cannot be devirtualized if (objType.IsCanonicalDefinitionType(CanonicalFormKind.Any)) @@ -963,13 +959,15 @@ private void getEHinfo(CORINFO_METHOD_STRUCT_* ftn, uint EHnumber, ref CORINFO_E MethodDesc decl = HandleToObject(info->virtualMethod); Debug.Assert(!decl.HasInstantiation); - if (info->context != null) + if (*ownerType != null) { - TypeDesc ownerTypeDesc = typeFromContext(info->context); + TypeDesc ownerTypeDesc = typeFromContext(*ownerType); if (decl.OwningType != ownerTypeDesc) { Debug.Assert(ownerTypeDesc is InstantiatedType); decl = _compilation.TypeSystemContext.GetMethodForInstantiatedType(decl.GetTypicalMethodDefinition(), (InstantiatedType)ownerTypeDesc); + *ownerType = contextFromType(decl.OwningType); + *requiresInstMethodTableArg = true; } } From ddbed14ddc711862f8513aeb1d4e222bcb8988df Mon Sep 17 00:00:00 2001 From: Rattenkrieg Date: Thu, 29 Oct 2020 02:32:45 +0300 Subject: [PATCH 12/29] return shared method desc instead of stub; refactor arg construction --- src/coreclr/jit/importer.cpp | 69 +++++++++++---------------------- src/coreclr/vm/jitinterface.cpp | 12 +++++- 2 files changed, 33 insertions(+), 48 deletions(-) diff --git a/src/coreclr/jit/importer.cpp b/src/coreclr/jit/importer.cpp index 8fcf8353af0f7..2aced26522b45 100644 --- a/src/coreclr/jit/importer.cpp +++ b/src/coreclr/jit/importer.cpp @@ -21170,6 +21170,7 @@ void Compiler::impDevirtualizeCall(GenTreeCall* call, // stubs) call->gtInlineCandidateInfo = nullptr; + bool passExtraArgForValueType = false; // If the 'this' object is a box, see if we can find the unboxed entry point for the call. if (thisObj->IsBoxedValue()) { @@ -21285,30 +21286,7 @@ void Compiler::impDevirtualizeCall(GenTreeCall* call, // there is no unboxed entry when we got devirtualized to DIM else if (requiresInstMethodTableArg) { - assert(((SIZE_T)ownerType & CORINFO_CONTEXTFLAGS_MASK) == CORINFO_CONTEXTFLAGS_CLASS); - CORINFO_CLASS_HANDLE exactClassHandle = eeGetClassFromContext(ownerType); - GenTree* instParam = gtNewIconEmbClsHndNode(exactClassHandle); - call->gtCallMethHnd = derivedMethod; - if ((Target::g_tgtArgOrder == Target::ARG_ORDER_R2L) || (call->gtCallArgs == nullptr)) - { - call->gtCallArgs = gtPrependNewCallArg(instParam, call->gtCallArgs); - } - // Append for non-empty L2R - else - { - GenTreeCall::Use* beforeArg = call->gtCallArgs; - while (beforeArg->GetNext() != nullptr) - { - beforeArg = beforeArg->GetNext(); - } - - beforeArg->SetNext(gtNewCallArgs(instParam)); - } - // do we need this? - for (GenTreeCall::Use& use : call->AsCall()->Args()) - { - call->gtFlags |= use.GetNode()->gtFlags & GTF_GLOB_EFFECT; - } + passExtraArgForValueType = true; } else { @@ -21321,34 +21299,31 @@ void Compiler::impDevirtualizeCall(GenTreeCall* call, } } // check wheter we have returned an instantiating stub for generic DIM - else if (isInterface) + if ((isInterface && requiresInstMethodTableArg) || passExtraArgForValueType) { - if (requiresInstMethodTableArg) + assert(((SIZE_T)ownerType & CORINFO_CONTEXTFLAGS_MASK) == CORINFO_CONTEXTFLAGS_CLASS); + CORINFO_CLASS_HANDLE exactClassHandle = eeGetClassFromContext(ownerType); + GenTree* instParam = gtNewIconEmbClsHndNode(exactClassHandle); + call->gtCallMethHnd = derivedMethod; + if ((Target::g_tgtArgOrder == Target::ARG_ORDER_R2L) || (call->gtCallArgs == nullptr)) + { + call->gtCallArgs = gtPrependNewCallArg(instParam, call->gtCallArgs); + } + // Append for non-empty L2R + else { - assert(((SIZE_T)ownerType & CORINFO_CONTEXTFLAGS_MASK) == CORINFO_CONTEXTFLAGS_CLASS); - CORINFO_CLASS_HANDLE exactClassHandle = eeGetClassFromContext(ownerType); - GenTree* instParam = gtNewIconEmbClsHndNode(exactClassHandle); - call->gtCallMethHnd = derivedMethod; - if ((Target::g_tgtArgOrder == Target::ARG_ORDER_R2L) || (call->gtCallArgs == nullptr)) + GenTreeCall::Use* beforeArg = call->gtCallArgs; + while (beforeArg->GetNext() != nullptr) { - call->gtCallArgs = gtPrependNewCallArg(instParam, call->gtCallArgs); + beforeArg = beforeArg->GetNext(); } - // Append for non-empty L2R - else - { - GenTreeCall::Use* beforeArg = call->gtCallArgs; - while (beforeArg->GetNext() != nullptr) - { - beforeArg = beforeArg->GetNext(); - } - beforeArg->SetNext(gtNewCallArgs(instParam)); - } - // do we need this? - for (GenTreeCall::Use& use : call->AsCall()->Args()) - { - call->gtFlags |= use.GetNode()->gtFlags & GTF_GLOB_EFFECT; - } + beforeArg->SetNext(gtNewCallArgs(instParam)); + } + // do we need this? + for (GenTreeCall::Use& use : call->AsCall()->Args()) + { + call->gtFlags |= use.GetNode()->gtFlags & GTF_GLOB_EFFECT; } // should we patch call->gtCallMoreFlags ? diff --git a/src/coreclr/vm/jitinterface.cpp b/src/coreclr/vm/jitinterface.cpp index 91f76e670c785..61ea97486ccdc 100644 --- a/src/coreclr/vm/jitinterface.cpp +++ b/src/coreclr/vm/jitinterface.cpp @@ -8957,8 +8957,18 @@ CORINFO_METHOD_HANDLE CEEInfo::resolveVirtualMethodHelper(CORINFO_METHOD_HANDLE // either instantiating stub ie `pDevirtMD->IsWrapperStub() == true` // or non shared generic instantiation ie is _ASSERTE(pDevirtMD->IsWrapperStub() || !(pDevirtMD->GetMethodTable()->IsSharedByGenericInstantiations() || pDevirtMD->IsSharedByGenericMethodInstantiations())); - *requiresInstMethodTableArg = pDevirtMD->IsWrapperStub(); *ownerType = MAKE_CLASSCONTEXT(pDevirtMD->GetMethodTable()); + _ASSERTE(pDevirtMD->IsRestored() && pDevirtMD->GetMethodTable()->IsFullyLoaded()); + if (pDevirtMD->IsWrapperStub()) + { + *requiresInstMethodTableArg = true; + pDevirtMD = pDevirtMD->GetExistingWrappedMethodDesc(); + } + else + { + *requiresInstMethodTableArg = false; + } + _ASSERTE(pDevirtMD->IsRestored() && pDevirtMD->GetMethodTable()->IsFullyLoaded()); } } else From 561ed32c2833b86b2a2cc704b46c98404ae8caf4 Mon Sep 17 00:00:00 2001 From: Rattenkrieg Date: Sat, 31 Oct 2020 13:44:31 +0300 Subject: [PATCH 13/29] cleanup and typos --- src/coreclr/vm/jitinterface.cpp | 1 - src/coreclr/vm/methodtable.h | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/coreclr/vm/jitinterface.cpp b/src/coreclr/vm/jitinterface.cpp index 61ea97486ccdc..5d80eddb61863 100644 --- a/src/coreclr/vm/jitinterface.cpp +++ b/src/coreclr/vm/jitinterface.cpp @@ -8958,7 +8958,6 @@ CORINFO_METHOD_HANDLE CEEInfo::resolveVirtualMethodHelper(CORINFO_METHOD_HANDLE // or non shared generic instantiation ie is _ASSERTE(pDevirtMD->IsWrapperStub() || !(pDevirtMD->GetMethodTable()->IsSharedByGenericInstantiations() || pDevirtMD->IsSharedByGenericMethodInstantiations())); *ownerType = MAKE_CLASSCONTEXT(pDevirtMD->GetMethodTable()); - _ASSERTE(pDevirtMD->IsRestored() && pDevirtMD->GetMethodTable()->IsFullyLoaded()); if (pDevirtMD->IsWrapperStub()) { *requiresInstMethodTableArg = true; diff --git a/src/coreclr/vm/methodtable.h b/src/coreclr/vm/methodtable.h index 118e56467ac22..556739f8e01c9 100644 --- a/src/coreclr/vm/methodtable.h +++ b/src/coreclr/vm/methodtable.h @@ -2094,7 +2094,7 @@ class MethodTable MethodDesc *GetMethodDescForInterfaceMethod(TypeHandle ownerType, MethodDesc *pInterfaceMD, BOOL throwOnConflict); MethodDesc *GetMethodDescForInterfaceMethod(MethodDesc *pInterfaceMD, BOOL throwOnConflict); // You can only use this one for non-generic interfaces - // ^-- I don't believe this is correct statement, we have PRECONDITION(!pInterfaceMD->HasClassOrMethodInstantiation()); whic implies it can be used with generic interfaces + // ^-- I don't believe this is correct statement, we have PRECONDITION(!pInterfaceMD->HasClassOrMethodInstantiation()); which implies it can be used with generic interfaces //------------------------------------------------------------------- // INTERFACE MAP. From 43d13cbf791440ee3a52c7250456476b46381624 Mon Sep 17 00:00:00 2001 From: Rattenkrieg Date: Tue, 3 Nov 2020 13:59:55 +0300 Subject: [PATCH 14/29] tests --- .../devirttest/devirttest.cs | 31 +++ .../devirttest/devirttest.csproj | 10 + .../devirttestinline/devirttestinline.cs | 26 ++ .../devirttestinline/devirttestinline.csproj | 10 + .../devirttestsingle/devirttestsingle.cs | 33 +++ .../devirttestsingle/devirttestsingle.csproj | 10 + .../devirttestsinglenongeneric.cs | 24 ++ .../devirttestsinglenongeneric.csproj | 10 + .../devirttestsingleoverriding.cs | 25 ++ .../devirttestsingleoverriding.csproj | 10 + .../devirttestsingleoverridinggeneric.cs | 25 ++ .../devirttestsingleoverridinggeneric.csproj | 10 + .../devirttestsingleoverstruct.cs | 24 ++ .../devirttestsingleoverstruct.csproj | 10 + .../devirttestsinglevaluetypenondim.cs | 25 ++ .../devirttestsinglevaluetypenondim.csproj | 10 + .../devirttestsinglevariance.cs | 24 ++ .../devirttestsinglevariance.csproj | 10 + .../devirttestsnondimstruct.cs | 23 ++ .../devirttestsnondimstruct.csproj | 10 + .../devirtteststructs/devirtteststructs.cs | 31 +++ .../devirtteststructs.csproj | 10 + .../staticshared/staticshared.cs | 34 +++ .../staticshared/staticshared.csproj | 10 + .../valuetypes/valuetypes/valuetypes.cs | 97 +++++++ .../valuetypes/valuetypes/valuetypes.il | 254 ++++++++++++++++++ .../valuetypes/valuetypes/valuetypes.ilproj | 10 + 27 files changed, 806 insertions(+) create mode 100644 src/tests/Loader/classloader/DefaultInterfaceMethods/devirttest/devirttest.cs create mode 100644 src/tests/Loader/classloader/DefaultInterfaceMethods/devirttest/devirttest.csproj create mode 100644 src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestinline/devirttestinline.cs create mode 100644 src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestinline/devirttestinline.csproj create mode 100644 src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsingle/devirttestsingle.cs create mode 100644 src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsingle/devirttestsingle.csproj create mode 100644 src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsinglenongeneric/devirttestsinglenongeneric.cs create mode 100644 src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsinglenongeneric/devirttestsinglenongeneric.csproj create mode 100644 src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsingleoverriding/devirttestsingleoverriding.cs create mode 100644 src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsingleoverriding/devirttestsingleoverriding.csproj create mode 100644 src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsingleoverridinggeneric/devirttestsingleoverridinggeneric.cs create mode 100644 src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsingleoverridinggeneric/devirttestsingleoverridinggeneric.csproj create mode 100644 src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsingleoverstruct/devirttestsingleoverstruct.cs create mode 100644 src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsingleoverstruct/devirttestsingleoverstruct.csproj create mode 100644 src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsinglevaluetypenondim/devirttestsinglevaluetypenondim.cs create mode 100644 src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsinglevaluetypenondim/devirttestsinglevaluetypenondim.csproj create mode 100644 src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsinglevariance/devirttestsinglevariance.cs create mode 100644 src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsinglevariance/devirttestsinglevariance.csproj create mode 100644 src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsnondimstruct/devirttestsnondimstruct.cs create mode 100644 src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsnondimstruct/devirttestsnondimstruct.csproj create mode 100644 src/tests/Loader/classloader/DefaultInterfaceMethods/devirtteststructs/devirtteststructs.cs create mode 100644 src/tests/Loader/classloader/DefaultInterfaceMethods/devirtteststructs/devirtteststructs.csproj create mode 100644 src/tests/Loader/classloader/DefaultInterfaceMethods/staticshared/staticshared.cs create mode 100644 src/tests/Loader/classloader/DefaultInterfaceMethods/staticshared/staticshared.csproj create mode 100644 src/tests/Loader/classloader/DefaultInterfaceMethods/valuetypes/valuetypes/valuetypes.cs create mode 100644 src/tests/Loader/classloader/DefaultInterfaceMethods/valuetypes/valuetypes/valuetypes.il create mode 100644 src/tests/Loader/classloader/DefaultInterfaceMethods/valuetypes/valuetypes/valuetypes.ilproj diff --git a/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttest/devirttest.cs b/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttest/devirttest.cs new file mode 100644 index 0000000000000..25e426dbf166a --- /dev/null +++ b/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttest/devirttest.cs @@ -0,0 +1,31 @@ +using System; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; + +interface I +{ + string DefaultTypeOf() => typeof(T).Name; +} + +class Dummy { } + +class C : I, I, I +{ + string I.DefaultTypeOf() => "C.Dummy"; +} + +public static class Program +{ + [MethodImpl(MethodImplOptions.AggressiveOptimization)] + static int Main() + { + var c = new C(); + var dcs = ((I)c).DefaultTypeOf(); + if (dcs != "String") return 200; + var dos = ((I)c).DefaultTypeOf(); + if (dos != "Object") return 300; + var dds = ((I)c).DefaultTypeOf(); + if (dds != "C.Dummy") return 300; + return 100; + } +} diff --git a/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttest/devirttest.csproj b/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttest/devirttest.csproj new file mode 100644 index 0000000000000..1b2deab014cbc --- /dev/null +++ b/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttest/devirttest.csproj @@ -0,0 +1,10 @@ + + + Exe + BuildAndRun + 0 + + + + + diff --git a/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestinline/devirttestinline.cs b/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestinline/devirttestinline.cs new file mode 100644 index 0000000000000..101b47ca0a9de --- /dev/null +++ b/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestinline/devirttestinline.cs @@ -0,0 +1,26 @@ +using System; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; + +interface I where T : IComparable +{ + T GetAt(int i, T[] tx) => tx[i]; +} + +class C : I +{ +} + +public static class Program +{ + private static string[] tx = new string[] { "test" }; + + [MethodImpl(MethodImplOptions.AggressiveOptimization)] + static int Main() + { + I c = new C(); + var dcs = c.GetAt(0, tx); + if (dcs != "test") return 200; + return 100; + } +} diff --git a/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestinline/devirttestinline.csproj b/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestinline/devirttestinline.csproj new file mode 100644 index 0000000000000..4a5088f8d6642 --- /dev/null +++ b/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestinline/devirttestinline.csproj @@ -0,0 +1,10 @@ + + + Exe + BuildAndRun + 0 + + + + + diff --git a/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsingle/devirttestsingle.cs b/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsingle/devirttestsingle.cs new file mode 100644 index 0000000000000..baeaa3f7b2779 --- /dev/null +++ b/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsingle/devirttestsingle.cs @@ -0,0 +1,33 @@ +using System; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; + +interface IM +{ + bool UseDefaultM { [MethodImpl(MethodImplOptions.AggressiveInlining)] get => true; } + ValueTask M(T instance) => throw new NotImplementedException("M must be implemented if UseDefaultM is false"); + static ValueTask DefaultM(T instance) + { + Console.WriteLine("Default Behaviour"); + return default; + } +} + +struct M : IM { } + +public static class Program +{ + [MethodImpl(MethodImplOptions.AggressiveOptimization)] + static void Main() + { + var m = new M(); + if (((IM)m).UseDefaultM) + { + IM.DefaultM(42); + } + else + { + ((IM)m).M(42); + } + } +} diff --git a/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsingle/devirttestsingle.csproj b/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsingle/devirttestsingle.csproj new file mode 100644 index 0000000000000..5947ca33624dd --- /dev/null +++ b/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsingle/devirttestsingle.csproj @@ -0,0 +1,10 @@ + + + Exe + BuildAndRun + 0 + + + + + diff --git a/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsinglenongeneric/devirttestsinglenongeneric.cs b/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsinglenongeneric/devirttestsinglenongeneric.cs new file mode 100644 index 0000000000000..46467d15c22a9 --- /dev/null +++ b/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsinglenongeneric/devirttestsinglenongeneric.cs @@ -0,0 +1,24 @@ +using System; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; + +interface I +{ + string DefaultTypeOf() => typeof(string).Name; +} + +class C : I +{ +} + +public static class Program +{ + [MethodImpl(MethodImplOptions.AggressiveOptimization)] + static int Main() + { + var c = new C(); + var dcs = ((I)c).DefaultTypeOf(); + if (dcs != "String") return 200; + return 100; + } +} diff --git a/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsinglenongeneric/devirttestsinglenongeneric.csproj b/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsinglenongeneric/devirttestsinglenongeneric.csproj new file mode 100644 index 0000000000000..ae643877c88a0 --- /dev/null +++ b/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsinglenongeneric/devirttestsinglenongeneric.csproj @@ -0,0 +1,10 @@ + + + Exe + BuildAndRun + 0 + + + + + diff --git a/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsingleoverriding/devirttestsingleoverriding.cs b/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsingleoverriding/devirttestsingleoverriding.cs new file mode 100644 index 0000000000000..1d650c46d28c3 --- /dev/null +++ b/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsingleoverriding/devirttestsingleoverriding.cs @@ -0,0 +1,25 @@ +using System; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; + +interface I +{ + string DefaultTypeOf() => typeof(T).Name; +} + +class C : I +{ + public string DefaultTypeOf() => "C.String"; +} + +public static class Program +{ + [MethodImpl(MethodImplOptions.AggressiveOptimization)] + static int Main() + { + var c = new C(); + var dcs = ((I)c).DefaultTypeOf(); + if (dcs != "C.String") return 200; + return 100; + } +} diff --git a/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsingleoverriding/devirttestsingleoverriding.csproj b/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsingleoverriding/devirttestsingleoverriding.csproj new file mode 100644 index 0000000000000..ebfbabc9c4771 --- /dev/null +++ b/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsingleoverriding/devirttestsingleoverriding.csproj @@ -0,0 +1,10 @@ + + + Exe + BuildAndRun + 0 + + + + + diff --git a/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsingleoverridinggeneric/devirttestsingleoverridinggeneric.cs b/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsingleoverridinggeneric/devirttestsingleoverridinggeneric.cs new file mode 100644 index 0000000000000..202a0431ce84c --- /dev/null +++ b/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsingleoverridinggeneric/devirttestsingleoverridinggeneric.cs @@ -0,0 +1,25 @@ +using System; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; + +interface I +{ + string DefaultTypeOf() => typeof(T).Name; +} + +class C : I +{ + public string DefaultTypeOf() => "C." + typeof(T).Name; +} + +public static class Program +{ + [MethodImpl(MethodImplOptions.AggressiveOptimization)] + static int Main() + { + var c = new C(); + var dcs = ((I)c).DefaultTypeOf(); + if (dcs != "C.String") return 200; + return 100; + } +} diff --git a/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsingleoverridinggeneric/devirttestsingleoverridinggeneric.csproj b/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsingleoverridinggeneric/devirttestsingleoverridinggeneric.csproj new file mode 100644 index 0000000000000..a1b81dac74ab8 --- /dev/null +++ b/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsingleoverridinggeneric/devirttestsingleoverridinggeneric.csproj @@ -0,0 +1,10 @@ + + + Exe + BuildAndRun + 0 + + + + + diff --git a/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsingleoverstruct/devirttestsingleoverstruct.cs b/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsingleoverstruct/devirttestsingleoverstruct.cs new file mode 100644 index 0000000000000..c0c2cf0d55920 --- /dev/null +++ b/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsingleoverstruct/devirttestsingleoverstruct.cs @@ -0,0 +1,24 @@ +using System; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; + +interface I +{ + string DefaultTypeOf() => typeof(T).Name; +} + +class C : I +{ +} + +public static class Program +{ + [MethodImpl(MethodImplOptions.AggressiveOptimization)] + static int Main() + { + var c = new C(); + var dcs = ((I)c).DefaultTypeOf(); + if (dcs != "Int32") return 200; + return 100; + } +} diff --git a/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsingleoverstruct/devirttestsingleoverstruct.csproj b/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsingleoverstruct/devirttestsingleoverstruct.csproj new file mode 100644 index 0000000000000..37f246786c56a --- /dev/null +++ b/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsingleoverstruct/devirttestsingleoverstruct.csproj @@ -0,0 +1,10 @@ + + + Exe + BuildAndRun + 0 + + + + + diff --git a/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsinglevaluetypenondim/devirttestsinglevaluetypenondim.cs b/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsinglevaluetypenondim/devirttestsinglevaluetypenondim.cs new file mode 100644 index 0000000000000..59e96838b1003 --- /dev/null +++ b/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsinglevaluetypenondim/devirttestsinglevaluetypenondim.cs @@ -0,0 +1,25 @@ +using System; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; + +interface I +{ + string DefaultTypeOf(); +} + +struct C : I +{ + public string DefaultTypeOf() => "C." + typeof(T).Name; +} + +public static class Program +{ + [MethodImpl(MethodImplOptions.AggressiveOptimization)] + static int Main() + { + var c = new C(); + var dcs = ((I)c).DefaultTypeOf(); + if (dcs != "C.String") return 200; + return 100; + } +} diff --git a/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsinglevaluetypenondim/devirttestsinglevaluetypenondim.csproj b/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsinglevaluetypenondim/devirttestsinglevaluetypenondim.csproj new file mode 100644 index 0000000000000..bb79204518d93 --- /dev/null +++ b/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsinglevaluetypenondim/devirttestsinglevaluetypenondim.csproj @@ -0,0 +1,10 @@ + + + Exe + BuildAndRun + 0 + + + + + diff --git a/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsinglevariance/devirttestsinglevariance.cs b/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsinglevariance/devirttestsinglevariance.cs new file mode 100644 index 0000000000000..969fa6c901793 --- /dev/null +++ b/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsinglevariance/devirttestsinglevariance.cs @@ -0,0 +1,24 @@ +using System; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; + +interface I +{ + string DefaultTypeOf() => typeof(T).Name; +} + +class C : I +{ +} + +public static class Program +{ + [MethodImpl(MethodImplOptions.AggressiveOptimization)] + static int Main() + { + var c = new C(); + var dcs = ((I)c).DefaultTypeOf(); + if (dcs != "Object") return 200; + return 100; + } +} diff --git a/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsinglevariance/devirttestsinglevariance.csproj b/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsinglevariance/devirttestsinglevariance.csproj new file mode 100644 index 0000000000000..61d1caaaa414a --- /dev/null +++ b/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsinglevariance/devirttestsinglevariance.csproj @@ -0,0 +1,10 @@ + + + Exe + BuildAndRun + 0 + + + + + diff --git a/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsnondimstruct/devirttestsnondimstruct.cs b/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsnondimstruct/devirttestsnondimstruct.cs new file mode 100644 index 0000000000000..11555cce0deca --- /dev/null +++ b/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsnondimstruct/devirttestsnondimstruct.cs @@ -0,0 +1,23 @@ +using System; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; + + +struct C +{ + [MethodImpl(MethodImplOptions.NoInlining)] + public string DefaultTypeOf() => typeof(T).Name; +} + +public static class Program +{ + [MethodImpl(MethodImplOptions.AggressiveOptimization)] + static int Main() + { + var c = new C(); + // IN0002: 000010 mov rdx, 0x7FF95B110710 + var dcs = c.DefaultTypeOf(); + if (dcs != "String") return 200; + return 100; + } +} diff --git a/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsnondimstruct/devirttestsnondimstruct.csproj b/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsnondimstruct/devirttestsnondimstruct.csproj new file mode 100644 index 0000000000000..e20cd67a866a6 --- /dev/null +++ b/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsnondimstruct/devirttestsnondimstruct.csproj @@ -0,0 +1,10 @@ + + + Exe + BuildAndRun + 0 + + + + + diff --git a/src/tests/Loader/classloader/DefaultInterfaceMethods/devirtteststructs/devirtteststructs.cs b/src/tests/Loader/classloader/DefaultInterfaceMethods/devirtteststructs/devirtteststructs.cs new file mode 100644 index 0000000000000..e981d826e8eec --- /dev/null +++ b/src/tests/Loader/classloader/DefaultInterfaceMethods/devirtteststructs/devirtteststructs.cs @@ -0,0 +1,31 @@ +using System; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; + +interface I +{ + string DefaultTypeOf() => typeof(T).Name; +} + +class Dummy { } + +struct C : I, I, I +{ + string I.DefaultTypeOf() => "C.Dummy"; +} + +public static class Program +{ + [MethodImpl(MethodImplOptions.AggressiveOptimization)] + static int Main() + { + var c = new C(); + var dcs = ((I)c).DefaultTypeOf(); + if (dcs != "String") return 200; + var dos = ((I)c).DefaultTypeOf(); + if (dos != "Object") return 300; + var dds = ((I)c).DefaultTypeOf(); + if (dds != "C.Dummy") return 300; + return 100; + } +} diff --git a/src/tests/Loader/classloader/DefaultInterfaceMethods/devirtteststructs/devirtteststructs.csproj b/src/tests/Loader/classloader/DefaultInterfaceMethods/devirtteststructs/devirtteststructs.csproj new file mode 100644 index 0000000000000..30b0e720dbfc5 --- /dev/null +++ b/src/tests/Loader/classloader/DefaultInterfaceMethods/devirtteststructs/devirtteststructs.csproj @@ -0,0 +1,10 @@ + + + Exe + BuildAndRun + + + + + + diff --git a/src/tests/Loader/classloader/DefaultInterfaceMethods/staticshared/staticshared.cs b/src/tests/Loader/classloader/DefaultInterfaceMethods/staticshared/staticshared.cs new file mode 100644 index 0000000000000..2874c346cd11f --- /dev/null +++ b/src/tests/Loader/classloader/DefaultInterfaceMethods/staticshared/staticshared.cs @@ -0,0 +1,34 @@ +using System; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; + +class C +{ + public static string DefaultTypeOf() => typeof(T).Name; +} + +public static class Program +{ + [MethodImpl(MethodImplOptions.AggressiveOptimization)] + static int Main() + { + var dcs = C.DefaultTypeOf(); + if (dcs != "String") return 200; + return 100; + } +} + +/* +impDevirtualizeCall: Trying to devirtualize interface call: + class for 'this' is C [exact] (attrib 20000000) + base method is I`1[__Canon]::DefaultTypeOf +--- base class is interface + devirt to I`1[[System.String, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]][System.String]::DefaultTypeOf -- exact + [000010] --C-G------- * CALLV stub ref I`1[__Canon][System.__Canon].DefaultTypeOf + [000009] ------------ this in rcx \--* LCL_VAR ref V00 loc0 + exact; can devirtualize +... after devirt... + [000010] --C-G------- * CALL nullcheck ref I`1[[System.String, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]][System.String].DefaultTypeOf + [000009] ------------ this in rcx \--* LCL_VAR ref V00 loc0 +Devirtualized interface call to I`1[__Canon]:DefaultTypeOf; now direct call to I`1[[System.String, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]][System.String]:DefaultTypeOf [exact] +*/ diff --git a/src/tests/Loader/classloader/DefaultInterfaceMethods/staticshared/staticshared.csproj b/src/tests/Loader/classloader/DefaultInterfaceMethods/staticshared/staticshared.csproj new file mode 100644 index 0000000000000..8c523392d6d66 --- /dev/null +++ b/src/tests/Loader/classloader/DefaultInterfaceMethods/staticshared/staticshared.csproj @@ -0,0 +1,10 @@ + + + Exe + BuildAndRun + 0 + + + + + diff --git a/src/tests/Loader/classloader/DefaultInterfaceMethods/valuetypes/valuetypes/valuetypes.cs b/src/tests/Loader/classloader/DefaultInterfaceMethods/valuetypes/valuetypes/valuetypes.cs new file mode 100644 index 0000000000000..cfd11c3520745 --- /dev/null +++ b/src/tests/Loader/classloader/DefaultInterfaceMethods/valuetypes/valuetypes/valuetypes.cs @@ -0,0 +1,97 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; + +interface IValue +{ + int GetValue(); + void SetValue(int a); + int Add(int a); +} + +// This class is only needed to spit out IL that assumes 'this' is an object (and therefore don't box) +struct FooBarStruct_ : IValue +{ + public int GetValue() + { + return 0; + } + + public void SetValue(int val) + { + } + + public int Add(int a) + { + // Force cast and boxing + IValue valueIntf = this as IValue; + int val = valueIntf.GetValue(); + val += a; + valueIntf.SetValue(val); + return val; + } +} + +struct FooBarStruct : IValue +{ + public int _val; + + public int GetValue() + { + return _val; + } + + public void SetValue(int val) + { + _val = val; + } + + public int Add(int a) + { + // Dummy + return 0; + } +} + +class Program +{ + public static int Main() + { + FooBarStruct fooBar = new FooBarStruct(); + + fooBar._val = 10; + + IValue foo = (IValue) fooBar; + + Console.WriteLine("Calling IFoo.Foo on FooBarStruct"); + Test.Assert(foo.Add(10) == 20, "Calling default method IValue.Add on FooBarStruct failed"); + Test.Assert(fooBar.GetValue() == 10, "FooBarStruct value should remain unchanged"); + + return Test.Ret(); + } +} + +class Test +{ + private static bool Pass = true; + + public static int Ret() + { + return Pass? 100 : 101; + } + + public static void Assert(bool cond, string msg) + { + if (cond) + { + Console.WriteLine("PASS"); + } + else + { + Console.WriteLine("FAIL: " + msg); + Pass = false; + } + } +} + diff --git a/src/tests/Loader/classloader/DefaultInterfaceMethods/valuetypes/valuetypes/valuetypes.il b/src/tests/Loader/classloader/DefaultInterfaceMethods/valuetypes/valuetypes/valuetypes.il new file mode 100644 index 0000000000000..ff51b0ab33f79 --- /dev/null +++ b/src/tests/Loader/classloader/DefaultInterfaceMethods/valuetypes/valuetypes/valuetypes.il @@ -0,0 +1,254 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0 +// Copyright (c) Microsoft Corporation. All rights reserved. + + + +// Metadata version: v4.0.30319 +.assembly extern mscorlib +{ + .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. + .ver 4:0:0:0 +} +.assembly valuetypes +{ + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx + 63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows. + + // --- The following custom attribute is added automatically, do not uncomment ------- + // .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 07 01 00 00 00 00 ) + + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module valuetypes.exe +// MVID: {E191F723-B724-4D70-B3A8-CEA89FD033D3} +.imagebase 0x00400000 +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 // WINDOWS_CUI +.corflags 0x00000001 // ILONLY +// Image base: 0x01170000 + + +// =============== CLASS MEMBERS DECLARATION =================== + +.class interface private abstract auto ansi IValue +{ + .method public hidebysig newslot abstract virtual + instance int32 GetValue() cil managed + { + } // end of method IValue::GetValue + + .method public hidebysig newslot abstract virtual + instance void SetValue(int32 a) cil managed + { + } // end of method IValue::SetValue + + .method public hidebysig newslot virtual + instance int32 Add(int32 a) cil managed + { + // Code size 26 (0x1a) + .maxstack 2 + .locals init (int32 V_0, + int32 V_1) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: callvirt instance int32 IValue::GetValue() + IL_0007: stloc.0 + IL_0008: ldloc.0 + IL_0009: ldarg.1 + IL_000a: add + IL_000b: stloc.0 + IL_000c: ldarg.0 + IL_000d: ldloc.0 + IL_000e: callvirt instance void IValue::SetValue(int32) + IL_0013: nop + IL_0014: ldloc.0 + IL_0015: stloc.1 + IL_0016: br.s IL_0018 + + IL_0018: ldloc.1 + IL_0019: ret + } // end of method IValue::Add + +} // end of class IValue + +.class private sequential ansi sealed beforefieldinit FooBarStruct + extends [mscorlib]System.ValueType + implements IValue +{ + .field public int32 _val + .method public hidebysig newslot virtual final + instance int32 GetValue() cil managed + { + // Code size 12 (0xc) + .maxstack 1 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld int32 FooBarStruct::_val + IL_0007: stloc.0 + IL_0008: br.s IL_000a + + IL_000a: ldloc.0 + IL_000b: ret + } // end of method FooBarStruct::GetValue + + .method public hidebysig newslot virtual final + instance void SetValue(int32 val) cil managed + { + // Code size 9 (0x9) + .maxstack 8 + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldarg.1 + IL_0003: stfld int32 FooBarStruct::_val + IL_0008: ret + } // end of method FooBarStruct::SetValue +} // end of class FooBarStruct + +.class private auto ansi beforefieldinit Program + extends [mscorlib]System.Object +{ + .method public hidebysig static int32 Main() cil managed + { + .entrypoint + .maxstack 2 + .locals init (valuetype FooBarStruct V_0, + class IValue V_1, + int32 V_2) + IL_0000: nop + IL_0001: ldloca.s V_0 + IL_0003: initobj FooBarStruct + IL_0009: ldloca.s V_0 + IL_000b: ldc.i4.s 10 + IL_000d: stfld int32 FooBarStruct::_val + IL_0012: ldloc.0 + IL_0013: box FooBarStruct + IL_0018: stloc.1 + IL_0019: ldstr "Calling IFoo.Foo on FooBarStruct" + IL_001e: call void [mscorlib]System.Console::WriteLine(string) + IL_0023: nop + IL_0024: ldloc.1 + IL_0025: ldc.i4.s 10 + IL_0027: callvirt instance int32 IValue::Add(int32) + IL_002c: ldc.i4.s 20 + IL_002e: ceq + IL_0030: ldstr "Calling default method IValue.Add on FooBarStruct " + + "failed" + IL_0035: call void Test::Assert(bool, + string) + IL_003a: nop + IL_003b: ldloca V_0 + callvirt instance int32 FooBarStruct::GetValue() + ldc.i4.s 10 + ceq + ldstr "FooBarStruct value should remain unchanged" + call void Test::Assert(bool, + string) + nop + call int32 Test::Ret() + ret + } // end of method Program::Main + + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: nop + IL_0007: ret + } // end of method Program::.ctor + +} // end of class Program + +.class private auto ansi beforefieldinit Test + extends [mscorlib]System.Object +{ + .field private static bool Pass + .method public hidebysig static int32 Ret() cil managed + { + // Code size 19 (0x13) + .maxstack 1 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldsfld bool Test::Pass + IL_0006: brtrue.s IL_000c + + IL_0008: ldc.i4.s 101 + IL_000a: br.s IL_000e + + IL_000c: ldc.i4.s 100 + IL_000e: stloc.0 + IL_000f: br.s IL_0011 + + IL_0011: ldloc.0 + IL_0012: ret + } // end of method Test::Ret + + .method public hidebysig static void Assert(bool cond, + string msg) cil managed + { + // Code size 47 (0x2f) + .maxstack 2 + .locals init (bool V_0) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: stloc.0 + IL_0003: ldloc.0 + IL_0004: brfalse.s IL_0015 + + IL_0006: nop + IL_0007: ldstr "PASS" + IL_000c: call void [mscorlib]System.Console::WriteLine(string) + IL_0011: nop + IL_0012: nop + IL_0013: br.s IL_002e + + IL_0015: nop + IL_0016: ldstr "FAIL: " + IL_001b: ldarg.1 + IL_001c: call string [mscorlib]System.String::Concat(string, + string) + IL_0021: call void [mscorlib]System.Console::WriteLine(string) + IL_0026: nop + IL_0027: ldc.i4.0 + IL_0028: stsfld bool Test::Pass + IL_002d: nop + IL_002e: ret + } // end of method Test::Assert + + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: nop + IL_0007: ret + } // end of method Test::.ctor + + .method private hidebysig specialname rtspecialname static + void .cctor() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldc.i4.1 + IL_0001: stsfld bool Test::Pass + IL_0006: ret + } // end of method Test::.cctor + +} // end of class Test + + +// ============================================================= + +// *********** DISASSEMBLY COMPLETE *********************** +// WARNING: Created Win32 resource file valuetypes.res diff --git a/src/tests/Loader/classloader/DefaultInterfaceMethods/valuetypes/valuetypes/valuetypes.ilproj b/src/tests/Loader/classloader/DefaultInterfaceMethods/valuetypes/valuetypes/valuetypes.ilproj new file mode 100644 index 0000000000000..cee06d403f073 --- /dev/null +++ b/src/tests/Loader/classloader/DefaultInterfaceMethods/valuetypes/valuetypes/valuetypes.ilproj @@ -0,0 +1,10 @@ + + + Exe + BuildAndRun + 0 + + + + + From e5e1002680d58cb48e0ae487d765f0cfb90afc3b Mon Sep 17 00:00:00 2001 From: Rattenkrieg Date: Tue, 3 Nov 2020 14:06:41 +0300 Subject: [PATCH 15/29] tests cleanup --- .../devirttest39419.cs} | 0 .../devirttest39419.csproj} | 2 +- .../staticshared/staticshared.cs | 15 -- .../valuetypes/valuetypes/valuetypes.cs | 97 ------- .../valuetypes/valuetypes/valuetypes.il | 254 ------------------ .../valuetypes/valuetypes/valuetypes.ilproj | 10 - 6 files changed, 1 insertion(+), 377 deletions(-) rename src/tests/Loader/classloader/DefaultInterfaceMethods/{devirttestsingle/devirttestsingle.cs => devirttest39419/devirttest39419.cs} (100%) rename src/tests/Loader/classloader/DefaultInterfaceMethods/{devirttestsingle/devirttestsingle.csproj => devirttest39419/devirttest39419.csproj} (83%) delete mode 100644 src/tests/Loader/classloader/DefaultInterfaceMethods/valuetypes/valuetypes/valuetypes.cs delete mode 100644 src/tests/Loader/classloader/DefaultInterfaceMethods/valuetypes/valuetypes/valuetypes.il delete mode 100644 src/tests/Loader/classloader/DefaultInterfaceMethods/valuetypes/valuetypes/valuetypes.ilproj diff --git a/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsingle/devirttestsingle.cs b/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttest39419/devirttest39419.cs similarity index 100% rename from src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsingle/devirttestsingle.cs rename to src/tests/Loader/classloader/DefaultInterfaceMethods/devirttest39419/devirttest39419.cs diff --git a/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsingle/devirttestsingle.csproj b/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttest39419/devirttest39419.csproj similarity index 83% rename from src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsingle/devirttestsingle.csproj rename to src/tests/Loader/classloader/DefaultInterfaceMethods/devirttest39419/devirttest39419.csproj index 5947ca33624dd..948aa7ddc14bc 100644 --- a/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttestsingle/devirttestsingle.csproj +++ b/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttest39419/devirttest39419.csproj @@ -5,6 +5,6 @@ 0 - + diff --git a/src/tests/Loader/classloader/DefaultInterfaceMethods/staticshared/staticshared.cs b/src/tests/Loader/classloader/DefaultInterfaceMethods/staticshared/staticshared.cs index 2874c346cd11f..fbf8b8f55f06d 100644 --- a/src/tests/Loader/classloader/DefaultInterfaceMethods/staticshared/staticshared.cs +++ b/src/tests/Loader/classloader/DefaultInterfaceMethods/staticshared/staticshared.cs @@ -17,18 +17,3 @@ static int Main() return 100; } } - -/* -impDevirtualizeCall: Trying to devirtualize interface call: - class for 'this' is C [exact] (attrib 20000000) - base method is I`1[__Canon]::DefaultTypeOf ---- base class is interface - devirt to I`1[[System.String, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]][System.String]::DefaultTypeOf -- exact - [000010] --C-G------- * CALLV stub ref I`1[__Canon][System.__Canon].DefaultTypeOf - [000009] ------------ this in rcx \--* LCL_VAR ref V00 loc0 - exact; can devirtualize -... after devirt... - [000010] --C-G------- * CALL nullcheck ref I`1[[System.String, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]][System.String].DefaultTypeOf - [000009] ------------ this in rcx \--* LCL_VAR ref V00 loc0 -Devirtualized interface call to I`1[__Canon]:DefaultTypeOf; now direct call to I`1[[System.String, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]][System.String]:DefaultTypeOf [exact] -*/ diff --git a/src/tests/Loader/classloader/DefaultInterfaceMethods/valuetypes/valuetypes/valuetypes.cs b/src/tests/Loader/classloader/DefaultInterfaceMethods/valuetypes/valuetypes/valuetypes.cs deleted file mode 100644 index cfd11c3520745..0000000000000 --- a/src/tests/Loader/classloader/DefaultInterfaceMethods/valuetypes/valuetypes/valuetypes.cs +++ /dev/null @@ -1,97 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System; - -interface IValue -{ - int GetValue(); - void SetValue(int a); - int Add(int a); -} - -// This class is only needed to spit out IL that assumes 'this' is an object (and therefore don't box) -struct FooBarStruct_ : IValue -{ - public int GetValue() - { - return 0; - } - - public void SetValue(int val) - { - } - - public int Add(int a) - { - // Force cast and boxing - IValue valueIntf = this as IValue; - int val = valueIntf.GetValue(); - val += a; - valueIntf.SetValue(val); - return val; - } -} - -struct FooBarStruct : IValue -{ - public int _val; - - public int GetValue() - { - return _val; - } - - public void SetValue(int val) - { - _val = val; - } - - public int Add(int a) - { - // Dummy - return 0; - } -} - -class Program -{ - public static int Main() - { - FooBarStruct fooBar = new FooBarStruct(); - - fooBar._val = 10; - - IValue foo = (IValue) fooBar; - - Console.WriteLine("Calling IFoo.Foo on FooBarStruct"); - Test.Assert(foo.Add(10) == 20, "Calling default method IValue.Add on FooBarStruct failed"); - Test.Assert(fooBar.GetValue() == 10, "FooBarStruct value should remain unchanged"); - - return Test.Ret(); - } -} - -class Test -{ - private static bool Pass = true; - - public static int Ret() - { - return Pass? 100 : 101; - } - - public static void Assert(bool cond, string msg) - { - if (cond) - { - Console.WriteLine("PASS"); - } - else - { - Console.WriteLine("FAIL: " + msg); - Pass = false; - } - } -} - diff --git a/src/tests/Loader/classloader/DefaultInterfaceMethods/valuetypes/valuetypes/valuetypes.il b/src/tests/Loader/classloader/DefaultInterfaceMethods/valuetypes/valuetypes/valuetypes.il deleted file mode 100644 index ff51b0ab33f79..0000000000000 --- a/src/tests/Loader/classloader/DefaultInterfaceMethods/valuetypes/valuetypes/valuetypes.il +++ /dev/null @@ -1,254 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0 -// Copyright (c) Microsoft Corporation. All rights reserved. - - - -// Metadata version: v4.0.30319 -.assembly extern mscorlib -{ - .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. - .ver 4:0:0:0 -} -.assembly valuetypes -{ - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 ) - .custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx - 63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows. - - // --- The following custom attribute is added automatically, do not uncomment ------- - // .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 07 01 00 00 00 00 ) - - .hash algorithm 0x00008004 - .ver 0:0:0:0 -} -.module valuetypes.exe -// MVID: {E191F723-B724-4D70-B3A8-CEA89FD033D3} -.imagebase 0x00400000 -.file alignment 0x00000200 -.stackreserve 0x00100000 -.subsystem 0x0003 // WINDOWS_CUI -.corflags 0x00000001 // ILONLY -// Image base: 0x01170000 - - -// =============== CLASS MEMBERS DECLARATION =================== - -.class interface private abstract auto ansi IValue -{ - .method public hidebysig newslot abstract virtual - instance int32 GetValue() cil managed - { - } // end of method IValue::GetValue - - .method public hidebysig newslot abstract virtual - instance void SetValue(int32 a) cil managed - { - } // end of method IValue::SetValue - - .method public hidebysig newslot virtual - instance int32 Add(int32 a) cil managed - { - // Code size 26 (0x1a) - .maxstack 2 - .locals init (int32 V_0, - int32 V_1) - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: callvirt instance int32 IValue::GetValue() - IL_0007: stloc.0 - IL_0008: ldloc.0 - IL_0009: ldarg.1 - IL_000a: add - IL_000b: stloc.0 - IL_000c: ldarg.0 - IL_000d: ldloc.0 - IL_000e: callvirt instance void IValue::SetValue(int32) - IL_0013: nop - IL_0014: ldloc.0 - IL_0015: stloc.1 - IL_0016: br.s IL_0018 - - IL_0018: ldloc.1 - IL_0019: ret - } // end of method IValue::Add - -} // end of class IValue - -.class private sequential ansi sealed beforefieldinit FooBarStruct - extends [mscorlib]System.ValueType - implements IValue -{ - .field public int32 _val - .method public hidebysig newslot virtual final - instance int32 GetValue() cil managed - { - // Code size 12 (0xc) - .maxstack 1 - .locals init (int32 V_0) - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldfld int32 FooBarStruct::_val - IL_0007: stloc.0 - IL_0008: br.s IL_000a - - IL_000a: ldloc.0 - IL_000b: ret - } // end of method FooBarStruct::GetValue - - .method public hidebysig newslot virtual final - instance void SetValue(int32 val) cil managed - { - // Code size 9 (0x9) - .maxstack 8 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldarg.1 - IL_0003: stfld int32 FooBarStruct::_val - IL_0008: ret - } // end of method FooBarStruct::SetValue -} // end of class FooBarStruct - -.class private auto ansi beforefieldinit Program - extends [mscorlib]System.Object -{ - .method public hidebysig static int32 Main() cil managed - { - .entrypoint - .maxstack 2 - .locals init (valuetype FooBarStruct V_0, - class IValue V_1, - int32 V_2) - IL_0000: nop - IL_0001: ldloca.s V_0 - IL_0003: initobj FooBarStruct - IL_0009: ldloca.s V_0 - IL_000b: ldc.i4.s 10 - IL_000d: stfld int32 FooBarStruct::_val - IL_0012: ldloc.0 - IL_0013: box FooBarStruct - IL_0018: stloc.1 - IL_0019: ldstr "Calling IFoo.Foo on FooBarStruct" - IL_001e: call void [mscorlib]System.Console::WriteLine(string) - IL_0023: nop - IL_0024: ldloc.1 - IL_0025: ldc.i4.s 10 - IL_0027: callvirt instance int32 IValue::Add(int32) - IL_002c: ldc.i4.s 20 - IL_002e: ceq - IL_0030: ldstr "Calling default method IValue.Add on FooBarStruct " - + "failed" - IL_0035: call void Test::Assert(bool, - string) - IL_003a: nop - IL_003b: ldloca V_0 - callvirt instance int32 FooBarStruct::GetValue() - ldc.i4.s 10 - ceq - ldstr "FooBarStruct value should remain unchanged" - call void Test::Assert(bool, - string) - nop - call int32 Test::Ret() - ret - } // end of method Program::Main - - .method public hidebysig specialname rtspecialname - instance void .ctor() cil managed - { - // Code size 8 (0x8) - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void [mscorlib]System.Object::.ctor() - IL_0006: nop - IL_0007: ret - } // end of method Program::.ctor - -} // end of class Program - -.class private auto ansi beforefieldinit Test - extends [mscorlib]System.Object -{ - .field private static bool Pass - .method public hidebysig static int32 Ret() cil managed - { - // Code size 19 (0x13) - .maxstack 1 - .locals init (int32 V_0) - IL_0000: nop - IL_0001: ldsfld bool Test::Pass - IL_0006: brtrue.s IL_000c - - IL_0008: ldc.i4.s 101 - IL_000a: br.s IL_000e - - IL_000c: ldc.i4.s 100 - IL_000e: stloc.0 - IL_000f: br.s IL_0011 - - IL_0011: ldloc.0 - IL_0012: ret - } // end of method Test::Ret - - .method public hidebysig static void Assert(bool cond, - string msg) cil managed - { - // Code size 47 (0x2f) - .maxstack 2 - .locals init (bool V_0) - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: stloc.0 - IL_0003: ldloc.0 - IL_0004: brfalse.s IL_0015 - - IL_0006: nop - IL_0007: ldstr "PASS" - IL_000c: call void [mscorlib]System.Console::WriteLine(string) - IL_0011: nop - IL_0012: nop - IL_0013: br.s IL_002e - - IL_0015: nop - IL_0016: ldstr "FAIL: " - IL_001b: ldarg.1 - IL_001c: call string [mscorlib]System.String::Concat(string, - string) - IL_0021: call void [mscorlib]System.Console::WriteLine(string) - IL_0026: nop - IL_0027: ldc.i4.0 - IL_0028: stsfld bool Test::Pass - IL_002d: nop - IL_002e: ret - } // end of method Test::Assert - - .method public hidebysig specialname rtspecialname - instance void .ctor() cil managed - { - // Code size 8 (0x8) - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void [mscorlib]System.Object::.ctor() - IL_0006: nop - IL_0007: ret - } // end of method Test::.ctor - - .method private hidebysig specialname rtspecialname static - void .cctor() cil managed - { - // Code size 7 (0x7) - .maxstack 8 - IL_0000: ldc.i4.1 - IL_0001: stsfld bool Test::Pass - IL_0006: ret - } // end of method Test::.cctor - -} // end of class Test - - -// ============================================================= - -// *********** DISASSEMBLY COMPLETE *********************** -// WARNING: Created Win32 resource file valuetypes.res diff --git a/src/tests/Loader/classloader/DefaultInterfaceMethods/valuetypes/valuetypes/valuetypes.ilproj b/src/tests/Loader/classloader/DefaultInterfaceMethods/valuetypes/valuetypes/valuetypes.ilproj deleted file mode 100644 index cee06d403f073..0000000000000 --- a/src/tests/Loader/classloader/DefaultInterfaceMethods/valuetypes/valuetypes/valuetypes.ilproj +++ /dev/null @@ -1,10 +0,0 @@ - - - Exe - BuildAndRun - 0 - - - - - From 5302c510a8d8113e5a844efd3aaa9b04765919f8 Mon Sep 17 00:00:00 2001 From: Sergey Prytkov Date: Tue, 3 Nov 2020 16:18:35 +0300 Subject: [PATCH 16/29] formatting and tests fixes --- .../DefaultInterfaceMethods/devirttest39419/devirttest39419.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttest39419/devirttest39419.cs b/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttest39419/devirttest39419.cs index baeaa3f7b2779..257b51211ba79 100644 --- a/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttest39419/devirttest39419.cs +++ b/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttest39419/devirttest39419.cs @@ -24,10 +24,12 @@ static void Main() if (((IM)m).UseDefaultM) { IM.DefaultM(42); + return 100; } else { ((IM)m).M(42); } + return 200; } } From 1adb465edbe0c4cb566260f799ba0db985748642 Mon Sep 17 00:00:00 2001 From: Sergey Prytkov Date: Tue, 3 Nov 2020 17:58:30 +0300 Subject: [PATCH 17/29] more tests fixes --- .../DefaultInterfaceMethods/devirttest39419/devirttest39419.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttest39419/devirttest39419.cs b/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttest39419/devirttest39419.cs index 257b51211ba79..98528ae3f7df1 100644 --- a/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttest39419/devirttest39419.cs +++ b/src/tests/Loader/classloader/DefaultInterfaceMethods/devirttest39419/devirttest39419.cs @@ -18,7 +18,7 @@ struct M : IM { } public static class Program { [MethodImpl(MethodImplOptions.AggressiveOptimization)] - static void Main() + static int Main() { var m = new M(); if (((IM)m).UseDefaultM) From df791f12d9a51a04df52f0a4ee76fcaac7e6e3d8 Mon Sep 17 00:00:00 2001 From: Rattenkrieg Date: Mon, 9 Nov 2020 00:54:14 +0300 Subject: [PATCH 18/29] args for resolveVirtualMethod in struct --- .../superpmi/superpmi-shared/lwmlist.h | 2 +- .../superpmi-shared/methodcontext.cpp | 86 +++++++++---------- .../superpmi/superpmi-shared/methodcontext.h | 48 +++++++---- .../superpmi-shared/spmidumphelper.cpp | 18 ++++ .../superpmi/superpmi-shared/spmidumphelper.h | 4 + .../superpmi-shared/spmirecordhelper.h | 64 ++++++++++++++ .../superpmi-shim-collector/icorjitinfo.cpp | 18 ++-- .../ToolBox/superpmi/superpmi/icorjitinfo.cpp | 12 +-- src/coreclr/inc/corinfo.h | 36 ++++++-- src/coreclr/jit/ICorJitInfo_API_names.h | 2 +- src/coreclr/jit/ICorJitInfo_API_wrapper.hpp | 15 ++-- src/coreclr/jit/compiler.h | 4 + src/coreclr/jit/importer.cpp | 32 +++++-- .../superpmi-shared/icorjitinfoimpl.h | 7 +- .../superpmi-shim-counter/icorjitinfo.cpp | 14 ++- .../superpmi-shim-simple/icorjitinfo.cpp | 12 +-- .../src/tools/aot/jitinterface/jitinterface.h | 13 +-- .../tools/Common/JitInterface/CorInfoBase.cs | 16 ++-- .../tools/Common/JitInterface/CorInfoImpl.cs | 28 +++--- .../tools/Common/JitInterface/CorInfoTypes.cs | 22 +++++ .../ThunkGenerator/ThunkInput.txt | 2 +- src/coreclr/vm/jitinterface.cpp | 48 ++++------- src/coreclr/vm/jitinterface.h | 14 +-- src/coreclr/zap/zapinfo.cpp | 8 +- src/coreclr/zap/zapinfo.h | 6 +- 25 files changed, 317 insertions(+), 214 deletions(-) diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shared/lwmlist.h b/src/coreclr/ToolBox/superpmi/superpmi-shared/lwmlist.h index 8aca1b1634b83..717f65e1dd5aa 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(ResolveVirtualMethod, Agnostic_ResolveVirtualMethodKey, Agnostic_ResolveVirtualMethodResult) +LWM(TryResolveVirtualMethod, Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTin, TryResolveVirtualMethodValue) 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 6037a70249dbe..1ad590067c47e 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.cpp +++ b/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.cpp @@ -1313,7 +1313,7 @@ void MethodContext::recTryResolveToken(CORINFO_RESOLVED_TOKEN* pResolvedToken, b TryResolveTokenValue value; - value.tokenOut = SpmiRecordsHelper::StoreAgnostic_CORINFO_RESOLVED_TOKENout(pResolvedToken, ResolveToken); + value.tokenOut = SpmiRecordsHelper::StoreAgnostic_CORINFO_RESOLVED_TOKENout(pResolvedToken, TryResolveToken); // copypaste artifacts? value.success = success ? 0 : 1; TryResolveToken->Add(key, value); @@ -1335,7 +1335,8 @@ bool MethodContext::repTryResolveToken(CORINFO_RESOLVED_TOKEN* pResolvedToken) TryResolveTokenValue value = TryResolveToken->Get(key); - SpmiRecordsHelper::Restore_CORINFO_RESOLVED_TOKENout(pResolvedToken, value.tokenOut, ResolveToken); + // why not RestoreAgnostic_CORINFO_RESOLVED_TOKENout + SpmiRecordsHelper::Restore_CORINFO_RESOLVED_TOKENout(pResolvedToken, value.tokenOut, TryResolveToken); // copypaste artifacts? DEBUG_REP(dmpTryResolveToken(key, value)); return (DWORD)value.success == 0; @@ -3073,59 +3074,56 @@ void MethodContext::repGetMethodVTableOffset(CORINFO_METHOD_HANDLE method, DEBUG_REP(dmpGetMethodVTableOffset((DWORDLONG)method, value)); } -void MethodContext::recResolveVirtualMethod(CORINFO_METHOD_HANDLE virtMethod, - CORINFO_CLASS_HANDLE implClass, - bool* requiresInstMethodTableArg, - CORINFO_CONTEXT_HANDLE* ownerType, - CORINFO_METHOD_HANDLE result) +void MethodContext::recTryResolveVirtualMethod(CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT* pResolvedMethod, bool success) { - if (ResolveVirtualMethod == nullptr) + if (TryResolveVirtualMethod == nullptr) { - ResolveVirtualMethod = new LightWeightMap(); + TryResolveVirtualMethod = + new LightWeightMap(); } - Agnostic_ResolveVirtualMethod key; - key.virtualMethod = (DWORDLONG)virtMethod; - key.implementingClass = (DWORDLONG)implClass; - key.ownerType = (DWORDLONG)(*ownerType); - key.requiresInstMethodTableArg = *requiresInstMethodTableArg ? 1 : 0; // it's out param, do we need this stuff idk - - ResolveVirtualMethod->Add(key, (DWORDLONG)result); - DEBUG_REC(dmpResolveVirtualMethod(key, (DWORDLONG)result)); -} + 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; -void MethodContext::dmpResolveVirtualMethod(const Agnostic_ResolveVirtualMethodKey& key, const Agnostic_ResolveVirtualMethodResult& result) + TryResolveVirtualMethod->Add(key, value); + DEBUG_REC(dmpTryResolveVirtualMethod(key, value)); +} +void MethodContext::dmpTryResolveVirtualMethod(const Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTin& key, + const TryResolveVirtualMethodValue& value) { - printf("ResolveVirtualMethod virtMethod-%016llX, implClass-%016llX, requiresInstMethodTableArg-%016lX, ownerType-%016llX, result-%016llX", - key.virtualMethod, key.implementingClass, key.requiresInstMethodTableArg, key.ownerType, value); + 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); } - -CORINFO_METHOD_HANDLE MethodContext::repResolveVirtualMethod(CORINFO_METHOD_HANDLE virtMethod, - CORINFO_CLASS_HANDLE implClass, - bool* requiresInstMethodTableArg, - CORINFO_CONTEXT_HANDLE* ownerType) +bool MethodContext::repTryResolveVirtualMethod(CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT* pResolvedMethod) { - Agnostic_ResolveVirtualMethod key; - key.virtualMethod = (DWORDLONG)virtMethod; - key.implementingClass = (DWORDLONG)implClass; - key.ownerType = (DWORDLONG)(*ownerType); - key.requiresInstMethodTableArg = *requiresInstMethodTableArg ? 1 : 0; + 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 - AssertCodeMsg(ResolveVirtualMethod != nullptr, EXCEPTIONCODE_MC, - "No ResolveVirtualMap map for %016llX-%016llX-%016llX-%016llX", key.virtualMethod, - key.implementingClass, key.requiresInstMethodTableArg, key.ownerType); - AssertCodeMsg(ResolveVirtualMethod->GetIndex(key) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX-%016llx-%016lX-%016llX", - key.virtualMethod, key.implementingClass, key.requiresInstMethodTableArg, key.ownerType); - DWORDLONG result = ResolveVirtualMethod->Get(key); + key = SpmiRecordsHelper::CreateAgnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTin(pResolvedMethod); - 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; + TryResolveVirtualMethodValue value = TryResolveVirtualMethod->Get(key); - *requiresInstMethodTableArg = (key.requiresInstMethodTableArg != 0); - return (CORINFO_METHOD_HANDLE)result; + SpmiRecordsHelper::Restore_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTout(pResolvedMethod, value.contextOut, + TryResolveVirtualMethod); + + DEBUG_REP(dmpTryResolveVirtualMethod(key, value)); + return (DWORD)value.success == 0; } void MethodContext::recGetUnboxedEntry(CORINFO_METHOD_HANDLE ftn, diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.h b/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.h index 811d3ac458e98..9edf77435e4b2 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.h +++ b/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.h @@ -123,6 +123,18 @@ 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; @@ -195,6 +207,12 @@ 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; @@ -507,14 +525,6 @@ class MethodContext DWORD result; }; - struct Agnostic_ResolveVirtualMethodKey - { - DWORDLONG virtualMethod; - DWORDLONG implementingClass; - DWORD requiresInstMethodTableArg; - DWORDLONG ownerType; - }; - struct ResolveTokenValue { Agnostic_CORINFO_RESOLVED_TOKENout tokenOut; @@ -527,6 +537,12 @@ class MethodContext DWORD success; }; + struct TryResolveVirtualMethodValue + { + Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTout contextOut; + DWORD success; + }; + struct GetTokenTypeAsHandleValue { DWORDLONG hMethod; @@ -928,16 +944,10 @@ class MethodContext unsigned* offsetAfterIndirection, bool* isRelative); - void recResolveVirtualMethod(CORINFO_METHOD_HANDLE virtMethod, - CORINFO_CLASS_HANDLE implClass, - bool* requiresInstMethodTableArg, - CORINFO_CONTEXT_HANDLE* ownerType, - CORINFO_METHOD_HANDLE result); - void dmpResolveVirtualMethod(const Agnostic_ResolveVirtualMethod& key, DWORDLONG value); - CORINFO_METHOD_HANDLE repResolveVirtualMethod(CORINFO_METHOD_HANDLE virtMethod, - CORINFO_CLASS_HANDLE implClass, - bool* requiresInstMethodTableArg, - CORINFO_CONTEXT_HANDLE* ownerType); + 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 recGetUnboxedEntry(CORINFO_METHOD_HANDLE ftn, bool* requiresInstMethodTableArg, CORINFO_METHOD_HANDLE result); void dmpGetUnboxedEntry(DWORDLONG key, DLD value); @@ -1536,7 +1546,7 @@ enum mcPackets Packet_IsMoreSpecificType = 174, // Added 2/14/2019 Packet_PInvokeMarshalingRequired = 108, Packet_ResolveToken = 109, - Packet_ResolveVirtualMethod = 160, // Added 2/13/17 + Packet_TryResolveVirtualMethod = 160, // Added 2/13/17 // is it safe to rename? Packet_TryResolveToken = 158, // Added 4/26/2016 Packet_SatisfiesClassConstraints = 110, Packet_SatisfiesMethodConstraints = 111, diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shared/spmidumphelper.cpp b/src/coreclr/ToolBox/superpmi/superpmi-shared/spmidumphelper.cpp index 2d7e8b5cb524f..50ce656b02eba 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi-shared/spmidumphelper.cpp +++ b/src/coreclr/ToolBox/superpmi/superpmi-shared/spmidumphelper.cpp @@ -38,6 +38,24 @@ std::string SpmiDumpHelper::DumpAgnostic_CORINFO_RESOLVED_TOKEN( DumpAgnostic_CORINFO_RESOLVED_TOKENout(token.outValue); } +std::string SpmiDumpHelper::DumpAgnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTin( + const MethodContext::Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTin& contextIn) +{ + char buffer[MAX_BUFFER_SIZE]; + sprintf_s(buffer, MAX_BUFFER_SIZE, "cls-%016llX vmeth-%016llX ownrcls-%016llX", contextIn.implementingClass, + contextIn.virtualMethod, contextIn.ownerType); + return std::string(buffer); +} + +std::string SpmiDumpHelper::DumpAgnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTout( + const MethodContext::Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTout& contextOut) +{ + char buffer[MAX_BUFFER_SIZE]; + sprintf_s(buffer, MAX_BUFFER_SIZE, "meth-%016llX needarg-%08X ownrcls-%016llX", contextOut.devirtualizedMethod, + contextOut.requiresInstMethodTableArg, contextOut.patchedOwnerType); + return std::string(buffer); +} + std::string SpmiDumpHelper::DumpAgnostic_CORINFO_LOOKUP_KIND( const MethodContext::Agnostic_CORINFO_LOOKUP_KIND& lookupKind) { diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shared/spmidumphelper.h b/src/coreclr/ToolBox/superpmi/superpmi-shared/spmidumphelper.h index 84349c0ee0b83..64098d59cabc8 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi-shared/spmidumphelper.h +++ b/src/coreclr/ToolBox/superpmi/superpmi-shared/spmidumphelper.h @@ -20,6 +20,10 @@ class SpmiDumpHelper static std::string DumpAgnostic_CORINFO_RESOLVED_TOKENout( const MethodContext::Agnostic_CORINFO_RESOLVED_TOKENout& tokenOut); static std::string DumpAgnostic_CORINFO_RESOLVED_TOKEN(const MethodContext::Agnostic_CORINFO_RESOLVED_TOKEN& token); + static std::string DumpAgnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTin( + const MethodContext::Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTin& contextIn); + static std::string DumpAgnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTout( + const MethodContext::Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTout& contextOut); static std::string DumpAgnostic_CORINFO_LOOKUP_KIND(const MethodContext::Agnostic_CORINFO_LOOKUP_KIND& lookupKind); static std::string DumpAgnostic_CORINFO_CONST_LOOKUP( const MethodContext::Agnostic_CORINFO_CONST_LOOKUP& constLookup); diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shared/spmirecordhelper.h b/src/coreclr/ToolBox/superpmi/superpmi-shared/spmirecordhelper.h index 54980ed34e40a..1e500fe948ed9 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi-shared/spmirecordhelper.h +++ b/src/coreclr/ToolBox/superpmi/superpmi-shared/spmirecordhelper.h @@ -43,6 +43,24 @@ class SpmiRecordsHelper MethodContext::Agnostic_CORINFO_RESOLVED_TOKENout& token, LightWeightMap* buffers); + static MethodContext::Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTin + CreateAgnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTin(CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT* pResolvedMethod); + + static MethodContext::Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTout + CreateAgnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTout_without_buffers( + CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT* pResolvedMethod); + + template + static MethodContext::Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTout + StoreAgnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTout( + CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT* pResolvedMethod, LightWeightMap* buffers); + + template + static void Restore_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTout( + CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT* pResolvedMethod, + MethodContext::Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTout& contextOut, + LightWeightMap* buffers); + static MethodContext::Agnostic_CORINFO_SIG_INFO CreateAgnostic_CORINFO_SIG_INFO_without_buffers( CORINFO_SIG_INFO& sigInfo); @@ -172,6 +190,52 @@ inline void SpmiRecordsHelper::Restore_CORINFO_RESOLVED_TOKENout( pResolvedToken->cbMethodSpec = (ULONG)tokenOut.cbMethodSpec; } +inline MethodContext::Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTin SpmiRecordsHelper:: + CreateAgnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTin(CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT* pResolvedMethod) +{ + MethodContext::Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTin contextIn; + ZeroMemory(&contextIn, sizeof(contextIn)); + contextIn.virtualMethod = (DWORDLONG)pResolvedMethod->virtualMethod; + contextIn.implementingClass = (DWORDLONG)pResolvedMethod->implementingClass; + contextIn.ownerType = (DWORDLONG)pResolvedMethod->ownerType; + return contextIn; +} + +inline MethodContext::Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTout SpmiRecordsHelper:: + CreateAgnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTout_without_buffers( + CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT* pResolvedMethod) +{ + MethodContext::Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTout contextOut; + ZeroMemory(&contextOut, sizeof(contextOut)); + contextOut.devirtualizedMethod = (DWORDLONG)pResolvedMethod->devirtualizedMethod; + contextOut.requiresInstMethodTableArg = (DWORD)pResolvedMethod->requiresInstMethodTableArg; + contextOut.patchedOwnerType = (DWORDLONG)pResolvedMethod->patchedOwnerType; + + return contextOut; +} + +template +inline MethodContext::Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTout SpmiRecordsHelper:: + StoreAgnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTout( + CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT* pResolvedMethod, LightWeightMap* buffers) +{ + MethodContext::Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTout contextOut( + CreateAgnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTout_without_buffers(pResolvedMethod)); + + return contextOut; +} + +template +inline void SpmiRecordsHelper::Restore_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTout( + CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT* pResolvedMethod, + MethodContext::Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTout& contextOut, + LightWeightMap* buffers) +{ + pResolvedMethod->devirtualizedMethod = (CORINFO_METHOD_HANDLE)contextOut.devirtualizedMethod; + pResolvedMethod->requiresInstMethodTableArg = contextOut.requiresInstMethodTableArg == 1; + pResolvedMethod->patchedOwnerType = (CORINFO_CONTEXT_HANDLE)contextOut.patchedOwnerType; +} + inline MethodContext::Agnostic_CORINFO_SIG_INFO SpmiRecordsHelper::CreateAgnostic_CORINFO_SIG_INFO_without_buffers( CORINFO_SIG_INFO& sigInfo) { diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp b/src/coreclr/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp index ebfaee3b01722..ab21d9ce7c9ad 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp +++ b/src/coreclr/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp @@ -231,17 +231,13 @@ void interceptor_ICJI::getMethodVTableOffset(CORINFO_METHOD_HANDLE method, } // Find the virtual method in implementingClass that overrides virtualMethod. -// Return null if devirtualization is not possible. -CORINFO_METHOD_HANDLE interceptor_ICJI::resolveVirtualMethod(CORINFO_METHOD_HANDLE virtualMethod, - CORINFO_CLASS_HANDLE implementingClass, - bool* requiresInstMethodTableArg, - CORINFO_CONTEXT_HANDLE* ownerType) -{ - mc->cr->AddCall("resolveVirtualMethod"); - CORINFO_METHOD_HANDLE result = original_ICorJitInfo->resolveVirtualMethod(virtualMethod, implementingClass, - requiresInstMethodTableArg, ownerType); - mc->recResolveVirtualMethod(virtualMethod, implementingClass, requiresInstMethodTableArg, ownerType, result); - return result; +// Return false if devirtualization is not possible. +bool interceptor_ICJI::tryResolveVirtualMethod(CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT* virtualMethodContext /* IN, OUT */) +{ + mc->cr->AddCall("tryResolveVirtualMethod"); + bool success = original_ICorJitInfo->tryResolveVirtualMethod(virtualMethodContext); + mc->recTryResolveVirtualMethod(virtualMethodContext, success); + return success; } // Get the unboxed entry point for a method, if possible. diff --git a/src/coreclr/ToolBox/superpmi/superpmi/icorjitinfo.cpp b/src/coreclr/ToolBox/superpmi/superpmi/icorjitinfo.cpp index b5605d3ff67bd..74c3e82694560 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi/icorjitinfo.cpp +++ b/src/coreclr/ToolBox/superpmi/superpmi/icorjitinfo.cpp @@ -173,14 +173,10 @@ void MyICJI::getMethodVTableOffset(CORINFO_METHOD_HANDLE method, // Find the virtual method in implementingClass that overrides virtualMethod. // Return null if devirtualization is not possible. -CORINFO_METHOD_HANDLE MyICJI::resolveVirtualMethod(CORINFO_METHOD_HANDLE virtualMethod, - CORINFO_CLASS_HANDLE implementingClass, - bool* requiresInstMethodTableArg, - CORINFO_CONTEXT_HANDLE* ownerType) -{ - jitInstance->mc->cr->AddCall("resolveVirtualMethod"); - CORINFO_METHOD_HANDLE result = jitInstance->mc->repResolveVirtualMethod(virtualMethod, implementingClass, - requiresInstMethodTableArg, ownerType); +bool MyICJI::tryResolveVirtualMethod(CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT* virtualMethodContext /* IN, OUT */) +{ + jitInstance->mc->cr->AddCall("tryResolveVirtualMethod"); + bool result = jitInstance->mc->repTryResolveVirtualMethod(virtualMethodContext); return result; } diff --git a/src/coreclr/inc/corinfo.h b/src/coreclr/inc/corinfo.h index 8c427f337588b..a66f45682f844 100644 --- a/src/coreclr/inc/corinfo.h +++ b/src/coreclr/inc/corinfo.h @@ -1537,6 +1537,29 @@ 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 @@ -2042,14 +2065,13 @@ class ICorStaticInfo // or the method in info->objClass that implements the interface method // represented by info->virtualMethod. // - // Return null if devirtualization is not possible. Owner type is optional + // Return true if devirtualization is possible. `virtualMethodContext.ownerType` is optional // and provides additional context for shared interface devirtualization. - virtual CORINFO_METHOD_HANDLE resolveVirtualMethod( - CORINFO_METHOD_HANDLE virtualMethod, /* IN */ - CORINFO_CLASS_HANDLE implementingClass, /* IN */ - bool* requiresInstMethodTableArg, /* OUT */ - CORINFO_CONTEXT_HANDLE* ownerType = NULL /* IN, OUT */ - ) = 0; + virtual bool tryResolveVirtualMethod( + CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT * virtualMethodContext /* IN, OUT */ + ) = 0; + + // Get the unboxed entry point for a method, if possible. virtual CORINFO_METHOD_HANDLE getUnboxedEntry( diff --git a/src/coreclr/jit/ICorJitInfo_API_names.h b/src/coreclr/jit/ICorJitInfo_API_names.h index d5a683a12176b..d6c152aaae82b 100644 --- a/src/coreclr/jit/ICorJitInfo_API_names.h +++ b/src/coreclr/jit/ICorJitInfo_API_names.h @@ -16,7 +16,7 @@ DEF_CLR_API(getEHinfo) DEF_CLR_API(getMethodClass) DEF_CLR_API(getMethodModule) DEF_CLR_API(getMethodVTableOffset) -DEF_CLR_API(resolveVirtualMethod) +DEF_CLR_API(tryResolveVirtualMethod) DEF_CLR_API(getUnboxedEntry) DEF_CLR_API(getDefaultEqualityComparerClass) DEF_CLR_API(expandRawHandleIntrinsic) diff --git a/src/coreclr/jit/ICorJitInfo_API_wrapper.hpp b/src/coreclr/jit/ICorJitInfo_API_wrapper.hpp index 06c1485745cd6..c4bca8a43d3bc 100644 --- a/src/coreclr/jit/ICorJitInfo_API_wrapper.hpp +++ b/src/coreclr/jit/ICorJitInfo_API_wrapper.hpp @@ -135,16 +135,11 @@ void WrapICorJitInfo::getMethodVTableOffset( API_LEAVE(getMethodVTableOffset); } -CORINFO_METHOD_HANDLE WrapICorJitInfo::resolveVirtualMethod( - CORINFO_METHOD_HANDLE virtualMethod, /* IN */ - CORINFO_CLASS_HANDLE implementingClass, /* IN */ - bool* requiresInstMethodTableArg, /* OUT */ - CORINFO_CONTEXT_HANDLE* ownerType = NULL /* IN, OUT */ - ) -{ - API_ENTER(resolveVirtualMethod); - CORINFO_METHOD_HANDLE temp = wrapHnd->resolveVirtualMethod(virtualMethod, implementingClass, requiresInstMethodTableArg, ownerType); - API_LEAVE(resolveVirtualMethod); +bool WrapICorJitInfo::tryResolveVirtualMethod(CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT * virtualMethodContext /* IN, OUT */) +{ + API_ENTER(tryResolveVirtualMethod); + bool temp = wrapHnd->tryResolveVirtualMethod(virtualMethodContext); + API_LEAVE(tryResolveVirtualMethod); return temp; } diff --git a/src/coreclr/jit/compiler.h b/src/coreclr/jit/compiler.h index aa4d63b23a3ed..f1430f3ba9d37 100644 --- a/src/coreclr/jit/compiler.h +++ b/src/coreclr/jit/compiler.h @@ -3810,6 +3810,10 @@ class Compiler bool impILConsumesAddr(const BYTE* codeAddr); void impResolveToken(const BYTE* addr, CORINFO_RESOLVED_TOKEN* pResolvedToken, CorInfoTokenKind kind); + CORINFO_METHOD_HANDLE impResolveVirtualMethod(CORINFO_METHOD_HANDLE virtualMethod, + CORINFO_CLASS_HANDLE implementingClass, + bool* requiresInstMethodTableArg, + CORINFO_CONTEXT_HANDLE* ownerType); void impPushOnStack(GenTree* tree, typeInfo ti); void impPushNullObjRefOnStack(); diff --git a/src/coreclr/jit/importer.cpp b/src/coreclr/jit/importer.cpp index 2aced26522b45..8dec6f296e0f0 100644 --- a/src/coreclr/jit/importer.cpp +++ b/src/coreclr/jit/importer.cpp @@ -20923,9 +20923,8 @@ 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 uniqueImplementingMethod = - info.compCompHnd->resolveVirtualMethod(baseMethod, uniqueImplementingClass, &requiresInstMethodTableArg, - &ownerType); + CORINFO_METHOD_HANDLE uniqueImplementingMethod = impResolveVirtualMethod( + baseMethod, uniqueImplementingClass, &requiresInstMethodTableArg, &ownerType); if (!canResolve) { @@ -20959,8 +20958,8 @@ void Compiler::impDevirtualizeCall(GenTreeCall* call, // 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 = - info.compCompHnd->resolveVirtualMethod(baseMethod, objClass, &requiresInstMethodTableArg, &ownerType); + 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 @@ -21387,6 +21386,29 @@ 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 index cca709d6a49ca..344eda1a170ba 100644 --- a/src/coreclr/src/ToolBox/superpmi/superpmi-shared/icorjitinfoimpl.h +++ b/src/coreclr/src/ToolBox/superpmi/superpmi-shared/icorjitinfoimpl.h @@ -116,11 +116,8 @@ void getMethodVTableOffset(CORINFO_METHOD_HANDLE method, /* IN */ ); // Find the virtual method in implementingClass that overrides virtualMethod. -// Return null if devirtualization is not possible. -CORINFO_METHOD_HANDLE resolveVirtualMethod(CORINFO_METHOD_HANDLE virtualMethod, - CORINFO_CLASS_HANDLE implementingClass, - bool* requiresInstMethodTableArg, - CORINFO_CONTEXT_HANDLE* ownerType); +// 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( diff --git a/src/coreclr/src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp b/src/coreclr/src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp index 06e2a7b60115d..ec7f48a57c979 100644 --- a/src/coreclr/src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp +++ b/src/coreclr/src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp @@ -153,15 +153,11 @@ void interceptor_ICJI::getMethodVTableOffset(CORINFO_METHOD_HANDLE method, } // Find the virtual method in implementingClass that overrides virtualMethod. -// Return null if devirtualization is not possible. -CORINFO_METHOD_HANDLE interceptor_ICJI::resolveVirtualMethod(CORINFO_METHOD_HANDLE virtualMethod, - CORINFO_CLASS_HANDLE implementingClass, - bool* requiresInstMethodTableArg, - CORINFO_CONTEXT_HANDLE* ownerType) -{ - mcs->AddCall("resolveVirtualMethod"); - return original_ICorJitInfo->resolveVirtualMethod(virtualMethod, implementingClass, requiresInstMethodTableArg, - ownerType); +// 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. diff --git a/src/coreclr/src/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp b/src/coreclr/src/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp index 5cdaa938653bd..eb0e26d04bf06 100644 --- a/src/coreclr/src/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp +++ b/src/coreclr/src/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp @@ -147,14 +147,10 @@ CORINFO_METHOD_HANDLE interceptor_ICJI::getUnboxedEntry(CORINFO_METHOD_HANDLE ft } // Find the virtual method in implementingClass that overrides virtualMethod. -// Return null if devirtualization is not possible. -CORINFO_METHOD_HANDLE interceptor_ICJI::resolveVirtualMethod(CORINFO_METHOD_HANDLE virtualMethod, - CORINFO_CLASS_HANDLE implementingClass, - bool* requiresInstMethodTableArg, - CORINFO_CONTEXT_HANDLE* ownerType) -{ - return original_ICorJitInfo->resolveVirtualMethod(virtualMethod, implementingClass, requiresInstMethodTableArg, - ownerType); +// 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. diff --git a/src/coreclr/src/tools/aot/jitinterface/jitinterface.h b/src/coreclr/src/tools/aot/jitinterface/jitinterface.h index 812836bdf5282..cb0aeacabb57d 100644 --- a/src/coreclr/src/tools/aot/jitinterface/jitinterface.h +++ b/src/coreclr/src/tools/aot/jitinterface/jitinterface.h @@ -18,7 +18,7 @@ struct JitInterfaceCallbacks 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); - void* (* resolveVirtualMethod)(void * thisHandle, CorInfoException** ppException, void* virtualMethod, void* implementingClass, bool* requiresInstMethodTableArg, void* ownerType); + 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); @@ -34,7 +34,7 @@ struct JitInterfaceCallbacks void (* setPatchpointInfo)(void * thisHandle, CorInfoException** ppException, void* patchpointInfo); void* (* getOSRInfo)(void * thisHandle, CorInfoException** ppException, unsigned* ilOffset); void (* resolveToken)(void * thisHandle, CorInfoException** ppException, void* pResolvedToken); - void (* tryResolveToken)(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); @@ -292,10 +292,10 @@ class JitInterfaceWrapper throw pException; } - virtual void* resolveVirtualMethod(void* virtualMethod, void* implementingClass, bool* requiresInstMethodTableArg, void* ownerType) + virtual bool tryResolveVirtualMethod(void* pResolvedMethod) { CorInfoException* pException = nullptr; - void* _ret = _callbacks->resolveVirtualMethod(_thisHandle, &pException, virtualMethod, implementingClass, requiresInstMethodTableArg, ownerType); + bool _ret = _callbacks->tryResolveVirtualMethod(_thisHandle, &pException, pResolvedMethod); if (pException != nullptr) throw pException; return _ret; @@ -431,12 +431,13 @@ class JitInterfaceWrapper throw pException; } - virtual void tryResolveToken(void* pResolvedToken) + virtual bool tryResolveToken(void* pResolvedToken) { CorInfoException* pException = nullptr; - _callbacks->tryResolveToken(_thisHandle, &pException, pResolvedToken); + 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) diff --git a/src/coreclr/tools/Common/JitInterface/CorInfoBase.cs b/src/coreclr/tools/Common/JitInterface/CorInfoBase.cs index 6acbdf890402d..d287033625580 100644 --- a/src/coreclr/tools/Common/JitInterface/CorInfoBase.cs +++ b/src/coreclr/tools/Common/JitInterface/CorInfoBase.cs @@ -187,17 +187,17 @@ static void _getMethodVTableOffset(IntPtr thisHandle, IntPtr* ppException, CORIN } [UnmanagedCallersOnly] - static CORINFO_METHOD_STRUCT_* _resolveVirtualMethod(IntPtr thisHandle, IntPtr* ppException, CORINFO_METHOD_STRUCT_* virtualMethod, CORINFO_CLASS_STRUCT_* implementingClass, bool* requiresInstMethodTableArg, CORINFO_CONTEXT_STRUCT** ownerType) + static bool _tryResolveVirtualMethod(IntPtr thisHandle, IntPtr* ppException, CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT* virtualMethodContext) { var _this = GetThis(thisHandle); try { - return _this.resolveVirtualMethod(virtualMethod, implementingClass, requiresInstMethodTableArg, ownerType); + return _this.tryResolveVirtualMethod(ref *virtualMethodContext); } catch (Exception ex) { *ppException = _this.AllocException(ex); - return default; + return false; } } @@ -422,17 +422,17 @@ static void _resolveToken(IntPtr thisHandle, IntPtr* ppException, CORINFO_RESOLV } [UnmanagedCallersOnly] - static byte _tryResolveToken(IntPtr thisHandle, IntPtr* ppException, CORINFO_RESOLVED_TOKEN* pResolvedToken) + static bool _tryResolveToken(IntPtr thisHandle, IntPtr* ppException, CORINFO_RESOLVED_TOKEN* pResolvedToken) { var _this = GetThis(thisHandle); try { - return _this.tryResolveToken(ref *pResolvedToken) ? 1 : 0; + return _this.tryResolveToken(ref *pResolvedToken); } catch (Exception ex) { *ppException = _this.AllocException(ex); - return default; + return false; } } @@ -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)&_resolveVirtualMethod; + callbacks[12] = (delegate* unmanaged)&_tryResolveVirtualMethod; callbacks[13] = (delegate* unmanaged)&_getUnboxedEntry; callbacks[14] = (delegate* unmanaged)&_getDefaultEqualityComparerClass; callbacks[15] = (delegate* unmanaged)&_expandRawHandleIntrinsic; @@ -2566,7 +2566,7 @@ static IntPtr GetUnmanagedCallbacks() callbacks[25] = (delegate* unmanaged)&_setPatchpointInfo; callbacks[26] = (delegate* unmanaged)&_getOSRInfo; callbacks[27] = (delegate* unmanaged)&_resolveToken; - callbacks[28] = (delegate* unmanaged)&_tryResolveToken; + callbacks[28] = (delegate* unmanaged)&_tryResolveToken; callbacks[29] = (delegate* unmanaged)&_findSig; callbacks[30] = (delegate* unmanaged)&_findCallSiteSig; callbacks[31] = (delegate* unmanaged)&_getTokenTypeAsHandle; diff --git a/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs b/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs index 23c0f4e421d16..0efccb1545f66 100644 --- a/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs +++ b/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs @@ -945,10 +945,11 @@ private void getEHinfo(CORINFO_METHOD_STRUCT_* ftn, uint EHnumber, ref CORINFO_E } // crossgen2smoke is passing now but I'm still not sure in this code - private CORINFO_METHOD_STRUCT_* resolveVirtualMethod(CORINFO_METHOD_STRUCT_* baseMethod, CORINFO_CLASS_STRUCT_* derivedClass, bool* requiresInstMethodTableArg, CORINFO_CONTEXT_STRUCT** ownerType) + private bool tryResolveVirtualMethod(ref CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT virtualMethodContext) { - TypeDesc implType = HandleToObject(derivedClass); - *requiresInstMethodTableArg = false; + TypeDesc implType = (TypeDesc)HandleToObject((IntPtr)virtualMethodContext.implementingClass); + virtualMethodContext.requiresInstMethodTableArg = false; + virtualMethodContext.patchedOwnerType = null; // __Canon cannot be devirtualized if (objType.IsCanonicalDefinitionType(CanonicalFormKind.Any)) @@ -956,18 +957,18 @@ private void getEHinfo(CORINFO_METHOD_STRUCT_* ftn, uint EHnumber, ref CORINFO_E return false; } - MethodDesc decl = HandleToObject(info->virtualMethod); + MethodDesc decl = (MethodDesc)HandleToObject(virtualMethodContext.virtualMethod); Debug.Assert(!decl.HasInstantiation); - if (*ownerType != null) + if (virtualMethodContext.ownerType != null) { - TypeDesc ownerTypeDesc = typeFromContext(*ownerType); + TypeDesc ownerTypeDesc = typeFromContext(virtualMethodContext.ownerType); if (decl.OwningType != ownerTypeDesc) { Debug.Assert(ownerTypeDesc is InstantiatedType); decl = _compilation.TypeSystemContext.GetMethodForInstantiatedType(decl.GetTypicalMethodDefinition(), (InstantiatedType)ownerTypeDesc); - *ownerType = contextFromType(decl.OwningType); - *requiresInstMethodTableArg = true; + virtualMethodContext.patchedOwnerType = contextFromType(decl.OwningType); + virtualMethodContext.requiresInstMethodTableArg = true; } } @@ -978,16 +979,11 @@ private void getEHinfo(CORINFO_METHOD_STRUCT_* ftn, uint EHnumber, ref CORINFO_E return false; } - if (impl.OwningType.IsValueType) - { - impl = getUnboxingThunk(impl); + virtualMethodContext.devirtualizedMethod = ObjectToHandle(impl); + return true; } - info->devirtualizedMethod = ObjectToHandle(impl); - info->requiresInstMethodTableArg = false; - info->exactContext = contextFromType(impl.OwningType); - - return true; + return false; } private CORINFO_METHOD_STRUCT_* getUnboxedEntry(CORINFO_METHOD_STRUCT_* ftn, ref bool requiresInstMethodTableArg) diff --git a/src/coreclr/tools/Common/JitInterface/CorInfoTypes.cs b/src/coreclr/tools/Common/JitInterface/CorInfoTypes.cs index d6eab1344394b..cb2ba98bce050 100644 --- a/src/coreclr/tools/Common/JitInterface/CorInfoTypes.cs +++ b/src/coreclr/tools/Common/JitInterface/CorInfoTypes.cs @@ -295,7 +295,29 @@ 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_CLASS_STRUCT_* implementingClass; + public CORINFO_METHOD_STRUCT_* virtualMethod; + 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 diff --git a/src/coreclr/tools/Common/JitInterface/ThunkGenerator/ThunkInput.txt b/src/coreclr/tools/Common/JitInterface/ThunkGenerator/ThunkInput.txt index 4a6af3c514e45..49073e16f52b2 100644 --- a/src/coreclr/tools/Common/JitInterface/ThunkGenerator/ThunkInput.txt +++ b/src/coreclr/tools/Common/JitInterface/ThunkGenerator/ThunkInput.txt @@ -170,7 +170,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); - CORINFO_METHOD_HANDLE resolveVirtualMethod( CORINFO_METHOD_HANDLE virtualMethod, CORINFO_CLASS_HANDLE implementingClass, BOOL* requiresInstMethodTableArg, CORINFO_CONTEXT_HANDLE* ownerType); + bool tryResolveVirtualMethod(CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT * virtualMethodContext); 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); diff --git a/src/coreclr/vm/jitinterface.cpp b/src/coreclr/vm/jitinterface.cpp index 5d80eddb61863..5f15c938c84ef 100644 --- a/src/coreclr/vm/jitinterface.cpp +++ b/src/coreclr/vm/jitinterface.cpp @@ -8854,10 +8854,7 @@ void CEEInfo::getMethodVTableOffset (CORINFO_METHOD_HANDLE methodHnd, } /*********************************************************************/ -CORINFO_METHOD_HANDLE CEEInfo::resolveVirtualMethodHelper(CORINFO_METHOD_HANDLE baseMethod, - CORINFO_CLASS_HANDLE derivedClass, - bool* requiresInstMethodTableArg, - CORINFO_CONTEXT_HANDLE* ownerType) +bool CEEInfo::tryResolveVirtualMethodHelper(CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT* virtualMethodContext) { CONTRACTL { THROWS; @@ -8865,12 +8862,7 @@ CORINFO_METHOD_HANDLE CEEInfo::resolveVirtualMethodHelper(CORINFO_METHOD_HANDLE MODE_PREEMPTIVE; } CONTRACTL_END; - // Initialize OUT fields - info->devirtualizedMethod = NULL; - info->requiresInstMethodTableArg = false; - info->exactContext = NULL; - - MethodDesc* pBaseMD = GetMethod(info->virtualMethod); + MethodDesc* pBaseMD = GetMethod(virtualMethodContext->virtualMethod); MethodTable* pBaseMT = pBaseMD->GetMethodTable(); // Method better be from a fully loaded class @@ -8884,9 +8876,9 @@ CORINFO_METHOD_HANDLE CEEInfo::resolveVirtualMethodHelper(CORINFO_METHOD_HANDLE MethodDesc* pDevirtMD = nullptr; - TypeHandle ObjClassHnd(info->objClass); - MethodTable* pObjMT = ObjClassHnd.GetMethodTable(); - _ASSERTE(pObjMT->IsRestored() && pObjMT->IsFullyLoaded()); + TypeHandle DerivedClsHnd(virtualMethodContext->implementingClass); + MethodTable* pDerivedMT = DerivedClsHnd.GetMethodTable(); + _ASSERTE(pDerivedMT->IsRestored() && pDerivedMT->IsFullyLoaded()); // Can't devirtualize from __Canon. if (ObjClassHnd == TypeHandle(g_pCanonMethodTableClass)) @@ -8901,7 +8893,7 @@ CORINFO_METHOD_HANDLE CEEInfo::resolveVirtualMethodHelper(CORINFO_METHOD_HANDLE // Don't try and devirtualize com interface calls. if (pObjMT->IsComObjectType()) { - return nullptr; + return false; } #endif // FEATURE_COMINTEROP @@ -8914,14 +8906,14 @@ CORINFO_METHOD_HANDLE CEEInfo::resolveVirtualMethodHelper(CORINFO_METHOD_HANDLE // For generic interface methods we must have context to // safely devirtualize. MethodTable* pOwnerMT = nullptr; - if (*ownerType != nullptr) + if (virtualMethodContext->ownerType != nullptr) { - TypeHandle OwnerClsHnd = GetTypeFromContext(*ownerType); + TypeHandle OwnerClsHnd = GetTypeFromContext(virtualMethodContext->ownerType); pOwnerMT = OwnerClsHnd.GetMethodTable(); if (!canCastStraightForward && !(pOwnerMT->IsInterface() && pDerivedMT->CanCastToInterface(pOwnerMT))) { - return nullptr; + return false; } // If the derived class is a shared class, make sure the @@ -8935,7 +8927,7 @@ CORINFO_METHOD_HANDLE CEEInfo::resolveVirtualMethodHelper(CORINFO_METHOD_HANDLE } else if (!canCastStraightForward) { - return nullptr; + return false; } else if (!pBaseMD->HasClassOrMethodInstantiation()) { @@ -8957,15 +8949,15 @@ CORINFO_METHOD_HANDLE CEEInfo::resolveVirtualMethodHelper(CORINFO_METHOD_HANDLE // either instantiating stub ie `pDevirtMD->IsWrapperStub() == true` // or non shared generic instantiation ie is _ASSERTE(pDevirtMD->IsWrapperStub() || !(pDevirtMD->GetMethodTable()->IsSharedByGenericInstantiations() || pDevirtMD->IsSharedByGenericMethodInstantiations())); - *ownerType = MAKE_CLASSCONTEXT(pDevirtMD->GetMethodTable()); + virtualMethodContext->patchedOwnerType = MAKE_CLASSCONTEXT(pDevirtMD->GetMethodTable()); if (pDevirtMD->IsWrapperStub()) { - *requiresInstMethodTableArg = true; + virtualMethodContext->requiresInstMethodTableArg = true; pDevirtMD = pDevirtMD->GetExistingWrappedMethodDesc(); } else { - *requiresInstMethodTableArg = false; + virtualMethodContext->requiresInstMethodTableArg = false; } _ASSERTE(pDevirtMD->IsRestored() && pDevirtMD->GetMethodTable()->IsFullyLoaded()); } @@ -9056,19 +9048,11 @@ CORINFO_METHOD_HANDLE CEEInfo::resolveVirtualMethodHelper(CORINFO_METHOD_HANDLE } #endif - // Success! Pass back the results. - // - info->devirtualizedMethod = (CORINFO_METHOD_HANDLE) pDevirtMD; - info->exactContext = MAKE_CLASSCONTEXT((CORINFO_CLASS_HANDLE) pExactMT); - info->requiresInstMethodTableArg = false; - + virtualMethodContext->devirtualizedMethod = (CORINFO_METHOD_HANDLE) pDevirtMD; return true; } -CORINFO_METHOD_HANDLE CEEInfo::resolveVirtualMethod(CORINFO_METHOD_HANDLE methodHnd, - CORINFO_CLASS_HANDLE derivedClass, - bool* requiresInstMethodTableArg, - CORINFO_CONTEXT_HANDLE* ownerType) +bool CEEInfo::tryResolveVirtualMethod(CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT* virtualMethodContext) { CONTRACTL { THROWS; @@ -9080,7 +9064,7 @@ CORINFO_METHOD_HANDLE CEEInfo::resolveVirtualMethod(CORINFO_METHOD_HANDLE method JIT_TO_EE_TRANSITION(); - result = resolveVirtualMethodHelper(methodHnd, derivedClass, requiresInstMethodTableArg, ownerType); + result = tryResolveVirtualMethodHelper(virtualMethodContext); EE_TO_JIT_TRANSITION(); diff --git a/src/coreclr/vm/jitinterface.h b/src/coreclr/vm/jitinterface.h index e7906b72ff538..4c30e24f9bad9 100644 --- a/src/coreclr/vm/jitinterface.h +++ b/src/coreclr/vm/jitinterface.h @@ -732,19 +732,9 @@ class CEEInfo : public ICorJitInfo unsigned * pOffsetAfterIndirection, bool * isRelative); - CORINFO_METHOD_HANDLE resolveVirtualMethod( - CORINFO_METHOD_HANDLE virtualMethod, - CORINFO_CLASS_HANDLE implementingClass, - bool* requiresInstMethodTableArg, - CORINFO_CONTEXT_HANDLE* ownerType - ); + bool tryResolveVirtualMethod(CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT* virtualMethodContext); - CORINFO_METHOD_HANDLE resolveVirtualMethodHelper( - CORINFO_METHOD_HANDLE virtualMethod, - CORINFO_CLASS_HANDLE implementingClass, - bool* requiresInstMethodTableArg, - CORINFO_CONTEXT_HANDLE* ownerType - ); + bool tryResolveVirtualMethodHelper(CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT* virtualMethodContext); CORINFO_METHOD_HANDLE getUnboxedEntry( CORINFO_METHOD_HANDLE ftn, diff --git a/src/coreclr/zap/zapinfo.cpp b/src/coreclr/zap/zapinfo.cpp index 2845774a60cb3..5fc99640df579 100644 --- a/src/coreclr/zap/zapinfo.cpp +++ b/src/coreclr/zap/zapinfo.cpp @@ -3996,13 +3996,9 @@ void ZapInfo::getMethodVTableOffset(CORINFO_METHOD_HANDLE method, m_pEEJitInfo->getMethodVTableOffset(method, pOffsetOfIndirection, pOffsetAfterIndirection, isRelative); } -CORINFO_METHOD_HANDLE ZapInfo::resolveVirtualMethod( - CORINFO_METHOD_HANDLE virtualMethod, - CORINFO_CLASS_HANDLE implementingClass, - bool* requiresInstMethodTableArg, - CORINFO_CONTEXT_HANDLE* ownerType) +bool ZapInfo::tryResolveVirtualMethod(CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT* virtualMethodContext) { - return m_pEEJitInfo->resolveVirtualMethod(virtualMethod, implementingClass, requiresInstMethodTableArg, ownerType); + return m_pEEJitInfo->tryResolveVirtualMethod(virtualMethodContext); } CORINFO_METHOD_HANDLE ZapInfo::getUnboxedEntry( diff --git a/src/coreclr/zap/zapinfo.h b/src/coreclr/zap/zapinfo.h index 408af0643a0d2..e1df5e920b9bf 100644 --- a/src/coreclr/zap/zapinfo.h +++ b/src/coreclr/zap/zapinfo.h @@ -675,11 +675,7 @@ class ZapInfo unsigned * pOffsetAfterIndirection, bool * isRelative); - CORINFO_METHOD_HANDLE resolveVirtualMethod( - CORINFO_METHOD_HANDLE virtualMethod, - CORINFO_CLASS_HANDLE implementingClass, - bool* requiresInstMethodTableArg, - CORINFO_CONTEXT_HANDLE* ownerType); + bool tryResolveVirtualMethod(CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT* virtualMethodContext); CORINFO_METHOD_HANDLE getUnboxedEntry( CORINFO_METHOD_HANDLE ftn, From e0a002e1e704e240e7841f1fd8a6e8dadb145e0b Mon Sep 17 00:00:00 2001 From: Rattenkrieg Date: Sat, 21 Nov 2020 23:12:19 +0300 Subject: [PATCH 19/29] fixed order of fields in csharp struct --- .../ToolBox/superpmi/superpmi-shared/methodcontext.cpp | 5 ++--- src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.h | 2 +- src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs | 2 +- src/coreclr/tools/Common/JitInterface/CorInfoTypes.cs | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.cpp b/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.cpp index 1ad590067c47e..f7e8aee34cf65 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.cpp +++ b/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.cpp @@ -1313,7 +1313,7 @@ void MethodContext::recTryResolveToken(CORINFO_RESOLVED_TOKEN* pResolvedToken, b TryResolveTokenValue value; - value.tokenOut = SpmiRecordsHelper::StoreAgnostic_CORINFO_RESOLVED_TOKENout(pResolvedToken, TryResolveToken); // copypaste artifacts? + value.tokenOut = SpmiRecordsHelper::StoreAgnostic_CORINFO_RESOLVED_TOKENout(pResolvedToken, TryResolveToken); value.success = success ? 0 : 1; TryResolveToken->Add(key, value); @@ -1335,8 +1335,7 @@ bool MethodContext::repTryResolveToken(CORINFO_RESOLVED_TOKEN* pResolvedToken) TryResolveTokenValue value = TryResolveToken->Get(key); - // why not RestoreAgnostic_CORINFO_RESOLVED_TOKENout - SpmiRecordsHelper::Restore_CORINFO_RESOLVED_TOKENout(pResolvedToken, value.tokenOut, TryResolveToken); // copypaste artifacts? + SpmiRecordsHelper::Restore_CORINFO_RESOLVED_TOKENout(pResolvedToken, value.tokenOut, TryResolveToken); DEBUG_REP(dmpTryResolveToken(key, value)); return (DWORD)value.success == 0; diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.h b/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.h index 9edf77435e4b2..4ad1e035ccd61 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.h +++ b/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.h @@ -1546,7 +1546,7 @@ enum mcPackets Packet_IsMoreSpecificType = 174, // Added 2/14/2019 Packet_PInvokeMarshalingRequired = 108, Packet_ResolveToken = 109, - Packet_TryResolveVirtualMethod = 160, // Added 2/13/17 // is it safe to rename? + Packet_TryResolveVirtualMethod = 160, // Added 2/13/17 // compatibility-wise is it safe to rename? Packet_TryResolveToken = 158, // Added 4/26/2016 Packet_SatisfiesClassConstraints = 110, Packet_SatisfiesMethodConstraints = 111, diff --git a/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs b/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs index 0efccb1545f66..cddaf20f013e9 100644 --- a/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs +++ b/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs @@ -957,7 +957,7 @@ private bool tryResolveVirtualMethod(ref CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT v return false; } - MethodDesc decl = (MethodDesc)HandleToObject(virtualMethodContext.virtualMethod); + MethodDesc decl = HandleToObject(virtualMethodContext.virtualMethod); Debug.Assert(!decl.HasInstantiation); if (virtualMethodContext.ownerType != null) diff --git a/src/coreclr/tools/Common/JitInterface/CorInfoTypes.cs b/src/coreclr/tools/Common/JitInterface/CorInfoTypes.cs index cb2ba98bce050..cd1a716a45421 100644 --- a/src/coreclr/tools/Common/JitInterface/CorInfoTypes.cs +++ b/src/coreclr/tools/Common/JitInterface/CorInfoTypes.cs @@ -301,8 +301,8 @@ public unsafe struct CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT // // [In] arguments of tryResolveVirtualMethod // - public CORINFO_CLASS_STRUCT_* implementingClass; public CORINFO_METHOD_STRUCT_* virtualMethod; + public CORINFO_CLASS_STRUCT_* implementingClass; public CORINFO_CONTEXT_STRUCT* ownerType; // From 73f12daf170014b665d845c9836f701b21bd8749 Mon Sep 17 00:00:00 2001 From: Rattenkrieg Date: Sat, 21 Nov 2020 23:16:21 +0300 Subject: [PATCH 20/29] conflicts fixed --- src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.h b/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.h index 4ad1e035ccd61..c6cb4c6b48271 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.h +++ b/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.h @@ -1391,7 +1391,7 @@ class MethodContext }; // ********************* Please keep this up-to-date to ease adding more *************** -// Highest packet number: 180 +// Highest packet number: 181 // ************************************************************************************* enum mcPackets { From bc8ecd34c91cdfeda86140e807223719ca17a0b8 Mon Sep 17 00:00:00 2001 From: Rattenkrieg Date: Sun, 22 Nov 2020 01:17:04 +0300 Subject: [PATCH 21/29] nonblittable return fixed --- src/coreclr/jit/importer.cpp | 8 ++++---- .../tools/Common/JitInterface/CorInfoBase.cs | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/coreclr/jit/importer.cpp b/src/coreclr/jit/importer.cpp index 8dec6f296e0f0..f339867569977 100644 --- a/src/coreclr/jit/importer.cpp +++ b/src/coreclr/jit/importer.cpp @@ -20923,8 +20923,8 @@ 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 uniqueImplementingMethod = impResolveVirtualMethod( - baseMethod, uniqueImplementingClass, &requiresInstMethodTableArg, &ownerType); + CORINFO_METHOD_HANDLE uniqueImplementingMethod = + impResolveVirtualMethod(baseMethod, uniqueImplementingClass, &requiresInstMethodTableArg, &ownerType); if (!canResolve) { @@ -20958,8 +20958,8 @@ void Compiler::impDevirtualizeCall(GenTreeCall* call, // 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); + 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 diff --git a/src/coreclr/tools/Common/JitInterface/CorInfoBase.cs b/src/coreclr/tools/Common/JitInterface/CorInfoBase.cs index d287033625580..262759b9fd9f6 100644 --- a/src/coreclr/tools/Common/JitInterface/CorInfoBase.cs +++ b/src/coreclr/tools/Common/JitInterface/CorInfoBase.cs @@ -187,17 +187,17 @@ static void _getMethodVTableOffset(IntPtr thisHandle, IntPtr* ppException, CORIN } [UnmanagedCallersOnly] - static bool _tryResolveVirtualMethod(IntPtr thisHandle, IntPtr* ppException, CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT* virtualMethodContext) + static byte _tryResolveVirtualMethod(IntPtr thisHandle, IntPtr* ppException, CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT* virtualMethodContext) { var _this = GetThis(thisHandle); try { - return _this.tryResolveVirtualMethod(ref *virtualMethodContext); + return _this.tryResolveVirtualMethod(ref *virtualMethodContext) ? 1 : 0; } catch (Exception ex) { *ppException = _this.AllocException(ex); - return false; + return 0; } } @@ -422,17 +422,17 @@ static void _resolveToken(IntPtr thisHandle, IntPtr* ppException, CORINFO_RESOLV } [UnmanagedCallersOnly] - static bool _tryResolveToken(IntPtr thisHandle, IntPtr* ppException, CORINFO_RESOLVED_TOKEN* pResolvedToken) + static byte _tryResolveToken(IntPtr thisHandle, IntPtr* ppException, CORINFO_RESOLVED_TOKEN* pResolvedToken) { var _this = GetThis(thisHandle); try { - return _this.tryResolveToken(ref *pResolvedToken); + return _this.tryResolveToken(ref *pResolvedToken) ? 1 : 0; } catch (Exception ex) { *ppException = _this.AllocException(ex); - return false; + return 0; } } @@ -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)&_tryResolveVirtualMethod; callbacks[13] = (delegate* unmanaged)&_getUnboxedEntry; callbacks[14] = (delegate* unmanaged)&_getDefaultEqualityComparerClass; callbacks[15] = (delegate* unmanaged)&_expandRawHandleIntrinsic; @@ -2566,7 +2566,7 @@ static IntPtr GetUnmanagedCallbacks() callbacks[25] = (delegate* unmanaged)&_setPatchpointInfo; callbacks[26] = (delegate* unmanaged)&_getOSRInfo; callbacks[27] = (delegate* unmanaged)&_resolveToken; - callbacks[28] = (delegate* unmanaged)&_tryResolveToken; + callbacks[28] = (delegate* unmanaged)&_tryResolveToken; callbacks[29] = (delegate* unmanaged)&_findSig; callbacks[30] = (delegate* unmanaged)&_findCallSiteSig; callbacks[31] = (delegate* unmanaged)&_getTokenTypeAsHandle; From 08b9b07e5616aaa2bed9eb04704034c4778cd2be Mon Sep 17 00:00:00 2001 From: Rattenkrieg Date: Sat, 28 Nov 2020 22:38:41 +0300 Subject: [PATCH 22/29] fix bad merge --- src/coreclr/jit/importer.cpp | 16 +- .../v1/query/client-MicrosoftVS/query.json | 1 + .../VSInheritEnvironments.txt | 1 + .../v1/query/client-MicrosoftVS/query.json | 1 + .../VSInheritEnvironments.txt | 1 + .../v1/query/client-MicrosoftVS/query.json | 1 + .../VSInheritEnvironments.txt | 1 + .../v1/query/client-MicrosoftVS/query.json | 1 + .../VSInheritEnvironments.txt | 1 + .../v1/query/client-MicrosoftVS/query.json | 1 + .../VSInheritEnvironments.txt | 1 + .../out/build/x64-Debug (default)/config.h | 1775 +++++++++++++++++ .../mono/eglib/eglib-config.h | 43 + .../v1/query/client-MicrosoftVS/query.json | 1 + .../VSInheritEnvironments.txt | 1 + 15 files changed, 1837 insertions(+), 9 deletions(-) create mode 100644 src/coreclr/out/build/x64-Debug (default)/.cmake/api/v1/query/client-MicrosoftVS/query.json create mode 100644 src/coreclr/out/build/x64-Debug (default)/VSInheritEnvironments.txt create mode 100644 src/installer/corehost/out/build/x64-Debug (default)/.cmake/api/v1/query/client-MicrosoftVS/query.json create mode 100644 src/installer/corehost/out/build/x64-Debug (default)/VSInheritEnvironments.txt create mode 100644 src/libraries/Native/Unix/out/build/x64-Debug (default)/.cmake/api/v1/query/client-MicrosoftVS/query.json create mode 100644 src/libraries/Native/Unix/out/build/x64-Debug (default)/VSInheritEnvironments.txt create mode 100644 src/libraries/Native/Windows/out/build/x64-Debug (default)/.cmake/api/v1/query/client-MicrosoftVS/query.json create mode 100644 src/libraries/Native/Windows/out/build/x64-Debug (default)/VSInheritEnvironments.txt create mode 100644 src/mono/out/build/x64-Debug (default)/.cmake/api/v1/query/client-MicrosoftVS/query.json create mode 100644 src/mono/out/build/x64-Debug (default)/VSInheritEnvironments.txt create mode 100644 src/mono/out/build/x64-Debug (default)/config.h create mode 100644 src/mono/out/build/x64-Debug (default)/mono/eglib/eglib-config.h create mode 100644 src/tests/out/build/x64-Debug (default)/.cmake/api/v1/query/client-MicrosoftVS/query.json create mode 100644 src/tests/out/build/x64-Debug (default)/VSInheritEnvironments.txt diff --git a/src/coreclr/jit/importer.cpp b/src/coreclr/jit/importer.cpp index f339867569977..1b460b966750a 100644 --- a/src/coreclr/jit/importer.cpp +++ b/src/coreclr/jit/importer.cpp @@ -20923,8 +20923,8 @@ 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 uniqueImplementingMethod = - impResolveVirtualMethod(baseMethod, uniqueImplementingClass, &requiresInstMethodTableArg, &ownerType); + CORINFO_METHOD_HANDLE likelyMethod = + impResolveVirtualMethod(baseMethod, likelyClass, &requiresInstMethodTableArg, &ownerType); if (!canResolve) { @@ -20958,7 +20958,7 @@ void Compiler::impDevirtualizeCall(GenTreeCall* call, // 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 = + CORINFO_METHOD_HANDLE derivedMethod = impResolveVirtualMethod(baseMethod, objClass, &requiresInstMethodTableArg, &ownerType); // If we failed to get a handle, we can't devirtualize. This can @@ -21109,12 +21109,10 @@ void Compiler::impDevirtualizeCall(GenTreeCall* call, // Figure out which method will be called. // - CORINFO_DEVIRTUALIZATION_INFO dvInfo; - dvInfo.virtualMethod = baseMethod; - dvInfo.objClass = likelyClass; - dvInfo.context = *pContextHandle; - - bool canResolve = info.compCompHnd->resolveVirtualMethod(&dvInfo); + CORINFO_CONTEXT_HANDLE ownerType = *contextHandle; + bool requiresInstMethodTableArg = false; + CORINFO_METHOD_HANDLE likelyMethod = + impResolveVirtualMethod(baseMethod, likelyClass, &requiresInstMethodTableArg, &ownerType); if (!canResolve) { diff --git a/src/coreclr/out/build/x64-Debug (default)/.cmake/api/v1/query/client-MicrosoftVS/query.json b/src/coreclr/out/build/x64-Debug (default)/.cmake/api/v1/query/client-MicrosoftVS/query.json new file mode 100644 index 0000000000000..308f68dd8c5fa --- /dev/null +++ b/src/coreclr/out/build/x64-Debug (default)/.cmake/api/v1/query/client-MicrosoftVS/query.json @@ -0,0 +1 @@ +{"requests":[{"kind":"cache","version":2},{"kind":"cmakeFiles","version":1},{"kind":"codemodel","version":2}]} \ No newline at end of file diff --git a/src/coreclr/out/build/x64-Debug (default)/VSInheritEnvironments.txt b/src/coreclr/out/build/x64-Debug (default)/VSInheritEnvironments.txt new file mode 100644 index 0000000000000..f8cc9d8acecec --- /dev/null +++ b/src/coreclr/out/build/x64-Debug (default)/VSInheritEnvironments.txt @@ -0,0 +1 @@ +msvc_x64_x64 \ No newline at end of file diff --git a/src/installer/corehost/out/build/x64-Debug (default)/.cmake/api/v1/query/client-MicrosoftVS/query.json b/src/installer/corehost/out/build/x64-Debug (default)/.cmake/api/v1/query/client-MicrosoftVS/query.json new file mode 100644 index 0000000000000..308f68dd8c5fa --- /dev/null +++ b/src/installer/corehost/out/build/x64-Debug (default)/.cmake/api/v1/query/client-MicrosoftVS/query.json @@ -0,0 +1 @@ +{"requests":[{"kind":"cache","version":2},{"kind":"cmakeFiles","version":1},{"kind":"codemodel","version":2}]} \ No newline at end of file diff --git a/src/installer/corehost/out/build/x64-Debug (default)/VSInheritEnvironments.txt b/src/installer/corehost/out/build/x64-Debug (default)/VSInheritEnvironments.txt new file mode 100644 index 0000000000000..f8cc9d8acecec --- /dev/null +++ b/src/installer/corehost/out/build/x64-Debug (default)/VSInheritEnvironments.txt @@ -0,0 +1 @@ +msvc_x64_x64 \ No newline at end of file diff --git a/src/libraries/Native/Unix/out/build/x64-Debug (default)/.cmake/api/v1/query/client-MicrosoftVS/query.json b/src/libraries/Native/Unix/out/build/x64-Debug (default)/.cmake/api/v1/query/client-MicrosoftVS/query.json new file mode 100644 index 0000000000000..308f68dd8c5fa --- /dev/null +++ b/src/libraries/Native/Unix/out/build/x64-Debug (default)/.cmake/api/v1/query/client-MicrosoftVS/query.json @@ -0,0 +1 @@ +{"requests":[{"kind":"cache","version":2},{"kind":"cmakeFiles","version":1},{"kind":"codemodel","version":2}]} \ No newline at end of file diff --git a/src/libraries/Native/Unix/out/build/x64-Debug (default)/VSInheritEnvironments.txt b/src/libraries/Native/Unix/out/build/x64-Debug (default)/VSInheritEnvironments.txt new file mode 100644 index 0000000000000..f8cc9d8acecec --- /dev/null +++ b/src/libraries/Native/Unix/out/build/x64-Debug (default)/VSInheritEnvironments.txt @@ -0,0 +1 @@ +msvc_x64_x64 \ No newline at end of file diff --git a/src/libraries/Native/Windows/out/build/x64-Debug (default)/.cmake/api/v1/query/client-MicrosoftVS/query.json b/src/libraries/Native/Windows/out/build/x64-Debug (default)/.cmake/api/v1/query/client-MicrosoftVS/query.json new file mode 100644 index 0000000000000..308f68dd8c5fa --- /dev/null +++ b/src/libraries/Native/Windows/out/build/x64-Debug (default)/.cmake/api/v1/query/client-MicrosoftVS/query.json @@ -0,0 +1 @@ +{"requests":[{"kind":"cache","version":2},{"kind":"cmakeFiles","version":1},{"kind":"codemodel","version":2}]} \ No newline at end of file diff --git a/src/libraries/Native/Windows/out/build/x64-Debug (default)/VSInheritEnvironments.txt b/src/libraries/Native/Windows/out/build/x64-Debug (default)/VSInheritEnvironments.txt new file mode 100644 index 0000000000000..f8cc9d8acecec --- /dev/null +++ b/src/libraries/Native/Windows/out/build/x64-Debug (default)/VSInheritEnvironments.txt @@ -0,0 +1 @@ +msvc_x64_x64 \ No newline at end of file diff --git a/src/mono/out/build/x64-Debug (default)/.cmake/api/v1/query/client-MicrosoftVS/query.json b/src/mono/out/build/x64-Debug (default)/.cmake/api/v1/query/client-MicrosoftVS/query.json new file mode 100644 index 0000000000000..308f68dd8c5fa --- /dev/null +++ b/src/mono/out/build/x64-Debug (default)/.cmake/api/v1/query/client-MicrosoftVS/query.json @@ -0,0 +1 @@ +{"requests":[{"kind":"cache","version":2},{"kind":"cmakeFiles","version":1},{"kind":"codemodel","version":2}]} \ No newline at end of file diff --git a/src/mono/out/build/x64-Debug (default)/VSInheritEnvironments.txt b/src/mono/out/build/x64-Debug (default)/VSInheritEnvironments.txt new file mode 100644 index 0000000000000..f8cc9d8acecec --- /dev/null +++ b/src/mono/out/build/x64-Debug (default)/VSInheritEnvironments.txt @@ -0,0 +1 @@ +msvc_x64_x64 \ No newline at end of file diff --git a/src/mono/out/build/x64-Debug (default)/config.h b/src/mono/out/build/x64-Debug (default)/config.h new file mode 100644 index 0000000000000..ff807806ba5ec --- /dev/null +++ b/src/mono/out/build/x64-Debug (default)/config.h @@ -0,0 +1,1775 @@ +#ifndef __MONO_CONFIG_H__ +#define __MONO_CONFIG_H__ + +#ifdef _MSC_VER + +// FIXME This is all questionable but the logs are flooded and nothing else is fixing them. +#pragma warning(disable:4018) // signed/unsigned mismatch +#pragma warning(disable:4090) // const problem +#pragma warning(disable:4146) // unary minus operator applied to unsigned type, result still unsigned +#pragma warning(disable:4244) // integer conversion, possible loss of data +#pragma warning(disable:4267) // integer conversion, possible loss of data + +// promote warnings to errors +#pragma warning( error:4013) // function undefined; assuming extern returning int +#pragma warning( error:4022) // call and prototype disagree +#pragma warning( error:4047) // differs in level of indirection +#pragma warning( error:4098) // void return returns a value +#pragma warning( error:4113) // call and prototype disagree +#pragma warning( error:4172) // returning address of local variable or temporary +#pragma warning( error:4197) // top-level volatile in cast is ignored +#pragma warning( error:4273) // inconsistent dll linkage +#pragma warning( error:4293) // shift count negative or too big, undefined behavior +#pragma warning( error:4312) // 'type cast': conversion from 'MonoNativeThreadId' to 'gpointer' of greater size +#pragma warning( error:4715) // 'keyword' not all control paths return a value + +#include + +#if _WIN32_WINNT < 0x0601 +#error "Mono requires Windows 7 or later." +#endif /* _WIN32_WINNT < 0x0601 */ + +#ifndef HAVE_WINAPI_FAMILY_SUPPORT + +#define HAVE_WINAPI_FAMILY_SUPPORT + +/* WIN API Family support */ +#include + +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) + #define HAVE_CLASSIC_WINAPI_SUPPORT 1 + #define HAVE_UWP_WINAPI_SUPPORT 0 +#elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) + #define HAVE_CLASSIC_WINAPI_SUPPORT 0 + #define HAVE_UWP_WINAPI_SUPPORT 1 +#else + #define HAVE_CLASSIC_WINAPI_SUPPORT 0 + #define HAVE_UWP_WINAPI_SUPPORT 0 +#ifndef HAVE_EXTERN_DEFINED_WINAPI_SUPPORT + #error Unsupported WINAPI family +#endif +#endif + +#endif +#endif + +/* Define to the full name of this package. */ +/* #undef PACKAGE_NAME */ + +/* Define to the one symbol short name of this package. */ +/* #undef PACKAGE_TARNAME */ + +/* Define to the version of this package. */ +/* #undef PACKAGE_VERSION */ + +/* Define to the full name and version of this package. */ +/* #undef PACKAGE_STRING */ + +/* Define to the address where bug reports for this package should be sent. */ +/* #undef PACKAGE_BUGREPORT */ + +/* Define to the home page for this package. */ +/* #undef PACKAGE_URL */ + +/* Version of the corlib-runtime interface */ +#define MONO_CORLIB_VERSION "1A5E0066-58DC-428A-B21C-0AD6CDAE2789" + +/* Disables the IO portability layer */ +#define DISABLE_PORTABILITY 1 + +/* This platform does not support symlinks */ +#define HOST_NO_SYMLINKS 1 + +/* pthread is a pointer */ +/* #undef PTHREAD_POINTER_ID */ + +/* Targeting the Android platform */ +/* #undef HOST_ANDROID */ + +/* ... */ +/* #undef TARGET_ANDROID */ + +/* ... */ +/* #undef USE_MACH_SEMA */ + +/* Targeting the Fuchsia platform */ +/* #undef HOST_FUCHSIA */ + +/* Targeting the AIX and PASE platforms */ +/* #undef HOST_AIX */ + +/* Define if Unix sockets cannot be created in an anonymous namespace */ +/* #undef NEED_LINK_UNLINK */ + +/* Host Platform is Win32 */ +#define HOST_WIN32 1 + +/* Target Platform is Win32 */ +#define TARGET_WIN32 1 + +/* Host Platform is Darwin */ +/* #undef HOST_DARWIN */ + +/* Host Platform is iOS */ +/* #undef HOST_IOS */ + +/* Host Platform is tvOS */ +/* #undef HOST_TVOS */ + +/* Use classic Windows API support */ +#define HAVE_CLASSIC_WINAPI_SUPPORT 1 + +/* Don't use UWP Windows API support */ +/* #undef HAVE_UWP_WINAPI_SUPPORT */ + +/* Define to 1 if you have the ANSI C header files. */ +/* #undef STDC_HEADERS */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_STRINGS_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_UNISTD_H */ + +/* Define to 1 if `major', `minor', and `makedev' are declared in . + */ +/* #undef MAJOR_IN_MKDEV */ + +/* Define to 1 if `major', `minor', and `makedev' are declared in + . */ +/* #undef MAJOR_IN_SYSMACROS */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_FILIO_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_SOCKIO_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NETDB_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_UTIME_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_UTIME_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SEMAPHORE_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_UN_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LINUX_RTC_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_SYSCALL_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_MKDEV_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_UIO_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_PARAM_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_SYSCTL_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LIBPROC_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_PRCTL_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_COPYFILE_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_GNU_LIB_NAMES_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_SOCKET_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_IPC_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_UTSNAME_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ALLOCA_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_UCONTEXT_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_PWD_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_SELECT_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NETINET_TCP_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NETINET_IN_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LINK_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ASM_SIGCONTEXT_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_INOTIFY_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ARPA_INET_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_COMPLEX_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_UNWIND_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LINUX_NETLINK_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LINUX_RTNETLINK_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_USER_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LINUX_SERIAL_H */ + +/* Use static zlib */ +/* #undef HAVE_STATIC_ZLIB */ + +/* Use static ICU */ +/* #undef STATIC_ICU */ + +/* Use OS-provided zlib */ +/* #undef HAVE_SYS_ZLIB */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ELF_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_POLL_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_POLL_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_WAIT_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_GRP_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYSLOG_H */ + +/* Define to 1 if you have the `vsyslog' function. */ +/* #undef HAVE_VSYSLOG */ + +/* Define to 1 if you have the header file. */ +#define HAVE_WCHAR_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LINUX_MAGIC_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_MACHINE_ENDIAN_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_ENDIAN_H */ + +/* Define to 1 if you have the header file. + */ +/* #undef HAVE_ANDROID_LEGACY_SIGNAL_INLINES_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ANDROID_NDK_VERSION_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ANDROID_API_LEVEL_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ANDROID_VERSIONING_H */ + +/* Whether Android NDK unified headers are used */ +/* #undef ANDROID_UNIFIED_HEADERS */ + +/* The size of `void *', as computed by sizeof. */ +#define SIZEOF_VOID_P 8 + +/* The size of `long', as computed by sizeof. */ +#define SIZEOF_LONG 4 + +/* The size of `int', as computed by sizeof. */ +#define SIZEOF_INT 4 + +/* The size of `long long', as computed by sizeof. */ +#define SIZEOF_LONG_LONG 8 + +/* Enables the support for .NET Core Features in the MonoVM */ +#define ENABLE_NETCORE 1 + +/* Xen-specific behaviour */ +/* #undef MONO_XEN_OPT */ + +/* Reduce runtime requirements (and capabilities) */ +/* #undef MONO_SMALL_CONFIG */ + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +# undef WORDS_BIGENDIAN +# endif +#endif + +/* Define if building universal (internal helper macro) */ +/* #undef AC_APPLE_UNIVERSAL_BUILD */ + +/* Make jemalloc assert for mono */ +/* #undef MONO_JEMALLOC_ASSERT */ + +/* Make jemalloc default for mono */ +/* #undef MONO_JEMALLOC_DEFAULT */ + +/* Enable jemalloc usage for mono */ +/* #undef MONO_JEMALLOC_ENABLED */ + +/* Do not include names of unmanaged functions in the crash dump */ +/* #undef MONO_PRIVATE_CRASHES */ + +/* Do not create structured crash files during unmanaged crashes */ +/* #undef DISABLE_STRUCTURED_CRASH */ + +/* Enable runtime support for Monodroid (Xamarin.Android) */ +/* #undef ENABLE_MONODROID */ + +/* Enable runtime support for Monotouch (Xamarin.iOS and Xamarin.Mac) */ +/* #undef ENABLE_MONOTOUCH */ + +/* String of disabled features */ +#define DISABLED_FEATURES "" + +/* Disable AOT Compiler */ +/* #undef DISABLE_AOT */ + +/* Disable default profiler support */ +/* #undef DISABLE_PROFILER */ + +/* Disable System.Decimal support */ +/* #undef DISABLE_DECIMAL */ + +/* Disable P/Invoke support */ +/* #undef DISABLE_PINVOKE */ + +/* Disable runtime debugging support */ +/* #undef DISABLE_DEBUG */ + +/* Disable reflection emit support */ +/* #undef DISABLE_REFLECTION_EMIT */ + +/* Disable assembly saving support in reflection emit */ +#define DISABLE_REFLECTION_EMIT_SAVE 1 + +/* Disable support for huge assemblies */ +/* #undef DISABLE_LARGE_CODE */ + +/* Disable support debug logging */ +/* #undef DISABLE_LOGGING */ + +/* Disable COM support */ +#define DISABLE_COM 1 + +/* Disable advanced SSA JIT optimizations */ +/* #undef DISABLE_SSA */ + +/* Disable generics support */ +/* #undef DISABLE_GENERICS */ + +/* Disable Shadow Copy for AppDomains */ +/* #undef DISABLE_SHADOW_COPY */ + +/* Disable agent attach support */ +#define DISABLE_ATTACH 1 + +/* Disables the verifier */ +#define DISABLE_VERIFIER 1 + +/* Disable the JIT, only full-aot mode or interpreter will be supported by the + runtime. */ +/* #undef DISABLE_JIT */ + +/* Disable the interpreter. */ +/* #undef DISABLE_INTERPRETER */ + +/* Some VES is available at runtime */ +#define ENABLE_ILGEN 1 + +/* Disable SIMD intrinsics related optimizations. */ +#define DISABLE_SIMD 1 + +/* Disable Soft Debugger Agent. */ +/* #undef DISABLE_DEBUGGER_AGENT */ + +/* Disable Performance Counters. */ +#define DISABLE_PERFCOUNTERS 1 + +/* Disable String normalization support. */ +/* #undef DISABLE_NORMALIZATION */ + +/* Disable desktop assembly loader semantics. */ +#define DISABLE_DESKTOP_LOADER 1 + +/* Disable shared perfcounters. */ +/* #undef DISABLE_SHARED_PERFCOUNTERS */ + +/* Disable support for multiple appdomains. */ +#define DISABLE_APPDOMAINS 1 + +/* Disable remoting support (This disables type proxies and make com + non-functional) */ +#define DISABLE_REMOTING 1 + +/* Disable CAS/CoreCLR security */ +#define DISABLE_SECURITY 1 + +/* Disable support code for the LLDB plugin. */ +/* #undef DISABLE_LLDB */ + +/* Disable support for .mdb symbol files. */ +#define DISABLE_MDB 1 + +/* Disable assertion messages. */ +/* #undef DISABLE_ASSERT_MESSAGES */ + +/* Disable runtime cleanup. */ +#define DISABLE_CLEANUP 1 + +/* Disable concurrent gc support in SGEN. */ +/* #undef DISABLE_SGEN_MAJOR_MARKSWEEP_CONC */ + +/* Disable minor=split support in SGEN. */ +/* #undef DISABLE_SGEN_SPLIT_NURSERY */ + +/* Disable gc bridge support in SGEN. */ +/* #undef DISABLE_SGEN_GC_BRIDGE */ + +/* Disable debug helpers in SGEN. */ +/* #undef DISABLE_SGEN_DEBUG_HELPERS */ + +/* Disable sockets */ +/* #undef DISABLE_SOCKETS */ + +/* Disable GAC */ +#define DISABLE_GAC 1 + +/* Disables use of DllMaps in MonoVM */ +#define DISABLE_DLLMAP 1 + +/* Disable Threads */ +/* #undef DISABLE_THREADS */ + +/* Disable config directories */ +#define DISABLE_CFGDIR_CONFIG 1 + +/* Extension module enabled */ +/* #undef ENABLE_EXTENSION_MODULE */ + +/* GC description */ +/* #undef DEFAULT_GC_NAME */ + +/* No GC support. */ +/* #undef HAVE_NULL_GC */ + +/* Length of zero length arrays */ +#define MONO_ZERO_LEN_ARRAY 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SIGNAL_H 1 + +/* Define to 1 if you have the `sigaction' function. */ +/* #undef HAVE_SIGACTION */ + +/* Define to 1 if you have the `kill' function. */ +/* #undef HAVE_KILL */ + +/* Define to 1 if you have the `signal' function. */ +#define HAVE_SIGNAL 1 + +/* CLOCK_MONOTONIC */ +/* #undef HAVE_CLOCK_MONOTONIC */ + +/* CLOCK_MONOTONIC_COARSE */ +/* #undef HAVE_CLOCK_MONOTONIC_COARSE */ + +/* CLOCK_REALTIME */ +/* #undef HAVE_CLOCK_REALTIME */ + +/* clockid_t */ +/* #undef HAVE_CLOCKID_T */ + +/* mach_absolute_time */ +/* #undef HAVE_MACH_ABSOLUTE_TIME */ + +/* gethrtime */ +/* #undef HAVE_GETHRTIME */ + +/* read_real_time */ +/* #undef HAVE_READ_REAL_TIME */ + +/* mach_timebase_info */ +/* #undef HAVE_MACH_TIMEBASE_INFO */ + +/* Define to 1 if you have the `futimes' function. */ +/* #undef HAVE_FUTIMES */ + +/* Define to 1 if you have the `futimens' function. */ +/* #undef HAVE_FUTIMENS */ + +/* Define to 1 if you have the `clock_nanosleep' function. */ +/* #undef HAVE_CLOCK_NANOSLEEP */ + +/* Does dlsym require leading underscore. */ +/* #undef MONO_DL_NEED_USCORE */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_EXECINFO_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_AUXV_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_RESOURCE_H */ + +/* Define to 1 if you have the `getgrgid_r' function. */ +/* #undef HAVE_GETGRGID_R */ + +/* Define to 1 if you have the `getgrnam_r' function. */ +/* #undef HAVE_GETGRNAM_R */ + +/* Define to 1 if you have the `getresuid' function. */ +/* #undef HAVE_GETRESUID */ + +/* Define to 1 if you have the `setresuid' function. */ +/* #undef HAVE_SETRESUID */ + +/* kqueue */ +/* #undef HAVE_KQUEUE */ + +/* Define to 1 if you have the `backtrace_symbols' function. */ +/* #undef HAVE_BACKTRACE_SYMBOLS */ + +/* Define to 1 if you have the `mkstemp' function. */ +/* #undef HAVE_MKSTEMP */ + +/* Define to 1 if you have the `mmap' function. */ +/* #undef HAVE_MMAP */ + +/* Define to 1 if you have the `madvise' function. */ +/* #undef HAVE_MADVISE */ + +/* Define to 1 if you have the `getrusage' function. */ +/* #undef HAVE_GETRUSAGE */ + +/* Define to 1 if you have the `getpriority' function. */ +/* #undef HAVE_GETPRIORITY */ + +/* Define to 1 if you have the `setpriority' function. */ +/* #undef HAVE_SETPRIORITY */ + +/* Define to 1 if you have the `dl_iterate_phdr' function. */ +/* #undef HAVE_DL_ITERATE_PHDR */ + +/* Define to 1 if you have the `dladdr' function. */ +/* #undef HAVE_DLADDR */ + +/* Define to 1 if you have the `sysconf' function. */ +/* #undef HAVE_SYSCONF */ + +/* Define to 1 if you have the `getrlimit' function. */ +/* #undef HAVE_GETRLIMIT */ + +/* Define to 1 if you have the `prctl' function. */ +/* #undef HAVE_PRCTL */ + +/* Define to 1 if you have the `arc4random' function. */ +/* #undef HAVE_ARC4RANDOM */ + +/* Define to 1 if you have the `nl_langinfo' function. */ +/* #undef HAVE_NL_LANGINFO */ + +/* sched_getaffinity */ +/* #undef HAVE_SCHED_GETAFFINITY */ + +/* sched_setaffinity */ +/* #undef HAVE_SCHED_SETAFFINITY */ + +/* Define to 1 if you have the `sched_getcpu' function. */ +/* #undef HAVE_SCHED_GETCPU */ + +/* Define to 1 if you have the `getpwnam_r' function. */ +/* #undef HAVE_GETPWNAM_R */ + +/* Define to 1 if you have the `getpwuid_r' function. */ +/* #undef HAVE_GETPWUID_R */ + +/* Define to 1 if you have the `readlink' function. */ +/* #undef HAVE_READLINK */ + +/* Define to 1 if you have the `chmod' function. */ +#define HAVE_CHMOD 1 + +/* Define to 1 if you have the `lstat' function. */ +/* #undef HAVE_LSTAT */ + +/* Define to 1 if you have the `getdtablesize' function. */ +/* #undef HAVE_GETDTABLESIZE */ + +/* Define to 1 if you have the `ftruncate' function. */ +/* #undef HAVE_FTRUNCATE */ + +/* Define to 1 if you have the `msync' function. */ +/* #undef HAVE_MSYNC */ + +/* Define to 1 if you have the `gethostname' function. */ +/* #undef HAVE_GETHOSTNAME */ + +/* Define to 1 if you have the `getpeername' function. */ +/* #undef HAVE_GETPEERNAME */ + +/* Define to 1 if you have the `utime' function. */ +#define HAVE_UTIME 1 + +/* Define to 1 if you have the `utimes' function. */ +/* #undef HAVE_UTIMES */ + +/* Define to 1 if you have the `openlog' function. */ +/* #undef HAVE_OPENLOG */ + +/* Define to 1 if you have the `closelog' function. */ +/* #undef HAVE_CLOSELOG */ + +/* Define to 1 if you have the `atexit' function. */ +#define HAVE_ATEXIT 1 + +/* Define to 1 if you have the `popen' function. */ +/* #undef HAVE_POPEN */ + +/* Define to 1 if you have the declaration of `strerror_r', and to 0 if you + don't. */ +/* #undef HAVE_DECL_STRERROR_R */ + +/* Define to 1 if you have the `strerror_r' function. */ +/* #undef HAVE_STRERROR_R */ + +/* Define to 1 if strerror_r returns char *. */ +/* #undef STRERROR_R_CHAR_P */ + +/* Have GLIBC_BEFORE_2_3_4_SCHED_SETAFFINITY */ +/* #undef GLIBC_BEFORE_2_3_4_SCHED_SETAFFINITY */ + +/* GLIBC has CPU_COUNT macro in sched.h */ +/* #undef GLIBC_HAS_CPU_COUNT */ + +/* Have large file support */ +/* #undef HAVE_LARGE_FILE_SUPPORT */ + +/* Have IPPROTO_IP */ +/* #undef HAVE_IPPROTO_IP */ + +/* Have IPPROTO_IPV6 */ +/* #undef HAVE_IPPROTO_IPV6 */ + +/* Have IPPROTO_TCP */ +/* #undef HAVE_IPPROTO_TCP */ + +/* Have SOL_IP */ +/* #undef HAVE_SOL_IP */ + +/* Have SOL_IPV6 */ +/* #undef HAVE_SOL_IPV6 */ + +/* Have SOL_TCP */ +/* #undef HAVE_SOL_TCP */ + +/* Have IP_PKTINFO */ +/* #undef HAVE_IP_PKTINFO */ + +/* Have IPV6_PKTINFO */ +/* #undef HAVE_IPV6_PKTINFO */ + +/* Have IP_DONTFRAG */ +/* #undef HAVE_IP_DONTFRAG */ + +/* Have IP_DONTFRAGMENT */ +/* #undef HAVE_IP_DONTFRAGMENT */ + +/* Have IP_MTU_DISCOVER */ +/* #undef HAVE_IP_MTU_DISCOVER */ + +/* Have IP_PMTUDISC_DO */ +/* #undef HAVE_IP_PMTUDISC_DO */ + +/* Have struct ip_mreqn */ +/* #undef HAVE_STRUCT_IP_MREQN */ + +/* Have struct ip_mreq */ +#define HAVE_STRUCT_IP_MREQ 1 + +/* Have getaddrinfo */ +#define HAVE_GETADDRINFO 1 + +/* Have gethostbyname2_r */ +/* #undef HAVE_GETHOSTBYNAME2_R */ + +/* Have gethostbyname2 */ +/* #undef HAVE_GETHOSTBYNAME2 */ + +/* Have gethostbyname */ +/* #undef HAVE_GETHOSTBYNAME */ + +/* Have getprotobyname */ +#define HAVE_GETPROTOBYNAME 1 + +/* Have getprotobyname_r */ +/* #undef HAVE_GETPROTOBYNAME_R */ + +/* Have getnameinfo */ +#define HAVE_GETNAMEINFO 1 + +/* Have inet_ntop */ +#define HAVE_INET_NTOP 1 + +/* Have inet_pton */ +#define HAVE_INET_PTON 1 + +/* Define to 1 if you have the `inet_aton' function. */ +/* #undef HAVE_INET_ATON */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_PTHREAD_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_PTHREAD_NP_H */ + +/* Define to 1 if you have the `pthread_mutex_timedlock' function. */ +/* #undef HAVE_PTHREAD_MUTEX_TIMEDLOCK */ + +/* Define to 1 if you have the `pthread_getattr_np' function. */ +/* #undef HAVE_PTHREAD_GETATTR_NP */ + +/* Define to 1 if you have the `pthread_attr_get_np' function. */ +/* #undef HAVE_PTHREAD_ATTR_GET_NP */ + +/* Define to 1 if you have the `pthread_getname_np' function. */ +/* #undef HAVE_PTHREAD_GETNAME_NP */ + +/* Define to 1 if you have the `pthread_setname_np' function. */ +/* #undef HAVE_PTHREAD_SETNAME_NP */ + +/* Define to 1 if you have the `pthread_cond_timedwait_relative_np' function. + */ +/* #undef HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE_NP */ + +/* Define to 1 if you have the `pthread_kill' function. */ +/* #undef HAVE_PTHREAD_KILL */ + +/* Define to 1 if you have the `pthread_attr_setstacksize' function. */ +/* #undef HAVE_PTHREAD_ATTR_SETSTACKSIZE */ + +/* Define to 1 if you have the `pthread_attr_getstack' function. */ +/* #undef HAVE_PTHREAD_ATTR_GETSTACK */ + +/* Define to 1 if you have the `pthread_attr_getstacksize' function. */ +/* #undef HAVE_PTHREAD_ATTR_GETSTACKSIZE */ + +/* Define to 1 if you have the `pthread_get_stacksize_np' function. */ +/* #undef HAVE_PTHREAD_GET_STACKSIZE_NP */ + +/* Define to 1 if you have the `pthread_get_stackaddr_np' function. */ +/* #undef HAVE_PTHREAD_GET_STACKADDR_NP */ + +/* Define to 1 if you have the declaration of `pthread_mutexattr_setprotocol', + and to 0 if you don't. */ +/* #undef HAVE_DECL_PTHREAD_MUTEXATTR_SETPROTOCOL */ + +/* Define to 1 if you have the `mincore' function. */ +/* #undef HAVE_MINCORE */ + +/* Define to 1 if you have the `mlock' function. */ +/* #undef HAVE_MLOCK */ + +/* Define to 1 if you have the `munlock' function. */ +/* #undef HAVE_MUNLOCK */ + +/* Have a working sigaltstack */ +/* #undef HAVE_WORKING_SIGALTSTACK */ + +/* Define to 1 if you have the `shm_open' function. */ +/* #undef HAVE_SHM_OPEN */ + +/* Have tm_gmtoff */ +/* #undef HAVE_TM_GMTOFF */ + +/* Have timezone variable */ +/* #undef HAVE_TIMEZONE */ + +/* Define to 1 if you have the `poll' function. */ +/* #undef HAVE_POLL */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_EPOLL_H */ + +/* Define to 1 if you have the `epoll_ctl' function. */ +/* #undef HAVE_EPOLL_CTL */ + +/* epoll_create1 */ +/* #undef HAVE_EPOLL */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_EVENT_H */ + +/* Use kqueue for the threadpool */ +/* #undef USE_KQUEUE_FOR_THREADPOOL */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_IOCTL_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NET_IF_H */ + +/* Can get interface list */ +/* #undef HAVE_SIOCGIFCONF */ + +/* sockaddr_in has sin_len */ +/* #undef HAVE_SOCKADDR_IN_SIN_LEN */ + +/* sockaddr_in6 has sin6_len */ +/* #undef HAVE_SOCKADDR_IN6_SIN_LEN */ + +/* Have getifaddrs */ +/* #undef HAVE_GETIFADDRS */ + +/* Have if_nametoindex */ +/* #undef HAVE_IF_NAMETOINDEX */ + +/* Have access */ +#define HAVE_ACCESS 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_ERRNO_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_CHECKLIST_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_PATHCONF_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_FSTAB_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ATTR_XATTR_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_EXTATTR_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_SENDFILE_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_STATVFS_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_STATFS_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_VFSTAB_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_XATTR_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_MMAN_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_MOUNT_H */ + +/* Define to 1 if you have the `confstr' function. */ +/* #undef HAVE_CONFSTR */ + +/* Define to 1 if you have the `seekdir' function. */ +/* #undef HAVE_SEEKDIR */ + +/* Define to 1 if you have the `telldir' function. */ +/* #undef HAVE_TELLDIR */ + +/* Define to 1 if you have the `getdomainname' function. */ +/* #undef HAVE_GETDOMAINNAME */ + +/* Define to 1 if you have the `setdomainname' function. */ +/* #undef HAVE_SETDOMAINNAME */ + +/* Define to 1 if you have the `endgrent' function. */ +/* #undef HAVE_ENDGRENT */ + +/* Define to 1 if you have the `getgrent' function. */ +/* #undef HAVE_GETGRENT */ + +/* Define to 1 if you have the `fgetgrent' function. */ +/* #undef HAVE_FGETGRENT */ + +/* Define to 1 if you have the `setgrent' function. */ +/* #undef HAVE_SETGRENT */ + +/* Define to 1 if you have the `setgroups' function. */ +/* #undef HAVE_SETGROUPS */ + +/* Define to 1 if you have the `endpwent' function. */ +/* #undef HAVE_ENDPWENT */ + +/* Define to 1 if you have the `getpwent' function. */ +/* #undef HAVE_GETPWENT */ + +/* Define to 1 if you have the `fgetpwent' function. */ +/* #undef HAVE_FGETPWENT */ + +/* Define to 1 if you have the `setpwent' function. */ +/* #undef HAVE_SETPWENT */ + +/* Define to 1 if you have the `getfsstat' function. */ +/* #undef HAVE_GETFSSTAT */ + +/* Define to 1 if you have the `lutimes' function. */ +/* #undef HAVE_LUTIMES */ + +/* Define to 1 if you have the `mremap' function. */ +/* #undef HAVE_MREMAP */ + +/* Define to 1 if you have the `remap_file_pages' function. */ +/* #undef HAVE_REMAP_FILE_PAGES */ + +/* Define to 1 if you have the `posix_fadvise' function. */ +/* #undef HAVE_POSIX_FADVISE */ + +/* Define to 1 if you have the `posix_fallocate' function. */ +/* #undef HAVE_POSIX_FALLOCATE */ + +/* Define to 1 if you have the `posix_madvise' function. */ +/* #undef HAVE_POSIX_MADVISE */ + +/* Define to 1 if you have the `vsnprintf' function. */ +/* #undef HAVE_VSNPRINTF */ + +/* Define to 1 if you have the `sendfile' function. */ +/* #undef HAVE_SENDFILE */ + +/* Define to 1 if you have the `gethostid' function. */ +/* #undef HAVE_GETHOSTID */ + +/* Define to 1 if you have the `sethostid' function. */ +/* #undef HAVE_SETHOSTID */ + +/* Define to 1 if you have the `sethostname' function. */ +/* #undef HAVE_SETHOSTNAME */ + +/* struct statfs */ +/* #undef HAVE_STATFS */ + +/* Define to 1 if you have the `fstatfs' function. */ +/* #undef HAVE_FSTATFS */ + +/* Define to 1 if you have the `statvfs' function. */ +/* #undef HAVE_STATVFS */ + +/* Define to 1 if you have the `fstatvfs' function. */ +/* #undef HAVE_FSTATVFS */ + +/* Define to 1 if you have the `stime' function. */ +/* #undef HAVE_STIME */ + +/* Define to 1 if you have the `ttyname_r' function. */ +/* #undef HAVE_TTYNAME_R */ + +/* Define to 1 if you have the `psignal' function. */ +/* #undef HAVE_PSIGNAL */ + +/* Define to 1 if you have the `getlogin_r' function. */ +/* #undef HAVE_GETLOGIN_R */ + +/* Define to 1 if you have the `lockf' function. */ +/* #undef HAVE_LOCKF */ + +/* Define to 1 if you have the `swab' function. */ +/* #undef HAVE_SWAB */ + +/* Define to 1 if you have the `setusershell' function. */ +/* #undef HAVE_SETUSERSHELL */ + +/* Define to 1 if you have the `endusershell' function. */ +/* #undef HAVE_ENDUSERSHELL */ + +/* Define to 1 if you have the `utimensat' function. */ +/* #undef HAVE_UTIMENSAT */ + +/* Define to 1 if you have the `fstatat' function. */ +/* #undef HAVE_FSTATAT */ + +/* Define to 1 if you have the `mknodat' function. */ +/* #undef HAVE_MKNODAT */ + +/* Define to 1 if you have the `readlinkat' function. */ +/* #undef HAVE_READLINKAT */ + +/* Define to 1 if you have the `readv' function. */ +/* #undef HAVE_READV */ + +/* Define to 1 if you have the `writev' function. */ +/* #undef HAVE_WRITEV */ + +/* Define to 1 if you have the `preadv' function. */ +/* #undef HAVE_PREADV */ + +/* Define to 1 if you have the `pwritev' function. */ +/* #undef HAVE_PWRITEV */ + +/* Define to 1 if you have the `setpgid' function. */ +/* #undef HAVE_SETPGID */ + +/* Define to 1 if you have the `system' function. */ +#ifdef _MSC_VER +#if HAVE_WINAPI_FAMILY_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) +#define HAVE_SYSTEM 1 +#endif +#else +#define HAVE_SYSTEM 1 +#endif + +/* Define to 1 if you have the `fork' function. */ +/* #undef HAVE_FORK */ + +/* Define to 1 if you have the `execv' function. */ +#define HAVE_EXECV 1 + +/* Define to 1 if you have the `execve' function. */ +#define HAVE_EXECVE 1 + +/* Define to 1 if you have the `waitpid' function. */ +/* #undef HAVE_WAITPID */ + +/* accept4 */ +/* #undef HAVE_ACCEPT4 */ + +/* Define to 1 if you have the `localtime_r' function. */ +/* #undef HAVE_LOCALTIME_R */ + +/* Define to 1 if you have the `mkdtemp' function. */ +/* #undef HAVE_MKDTEMP */ + +/* The size of `size_t', as computed by sizeof. */ +#define SIZEOF_SIZE_T 8 + +/* Define to 1 if the system has the type `blksize_t'. */ +/* #undef HAVE_BLKSIZE_T */ + +/* Define to 1 if the system has the type `blkcnt_t'. */ +/* #undef HAVE_BLKCNT_T */ + +/* Define to 1 if the system has the type `suseconds_t'. */ +/* #undef HAVE_SUSECONDS_T */ + +/* Define to 1 if the system has the type `struct cmsghdr'. */ +/* #undef HAVE_STRUCT_CMSGHDR */ + +/* Define to 1 if the system has the type `struct flock'. */ +/* #undef HAVE_STRUCT_FLOCK */ + +/* Define to 1 if the system has the type `struct iovec'. */ +/* #undef HAVE_STRUCT_IOVEC */ + +/* Define to 1 if the system has the type `struct linger'. */ +/* #undef HAVE_STRUCT_LINGER */ + +/* Define to 1 if the system has the type `struct pollfd'. */ +/* #undef HAVE_STRUCT_POLLFD */ + +/* Define to 1 if the system has the type `struct sockaddr'. */ +/* #undef HAVE_STRUCT_SOCKADDR */ + +/* Define to 1 if the system has the type `struct sockaddr_storage'. */ +/* #undef HAVE_STRUCT_SOCKADDR_STORAGE */ + +/* Define to 1 if the system has the type `struct sockaddr_in'. */ +/* #undef HAVE_STRUCT_SOCKADDR_IN */ + +/* Define to 1 if the system has the type `struct sockaddr_in6'. */ +#define HAVE_STRUCT_SOCKADDR_IN6 1 + +/* Define to 1 if the system has the type `struct sockaddr_un'. */ +/* #undef HAVE_STRUCT_SOCKADDR_UN */ + +/* Define to 1 if the system has the type `struct stat'. */ +/* #undef HAVE_STRUCT_STAT */ + +/* Define to 1 if the system has the type `struct timespec'. */ +/* #undef HAVE_STRUCT_TIMESPEC */ + +/* Define to 1 if the system has the type `struct timeval'. */ +/* #undef HAVE_STRUCT_TIMEVAL */ + +/* Define to 1 if the system has the type `struct timezone'. */ +/* #undef HAVE_STRUCT_TIMEZONE */ + +/* Define to 1 if the system has the type `struct utimbuf'. */ +/* #undef HAVE_STRUCT_UTIMBUF */ + +/* Define to 1 if `d_off' is a member of `struct dirent'. */ +/* #undef HAVE_STRUCT_DIRENT_D_OFF */ + +/* Define to 1 if `d_reclen' is a member of `struct dirent'. */ +/* #undef HAVE_STRUCT_DIRENT_D_RECLEN */ + +/* Define to 1 if `d_type' is a member of `struct dirent'. */ +/* #undef HAVE_STRUCT_DIRENT_D_TYPE */ + +/* Define to 1 if `pw_gecos' is a member of `struct passwd'. */ +/* #undef HAVE_STRUCT_PASSWD_PW_GECOS */ + +/* Define to 1 if `f_flags' is a member of `struct statfs'. */ +/* #undef HAVE_STRUCT_STATFS_F_FLAGS */ + +/* Define to 1 if `st_atim' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_ATIM */ + +/* Define to 1 if `st_mtim' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_MTIM */ + +/* Define to 1 if `st_atimespec' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_ATIMESPEC */ + +/* Define to 1 if `st_ctim' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_CTIM */ + +/* Define to 1 if `kp_proc' is a member of `struct kinfo_proc'. */ +/* #undef HAVE_STRUCT_KINFO_PROC_KP_PROC */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_TIME_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_DIRENT_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_COMMONCRYPTO_COMMONDIGEST_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_CURSES_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_TERM_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_TERMIOS_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_RANDOM_H */ + +/* Define to 1 if you have the `getrandom' function. */ +/* #undef HAVE_GETRANDOM */ + +/* Define to 1 if you have the `getentropy' function. */ +/* #undef HAVE_GETENTROPY */ + +/* linux/in.h */ +/* #undef HAVE_LINUX_IN_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LINUX_IF_PACKET_H */ + +/* struct in_pktinfo */ +/* #undef HAVE_IN_PKTINFO */ + +/* struct ip_mreqn */ +/* #undef HAVE_IP_MREQN */ + +/* Define to 1 if the system has the type `struct flock64'. */ +/* #undef HAVE_STRUCT_FLOCK64 */ + +/* struct flock64 */ +/* #undef HAVE_FLOCK64 */ + +/* O_CLOEXEC */ +/* #undef HAVE_O_CLOEXEC */ + +/* F_DUPFD_CLOEXEC */ +/* #undef HAVE_F_DUPFD_CLOEXEC */ + +/* Qp2getifaddrs */ +/* #undef HAVE_QP2GETIFADDRS */ + +/* lseek64 */ +/* #undef HAVE_LSEEK64 */ + +/* mmap64 */ +/* #undef HAVE_MMAP64 */ + +/* ftruncate64 */ +/* #undef HAVE_FTRUNCATE64 */ + +/* posix_fadvise64 */ +/* #undef HAVE_POSIX_FADVISE64 */ + +/* stat64 */ +/* #undef HAVE_STAT64 */ + +/* pipe2 */ +/* #undef HAVE_PIPE2 */ + +/* getmntinfo */ +/* #undef HAVE_GETMNTINFO */ + +/* strcpy_s */ +/* #undef HAVE_STRCPY_S */ + +/* Define to 1 if you have the `strlcpy' function. */ +/* #undef HAVE_STRLCPY */ + +/* posix_fadvise */ +/* #undef HAVE_POSIX_ADVISE */ + +/* ioctl */ +/* #undef HAVE_IOCTL */ + +/* arc4random_buf */ +/* #undef HAVE_ARC4RANDOM_BUF */ + +/* TIOCGWINSZ */ +/* #undef HAVE_TIOCGWINSZ */ + +/* tcgetattr */ +/* #undef HAVE_TCGETATTR */ + +/* tcsetattr */ +/* #undef HAVE_TCSETATTR */ + +/* ECHO */ +/* #undef HAVE_ECHO */ + +/* ICANON */ +/* #undef HAVE_ICANON */ + +/* TCSANOW */ +/* #undef HAVE_TCSANOW */ + +/* lchflags */ +/* #undef HAVE_LCHFLAGS */ + +/* struct stat.st_flags */ +/* #undef HAVE_STAT_FLAGS */ + +/* struct stat.st_birthtimespec */ +/* #undef HAVE_STAT_BIRTHTIME */ + +/* struct stat.st_atimespec */ +/* #undef HAVE_STAT_TIMESPEC */ + +/* struct stat.st_atim */ +/* #undef HAVE_STAT_TIM */ + +/* struct stat.st_atimensec */ +/* #undef HAVE_STAT_NSEC */ + +/* struct dirent.d_namlen */ +/* #undef HAVE_DIRENT_NAME_LEN */ + +/* struct statfs.f_fstypename */ +/* #undef HAVE_STATFS_FSTYPENAME */ + +/* struct statvfs.f_fstypename */ +/* #undef HAVE_STATVFS_FSTYPENAME */ + +/* char* strerror(int errnum, char *buf, size_t buflen) */ +/* #undef HAVE_GNU_STRERROR_R */ + +/* readdir_r */ +/* #undef HAVE_READDIR_R */ + +/* kevent with void *data */ +/* #undef KEVENT_HAS_VOID_UDATA */ + +/* struct fd_set.fds_bits */ +/* #undef HAVE_FDS_BITS */ + +/* struct fd_set.__fds_bits */ +/* #undef HAVE_PRIVATE_FDS_BITS */ + +/* sendfile with 4 arguments */ +/* #undef HAVE_SENDFILE_4 */ + +/* sendfile with 6 arguments */ +/* #undef HAVE_SENDFILE_6 */ + +/* fcopyfile */ +/* #undef HAVE_FCOPYFILE */ + +/* getnameinfo with signed flags */ +/* #undef HAVE_GETNAMEINFO_SIGNED_FLAGS */ + +/* HAVE_SUPPORT_FOR_DUAL_MODE_IPV4_PACKET_INFO */ +/* #undef HAVE_SUPPORT_FOR_DUAL_MODE_IPV4_PACKET_INFO */ + +/* bind with unsigned addrlen */ +/* #undef BIND_ADDRLEN_UNSIGNED */ + +/* struct ipv6_mreq with unsigned ipv6mr_interface */ +/* #undef IPV6MR_INTERFACE_UNSIGNED */ + +/* inotify_rm_watch with unsigned wd */ +/* #undef INOTIFY_RM_WATCH_WD_UNSIGNED */ + +/* getpriority with int who */ +/* #undef PRIORITY_REQUIRES_INT_WHO */ + +/* kevent with int parameters */ +/* #undef KEVENT_REQUIRES_INT_PARAMS */ + +/* Define to 1 if you have the `mkstemps' function. */ +/* #undef HAVE_MKSTEMPS */ + +/* tcp/var.h */ +/* #undef HAVE_TCP_VAR_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_CDEFS_H */ + +/* TCPSTATE enum in netinet/tcp.h */ +/* #undef HAVE_TCP_H_TCPSTATE_ENUM */ + +/* HAVE_TCP_FSM_H */ +/* #undef HAVE_TCP_FSM_H */ + +/* struct rt_msghdr */ +/* #undef HAVE_RT_MSGHDR */ + +/* getpeereid */ +/* #undef HAVE_GETPEEREID */ + +/* uname */ +/* #undef HAVE_UNAME */ + +/* getdomainname with size_t namelen */ +/* #undef HAVE_GETDOMAINNAME_SIZET */ + +/* inotify_init */ +/* #undef HAVE_INOTIFY_INIT */ + +/* inotify_add_watch */ +/* #undef HAVE_INOTIFY_ADD_WATCH */ + +/* inotify_rm_watch */ +/* #undef HAVE_INOTIFY_RM_WATCH */ + +/* HAVE_INOTIFY */ +/* #undef HAVE_INOTIFY */ + +/* GSS/GSS.h */ +/* #undef HAVE_GSSFW_HEADERS */ + +/* GSS_SPNEGO_MECHANISM */ +/* #undef HAVE_GSS_SPNEGO_MECHANISM */ + +/* ENABLE_GSS */ +/* #undef ENABLE_GSS */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_CRT_EXTERNS_H */ + +/* _NSGetEnviron */ +/* #undef HAVE_NSGETENVIRON */ + +/* IN_EXCL_UNLINK */ +/* #undef HAVE_IN_EXCL_UNLINK */ + +/* Define to 1 if you have the header file. */ +#define HAVE_WINTERNL_H 1 + +/* Have socklen_t */ +/* #undef HAVE_SOCKLEN_T */ + +/* Define to 1 if you have the `execvp' function. */ +/* #undef HAVE_EXECVP */ + +/* Name of /dev/random */ +#define NAME_DEV_RANDOM "" + +/* Have /dev/random */ +#define HAVE_CRYPT_RNG 1 + +/* Enable the allocation and indexing of arrays greater than Int32.MaxValue */ +/* #undef MONO_BIG_ARRAYS */ + +/* Enable DTrace probes */ +/* #undef ENABLE_DTRACE */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_SDT_H */ + +/* AOT cross offsets file */ +/* #undef MONO_OFFSETS_FILE */ + +/* Enable the LLVM back end */ +/* #undef ENABLE_LLVM */ + +/* Enable the LLVM back end */ +/* #undef ENABLE_LLVM_MSVC_ONLY */ + +/* LLVM used is being build during mono build */ +/* #undef INTERNAL_LLVM */ + +/* LLVM used is being build during mono build */ +/* #undef INTERNAL_LLVM_MSVC_ONLY */ + +/* Build LLVM with assertions */ +/* #undef INTERNAL_LLVM_ASSERTS */ + +/* Build LLVM with assertions */ +/* #undef INTERNAL_LLVM_ASSERTS_MSVC_ONLY */ + +/* The LLVM back end is dynamically loaded */ +/* #undef MONO_LLVM_LOADED */ + +/* Runtime support code for llvm enabled */ +/* #undef ENABLE_LLVM_RUNTIME */ + +/* Runtime support code for llvm enabled */ +/* #undef ENABLE_LLVM_RUNTIME_MSVC_ONLY */ + +/* 64 bit mode with 4 byte longs and pointers */ +/* #undef MONO_ARCH_ILP32 */ + +/* The runtime is compiled for cross-compiling mode */ +/* #undef MONO_CROSS_COMPILE */ + +/* ... */ +/* #undef TARGET_WASM */ + +/* The JIT/AOT targets WatchOS */ +/* #undef TARGET_WATCHOS */ + +/* ... */ +/* #undef TARGET_PS3 */ + +/* ... */ +/* #undef __mono_ppc64__ */ + +/* ... */ +/* #undef TARGET_XBOX360 */ + +/* ... */ +/* #undef TARGET_PS4 */ + +/* ... */ +/* #undef DISABLE_HW_TRAPS */ + +/* Target is RISC-V */ +/* #undef TARGET_RISCV */ + +/* Target is 32-bit RISC-V */ +/* #undef TARGET_RISCV32 */ + +/* Target is 64-bit RISC-V */ +/* #undef TARGET_RISCV64 */ + +/* ... */ +/* #undef TARGET_X86 */ + +/* ... */ +#define TARGET_AMD64 1 + +/* ... */ +/* #undef TARGET_ARM */ + +/* ... */ +/* #undef TARGET_ARM64 */ + +/* ... */ +/* #undef TARGET_POWERPC */ + +/* ... */ +/* #undef TARGET_POWERPC64 */ + +/* ... */ +/* #undef TARGET_S390X */ + +/* ... */ +/* #undef TARGET_MIPS */ + +/* ... */ +/* #undef TARGET_SPARC */ + +/* ... */ +/* #undef TARGET_SPARC64 */ + +/* ... */ +/* #undef HOST_WASM */ + +/* ... */ +/* #undef HOST_X86 */ + +/* ... */ +#define HOST_AMD64 1 + +/* ... */ +/* #undef HOST_ARM */ + +/* ... */ +/* #undef HOST_ARM64 */ + +/* ... */ +/* #undef HOST_POWERPC */ + +/* ... */ +/* #undef HOST_POWERPC64 */ + +/* ... */ +/* #undef HOST_S390X */ + +/* ... */ +/* #undef HOST_MIPS */ + +/* ... */ +/* #undef HOST_SPARC */ + +/* ... */ +/* #undef HOST_SPARC64 */ + +/* Host is RISC-V */ +/* #undef HOST_RISCV */ + +/* Host is 32-bit RISC-V */ +/* #undef HOST_RISCV32 */ + +/* Host is 64-bit RISC-V */ +/* #undef HOST_RISCV64 */ + +/* ... */ +/* #undef USE_GCC_ATOMIC_OPS */ + +/* The JIT/AOT targets iOS */ +/* #undef TARGET_IOS */ + +/* The JIT/AOT targets OSX */ +/* #undef TARGET_OSX */ + +/* The JIT/AOT targets Apple platforms */ +/* #undef TARGET_MACH */ + +/* byte order of target */ +#define TARGET_BYTE_ORDER G_LITTLE_ENDIAN + +/* wordsize of target */ +#define TARGET_SIZEOF_VOID_P 8 + +/* size of target machine integer registers */ +#define SIZEOF_REGISTER 8 + +/* Support for the visibility ("hidden") attribute */ +/* #undef HAVE_VISIBILITY_HIDDEN */ + +/* Support for the deprecated attribute */ +/* #undef HAVE_DEPRECATED */ + +/* Moving collector */ +#define HAVE_MOVING_COLLECTOR 1 + +/* Defaults to concurrent GC */ +#define HAVE_CONC_GC_AS_DEFAULT 1 + +/* Define to 1 if you have the `stpcpy' function. */ +/* #undef HAVE_STPCPY */ + +/* Define to 1 if you have the `strtok_r' function. */ +#define HAVE_STRTOK_R 1 + +/* Define to 1 if you have the `rewinddir' function. */ +/* #undef HAVE_REWINDDIR */ + +/* Define to 1 if you have the `vasprintf' function. */ +/* #undef HAVE_VASPRINTF */ + +/* Overridable allocator support enabled */ +/* #undef ENABLE_OVERRIDABLE_ALLOCATORS */ + +/* Define to 1 if you have the `strndup' function. */ +/* #undef HAVE_STRNDUP */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_GETOPT_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ICONV_H */ + +/* Define to 1 if you have the `iconv' library (-liconv). */ +/* #undef HAVE_LIBICONV */ + +/* Icall symbol map enabled */ +/* #undef ENABLE_ICALL_SYMBOL_MAP */ + +/* Icall export enabled */ +/* #undef ENABLE_ICALL_EXPORT */ + +/* Icall tables disabled */ +/* #undef DISABLE_ICALL_TABLES */ + +/* QCalls disabled */ +/* #undef DISABLE_QCALLS */ + +/* Have __thread keyword */ +#define MONO_KEYWORD_THREAD __declspec (thread) + +/* tls_model available */ +/* #undef HAVE_TLS_MODEL_ATTR */ + +/* ARM v5 */ +/* #undef HAVE_ARMV5 */ + +/* ARM v6 */ +/* #undef HAVE_ARMV6 */ + +/* ARM v7 */ +/* #undef HAVE_ARMV7 */ + +/* RISC-V FPABI is double-precision */ +/* #undef RISCV_FPABI_DOUBLE */ + +/* RISC-V FPABI is single-precision */ +/* #undef RISCV_FPABI_SINGLE */ + +/* RISC-V FPABI is soft float */ +/* #undef RISCV_FPABI_SOFT */ + +/* Use malloc for each single mempool allocation */ +/* #undef USE_MALLOC_FOR_MEMPOOLS */ + +/* Enable lazy gc thread creation by the embedding host. */ +/* #undef LAZY_GC_THREAD_CREATION */ + +/* Enable cooperative stop-the-world garbage collection. */ +/* #undef ENABLE_COOP_SUSPEND */ + +/* Enable hybrid suspend for GC stop-the-world */ +/* #undef ENABLE_HYBRID_SUSPEND */ + +/* Enable feature experiments */ +/* #undef ENABLE_EXPERIMENTS */ + +/* Enable experiment 'null' */ +/* #undef ENABLE_EXPERIMENT_null */ + +/* Enable experiment 'Tiered Compilation' */ +/* #undef ENABLE_EXPERIMENT_TIERED */ + +/* Enable checked build */ +#define ENABLE_CHECKED_BUILD 1 + +/* Enable GC checked build */ +/* #undef ENABLE_CHECKED_BUILD_GC */ + +/* Enable metadata checked build */ +/* #undef ENABLE_CHECKED_BUILD_METADATA */ + +/* Enable thread checked build */ +/* #undef ENABLE_CHECKED_BUILD_THREAD */ + +/* Enable private types checked build */ +#define ENABLE_CHECKED_BUILD_PRIVATE_TYPES 1 + +/* Enable private types checked build */ +/* #undef ENABLE_CHECKED_BUILD_CRASH_REPORTING */ + +/* Enable EventPipe library support */ +#define ENABLE_PERFTRACING 1 + +/* Define to 1 if you have /usr/include/malloc.h. */ +/* #undef HAVE_USR_INCLUDE_MALLOC_H */ + +/* BoringTls is supported */ +/* #undef HAVE_BTLS */ + +/* The architecture this is running on */ +#define MONO_ARCHITECTURE "amd64" + +/* Disable banned functions from being used by the runtime */ +#define MONO_INSIDE_RUNTIME 1 + +/* Version number of package */ +#define VERSION "...0" + +/* Full version number of package */ +#define FULL_VERSION + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_DLFCN_H */ + +/* Disable crash reporting subsystem */ +#define DISABLE_CRASH_REPORTING 1 + +/* Enable lazy gc thread creation by the embedding host */ +/* #undef LAZY_GC_THREAD_CREATION */ + +/* Enable additional checks */ +#define ENABLE_CHECKED_BUILD 1 + +/* Enable compile time checking that getter functions are used */ +#define ENABLE_CHECKED_BUILD_PRIVATE_TYPES 1 + +/* Enable runtime GC Safe / Unsafe mode assertion checks (must set env var MONO_CHECK_MODE=gc) */ +/* #undef ENABLE_CHECKED_BUILD_GC */ + +/* Enable runtime history of per-thread coop state transitions (must set env var MONO_CHECK_MODE=thread) */ +/* #undef ENABLE_CHECKED_BUILD_THREAD */ + +/* Enable runtime checks of mempool references between metadata images (must set env var MONO_CHECK_MODE=metadata) */ +/* #undef ENABLE_CHECKED_BUILD_METADATA */ + +#if defined(ENABLE_LLVM) && defined(HOST_WIN32) && defined(TARGET_WIN32) && (!defined(TARGET_AMD64) || !defined(_MSC_VER)) +#error LLVM for host=Windows and target=Windows is only supported on x64 MSVC build. +#endif + +#endif diff --git a/src/mono/out/build/x64-Debug (default)/mono/eglib/eglib-config.h b/src/mono/out/build/x64-Debug (default)/mono/eglib/eglib-config.h new file mode 100644 index 0000000000000..02d54c99eae01 --- /dev/null +++ b/src/mono/out/build/x64-Debug (default)/mono/eglib/eglib-config.h @@ -0,0 +1,43 @@ +#ifndef __EGLIB_CONFIG_H +#define __EGLIB_CONFIG_H + +/* + * System-dependent settings + */ +#define G_GNUC_PRETTY_FUNCTION +#define G_GNUC_UNUSED +#define G_BYTE_ORDER G_LITTLE_ENDIAN +#define G_GNUC_NORETURN +#define G_SEARCHPATH_SEPARATOR_S ";" +#define G_SEARCHPATH_SEPARATOR ';' +#define G_DIR_SEPARATOR '\' +#define G_DIR_SEPARATOR_S "\" +#define G_BREAKPOINT() G_STMT_START { raise(SIGTRAP); } G_STMT_END +#define G_OS_WIN32 + +#if == 1 +#define G_HAVE_ALLOCA_H +#endif + +#if == 1 +#define G_HAVE_UNISTD_H +#endif + +typedef size_t gsize; +typedef ptrdiff_t gssize; + +#define G_GSIZE_FORMAT "lu" + +#if defined (HOST_WATCHOS) +#undef G_BREAKPOINT +#define G_BREAKPOINT() +#endif + +#if defined (HOST_WASM) +#undef G_BREAKPOINT +#define G_BREAKPOINT() do { printf ("MONO: BREAKPOINT\n"); abort (); } while (0) +#endif + +typedef void * GPid; + +#endif diff --git a/src/tests/out/build/x64-Debug (default)/.cmake/api/v1/query/client-MicrosoftVS/query.json b/src/tests/out/build/x64-Debug (default)/.cmake/api/v1/query/client-MicrosoftVS/query.json new file mode 100644 index 0000000000000..308f68dd8c5fa --- /dev/null +++ b/src/tests/out/build/x64-Debug (default)/.cmake/api/v1/query/client-MicrosoftVS/query.json @@ -0,0 +1 @@ +{"requests":[{"kind":"cache","version":2},{"kind":"cmakeFiles","version":1},{"kind":"codemodel","version":2}]} \ No newline at end of file diff --git a/src/tests/out/build/x64-Debug (default)/VSInheritEnvironments.txt b/src/tests/out/build/x64-Debug (default)/VSInheritEnvironments.txt new file mode 100644 index 0000000000000..f8cc9d8acecec --- /dev/null +++ b/src/tests/out/build/x64-Debug (default)/VSInheritEnvironments.txt @@ -0,0 +1 @@ +msvc_x64_x64 \ No newline at end of file From c49efefd1a6eaa9c601e54c5ccf72f53912729ca Mon Sep 17 00:00:00 2001 From: Rattenkrieg Date: Sat, 28 Nov 2020 22:46:18 +0300 Subject: [PATCH 23/29] cleanup build artifacts --- .../.cmake/api/v1/query/client-MicrosoftVS/query.json | 1 - .../out/build/x64-Debug (default)/VSInheritEnvironments.txt | 1 - .../.cmake/api/v1/query/client-MicrosoftVS/query.json | 1 - .../out/build/x64-Debug (default)/VSInheritEnvironments.txt | 1 - .../.cmake/api/v1/query/client-MicrosoftVS/query.json | 1 - .../Unix/out/build/x64-Debug (default)/VSInheritEnvironments.txt | 1 - .../.cmake/api/v1/query/client-MicrosoftVS/query.json | 1 - .../out/build/x64-Debug (default)/VSInheritEnvironments.txt | 1 - .../.cmake/api/v1/query/client-MicrosoftVS/query.json | 1 - src/mono/out/build/x64-Debug (default)/VSInheritEnvironments.txt | 1 - .../.cmake/api/v1/query/client-MicrosoftVS/query.json | 1 - .../out/build/x64-Debug (default)/VSInheritEnvironments.txt | 1 - 12 files changed, 12 deletions(-) delete mode 100644 src/coreclr/out/build/x64-Debug (default)/.cmake/api/v1/query/client-MicrosoftVS/query.json delete mode 100644 src/coreclr/out/build/x64-Debug (default)/VSInheritEnvironments.txt delete mode 100644 src/installer/corehost/out/build/x64-Debug (default)/.cmake/api/v1/query/client-MicrosoftVS/query.json delete mode 100644 src/installer/corehost/out/build/x64-Debug (default)/VSInheritEnvironments.txt delete mode 100644 src/libraries/Native/Unix/out/build/x64-Debug (default)/.cmake/api/v1/query/client-MicrosoftVS/query.json delete mode 100644 src/libraries/Native/Unix/out/build/x64-Debug (default)/VSInheritEnvironments.txt delete mode 100644 src/libraries/Native/Windows/out/build/x64-Debug (default)/.cmake/api/v1/query/client-MicrosoftVS/query.json delete mode 100644 src/libraries/Native/Windows/out/build/x64-Debug (default)/VSInheritEnvironments.txt delete mode 100644 src/mono/out/build/x64-Debug (default)/.cmake/api/v1/query/client-MicrosoftVS/query.json delete mode 100644 src/mono/out/build/x64-Debug (default)/VSInheritEnvironments.txt delete mode 100644 src/tests/out/build/x64-Debug (default)/.cmake/api/v1/query/client-MicrosoftVS/query.json delete mode 100644 src/tests/out/build/x64-Debug (default)/VSInheritEnvironments.txt diff --git a/src/coreclr/out/build/x64-Debug (default)/.cmake/api/v1/query/client-MicrosoftVS/query.json b/src/coreclr/out/build/x64-Debug (default)/.cmake/api/v1/query/client-MicrosoftVS/query.json deleted file mode 100644 index 308f68dd8c5fa..0000000000000 --- a/src/coreclr/out/build/x64-Debug (default)/.cmake/api/v1/query/client-MicrosoftVS/query.json +++ /dev/null @@ -1 +0,0 @@ -{"requests":[{"kind":"cache","version":2},{"kind":"cmakeFiles","version":1},{"kind":"codemodel","version":2}]} \ No newline at end of file diff --git a/src/coreclr/out/build/x64-Debug (default)/VSInheritEnvironments.txt b/src/coreclr/out/build/x64-Debug (default)/VSInheritEnvironments.txt deleted file mode 100644 index f8cc9d8acecec..0000000000000 --- a/src/coreclr/out/build/x64-Debug (default)/VSInheritEnvironments.txt +++ /dev/null @@ -1 +0,0 @@ -msvc_x64_x64 \ No newline at end of file diff --git a/src/installer/corehost/out/build/x64-Debug (default)/.cmake/api/v1/query/client-MicrosoftVS/query.json b/src/installer/corehost/out/build/x64-Debug (default)/.cmake/api/v1/query/client-MicrosoftVS/query.json deleted file mode 100644 index 308f68dd8c5fa..0000000000000 --- a/src/installer/corehost/out/build/x64-Debug (default)/.cmake/api/v1/query/client-MicrosoftVS/query.json +++ /dev/null @@ -1 +0,0 @@ -{"requests":[{"kind":"cache","version":2},{"kind":"cmakeFiles","version":1},{"kind":"codemodel","version":2}]} \ No newline at end of file diff --git a/src/installer/corehost/out/build/x64-Debug (default)/VSInheritEnvironments.txt b/src/installer/corehost/out/build/x64-Debug (default)/VSInheritEnvironments.txt deleted file mode 100644 index f8cc9d8acecec..0000000000000 --- a/src/installer/corehost/out/build/x64-Debug (default)/VSInheritEnvironments.txt +++ /dev/null @@ -1 +0,0 @@ -msvc_x64_x64 \ No newline at end of file diff --git a/src/libraries/Native/Unix/out/build/x64-Debug (default)/.cmake/api/v1/query/client-MicrosoftVS/query.json b/src/libraries/Native/Unix/out/build/x64-Debug (default)/.cmake/api/v1/query/client-MicrosoftVS/query.json deleted file mode 100644 index 308f68dd8c5fa..0000000000000 --- a/src/libraries/Native/Unix/out/build/x64-Debug (default)/.cmake/api/v1/query/client-MicrosoftVS/query.json +++ /dev/null @@ -1 +0,0 @@ -{"requests":[{"kind":"cache","version":2},{"kind":"cmakeFiles","version":1},{"kind":"codemodel","version":2}]} \ No newline at end of file diff --git a/src/libraries/Native/Unix/out/build/x64-Debug (default)/VSInheritEnvironments.txt b/src/libraries/Native/Unix/out/build/x64-Debug (default)/VSInheritEnvironments.txt deleted file mode 100644 index f8cc9d8acecec..0000000000000 --- a/src/libraries/Native/Unix/out/build/x64-Debug (default)/VSInheritEnvironments.txt +++ /dev/null @@ -1 +0,0 @@ -msvc_x64_x64 \ No newline at end of file diff --git a/src/libraries/Native/Windows/out/build/x64-Debug (default)/.cmake/api/v1/query/client-MicrosoftVS/query.json b/src/libraries/Native/Windows/out/build/x64-Debug (default)/.cmake/api/v1/query/client-MicrosoftVS/query.json deleted file mode 100644 index 308f68dd8c5fa..0000000000000 --- a/src/libraries/Native/Windows/out/build/x64-Debug (default)/.cmake/api/v1/query/client-MicrosoftVS/query.json +++ /dev/null @@ -1 +0,0 @@ -{"requests":[{"kind":"cache","version":2},{"kind":"cmakeFiles","version":1},{"kind":"codemodel","version":2}]} \ No newline at end of file diff --git a/src/libraries/Native/Windows/out/build/x64-Debug (default)/VSInheritEnvironments.txt b/src/libraries/Native/Windows/out/build/x64-Debug (default)/VSInheritEnvironments.txt deleted file mode 100644 index f8cc9d8acecec..0000000000000 --- a/src/libraries/Native/Windows/out/build/x64-Debug (default)/VSInheritEnvironments.txt +++ /dev/null @@ -1 +0,0 @@ -msvc_x64_x64 \ No newline at end of file diff --git a/src/mono/out/build/x64-Debug (default)/.cmake/api/v1/query/client-MicrosoftVS/query.json b/src/mono/out/build/x64-Debug (default)/.cmake/api/v1/query/client-MicrosoftVS/query.json deleted file mode 100644 index 308f68dd8c5fa..0000000000000 --- a/src/mono/out/build/x64-Debug (default)/.cmake/api/v1/query/client-MicrosoftVS/query.json +++ /dev/null @@ -1 +0,0 @@ -{"requests":[{"kind":"cache","version":2},{"kind":"cmakeFiles","version":1},{"kind":"codemodel","version":2}]} \ No newline at end of file diff --git a/src/mono/out/build/x64-Debug (default)/VSInheritEnvironments.txt b/src/mono/out/build/x64-Debug (default)/VSInheritEnvironments.txt deleted file mode 100644 index f8cc9d8acecec..0000000000000 --- a/src/mono/out/build/x64-Debug (default)/VSInheritEnvironments.txt +++ /dev/null @@ -1 +0,0 @@ -msvc_x64_x64 \ No newline at end of file diff --git a/src/tests/out/build/x64-Debug (default)/.cmake/api/v1/query/client-MicrosoftVS/query.json b/src/tests/out/build/x64-Debug (default)/.cmake/api/v1/query/client-MicrosoftVS/query.json deleted file mode 100644 index 308f68dd8c5fa..0000000000000 --- a/src/tests/out/build/x64-Debug (default)/.cmake/api/v1/query/client-MicrosoftVS/query.json +++ /dev/null @@ -1 +0,0 @@ -{"requests":[{"kind":"cache","version":2},{"kind":"cmakeFiles","version":1},{"kind":"codemodel","version":2}]} \ No newline at end of file diff --git a/src/tests/out/build/x64-Debug (default)/VSInheritEnvironments.txt b/src/tests/out/build/x64-Debug (default)/VSInheritEnvironments.txt deleted file mode 100644 index f8cc9d8acecec..0000000000000 --- a/src/tests/out/build/x64-Debug (default)/VSInheritEnvironments.txt +++ /dev/null @@ -1 +0,0 @@ -msvc_x64_x64 \ No newline at end of file From aa8955017dd5322df553d97befe1160383f55ce8 Mon Sep 17 00:00:00 2001 From: Rattenkrieg Date: Sat, 28 Nov 2020 22:49:13 +0300 Subject: [PATCH 24/29] more build artifacts removed --- .../out/build/x64-Debug (default)/config.h | 1775 ----------------- .../mono/eglib/eglib-config.h | 43 - 2 files changed, 1818 deletions(-) delete mode 100644 src/mono/out/build/x64-Debug (default)/config.h delete mode 100644 src/mono/out/build/x64-Debug (default)/mono/eglib/eglib-config.h diff --git a/src/mono/out/build/x64-Debug (default)/config.h b/src/mono/out/build/x64-Debug (default)/config.h deleted file mode 100644 index ff807806ba5ec..0000000000000 --- a/src/mono/out/build/x64-Debug (default)/config.h +++ /dev/null @@ -1,1775 +0,0 @@ -#ifndef __MONO_CONFIG_H__ -#define __MONO_CONFIG_H__ - -#ifdef _MSC_VER - -// FIXME This is all questionable but the logs are flooded and nothing else is fixing them. -#pragma warning(disable:4018) // signed/unsigned mismatch -#pragma warning(disable:4090) // const problem -#pragma warning(disable:4146) // unary minus operator applied to unsigned type, result still unsigned -#pragma warning(disable:4244) // integer conversion, possible loss of data -#pragma warning(disable:4267) // integer conversion, possible loss of data - -// promote warnings to errors -#pragma warning( error:4013) // function undefined; assuming extern returning int -#pragma warning( error:4022) // call and prototype disagree -#pragma warning( error:4047) // differs in level of indirection -#pragma warning( error:4098) // void return returns a value -#pragma warning( error:4113) // call and prototype disagree -#pragma warning( error:4172) // returning address of local variable or temporary -#pragma warning( error:4197) // top-level volatile in cast is ignored -#pragma warning( error:4273) // inconsistent dll linkage -#pragma warning( error:4293) // shift count negative or too big, undefined behavior -#pragma warning( error:4312) // 'type cast': conversion from 'MonoNativeThreadId' to 'gpointer' of greater size -#pragma warning( error:4715) // 'keyword' not all control paths return a value - -#include - -#if _WIN32_WINNT < 0x0601 -#error "Mono requires Windows 7 or later." -#endif /* _WIN32_WINNT < 0x0601 */ - -#ifndef HAVE_WINAPI_FAMILY_SUPPORT - -#define HAVE_WINAPI_FAMILY_SUPPORT - -/* WIN API Family support */ -#include - -#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) - #define HAVE_CLASSIC_WINAPI_SUPPORT 1 - #define HAVE_UWP_WINAPI_SUPPORT 0 -#elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) - #define HAVE_CLASSIC_WINAPI_SUPPORT 0 - #define HAVE_UWP_WINAPI_SUPPORT 1 -#else - #define HAVE_CLASSIC_WINAPI_SUPPORT 0 - #define HAVE_UWP_WINAPI_SUPPORT 0 -#ifndef HAVE_EXTERN_DEFINED_WINAPI_SUPPORT - #error Unsupported WINAPI family -#endif -#endif - -#endif -#endif - -/* Define to the full name of this package. */ -/* #undef PACKAGE_NAME */ - -/* Define to the one symbol short name of this package. */ -/* #undef PACKAGE_TARNAME */ - -/* Define to the version of this package. */ -/* #undef PACKAGE_VERSION */ - -/* Define to the full name and version of this package. */ -/* #undef PACKAGE_STRING */ - -/* Define to the address where bug reports for this package should be sent. */ -/* #undef PACKAGE_BUGREPORT */ - -/* Define to the home page for this package. */ -/* #undef PACKAGE_URL */ - -/* Version of the corlib-runtime interface */ -#define MONO_CORLIB_VERSION "1A5E0066-58DC-428A-B21C-0AD6CDAE2789" - -/* Disables the IO portability layer */ -#define DISABLE_PORTABILITY 1 - -/* This platform does not support symlinks */ -#define HOST_NO_SYMLINKS 1 - -/* pthread is a pointer */ -/* #undef PTHREAD_POINTER_ID */ - -/* Targeting the Android platform */ -/* #undef HOST_ANDROID */ - -/* ... */ -/* #undef TARGET_ANDROID */ - -/* ... */ -/* #undef USE_MACH_SEMA */ - -/* Targeting the Fuchsia platform */ -/* #undef HOST_FUCHSIA */ - -/* Targeting the AIX and PASE platforms */ -/* #undef HOST_AIX */ - -/* Define if Unix sockets cannot be created in an anonymous namespace */ -/* #undef NEED_LINK_UNLINK */ - -/* Host Platform is Win32 */ -#define HOST_WIN32 1 - -/* Target Platform is Win32 */ -#define TARGET_WIN32 1 - -/* Host Platform is Darwin */ -/* #undef HOST_DARWIN */ - -/* Host Platform is iOS */ -/* #undef HOST_IOS */ - -/* Host Platform is tvOS */ -/* #undef HOST_TVOS */ - -/* Use classic Windows API support */ -#define HAVE_CLASSIC_WINAPI_SUPPORT 1 - -/* Don't use UWP Windows API support */ -/* #undef HAVE_UWP_WINAPI_SUPPORT */ - -/* Define to 1 if you have the ANSI C header files. */ -/* #undef STDC_HEADERS */ - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_STRINGS_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_UNISTD_H */ - -/* Define to 1 if `major', `minor', and `makedev' are declared in . - */ -/* #undef MAJOR_IN_MKDEV */ - -/* Define to 1 if `major', `minor', and `makedev' are declared in - . */ -/* #undef MAJOR_IN_SYSMACROS */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_FILIO_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_SOCKIO_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_NETDB_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_UTIME_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_UTIME_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SEMAPHORE_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_UN_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_LINUX_RTC_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_SYSCALL_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_MKDEV_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_UIO_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_PARAM_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_SYSCTL_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_LIBPROC_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_PRCTL_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_COPYFILE_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_GNU_LIB_NAMES_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_SOCKET_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_IPC_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_UTSNAME_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_ALLOCA_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_UCONTEXT_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_PWD_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_SELECT_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_NETINET_TCP_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_NETINET_IN_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_LINK_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_ASM_SIGCONTEXT_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_INOTIFY_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_ARPA_INET_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_COMPLEX_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_UNWIND_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_LINUX_NETLINK_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_LINUX_RTNETLINK_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_USER_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_LINUX_SERIAL_H */ - -/* Use static zlib */ -/* #undef HAVE_STATIC_ZLIB */ - -/* Use static ICU */ -/* #undef STATIC_ICU */ - -/* Use OS-provided zlib */ -/* #undef HAVE_SYS_ZLIB */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_ELF_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_POLL_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_POLL_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_WAIT_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_GRP_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYSLOG_H */ - -/* Define to 1 if you have the `vsyslog' function. */ -/* #undef HAVE_VSYSLOG */ - -/* Define to 1 if you have the header file. */ -#define HAVE_WCHAR_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_LINUX_MAGIC_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_MACHINE_ENDIAN_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_ENDIAN_H */ - -/* Define to 1 if you have the header file. - */ -/* #undef HAVE_ANDROID_LEGACY_SIGNAL_INLINES_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_ANDROID_NDK_VERSION_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_ANDROID_API_LEVEL_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_ANDROID_VERSIONING_H */ - -/* Whether Android NDK unified headers are used */ -/* #undef ANDROID_UNIFIED_HEADERS */ - -/* The size of `void *', as computed by sizeof. */ -#define SIZEOF_VOID_P 8 - -/* The size of `long', as computed by sizeof. */ -#define SIZEOF_LONG 4 - -/* The size of `int', as computed by sizeof. */ -#define SIZEOF_INT 4 - -/* The size of `long long', as computed by sizeof. */ -#define SIZEOF_LONG_LONG 8 - -/* Enables the support for .NET Core Features in the MonoVM */ -#define ENABLE_NETCORE 1 - -/* Xen-specific behaviour */ -/* #undef MONO_XEN_OPT */ - -/* Reduce runtime requirements (and capabilities) */ -/* #undef MONO_SMALL_CONFIG */ - -/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most - significant byte first (like Motorola and SPARC, unlike Intel). */ -#if defined AC_APPLE_UNIVERSAL_BUILD -# if defined __BIG_ENDIAN__ -# define WORDS_BIGENDIAN 1 -# endif -#else -# ifndef WORDS_BIGENDIAN -# undef WORDS_BIGENDIAN -# endif -#endif - -/* Define if building universal (internal helper macro) */ -/* #undef AC_APPLE_UNIVERSAL_BUILD */ - -/* Make jemalloc assert for mono */ -/* #undef MONO_JEMALLOC_ASSERT */ - -/* Make jemalloc default for mono */ -/* #undef MONO_JEMALLOC_DEFAULT */ - -/* Enable jemalloc usage for mono */ -/* #undef MONO_JEMALLOC_ENABLED */ - -/* Do not include names of unmanaged functions in the crash dump */ -/* #undef MONO_PRIVATE_CRASHES */ - -/* Do not create structured crash files during unmanaged crashes */ -/* #undef DISABLE_STRUCTURED_CRASH */ - -/* Enable runtime support for Monodroid (Xamarin.Android) */ -/* #undef ENABLE_MONODROID */ - -/* Enable runtime support for Monotouch (Xamarin.iOS and Xamarin.Mac) */ -/* #undef ENABLE_MONOTOUCH */ - -/* String of disabled features */ -#define DISABLED_FEATURES "" - -/* Disable AOT Compiler */ -/* #undef DISABLE_AOT */ - -/* Disable default profiler support */ -/* #undef DISABLE_PROFILER */ - -/* Disable System.Decimal support */ -/* #undef DISABLE_DECIMAL */ - -/* Disable P/Invoke support */ -/* #undef DISABLE_PINVOKE */ - -/* Disable runtime debugging support */ -/* #undef DISABLE_DEBUG */ - -/* Disable reflection emit support */ -/* #undef DISABLE_REFLECTION_EMIT */ - -/* Disable assembly saving support in reflection emit */ -#define DISABLE_REFLECTION_EMIT_SAVE 1 - -/* Disable support for huge assemblies */ -/* #undef DISABLE_LARGE_CODE */ - -/* Disable support debug logging */ -/* #undef DISABLE_LOGGING */ - -/* Disable COM support */ -#define DISABLE_COM 1 - -/* Disable advanced SSA JIT optimizations */ -/* #undef DISABLE_SSA */ - -/* Disable generics support */ -/* #undef DISABLE_GENERICS */ - -/* Disable Shadow Copy for AppDomains */ -/* #undef DISABLE_SHADOW_COPY */ - -/* Disable agent attach support */ -#define DISABLE_ATTACH 1 - -/* Disables the verifier */ -#define DISABLE_VERIFIER 1 - -/* Disable the JIT, only full-aot mode or interpreter will be supported by the - runtime. */ -/* #undef DISABLE_JIT */ - -/* Disable the interpreter. */ -/* #undef DISABLE_INTERPRETER */ - -/* Some VES is available at runtime */ -#define ENABLE_ILGEN 1 - -/* Disable SIMD intrinsics related optimizations. */ -#define DISABLE_SIMD 1 - -/* Disable Soft Debugger Agent. */ -/* #undef DISABLE_DEBUGGER_AGENT */ - -/* Disable Performance Counters. */ -#define DISABLE_PERFCOUNTERS 1 - -/* Disable String normalization support. */ -/* #undef DISABLE_NORMALIZATION */ - -/* Disable desktop assembly loader semantics. */ -#define DISABLE_DESKTOP_LOADER 1 - -/* Disable shared perfcounters. */ -/* #undef DISABLE_SHARED_PERFCOUNTERS */ - -/* Disable support for multiple appdomains. */ -#define DISABLE_APPDOMAINS 1 - -/* Disable remoting support (This disables type proxies and make com - non-functional) */ -#define DISABLE_REMOTING 1 - -/* Disable CAS/CoreCLR security */ -#define DISABLE_SECURITY 1 - -/* Disable support code for the LLDB plugin. */ -/* #undef DISABLE_LLDB */ - -/* Disable support for .mdb symbol files. */ -#define DISABLE_MDB 1 - -/* Disable assertion messages. */ -/* #undef DISABLE_ASSERT_MESSAGES */ - -/* Disable runtime cleanup. */ -#define DISABLE_CLEANUP 1 - -/* Disable concurrent gc support in SGEN. */ -/* #undef DISABLE_SGEN_MAJOR_MARKSWEEP_CONC */ - -/* Disable minor=split support in SGEN. */ -/* #undef DISABLE_SGEN_SPLIT_NURSERY */ - -/* Disable gc bridge support in SGEN. */ -/* #undef DISABLE_SGEN_GC_BRIDGE */ - -/* Disable debug helpers in SGEN. */ -/* #undef DISABLE_SGEN_DEBUG_HELPERS */ - -/* Disable sockets */ -/* #undef DISABLE_SOCKETS */ - -/* Disable GAC */ -#define DISABLE_GAC 1 - -/* Disables use of DllMaps in MonoVM */ -#define DISABLE_DLLMAP 1 - -/* Disable Threads */ -/* #undef DISABLE_THREADS */ - -/* Disable config directories */ -#define DISABLE_CFGDIR_CONFIG 1 - -/* Extension module enabled */ -/* #undef ENABLE_EXTENSION_MODULE */ - -/* GC description */ -/* #undef DEFAULT_GC_NAME */ - -/* No GC support. */ -/* #undef HAVE_NULL_GC */ - -/* Length of zero length arrays */ -#define MONO_ZERO_LEN_ARRAY 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SIGNAL_H 1 - -/* Define to 1 if you have the `sigaction' function. */ -/* #undef HAVE_SIGACTION */ - -/* Define to 1 if you have the `kill' function. */ -/* #undef HAVE_KILL */ - -/* Define to 1 if you have the `signal' function. */ -#define HAVE_SIGNAL 1 - -/* CLOCK_MONOTONIC */ -/* #undef HAVE_CLOCK_MONOTONIC */ - -/* CLOCK_MONOTONIC_COARSE */ -/* #undef HAVE_CLOCK_MONOTONIC_COARSE */ - -/* CLOCK_REALTIME */ -/* #undef HAVE_CLOCK_REALTIME */ - -/* clockid_t */ -/* #undef HAVE_CLOCKID_T */ - -/* mach_absolute_time */ -/* #undef HAVE_MACH_ABSOLUTE_TIME */ - -/* gethrtime */ -/* #undef HAVE_GETHRTIME */ - -/* read_real_time */ -/* #undef HAVE_READ_REAL_TIME */ - -/* mach_timebase_info */ -/* #undef HAVE_MACH_TIMEBASE_INFO */ - -/* Define to 1 if you have the `futimes' function. */ -/* #undef HAVE_FUTIMES */ - -/* Define to 1 if you have the `futimens' function. */ -/* #undef HAVE_FUTIMENS */ - -/* Define to 1 if you have the `clock_nanosleep' function. */ -/* #undef HAVE_CLOCK_NANOSLEEP */ - -/* Does dlsym require leading underscore. */ -/* #undef MONO_DL_NEED_USCORE */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_EXECINFO_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_AUXV_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_RESOURCE_H */ - -/* Define to 1 if you have the `getgrgid_r' function. */ -/* #undef HAVE_GETGRGID_R */ - -/* Define to 1 if you have the `getgrnam_r' function. */ -/* #undef HAVE_GETGRNAM_R */ - -/* Define to 1 if you have the `getresuid' function. */ -/* #undef HAVE_GETRESUID */ - -/* Define to 1 if you have the `setresuid' function. */ -/* #undef HAVE_SETRESUID */ - -/* kqueue */ -/* #undef HAVE_KQUEUE */ - -/* Define to 1 if you have the `backtrace_symbols' function. */ -/* #undef HAVE_BACKTRACE_SYMBOLS */ - -/* Define to 1 if you have the `mkstemp' function. */ -/* #undef HAVE_MKSTEMP */ - -/* Define to 1 if you have the `mmap' function. */ -/* #undef HAVE_MMAP */ - -/* Define to 1 if you have the `madvise' function. */ -/* #undef HAVE_MADVISE */ - -/* Define to 1 if you have the `getrusage' function. */ -/* #undef HAVE_GETRUSAGE */ - -/* Define to 1 if you have the `getpriority' function. */ -/* #undef HAVE_GETPRIORITY */ - -/* Define to 1 if you have the `setpriority' function. */ -/* #undef HAVE_SETPRIORITY */ - -/* Define to 1 if you have the `dl_iterate_phdr' function. */ -/* #undef HAVE_DL_ITERATE_PHDR */ - -/* Define to 1 if you have the `dladdr' function. */ -/* #undef HAVE_DLADDR */ - -/* Define to 1 if you have the `sysconf' function. */ -/* #undef HAVE_SYSCONF */ - -/* Define to 1 if you have the `getrlimit' function. */ -/* #undef HAVE_GETRLIMIT */ - -/* Define to 1 if you have the `prctl' function. */ -/* #undef HAVE_PRCTL */ - -/* Define to 1 if you have the `arc4random' function. */ -/* #undef HAVE_ARC4RANDOM */ - -/* Define to 1 if you have the `nl_langinfo' function. */ -/* #undef HAVE_NL_LANGINFO */ - -/* sched_getaffinity */ -/* #undef HAVE_SCHED_GETAFFINITY */ - -/* sched_setaffinity */ -/* #undef HAVE_SCHED_SETAFFINITY */ - -/* Define to 1 if you have the `sched_getcpu' function. */ -/* #undef HAVE_SCHED_GETCPU */ - -/* Define to 1 if you have the `getpwnam_r' function. */ -/* #undef HAVE_GETPWNAM_R */ - -/* Define to 1 if you have the `getpwuid_r' function. */ -/* #undef HAVE_GETPWUID_R */ - -/* Define to 1 if you have the `readlink' function. */ -/* #undef HAVE_READLINK */ - -/* Define to 1 if you have the `chmod' function. */ -#define HAVE_CHMOD 1 - -/* Define to 1 if you have the `lstat' function. */ -/* #undef HAVE_LSTAT */ - -/* Define to 1 if you have the `getdtablesize' function. */ -/* #undef HAVE_GETDTABLESIZE */ - -/* Define to 1 if you have the `ftruncate' function. */ -/* #undef HAVE_FTRUNCATE */ - -/* Define to 1 if you have the `msync' function. */ -/* #undef HAVE_MSYNC */ - -/* Define to 1 if you have the `gethostname' function. */ -/* #undef HAVE_GETHOSTNAME */ - -/* Define to 1 if you have the `getpeername' function. */ -/* #undef HAVE_GETPEERNAME */ - -/* Define to 1 if you have the `utime' function. */ -#define HAVE_UTIME 1 - -/* Define to 1 if you have the `utimes' function. */ -/* #undef HAVE_UTIMES */ - -/* Define to 1 if you have the `openlog' function. */ -/* #undef HAVE_OPENLOG */ - -/* Define to 1 if you have the `closelog' function. */ -/* #undef HAVE_CLOSELOG */ - -/* Define to 1 if you have the `atexit' function. */ -#define HAVE_ATEXIT 1 - -/* Define to 1 if you have the `popen' function. */ -/* #undef HAVE_POPEN */ - -/* Define to 1 if you have the declaration of `strerror_r', and to 0 if you - don't. */ -/* #undef HAVE_DECL_STRERROR_R */ - -/* Define to 1 if you have the `strerror_r' function. */ -/* #undef HAVE_STRERROR_R */ - -/* Define to 1 if strerror_r returns char *. */ -/* #undef STRERROR_R_CHAR_P */ - -/* Have GLIBC_BEFORE_2_3_4_SCHED_SETAFFINITY */ -/* #undef GLIBC_BEFORE_2_3_4_SCHED_SETAFFINITY */ - -/* GLIBC has CPU_COUNT macro in sched.h */ -/* #undef GLIBC_HAS_CPU_COUNT */ - -/* Have large file support */ -/* #undef HAVE_LARGE_FILE_SUPPORT */ - -/* Have IPPROTO_IP */ -/* #undef HAVE_IPPROTO_IP */ - -/* Have IPPROTO_IPV6 */ -/* #undef HAVE_IPPROTO_IPV6 */ - -/* Have IPPROTO_TCP */ -/* #undef HAVE_IPPROTO_TCP */ - -/* Have SOL_IP */ -/* #undef HAVE_SOL_IP */ - -/* Have SOL_IPV6 */ -/* #undef HAVE_SOL_IPV6 */ - -/* Have SOL_TCP */ -/* #undef HAVE_SOL_TCP */ - -/* Have IP_PKTINFO */ -/* #undef HAVE_IP_PKTINFO */ - -/* Have IPV6_PKTINFO */ -/* #undef HAVE_IPV6_PKTINFO */ - -/* Have IP_DONTFRAG */ -/* #undef HAVE_IP_DONTFRAG */ - -/* Have IP_DONTFRAGMENT */ -/* #undef HAVE_IP_DONTFRAGMENT */ - -/* Have IP_MTU_DISCOVER */ -/* #undef HAVE_IP_MTU_DISCOVER */ - -/* Have IP_PMTUDISC_DO */ -/* #undef HAVE_IP_PMTUDISC_DO */ - -/* Have struct ip_mreqn */ -/* #undef HAVE_STRUCT_IP_MREQN */ - -/* Have struct ip_mreq */ -#define HAVE_STRUCT_IP_MREQ 1 - -/* Have getaddrinfo */ -#define HAVE_GETADDRINFO 1 - -/* Have gethostbyname2_r */ -/* #undef HAVE_GETHOSTBYNAME2_R */ - -/* Have gethostbyname2 */ -/* #undef HAVE_GETHOSTBYNAME2 */ - -/* Have gethostbyname */ -/* #undef HAVE_GETHOSTBYNAME */ - -/* Have getprotobyname */ -#define HAVE_GETPROTOBYNAME 1 - -/* Have getprotobyname_r */ -/* #undef HAVE_GETPROTOBYNAME_R */ - -/* Have getnameinfo */ -#define HAVE_GETNAMEINFO 1 - -/* Have inet_ntop */ -#define HAVE_INET_NTOP 1 - -/* Have inet_pton */ -#define HAVE_INET_PTON 1 - -/* Define to 1 if you have the `inet_aton' function. */ -/* #undef HAVE_INET_ATON */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_PTHREAD_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_PTHREAD_NP_H */ - -/* Define to 1 if you have the `pthread_mutex_timedlock' function. */ -/* #undef HAVE_PTHREAD_MUTEX_TIMEDLOCK */ - -/* Define to 1 if you have the `pthread_getattr_np' function. */ -/* #undef HAVE_PTHREAD_GETATTR_NP */ - -/* Define to 1 if you have the `pthread_attr_get_np' function. */ -/* #undef HAVE_PTHREAD_ATTR_GET_NP */ - -/* Define to 1 if you have the `pthread_getname_np' function. */ -/* #undef HAVE_PTHREAD_GETNAME_NP */ - -/* Define to 1 if you have the `pthread_setname_np' function. */ -/* #undef HAVE_PTHREAD_SETNAME_NP */ - -/* Define to 1 if you have the `pthread_cond_timedwait_relative_np' function. - */ -/* #undef HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE_NP */ - -/* Define to 1 if you have the `pthread_kill' function. */ -/* #undef HAVE_PTHREAD_KILL */ - -/* Define to 1 if you have the `pthread_attr_setstacksize' function. */ -/* #undef HAVE_PTHREAD_ATTR_SETSTACKSIZE */ - -/* Define to 1 if you have the `pthread_attr_getstack' function. */ -/* #undef HAVE_PTHREAD_ATTR_GETSTACK */ - -/* Define to 1 if you have the `pthread_attr_getstacksize' function. */ -/* #undef HAVE_PTHREAD_ATTR_GETSTACKSIZE */ - -/* Define to 1 if you have the `pthread_get_stacksize_np' function. */ -/* #undef HAVE_PTHREAD_GET_STACKSIZE_NP */ - -/* Define to 1 if you have the `pthread_get_stackaddr_np' function. */ -/* #undef HAVE_PTHREAD_GET_STACKADDR_NP */ - -/* Define to 1 if you have the declaration of `pthread_mutexattr_setprotocol', - and to 0 if you don't. */ -/* #undef HAVE_DECL_PTHREAD_MUTEXATTR_SETPROTOCOL */ - -/* Define to 1 if you have the `mincore' function. */ -/* #undef HAVE_MINCORE */ - -/* Define to 1 if you have the `mlock' function. */ -/* #undef HAVE_MLOCK */ - -/* Define to 1 if you have the `munlock' function. */ -/* #undef HAVE_MUNLOCK */ - -/* Have a working sigaltstack */ -/* #undef HAVE_WORKING_SIGALTSTACK */ - -/* Define to 1 if you have the `shm_open' function. */ -/* #undef HAVE_SHM_OPEN */ - -/* Have tm_gmtoff */ -/* #undef HAVE_TM_GMTOFF */ - -/* Have timezone variable */ -/* #undef HAVE_TIMEZONE */ - -/* Define to 1 if you have the `poll' function. */ -/* #undef HAVE_POLL */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_EPOLL_H */ - -/* Define to 1 if you have the `epoll_ctl' function. */ -/* #undef HAVE_EPOLL_CTL */ - -/* epoll_create1 */ -/* #undef HAVE_EPOLL */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_EVENT_H */ - -/* Use kqueue for the threadpool */ -/* #undef USE_KQUEUE_FOR_THREADPOOL */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_IOCTL_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_NET_IF_H */ - -/* Can get interface list */ -/* #undef HAVE_SIOCGIFCONF */ - -/* sockaddr_in has sin_len */ -/* #undef HAVE_SOCKADDR_IN_SIN_LEN */ - -/* sockaddr_in6 has sin6_len */ -/* #undef HAVE_SOCKADDR_IN6_SIN_LEN */ - -/* Have getifaddrs */ -/* #undef HAVE_GETIFADDRS */ - -/* Have if_nametoindex */ -/* #undef HAVE_IF_NAMETOINDEX */ - -/* Have access */ -#define HAVE_ACCESS 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_ERRNO_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_CHECKLIST_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_PATHCONF_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_FSTAB_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_ATTR_XATTR_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_EXTATTR_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_SENDFILE_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_STATVFS_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_STATFS_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_VFSTAB_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_XATTR_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_MMAN_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_MOUNT_H */ - -/* Define to 1 if you have the `confstr' function. */ -/* #undef HAVE_CONFSTR */ - -/* Define to 1 if you have the `seekdir' function. */ -/* #undef HAVE_SEEKDIR */ - -/* Define to 1 if you have the `telldir' function. */ -/* #undef HAVE_TELLDIR */ - -/* Define to 1 if you have the `getdomainname' function. */ -/* #undef HAVE_GETDOMAINNAME */ - -/* Define to 1 if you have the `setdomainname' function. */ -/* #undef HAVE_SETDOMAINNAME */ - -/* Define to 1 if you have the `endgrent' function. */ -/* #undef HAVE_ENDGRENT */ - -/* Define to 1 if you have the `getgrent' function. */ -/* #undef HAVE_GETGRENT */ - -/* Define to 1 if you have the `fgetgrent' function. */ -/* #undef HAVE_FGETGRENT */ - -/* Define to 1 if you have the `setgrent' function. */ -/* #undef HAVE_SETGRENT */ - -/* Define to 1 if you have the `setgroups' function. */ -/* #undef HAVE_SETGROUPS */ - -/* Define to 1 if you have the `endpwent' function. */ -/* #undef HAVE_ENDPWENT */ - -/* Define to 1 if you have the `getpwent' function. */ -/* #undef HAVE_GETPWENT */ - -/* Define to 1 if you have the `fgetpwent' function. */ -/* #undef HAVE_FGETPWENT */ - -/* Define to 1 if you have the `setpwent' function. */ -/* #undef HAVE_SETPWENT */ - -/* Define to 1 if you have the `getfsstat' function. */ -/* #undef HAVE_GETFSSTAT */ - -/* Define to 1 if you have the `lutimes' function. */ -/* #undef HAVE_LUTIMES */ - -/* Define to 1 if you have the `mremap' function. */ -/* #undef HAVE_MREMAP */ - -/* Define to 1 if you have the `remap_file_pages' function. */ -/* #undef HAVE_REMAP_FILE_PAGES */ - -/* Define to 1 if you have the `posix_fadvise' function. */ -/* #undef HAVE_POSIX_FADVISE */ - -/* Define to 1 if you have the `posix_fallocate' function. */ -/* #undef HAVE_POSIX_FALLOCATE */ - -/* Define to 1 if you have the `posix_madvise' function. */ -/* #undef HAVE_POSIX_MADVISE */ - -/* Define to 1 if you have the `vsnprintf' function. */ -/* #undef HAVE_VSNPRINTF */ - -/* Define to 1 if you have the `sendfile' function. */ -/* #undef HAVE_SENDFILE */ - -/* Define to 1 if you have the `gethostid' function. */ -/* #undef HAVE_GETHOSTID */ - -/* Define to 1 if you have the `sethostid' function. */ -/* #undef HAVE_SETHOSTID */ - -/* Define to 1 if you have the `sethostname' function. */ -/* #undef HAVE_SETHOSTNAME */ - -/* struct statfs */ -/* #undef HAVE_STATFS */ - -/* Define to 1 if you have the `fstatfs' function. */ -/* #undef HAVE_FSTATFS */ - -/* Define to 1 if you have the `statvfs' function. */ -/* #undef HAVE_STATVFS */ - -/* Define to 1 if you have the `fstatvfs' function. */ -/* #undef HAVE_FSTATVFS */ - -/* Define to 1 if you have the `stime' function. */ -/* #undef HAVE_STIME */ - -/* Define to 1 if you have the `ttyname_r' function. */ -/* #undef HAVE_TTYNAME_R */ - -/* Define to 1 if you have the `psignal' function. */ -/* #undef HAVE_PSIGNAL */ - -/* Define to 1 if you have the `getlogin_r' function. */ -/* #undef HAVE_GETLOGIN_R */ - -/* Define to 1 if you have the `lockf' function. */ -/* #undef HAVE_LOCKF */ - -/* Define to 1 if you have the `swab' function. */ -/* #undef HAVE_SWAB */ - -/* Define to 1 if you have the `setusershell' function. */ -/* #undef HAVE_SETUSERSHELL */ - -/* Define to 1 if you have the `endusershell' function. */ -/* #undef HAVE_ENDUSERSHELL */ - -/* Define to 1 if you have the `utimensat' function. */ -/* #undef HAVE_UTIMENSAT */ - -/* Define to 1 if you have the `fstatat' function. */ -/* #undef HAVE_FSTATAT */ - -/* Define to 1 if you have the `mknodat' function. */ -/* #undef HAVE_MKNODAT */ - -/* Define to 1 if you have the `readlinkat' function. */ -/* #undef HAVE_READLINKAT */ - -/* Define to 1 if you have the `readv' function. */ -/* #undef HAVE_READV */ - -/* Define to 1 if you have the `writev' function. */ -/* #undef HAVE_WRITEV */ - -/* Define to 1 if you have the `preadv' function. */ -/* #undef HAVE_PREADV */ - -/* Define to 1 if you have the `pwritev' function. */ -/* #undef HAVE_PWRITEV */ - -/* Define to 1 if you have the `setpgid' function. */ -/* #undef HAVE_SETPGID */ - -/* Define to 1 if you have the `system' function. */ -#ifdef _MSC_VER -#if HAVE_WINAPI_FAMILY_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) -#define HAVE_SYSTEM 1 -#endif -#else -#define HAVE_SYSTEM 1 -#endif - -/* Define to 1 if you have the `fork' function. */ -/* #undef HAVE_FORK */ - -/* Define to 1 if you have the `execv' function. */ -#define HAVE_EXECV 1 - -/* Define to 1 if you have the `execve' function. */ -#define HAVE_EXECVE 1 - -/* Define to 1 if you have the `waitpid' function. */ -/* #undef HAVE_WAITPID */ - -/* accept4 */ -/* #undef HAVE_ACCEPT4 */ - -/* Define to 1 if you have the `localtime_r' function. */ -/* #undef HAVE_LOCALTIME_R */ - -/* Define to 1 if you have the `mkdtemp' function. */ -/* #undef HAVE_MKDTEMP */ - -/* The size of `size_t', as computed by sizeof. */ -#define SIZEOF_SIZE_T 8 - -/* Define to 1 if the system has the type `blksize_t'. */ -/* #undef HAVE_BLKSIZE_T */ - -/* Define to 1 if the system has the type `blkcnt_t'. */ -/* #undef HAVE_BLKCNT_T */ - -/* Define to 1 if the system has the type `suseconds_t'. */ -/* #undef HAVE_SUSECONDS_T */ - -/* Define to 1 if the system has the type `struct cmsghdr'. */ -/* #undef HAVE_STRUCT_CMSGHDR */ - -/* Define to 1 if the system has the type `struct flock'. */ -/* #undef HAVE_STRUCT_FLOCK */ - -/* Define to 1 if the system has the type `struct iovec'. */ -/* #undef HAVE_STRUCT_IOVEC */ - -/* Define to 1 if the system has the type `struct linger'. */ -/* #undef HAVE_STRUCT_LINGER */ - -/* Define to 1 if the system has the type `struct pollfd'. */ -/* #undef HAVE_STRUCT_POLLFD */ - -/* Define to 1 if the system has the type `struct sockaddr'. */ -/* #undef HAVE_STRUCT_SOCKADDR */ - -/* Define to 1 if the system has the type `struct sockaddr_storage'. */ -/* #undef HAVE_STRUCT_SOCKADDR_STORAGE */ - -/* Define to 1 if the system has the type `struct sockaddr_in'. */ -/* #undef HAVE_STRUCT_SOCKADDR_IN */ - -/* Define to 1 if the system has the type `struct sockaddr_in6'. */ -#define HAVE_STRUCT_SOCKADDR_IN6 1 - -/* Define to 1 if the system has the type `struct sockaddr_un'. */ -/* #undef HAVE_STRUCT_SOCKADDR_UN */ - -/* Define to 1 if the system has the type `struct stat'. */ -/* #undef HAVE_STRUCT_STAT */ - -/* Define to 1 if the system has the type `struct timespec'. */ -/* #undef HAVE_STRUCT_TIMESPEC */ - -/* Define to 1 if the system has the type `struct timeval'. */ -/* #undef HAVE_STRUCT_TIMEVAL */ - -/* Define to 1 if the system has the type `struct timezone'. */ -/* #undef HAVE_STRUCT_TIMEZONE */ - -/* Define to 1 if the system has the type `struct utimbuf'. */ -/* #undef HAVE_STRUCT_UTIMBUF */ - -/* Define to 1 if `d_off' is a member of `struct dirent'. */ -/* #undef HAVE_STRUCT_DIRENT_D_OFF */ - -/* Define to 1 if `d_reclen' is a member of `struct dirent'. */ -/* #undef HAVE_STRUCT_DIRENT_D_RECLEN */ - -/* Define to 1 if `d_type' is a member of `struct dirent'. */ -/* #undef HAVE_STRUCT_DIRENT_D_TYPE */ - -/* Define to 1 if `pw_gecos' is a member of `struct passwd'. */ -/* #undef HAVE_STRUCT_PASSWD_PW_GECOS */ - -/* Define to 1 if `f_flags' is a member of `struct statfs'. */ -/* #undef HAVE_STRUCT_STATFS_F_FLAGS */ - -/* Define to 1 if `st_atim' is a member of `struct stat'. */ -/* #undef HAVE_STRUCT_STAT_ST_ATIM */ - -/* Define to 1 if `st_mtim' is a member of `struct stat'. */ -/* #undef HAVE_STRUCT_STAT_ST_MTIM */ - -/* Define to 1 if `st_atimespec' is a member of `struct stat'. */ -/* #undef HAVE_STRUCT_STAT_ST_ATIMESPEC */ - -/* Define to 1 if `st_ctim' is a member of `struct stat'. */ -/* #undef HAVE_STRUCT_STAT_ST_CTIM */ - -/* Define to 1 if `kp_proc' is a member of `struct kinfo_proc'. */ -/* #undef HAVE_STRUCT_KINFO_PROC_KP_PROC */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_TIME_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_DIRENT_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_COMMONCRYPTO_COMMONDIGEST_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_CURSES_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_TERM_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_TERMIOS_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_RANDOM_H */ - -/* Define to 1 if you have the `getrandom' function. */ -/* #undef HAVE_GETRANDOM */ - -/* Define to 1 if you have the `getentropy' function. */ -/* #undef HAVE_GETENTROPY */ - -/* linux/in.h */ -/* #undef HAVE_LINUX_IN_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_LINUX_IF_PACKET_H */ - -/* struct in_pktinfo */ -/* #undef HAVE_IN_PKTINFO */ - -/* struct ip_mreqn */ -/* #undef HAVE_IP_MREQN */ - -/* Define to 1 if the system has the type `struct flock64'. */ -/* #undef HAVE_STRUCT_FLOCK64 */ - -/* struct flock64 */ -/* #undef HAVE_FLOCK64 */ - -/* O_CLOEXEC */ -/* #undef HAVE_O_CLOEXEC */ - -/* F_DUPFD_CLOEXEC */ -/* #undef HAVE_F_DUPFD_CLOEXEC */ - -/* Qp2getifaddrs */ -/* #undef HAVE_QP2GETIFADDRS */ - -/* lseek64 */ -/* #undef HAVE_LSEEK64 */ - -/* mmap64 */ -/* #undef HAVE_MMAP64 */ - -/* ftruncate64 */ -/* #undef HAVE_FTRUNCATE64 */ - -/* posix_fadvise64 */ -/* #undef HAVE_POSIX_FADVISE64 */ - -/* stat64 */ -/* #undef HAVE_STAT64 */ - -/* pipe2 */ -/* #undef HAVE_PIPE2 */ - -/* getmntinfo */ -/* #undef HAVE_GETMNTINFO */ - -/* strcpy_s */ -/* #undef HAVE_STRCPY_S */ - -/* Define to 1 if you have the `strlcpy' function. */ -/* #undef HAVE_STRLCPY */ - -/* posix_fadvise */ -/* #undef HAVE_POSIX_ADVISE */ - -/* ioctl */ -/* #undef HAVE_IOCTL */ - -/* arc4random_buf */ -/* #undef HAVE_ARC4RANDOM_BUF */ - -/* TIOCGWINSZ */ -/* #undef HAVE_TIOCGWINSZ */ - -/* tcgetattr */ -/* #undef HAVE_TCGETATTR */ - -/* tcsetattr */ -/* #undef HAVE_TCSETATTR */ - -/* ECHO */ -/* #undef HAVE_ECHO */ - -/* ICANON */ -/* #undef HAVE_ICANON */ - -/* TCSANOW */ -/* #undef HAVE_TCSANOW */ - -/* lchflags */ -/* #undef HAVE_LCHFLAGS */ - -/* struct stat.st_flags */ -/* #undef HAVE_STAT_FLAGS */ - -/* struct stat.st_birthtimespec */ -/* #undef HAVE_STAT_BIRTHTIME */ - -/* struct stat.st_atimespec */ -/* #undef HAVE_STAT_TIMESPEC */ - -/* struct stat.st_atim */ -/* #undef HAVE_STAT_TIM */ - -/* struct stat.st_atimensec */ -/* #undef HAVE_STAT_NSEC */ - -/* struct dirent.d_namlen */ -/* #undef HAVE_DIRENT_NAME_LEN */ - -/* struct statfs.f_fstypename */ -/* #undef HAVE_STATFS_FSTYPENAME */ - -/* struct statvfs.f_fstypename */ -/* #undef HAVE_STATVFS_FSTYPENAME */ - -/* char* strerror(int errnum, char *buf, size_t buflen) */ -/* #undef HAVE_GNU_STRERROR_R */ - -/* readdir_r */ -/* #undef HAVE_READDIR_R */ - -/* kevent with void *data */ -/* #undef KEVENT_HAS_VOID_UDATA */ - -/* struct fd_set.fds_bits */ -/* #undef HAVE_FDS_BITS */ - -/* struct fd_set.__fds_bits */ -/* #undef HAVE_PRIVATE_FDS_BITS */ - -/* sendfile with 4 arguments */ -/* #undef HAVE_SENDFILE_4 */ - -/* sendfile with 6 arguments */ -/* #undef HAVE_SENDFILE_6 */ - -/* fcopyfile */ -/* #undef HAVE_FCOPYFILE */ - -/* getnameinfo with signed flags */ -/* #undef HAVE_GETNAMEINFO_SIGNED_FLAGS */ - -/* HAVE_SUPPORT_FOR_DUAL_MODE_IPV4_PACKET_INFO */ -/* #undef HAVE_SUPPORT_FOR_DUAL_MODE_IPV4_PACKET_INFO */ - -/* bind with unsigned addrlen */ -/* #undef BIND_ADDRLEN_UNSIGNED */ - -/* struct ipv6_mreq with unsigned ipv6mr_interface */ -/* #undef IPV6MR_INTERFACE_UNSIGNED */ - -/* inotify_rm_watch with unsigned wd */ -/* #undef INOTIFY_RM_WATCH_WD_UNSIGNED */ - -/* getpriority with int who */ -/* #undef PRIORITY_REQUIRES_INT_WHO */ - -/* kevent with int parameters */ -/* #undef KEVENT_REQUIRES_INT_PARAMS */ - -/* Define to 1 if you have the `mkstemps' function. */ -/* #undef HAVE_MKSTEMPS */ - -/* tcp/var.h */ -/* #undef HAVE_TCP_VAR_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_CDEFS_H */ - -/* TCPSTATE enum in netinet/tcp.h */ -/* #undef HAVE_TCP_H_TCPSTATE_ENUM */ - -/* HAVE_TCP_FSM_H */ -/* #undef HAVE_TCP_FSM_H */ - -/* struct rt_msghdr */ -/* #undef HAVE_RT_MSGHDR */ - -/* getpeereid */ -/* #undef HAVE_GETPEEREID */ - -/* uname */ -/* #undef HAVE_UNAME */ - -/* getdomainname with size_t namelen */ -/* #undef HAVE_GETDOMAINNAME_SIZET */ - -/* inotify_init */ -/* #undef HAVE_INOTIFY_INIT */ - -/* inotify_add_watch */ -/* #undef HAVE_INOTIFY_ADD_WATCH */ - -/* inotify_rm_watch */ -/* #undef HAVE_INOTIFY_RM_WATCH */ - -/* HAVE_INOTIFY */ -/* #undef HAVE_INOTIFY */ - -/* GSS/GSS.h */ -/* #undef HAVE_GSSFW_HEADERS */ - -/* GSS_SPNEGO_MECHANISM */ -/* #undef HAVE_GSS_SPNEGO_MECHANISM */ - -/* ENABLE_GSS */ -/* #undef ENABLE_GSS */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_CRT_EXTERNS_H */ - -/* _NSGetEnviron */ -/* #undef HAVE_NSGETENVIRON */ - -/* IN_EXCL_UNLINK */ -/* #undef HAVE_IN_EXCL_UNLINK */ - -/* Define to 1 if you have the header file. */ -#define HAVE_WINTERNL_H 1 - -/* Have socklen_t */ -/* #undef HAVE_SOCKLEN_T */ - -/* Define to 1 if you have the `execvp' function. */ -/* #undef HAVE_EXECVP */ - -/* Name of /dev/random */ -#define NAME_DEV_RANDOM "" - -/* Have /dev/random */ -#define HAVE_CRYPT_RNG 1 - -/* Enable the allocation and indexing of arrays greater than Int32.MaxValue */ -/* #undef MONO_BIG_ARRAYS */ - -/* Enable DTrace probes */ -/* #undef ENABLE_DTRACE */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_SDT_H */ - -/* AOT cross offsets file */ -/* #undef MONO_OFFSETS_FILE */ - -/* Enable the LLVM back end */ -/* #undef ENABLE_LLVM */ - -/* Enable the LLVM back end */ -/* #undef ENABLE_LLVM_MSVC_ONLY */ - -/* LLVM used is being build during mono build */ -/* #undef INTERNAL_LLVM */ - -/* LLVM used is being build during mono build */ -/* #undef INTERNAL_LLVM_MSVC_ONLY */ - -/* Build LLVM with assertions */ -/* #undef INTERNAL_LLVM_ASSERTS */ - -/* Build LLVM with assertions */ -/* #undef INTERNAL_LLVM_ASSERTS_MSVC_ONLY */ - -/* The LLVM back end is dynamically loaded */ -/* #undef MONO_LLVM_LOADED */ - -/* Runtime support code for llvm enabled */ -/* #undef ENABLE_LLVM_RUNTIME */ - -/* Runtime support code for llvm enabled */ -/* #undef ENABLE_LLVM_RUNTIME_MSVC_ONLY */ - -/* 64 bit mode with 4 byte longs and pointers */ -/* #undef MONO_ARCH_ILP32 */ - -/* The runtime is compiled for cross-compiling mode */ -/* #undef MONO_CROSS_COMPILE */ - -/* ... */ -/* #undef TARGET_WASM */ - -/* The JIT/AOT targets WatchOS */ -/* #undef TARGET_WATCHOS */ - -/* ... */ -/* #undef TARGET_PS3 */ - -/* ... */ -/* #undef __mono_ppc64__ */ - -/* ... */ -/* #undef TARGET_XBOX360 */ - -/* ... */ -/* #undef TARGET_PS4 */ - -/* ... */ -/* #undef DISABLE_HW_TRAPS */ - -/* Target is RISC-V */ -/* #undef TARGET_RISCV */ - -/* Target is 32-bit RISC-V */ -/* #undef TARGET_RISCV32 */ - -/* Target is 64-bit RISC-V */ -/* #undef TARGET_RISCV64 */ - -/* ... */ -/* #undef TARGET_X86 */ - -/* ... */ -#define TARGET_AMD64 1 - -/* ... */ -/* #undef TARGET_ARM */ - -/* ... */ -/* #undef TARGET_ARM64 */ - -/* ... */ -/* #undef TARGET_POWERPC */ - -/* ... */ -/* #undef TARGET_POWERPC64 */ - -/* ... */ -/* #undef TARGET_S390X */ - -/* ... */ -/* #undef TARGET_MIPS */ - -/* ... */ -/* #undef TARGET_SPARC */ - -/* ... */ -/* #undef TARGET_SPARC64 */ - -/* ... */ -/* #undef HOST_WASM */ - -/* ... */ -/* #undef HOST_X86 */ - -/* ... */ -#define HOST_AMD64 1 - -/* ... */ -/* #undef HOST_ARM */ - -/* ... */ -/* #undef HOST_ARM64 */ - -/* ... */ -/* #undef HOST_POWERPC */ - -/* ... */ -/* #undef HOST_POWERPC64 */ - -/* ... */ -/* #undef HOST_S390X */ - -/* ... */ -/* #undef HOST_MIPS */ - -/* ... */ -/* #undef HOST_SPARC */ - -/* ... */ -/* #undef HOST_SPARC64 */ - -/* Host is RISC-V */ -/* #undef HOST_RISCV */ - -/* Host is 32-bit RISC-V */ -/* #undef HOST_RISCV32 */ - -/* Host is 64-bit RISC-V */ -/* #undef HOST_RISCV64 */ - -/* ... */ -/* #undef USE_GCC_ATOMIC_OPS */ - -/* The JIT/AOT targets iOS */ -/* #undef TARGET_IOS */ - -/* The JIT/AOT targets OSX */ -/* #undef TARGET_OSX */ - -/* The JIT/AOT targets Apple platforms */ -/* #undef TARGET_MACH */ - -/* byte order of target */ -#define TARGET_BYTE_ORDER G_LITTLE_ENDIAN - -/* wordsize of target */ -#define TARGET_SIZEOF_VOID_P 8 - -/* size of target machine integer registers */ -#define SIZEOF_REGISTER 8 - -/* Support for the visibility ("hidden") attribute */ -/* #undef HAVE_VISIBILITY_HIDDEN */ - -/* Support for the deprecated attribute */ -/* #undef HAVE_DEPRECATED */ - -/* Moving collector */ -#define HAVE_MOVING_COLLECTOR 1 - -/* Defaults to concurrent GC */ -#define HAVE_CONC_GC_AS_DEFAULT 1 - -/* Define to 1 if you have the `stpcpy' function. */ -/* #undef HAVE_STPCPY */ - -/* Define to 1 if you have the `strtok_r' function. */ -#define HAVE_STRTOK_R 1 - -/* Define to 1 if you have the `rewinddir' function. */ -/* #undef HAVE_REWINDDIR */ - -/* Define to 1 if you have the `vasprintf' function. */ -/* #undef HAVE_VASPRINTF */ - -/* Overridable allocator support enabled */ -/* #undef ENABLE_OVERRIDABLE_ALLOCATORS */ - -/* Define to 1 if you have the `strndup' function. */ -/* #undef HAVE_STRNDUP */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_GETOPT_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_ICONV_H */ - -/* Define to 1 if you have the `iconv' library (-liconv). */ -/* #undef HAVE_LIBICONV */ - -/* Icall symbol map enabled */ -/* #undef ENABLE_ICALL_SYMBOL_MAP */ - -/* Icall export enabled */ -/* #undef ENABLE_ICALL_EXPORT */ - -/* Icall tables disabled */ -/* #undef DISABLE_ICALL_TABLES */ - -/* QCalls disabled */ -/* #undef DISABLE_QCALLS */ - -/* Have __thread keyword */ -#define MONO_KEYWORD_THREAD __declspec (thread) - -/* tls_model available */ -/* #undef HAVE_TLS_MODEL_ATTR */ - -/* ARM v5 */ -/* #undef HAVE_ARMV5 */ - -/* ARM v6 */ -/* #undef HAVE_ARMV6 */ - -/* ARM v7 */ -/* #undef HAVE_ARMV7 */ - -/* RISC-V FPABI is double-precision */ -/* #undef RISCV_FPABI_DOUBLE */ - -/* RISC-V FPABI is single-precision */ -/* #undef RISCV_FPABI_SINGLE */ - -/* RISC-V FPABI is soft float */ -/* #undef RISCV_FPABI_SOFT */ - -/* Use malloc for each single mempool allocation */ -/* #undef USE_MALLOC_FOR_MEMPOOLS */ - -/* Enable lazy gc thread creation by the embedding host. */ -/* #undef LAZY_GC_THREAD_CREATION */ - -/* Enable cooperative stop-the-world garbage collection. */ -/* #undef ENABLE_COOP_SUSPEND */ - -/* Enable hybrid suspend for GC stop-the-world */ -/* #undef ENABLE_HYBRID_SUSPEND */ - -/* Enable feature experiments */ -/* #undef ENABLE_EXPERIMENTS */ - -/* Enable experiment 'null' */ -/* #undef ENABLE_EXPERIMENT_null */ - -/* Enable experiment 'Tiered Compilation' */ -/* #undef ENABLE_EXPERIMENT_TIERED */ - -/* Enable checked build */ -#define ENABLE_CHECKED_BUILD 1 - -/* Enable GC checked build */ -/* #undef ENABLE_CHECKED_BUILD_GC */ - -/* Enable metadata checked build */ -/* #undef ENABLE_CHECKED_BUILD_METADATA */ - -/* Enable thread checked build */ -/* #undef ENABLE_CHECKED_BUILD_THREAD */ - -/* Enable private types checked build */ -#define ENABLE_CHECKED_BUILD_PRIVATE_TYPES 1 - -/* Enable private types checked build */ -/* #undef ENABLE_CHECKED_BUILD_CRASH_REPORTING */ - -/* Enable EventPipe library support */ -#define ENABLE_PERFTRACING 1 - -/* Define to 1 if you have /usr/include/malloc.h. */ -/* #undef HAVE_USR_INCLUDE_MALLOC_H */ - -/* BoringTls is supported */ -/* #undef HAVE_BTLS */ - -/* The architecture this is running on */ -#define MONO_ARCHITECTURE "amd64" - -/* Disable banned functions from being used by the runtime */ -#define MONO_INSIDE_RUNTIME 1 - -/* Version number of package */ -#define VERSION "...0" - -/* Full version number of package */ -#define FULL_VERSION - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_DLFCN_H */ - -/* Disable crash reporting subsystem */ -#define DISABLE_CRASH_REPORTING 1 - -/* Enable lazy gc thread creation by the embedding host */ -/* #undef LAZY_GC_THREAD_CREATION */ - -/* Enable additional checks */ -#define ENABLE_CHECKED_BUILD 1 - -/* Enable compile time checking that getter functions are used */ -#define ENABLE_CHECKED_BUILD_PRIVATE_TYPES 1 - -/* Enable runtime GC Safe / Unsafe mode assertion checks (must set env var MONO_CHECK_MODE=gc) */ -/* #undef ENABLE_CHECKED_BUILD_GC */ - -/* Enable runtime history of per-thread coop state transitions (must set env var MONO_CHECK_MODE=thread) */ -/* #undef ENABLE_CHECKED_BUILD_THREAD */ - -/* Enable runtime checks of mempool references between metadata images (must set env var MONO_CHECK_MODE=metadata) */ -/* #undef ENABLE_CHECKED_BUILD_METADATA */ - -#if defined(ENABLE_LLVM) && defined(HOST_WIN32) && defined(TARGET_WIN32) && (!defined(TARGET_AMD64) || !defined(_MSC_VER)) -#error LLVM for host=Windows and target=Windows is only supported on x64 MSVC build. -#endif - -#endif diff --git a/src/mono/out/build/x64-Debug (default)/mono/eglib/eglib-config.h b/src/mono/out/build/x64-Debug (default)/mono/eglib/eglib-config.h deleted file mode 100644 index 02d54c99eae01..0000000000000 --- a/src/mono/out/build/x64-Debug (default)/mono/eglib/eglib-config.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef __EGLIB_CONFIG_H -#define __EGLIB_CONFIG_H - -/* - * System-dependent settings - */ -#define G_GNUC_PRETTY_FUNCTION -#define G_GNUC_UNUSED -#define G_BYTE_ORDER G_LITTLE_ENDIAN -#define G_GNUC_NORETURN -#define G_SEARCHPATH_SEPARATOR_S ";" -#define G_SEARCHPATH_SEPARATOR ';' -#define G_DIR_SEPARATOR '\' -#define G_DIR_SEPARATOR_S "\" -#define G_BREAKPOINT() G_STMT_START { raise(SIGTRAP); } G_STMT_END -#define G_OS_WIN32 - -#if == 1 -#define G_HAVE_ALLOCA_H -#endif - -#if == 1 -#define G_HAVE_UNISTD_H -#endif - -typedef size_t gsize; -typedef ptrdiff_t gssize; - -#define G_GSIZE_FORMAT "lu" - -#if defined (HOST_WATCHOS) -#undef G_BREAKPOINT -#define G_BREAKPOINT() -#endif - -#if defined (HOST_WASM) -#undef G_BREAKPOINT -#define G_BREAKPOINT() do { printf ("MONO: BREAKPOINT\n"); abort (); } while (0) -#endif - -typedef void * GPid; - -#endif From e91c55bdc514bc3901f0ad46d64d95ea092de933 Mon Sep 17 00:00:00 2001 From: Rattenkrieg Date: Sat, 12 Dec 2020 23:12:09 +0300 Subject: [PATCH 25/29] 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, From d3020578961dfeec304803d817cd2a29db39c41d Mon Sep 17 00:00:00 2001 From: Rattenkrieg Date: Sat, 12 Dec 2020 23:51:32 +0300 Subject: [PATCH 26/29] fix rebase artifacts --- .../superpmi-shared/icorjitinfoimpl.h | 4 +- .../superpmi-shared/methodcontext.cpp | 6 +- .../superpmi-shared/spmidumphelper.cpp | 18 --- .../superpmi/superpmi-shared/spmidumphelper.h | 4 - .../superpmi-shared/spmirecordhelper.h | 64 -------- .../superpmi-shim-collector/icorjitinfo.cpp | 4 +- .../superpmi-shim-counter/icorjitinfo.cpp | 6 +- .../superpmi-shim-simple/icorjitinfo.cpp | 6 +- .../ToolBox/superpmi/superpmi/icorjitinfo.cpp | 2 +- src/coreclr/inc/corinfo.h | 24 +-- src/coreclr/jit/ICorJitInfo_API_names.h | 2 +- src/coreclr/jit/ICorJitInfo_API_wrapper.hpp | 7 +- src/coreclr/jit/compiler.cpp | 6 +- src/coreclr/jit/compiler.h | 4 - .../tools/Common/JitInterface/CorInfoBase.cs | 6 +- .../tools/Common/JitInterface/CorInfoImpl.cs | 56 ++----- .../tools/Common/JitInterface/CorInfoTypes.cs | 10 +- .../ThunkGenerator/ThunkInput.txt | 10 +- .../tools/aot/jitinterface/jitinterface.h | 143 +++++++++--------- src/coreclr/vm/jitinterface.cpp | 82 +++++----- src/coreclr/vm/jitinterface.h | 30 ++-- src/coreclr/zap/zapinfo.cpp | 78 ++++------ src/coreclr/zap/zapinfo.h | 14 +- 23 files changed, 231 insertions(+), 355 deletions(-) diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shared/icorjitinfoimpl.h b/src/coreclr/ToolBox/superpmi/superpmi-shared/icorjitinfoimpl.h index 7763f2181b6bb..9693846a6f3b9 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/src/tools/Common/JitInterface/ThunkGenerator +// To regenerate run the gen script in src/coreclr/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); -void notifyInstructionSetUsage( +bool notifyInstructionSetUsage( CORINFO_InstructionSet instructionSet, bool supportEnabled); diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.cpp b/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.cpp index 8aa81d1087cc4..31cad0f6f52c8 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; @@ -3409,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 = diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shared/spmidumphelper.cpp b/src/coreclr/ToolBox/superpmi/superpmi-shared/spmidumphelper.cpp index 50ce656b02eba..2d7e8b5cb524f 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi-shared/spmidumphelper.cpp +++ b/src/coreclr/ToolBox/superpmi/superpmi-shared/spmidumphelper.cpp @@ -38,24 +38,6 @@ std::string SpmiDumpHelper::DumpAgnostic_CORINFO_RESOLVED_TOKEN( DumpAgnostic_CORINFO_RESOLVED_TOKENout(token.outValue); } -std::string SpmiDumpHelper::DumpAgnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTin( - const MethodContext::Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTin& contextIn) -{ - char buffer[MAX_BUFFER_SIZE]; - sprintf_s(buffer, MAX_BUFFER_SIZE, "cls-%016llX vmeth-%016llX ownrcls-%016llX", contextIn.implementingClass, - contextIn.virtualMethod, contextIn.ownerType); - return std::string(buffer); -} - -std::string SpmiDumpHelper::DumpAgnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTout( - const MethodContext::Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTout& contextOut) -{ - char buffer[MAX_BUFFER_SIZE]; - sprintf_s(buffer, MAX_BUFFER_SIZE, "meth-%016llX needarg-%08X ownrcls-%016llX", contextOut.devirtualizedMethod, - contextOut.requiresInstMethodTableArg, contextOut.patchedOwnerType); - return std::string(buffer); -} - std::string SpmiDumpHelper::DumpAgnostic_CORINFO_LOOKUP_KIND( const MethodContext::Agnostic_CORINFO_LOOKUP_KIND& lookupKind) { diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shared/spmidumphelper.h b/src/coreclr/ToolBox/superpmi/superpmi-shared/spmidumphelper.h index 64098d59cabc8..84349c0ee0b83 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi-shared/spmidumphelper.h +++ b/src/coreclr/ToolBox/superpmi/superpmi-shared/spmidumphelper.h @@ -20,10 +20,6 @@ class SpmiDumpHelper static std::string DumpAgnostic_CORINFO_RESOLVED_TOKENout( const MethodContext::Agnostic_CORINFO_RESOLVED_TOKENout& tokenOut); static std::string DumpAgnostic_CORINFO_RESOLVED_TOKEN(const MethodContext::Agnostic_CORINFO_RESOLVED_TOKEN& token); - static std::string DumpAgnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTin( - const MethodContext::Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTin& contextIn); - static std::string DumpAgnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTout( - const MethodContext::Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTout& contextOut); static std::string DumpAgnostic_CORINFO_LOOKUP_KIND(const MethodContext::Agnostic_CORINFO_LOOKUP_KIND& lookupKind); static std::string DumpAgnostic_CORINFO_CONST_LOOKUP( const MethodContext::Agnostic_CORINFO_CONST_LOOKUP& constLookup); diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shared/spmirecordhelper.h b/src/coreclr/ToolBox/superpmi/superpmi-shared/spmirecordhelper.h index 1e500fe948ed9..54980ed34e40a 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi-shared/spmirecordhelper.h +++ b/src/coreclr/ToolBox/superpmi/superpmi-shared/spmirecordhelper.h @@ -43,24 +43,6 @@ class SpmiRecordsHelper MethodContext::Agnostic_CORINFO_RESOLVED_TOKENout& token, LightWeightMap* buffers); - static MethodContext::Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTin - CreateAgnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTin(CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT* pResolvedMethod); - - static MethodContext::Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTout - CreateAgnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTout_without_buffers( - CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT* pResolvedMethod); - - template - static MethodContext::Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTout - StoreAgnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTout( - CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT* pResolvedMethod, LightWeightMap* buffers); - - template - static void Restore_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTout( - CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT* pResolvedMethod, - MethodContext::Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTout& contextOut, - LightWeightMap* buffers); - static MethodContext::Agnostic_CORINFO_SIG_INFO CreateAgnostic_CORINFO_SIG_INFO_without_buffers( CORINFO_SIG_INFO& sigInfo); @@ -190,52 +172,6 @@ inline void SpmiRecordsHelper::Restore_CORINFO_RESOLVED_TOKENout( pResolvedToken->cbMethodSpec = (ULONG)tokenOut.cbMethodSpec; } -inline MethodContext::Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTin SpmiRecordsHelper:: - CreateAgnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTin(CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT* pResolvedMethod) -{ - MethodContext::Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTin contextIn; - ZeroMemory(&contextIn, sizeof(contextIn)); - contextIn.virtualMethod = (DWORDLONG)pResolvedMethod->virtualMethod; - contextIn.implementingClass = (DWORDLONG)pResolvedMethod->implementingClass; - contextIn.ownerType = (DWORDLONG)pResolvedMethod->ownerType; - return contextIn; -} - -inline MethodContext::Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTout SpmiRecordsHelper:: - CreateAgnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTout_without_buffers( - CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT* pResolvedMethod) -{ - MethodContext::Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTout contextOut; - ZeroMemory(&contextOut, sizeof(contextOut)); - contextOut.devirtualizedMethod = (DWORDLONG)pResolvedMethod->devirtualizedMethod; - contextOut.requiresInstMethodTableArg = (DWORD)pResolvedMethod->requiresInstMethodTableArg; - contextOut.patchedOwnerType = (DWORDLONG)pResolvedMethod->patchedOwnerType; - - return contextOut; -} - -template -inline MethodContext::Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTout SpmiRecordsHelper:: - StoreAgnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTout( - CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT* pResolvedMethod, LightWeightMap* buffers) -{ - MethodContext::Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTout contextOut( - CreateAgnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTout_without_buffers(pResolvedMethod)); - - return contextOut; -} - -template -inline void SpmiRecordsHelper::Restore_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTout( - CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT* pResolvedMethod, - MethodContext::Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTout& contextOut, - LightWeightMap* buffers) -{ - pResolvedMethod->devirtualizedMethod = (CORINFO_METHOD_HANDLE)contextOut.devirtualizedMethod; - pResolvedMethod->requiresInstMethodTableArg = contextOut.requiresInstMethodTableArg == 1; - pResolvedMethod->patchedOwnerType = (CORINFO_CONTEXT_HANDLE)contextOut.patchedOwnerType; -} - inline MethodContext::Agnostic_CORINFO_SIG_INFO SpmiRecordsHelper::CreateAgnostic_CORINFO_SIG_INFO_without_buffers( CORINFO_SIG_INFO& sigInfo) { diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp b/src/coreclr/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp index 40935680d97b9..90462003479c5 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp +++ b/src/coreclr/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp @@ -2105,7 +2105,7 @@ DWORD interceptor_ICJI::getExpectedTargetArchitecture() return original_ICorJitInfo->getExpectedTargetArchitecture(); } -void interceptor_ICJI::notifyInstructionSetUsage(CORINFO_InstructionSet instructionSet, bool supported) +bool interceptor_ICJI::notifyInstructionSetUsage(CORINFO_InstructionSet instructionSet, bool supported) { - original_ICorJitInfo->notifyInstructionSetUsage(instructionSet, supported); + return 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 68d226cc8b59f..bb32bdf36a393 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/src/tools/Common/JitInterface/ThunkGenerator +// To regenerate run the gen script in src/coreclr/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); } -void interceptor_ICJI::notifyInstructionSetUsage( +bool interceptor_ICJI::notifyInstructionSetUsage( CORINFO_InstructionSet instructionSet, bool supportEnabled) { mcs->AddCall("notifyInstructionSetUsage"); - original_ICorJitInfo->notifyInstructionSetUsage(instructionSet, supportEnabled); + return 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 f32838307c10b..64c3e0e9e8580 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/src/tools/Common/JitInterface/ThunkGenerator +// To regenerate run the gen script in src/coreclr/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); } -void interceptor_ICJI::notifyInstructionSetUsage( +bool interceptor_ICJI::notifyInstructionSetUsage( CORINFO_InstructionSet instructionSet, bool supportEnabled) { - original_ICorJitInfo->notifyInstructionSetUsage(instructionSet, supportEnabled); + return original_ICorJitInfo->notifyInstructionSetUsage(instructionSet, supportEnabled); } void interceptor_ICJI::allocMem( diff --git a/src/coreclr/ToolBox/superpmi/superpmi/icorjitinfo.cpp b/src/coreclr/ToolBox/superpmi/superpmi/icorjitinfo.cpp index 74c3e82694560..68649edf0b813 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi/icorjitinfo.cpp +++ b/src/coreclr/ToolBox/superpmi/superpmi/icorjitinfo.cpp @@ -173,7 +173,7 @@ void MyICJI::getMethodVTableOffset(CORINFO_METHOD_HANDLE method, // Find the virtual method in implementingClass that overrides virtualMethod. // Return null if devirtualization is not possible. -bool MyICJI::tryResolveVirtualMethod(CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT* virtualMethodContext /* IN, OUT */) +bool MyICJI::resolveVirtualMethod(CORINFO_DEVIRTUALIZATION_INFO * info) { jitInstance->mc->cr->AddCall("tryResolveVirtualMethod"); bool result = jitInstance->mc->repTryResolveVirtualMethod(virtualMethodContext); diff --git a/src/coreclr/inc/corinfo.h b/src/coreclr/inc/corinfo.h index 9ebc1f7c046fc..f25ed6cebce09 100644 --- a/src/coreclr/inc/corinfo.h +++ b/src/coreclr/inc/corinfo.h @@ -595,8 +595,6 @@ enum CorInfoHelpFunc CORINFO_HELP_COUNT, }; -#define CORINFO_HELP_READYTORUN_ATYPICAL_CALLSITE 0x40000000 - //This describes the signature for a helper method. enum CorInfoHelpSig { @@ -623,7 +621,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, @@ -703,14 +701,20 @@ inline bool IsCallerPop(CorInfoCallConv callConv) 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 { @@ -818,7 +822,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 - CORINFO_ACCESS_ATYPICAL_CALLSITE = 0x4000, // Atypical callsite that cannot be disassembled by delay loading helper + // UNUSED = 0x4000, CORINFO_ACCESS_INLINECHECK= 0x8000, // Return fieldFlags and fieldAccessor only. Used by JIT64 during inlining. }; @@ -1459,7 +1463,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 - CORINFO_CALLINFO_ATYPICAL_CALLSITE = 0x0040, // Atypical callsite that cannot be disassembled by delay loading helper + // UNUSED = 0x0040, }; enum CorInfoIsAccessAllowedResult @@ -2042,7 +2046,7 @@ class ICorStaticInfo // Get the unboxed entry point for a method, if possible. virtual CORINFO_METHOD_HANDLE getUnboxedEntry( CORINFO_METHOD_HANDLE ftn, - bool* requiresInstMethodTableArg = NULL /* OUT */ + bool* requiresInstMethodTableArg ) = 0; // Given T, return the type of the default EqualityComparer. @@ -2298,7 +2302,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 @@ -2335,7 +2339,7 @@ class ICorStaticInfo virtual CorInfoHelpFunc getNewHelper( CORINFO_RESOLVED_TOKEN * pResolvedToken, CORINFO_METHOD_HANDLE callerHandle, - bool * pHasSideEffects = NULL /* OUT */ + bool * pHasSideEffects ) = 0; // returns the newArr (1-Dim array) helper optimized for "arrayCls." @@ -3103,7 +3107,7 @@ class ICorDynamicInfo : public ICorStaticInfo bool fMustConvert ) = 0; - virtual void notifyInstructionSetUsage( + virtual bool notifyInstructionSetUsage( CORINFO_InstructionSet instructionSet, bool supportEnabled ) = 0; diff --git a/src/coreclr/jit/ICorJitInfo_API_names.h b/src/coreclr/jit/ICorJitInfo_API_names.h index d6c152aaae82b..d5a683a12176b 100644 --- a/src/coreclr/jit/ICorJitInfo_API_names.h +++ b/src/coreclr/jit/ICorJitInfo_API_names.h @@ -16,7 +16,7 @@ DEF_CLR_API(getEHinfo) DEF_CLR_API(getMethodClass) DEF_CLR_API(getMethodModule) DEF_CLR_API(getMethodVTableOffset) -DEF_CLR_API(tryResolveVirtualMethod) +DEF_CLR_API(resolveVirtualMethod) DEF_CLR_API(getUnboxedEntry) DEF_CLR_API(getDefaultEqualityComparerClass) DEF_CLR_API(expandRawHandleIntrinsic) diff --git a/src/coreclr/jit/ICorJitInfo_API_wrapper.hpp b/src/coreclr/jit/ICorJitInfo_API_wrapper.hpp index 29f9fd9ae8def..fb10358a4129f 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/src/tools/Common/JitInterface/ThunkGenerator +// To regenerate run the gen script in src/coreclr/tools/Common/JitInterface/ThunkGenerator // and follow the instructions in docs/project/updating-jitinterface.md #define API_ENTER(name) wrapComp->CLR_API_Enter(API_##name); @@ -1495,13 +1495,14 @@ bool WrapICorJitInfo::convertPInvokeCalliToCall( return temp; } -void WrapICorJitInfo::notifyInstructionSetUsage( +bool WrapICorJitInfo::notifyInstructionSetUsage( CORINFO_InstructionSet instructionSet, bool supportEnabled) { API_ENTER(notifyInstructionSetUsage); - wrapHnd->notifyInstructionSetUsage(instructionSet, supportEnabled); + bool temp = 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 a8d6a1450a646..4642388b574e4 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.h b/src/coreclr/jit/compiler.h index f1430f3ba9d37..aa4d63b23a3ed 100644 --- a/src/coreclr/jit/compiler.h +++ b/src/coreclr/jit/compiler.h @@ -3810,10 +3810,6 @@ class Compiler bool impILConsumesAddr(const BYTE* codeAddr); void impResolveToken(const BYTE* addr, CORINFO_RESOLVED_TOKEN* pResolvedToken, CorInfoTokenKind kind); - CORINFO_METHOD_HANDLE impResolveVirtualMethod(CORINFO_METHOD_HANDLE virtualMethod, - CORINFO_CLASS_HANDLE implementingClass, - bool* requiresInstMethodTableArg, - CORINFO_CONTEXT_HANDLE* ownerType); void impPushOnStack(GenTree* tree, typeInfo ti); void impPushNullObjRefOnStack(); diff --git a/src/coreclr/tools/Common/JitInterface/CorInfoBase.cs b/src/coreclr/tools/Common/JitInterface/CorInfoBase.cs index f163f6a59eac4..2326320e34eb4 100644 --- a/src/coreclr/tools/Common/JitInterface/CorInfoBase.cs +++ b/src/coreclr/tools/Common/JitInterface/CorInfoBase.cs @@ -197,7 +197,7 @@ static byte _resolveVirtualMethod(IntPtr thisHandle, IntPtr* ppException, CORINF catch (Exception ex) { *ppException = _this.AllocException(ex); - return 0; + return default; } } @@ -432,7 +432,7 @@ static byte _tryResolveToken(IntPtr thisHandle, IntPtr* ppException, CORINFO_RES catch (Exception ex) { *ppException = _this.AllocException(ex); - return 0; + return default; } } @@ -2551,7 +2551,7 @@ static IntPtr GetUnmanagedCallbacks() callbacks[10] = (delegate* unmanaged)&_getMethodModule; callbacks[11] = (delegate* unmanaged)&_getMethodVTableOffset; callbacks[12] = (delegate* unmanaged)&_resolveVirtualMethod; - callbacks[13] = (delegate* unmanaged)&_getUnboxedEntry; + callbacks[13] = (delegate* unmanaged)&_getUnboxedEntry; callbacks[14] = (delegate* unmanaged)&_getDefaultEqualityComparerClass; callbacks[15] = (delegate* unmanaged)&_expandRawHandleIntrinsic; callbacks[16] = (delegate* unmanaged)&_getIntrinsicID; diff --git a/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs b/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs index faa066eee2110..dc08bdace05fd 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,21 +683,6 @@ 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; @@ -858,17 +843,7 @@ private uint getMethodAttribsInternal(MethodDesc method) // Check for hardware intrinsics if (HardwareIntrinsicHelpers.IsHardwareIntrinsic(method)) { -#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; - } + result |= CorInfoFlag.CORINFO_FLG_JIT_INTRINSIC; } return (uint)result; @@ -1020,21 +995,16 @@ private bool resolveVirtualMethod(CORINFO_DEVIRTUALIZATION_INFO* info) return true; } - private CORINFO_METHOD_STRUCT_* getUnboxedEntry(CORINFO_METHOD_STRUCT_* ftn, byte* requiresInstMethodTableArg) + private CORINFO_METHOD_STRUCT_* getUnboxedEntry(CORINFO_METHOD_STRUCT_* ftn, ref bool requiresInstMethodTableArg) { MethodDesc result = null; - bool requiresInstMTArg = false; + requiresInstMethodTableArg = false; MethodDesc method = HandleToObject(ftn); if (method.IsUnboxingThunk()) { result = method.GetUnboxedMethod(); - requiresInstMTArg = method.RequiresInstMethodTableArg(); - } - - if (requiresInstMethodTableArg != null) - { - *requiresInstMethodTableArg = requiresInstMTArg ? (byte)1 : (byte)0; + requiresInstMethodTableArg = method.RequiresInstMethodTableArg(); } return result != null ? ObjectToHandle(result) : null; @@ -1076,7 +1046,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, BOOL* pfIsOpenDelegate) + private bool isCompatibleDelegate(CORINFO_CLASS_STRUCT_* objCls, CORINFO_CLASS_STRUCT_* methodParentCls, CORINFO_METHOD_STRUCT_* method, CORINFO_CLASS_STRUCT_* delegateCls, ref bool pfIsOpenDelegate) { throw new NotImplementedException("isCompatibleDelegate"); } private void setPatchpointInfo(PatchpointInfo* patchpointInfo) { throw new NotImplementedException("setPatchpointInfo"); } @@ -2750,7 +2720,7 @@ private void getLocationOfThisType(CORINFO_METHOD_STRUCT_* context, ref CORINFO_ ppIndirection = null; return null; } - private void GetProfilingHandle(BOOL* pbHookFunction, ref void* pProfilerHandle, BOOL* pbIndirectedHandles) + private void GetProfilingHandle(ref bool pbHookFunction, ref void* pProfilerHandle, BOOL* pbIndirectedHandles) { throw new NotImplementedException("GetProfilingHandle"); } /// @@ -3250,10 +3220,11 @@ private uint getJitFlags(ref CORJIT_FLAGS flags, uint sizeInBytes) } +#if READYTORUN InstructionSetFlags _actualInstructionSetSupported; InstructionSetFlags _actualInstructionSetUnsupported; - private void notifyInstructionSetUsage(InstructionSet instructionSet, bool supportEnabled) + private bool notifyInstructionSetUsage(InstructionSet instructionSet, bool supportEnabled) { if (supportEnabled) { @@ -3261,15 +3232,20 @@ private void 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 bb894cf5a0e04..d6eab1344394b 100644 --- a/src/coreclr/tools/Common/JitInterface/CorInfoTypes.cs +++ b/src/coreclr/tools/Common/JitInterface/CorInfoTypes.cs @@ -352,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 - CORINFO_CALLINFO_ATYPICAL_CALLSITE = 0x0040, // Atypical callsite that cannot be disassembled by delay loading helper + // UNUSED = 0x0040, } // Bit-twiddling of contexts assumes word-alignment of method handles and type handles @@ -535,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 - CORINFO_ACCESS_ATYPICAL_CALLSITE = 0x4000, // Atypical callsite that cannot be disassembled by delay loading helper + // UNUSED = 0x4000, CORINFO_ACCESS_INLINECHECK = 0x8000, // Return fieldFlags and fieldAccessor only. Used by JIT64 during inlining. } @@ -1009,13 +1009,13 @@ public unsafe struct CORINFO_CALL_INFO public CORINFO_CALL_KIND kind; - public uint _nullInstanceCheck; + public byte _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 uint _exactContextNeedsRuntimeLookup; // Set if contextHandle is approx handle. Runtime lookup is required to get the exact handle. + public byte _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. @@ -1025,7 +1025,7 @@ public unsafe struct CORINFO_CALL_INFO // Used by Ready-to-Run public CORINFO_CONST_LOOKUP instParamLookup; - public uint _wrapperDelegateInvoke; + public byte _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 68f772bc74f78..f83c4924ca240 100644 --- a/src/coreclr/tools/Common/JitInterface/ThunkGenerator/ThunkInput.txt +++ b/src/coreclr/tools/Common/JitInterface/ThunkGenerator/ThunkInput.txt @@ -52,7 +52,6 @@ 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 @@ -61,7 +60,6 @@ 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* @@ -173,7 +171,7 @@ FUNCTIONS CORINFO_MODULE_HANDLE getMethodModule( CORINFO_METHOD_HANDLE method ); void getMethodVTableOffset( CORINFO_METHOD_HANDLE method, unsigned* offsetOfIndirection, unsigned* offsetAfterIndirection, bool* isRelative); bool resolveVirtualMethod(CORINFO_DEVIRTUALIZATION_INFO* info); - CORINFO_METHOD_HANDLE getUnboxedEntry(CORINFO_METHOD_HANDLE ftn, BoolStar requiresInstMethodTableArg); + CORINFO_METHOD_HANDLE getUnboxedEntry(CORINFO_METHOD_HANDLE ftn, bool* requiresInstMethodTableArg); CORINFO_CLASS_HANDLE getDefaultEqualityComparerClass(CORINFO_CLASS_HANDLE elemType); void expandRawHandleIntrinsic(CORINFO_RESOLVED_TOKEN * pResolvedToken, CORINFO_GENERICHANDLE_RESULT * pResult); CorInfoIntrinsics getIntrinsicID( CORINFO_METHOD_HANDLE method , BoolStar pMustExpand); @@ -218,7 +216,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, BoolStar pHasSideEffects) + CorInfoHelpFunc getNewHelper(CORINFO_RESOLVED_TOKEN* pResolvedToken, CORINFO_METHOD_HANDLE callerHandle, bool* pHasSideEffects) CorInfoHelpFunc getNewArrHelper(CORINFO_CLASS_HANDLE arrayCls) CorInfoHelpFunc getCastingHelper(CORINFO_RESOLVED_TOKEN* pResolvedToken, bool fThrowing) CorInfoHelpFunc getSharedCCtorHelper(CORINFO_CLASS_HANDLE clsHnd) @@ -295,7 +293,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); @@ -313,7 +311,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); - void notifyInstructionSetUsage(CORINFO_InstructionSet instructionSet,bool supportEnabled); + bool 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 cbd3fd37044f0..e7a9609b6e456 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/src/tools/Common/JitInterface/ThunkGenerator +// To regenerate run the gen script in src/coreclr/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); - 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); + 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); 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); - int (* isValidToken)(void * thisHandle, CorInfoExceptionClass** ppException, void* module, unsigned metaTOK); - int (* isValidStringRef)(void * thisHandle, CorInfoExceptionClass** ppException, void* module, unsigned metaTOK); + bool (* isValidToken)(void * thisHandle, CorInfoExceptionClass** ppException, void* module, unsigned metaTOK); + bool (* 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, int fNamespace, int fFullInst, int fAssembly); - int (* isValueClass)(void * thisHandle, CorInfoExceptionClass** ppException, void* cls); + 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 (* canInlineTypeCheck)(void * thisHandle, CorInfoExceptionClass** ppException, void* cls, int source); unsigned int (* getClassAttribs)(void * thisHandle, CorInfoExceptionClass** ppException, void* cls); - int (* isStructRequiringStackAllocRetBuf)(void * thisHandle, CorInfoExceptionClass** ppException, void* cls); + bool (* 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); - int (* canAllocateOnStack)(void * thisHandle, CorInfoExceptionClass** ppException, void* cls); - unsigned (* getClassAlignmentRequirement)(void * thisHandle, CorInfoExceptionClass** ppException, void* cls, int fDoubleAlignHint); + bool (* canAllocateOnStack)(void * thisHandle, CorInfoExceptionClass** ppException, void* cls); + unsigned (* getClassAlignmentRequirement)(void * thisHandle, CorInfoExceptionClass** ppException, void* cls, bool 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); - int (* checkMethodModifier)(void * thisHandle, CorInfoExceptionClass** ppException, void* hMethod, const char* modifier, int fOptional); + bool (* checkMethodModifier)(void * thisHandle, CorInfoExceptionClass** ppException, void* hMethod, const char* modifier, bool 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); - int (* canCast)(void * thisHandle, CorInfoExceptionClass** ppException, void* child, void* parent); - int (* areTypesEquivalent)(void * thisHandle, CorInfoExceptionClass** ppException, void* cls1, void* cls2); + bool (* canCast)(void * thisHandle, CorInfoExceptionClass** ppException, void* child, void* parent); + bool (* 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); - int (* isMoreSpecificType)(void * thisHandle, CorInfoExceptionClass** ppException, void* cls1, void* cls2); + bool (* 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); - int (* satisfiesClassConstraints)(void * thisHandle, CorInfoExceptionClass** ppException, void* cls); - int (* isSDArray)(void * thisHandle, CorInfoExceptionClass** ppException, void* cls); + bool (* satisfiesClassConstraints)(void * thisHandle, CorInfoExceptionClass** ppException, void* cls); + bool (* 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, int fEmbedParent, void* pResult); + void (* embedGenericHandle)(void * thisHandle, CorInfoExceptionClass** ppException, void* pResolvedToken, bool 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, int* pbHookFunction, void** pProfilerHandle, int* pbIndirectedHandles); + void (* GetProfilingHandle)(void * thisHandle, CorInfoExceptionClass** ppException, bool* pbHookFunction, void** pProfilerHandle, bool* pbIndirectedHandles); void (* getCallInfo)(void * thisHandle, CorInfoExceptionClass** ppException, void* pResolvedToken, void* pConstrainedResolvedToken, void* callerHandle, int flags, void* pResult); - int (* canAccessFamily)(void * thisHandle, CorInfoExceptionClass** ppException, void* hCaller, void* hInstanceType); - int (* isRIDClassDomainID)(void * thisHandle, CorInfoExceptionClass** ppException, void* cls); + bool (* canAccessFamily)(void * thisHandle, CorInfoExceptionClass** ppException, void* hCaller, void* hInstanceType); + bool (* 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); - void (* notifyInstructionSetUsage)(void * thisHandle, CorInfoExceptionClass** ppException, int instructionSet, bool supportEnabled); + bool (* 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, int isFunclet, int isColdCode, unsigned int unwindSize); + void (* reserveUnwindInfo)(void * thisHandle, CorInfoExceptionClass** ppException, bool isFunclet, bool 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); - int (* logMsg)(void * thisHandle, CorInfoExceptionClass** ppException, unsigned level, const char* fmt, va_list args); + bool (* 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 int pInvokeMarshalingRequired( + virtual bool pInvokeMarshalingRequired( void* method, void* callSiteSig) { CorInfoExceptionClass* pException = nullptr; - int temp = _callbacks->pInvokeMarshalingRequired(_thisHandle, &pException, method, callSiteSig); + bool temp = _callbacks->pInvokeMarshalingRequired(_thisHandle, &pException, method, callSiteSig); if (pException != nullptr) throw pException; return temp; } - virtual int satisfiesMethodConstraints( + virtual bool satisfiesMethodConstraints( void* parent, void* method) { CorInfoExceptionClass* pException = nullptr; - int temp = _callbacks->satisfiesMethodConstraints(_thisHandle, &pException, parent, method); + bool temp = _callbacks->satisfiesMethodConstraints(_thisHandle, &pException, parent, method); if (pException != nullptr) throw pException; return temp; } - virtual int isCompatibleDelegate( + virtual bool isCompatibleDelegate( void* objCls, void* methodParentCls, void* method, void* delegateCls, - int* pfIsOpenDelegate) + bool* pfIsOpenDelegate) { CorInfoExceptionClass* pException = nullptr; - int temp = _callbacks->isCompatibleDelegate(_thisHandle, &pException, objCls, methodParentCls, method, delegateCls, pfIsOpenDelegate); + bool 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 int isValidToken( + virtual bool isValidToken( void* module, unsigned metaTOK) { CorInfoExceptionClass* pException = nullptr; - int temp = _callbacks->isValidToken(_thisHandle, &pException, module, metaTOK); + bool temp = _callbacks->isValidToken(_thisHandle, &pException, module, metaTOK); if (pException != nullptr) throw pException; return temp; } - virtual int isValidStringRef( + virtual bool isValidStringRef( void* module, unsigned metaTOK) { CorInfoExceptionClass* pException = nullptr; - int temp = _callbacks->isValidStringRef(_thisHandle, &pException, module, metaTOK); + bool 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, - int fNamespace, - int fFullInst, - int fAssembly) + bool fNamespace, + bool fFullInst, + bool 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 int isValueClass( + virtual bool isValueClass( void* cls) { CorInfoExceptionClass* pException = nullptr; - int temp = _callbacks->isValueClass(_thisHandle, &pException, cls); + bool temp = _callbacks->isValueClass(_thisHandle, &pException, cls); if (pException != nullptr) throw pException; return temp; } @@ -619,11 +619,11 @@ class JitInterfaceWrapper return temp; } - virtual int isStructRequiringStackAllocRetBuf( + virtual bool isStructRequiringStackAllocRetBuf( void* cls) { CorInfoExceptionClass* pException = nullptr; - int temp = _callbacks->isStructRequiringStackAllocRetBuf(_thisHandle, &pException, cls); + bool temp = _callbacks->isStructRequiringStackAllocRetBuf(_thisHandle, &pException, cls); if (pException != nullptr) throw pException; return temp; } @@ -701,18 +701,18 @@ class JitInterfaceWrapper return temp; } - virtual int canAllocateOnStack( + virtual bool canAllocateOnStack( void* cls) { CorInfoExceptionClass* pException = nullptr; - int temp = _callbacks->canAllocateOnStack(_thisHandle, &pException, cls); + bool temp = _callbacks->canAllocateOnStack(_thisHandle, &pException, cls); if (pException != nullptr) throw pException; return temp; } virtual unsigned getClassAlignmentRequirement( void* cls, - int fDoubleAlignHint) + bool fDoubleAlignHint) { CorInfoExceptionClass* pException = nullptr; unsigned temp = _callbacks->getClassAlignmentRequirement(_thisHandle, &pException, cls, fDoubleAlignHint); @@ -749,13 +749,13 @@ class JitInterfaceWrapper return temp; } - virtual int checkMethodModifier( + virtual bool checkMethodModifier( void* hMethod, const char* modifier, - int fOptional) + bool fOptional) { CorInfoExceptionClass* pException = nullptr; - int temp = _callbacks->checkMethodModifier(_thisHandle, &pException, hMethod, modifier, fOptional); + bool temp = _callbacks->checkMethodModifier(_thisHandle, &pException, hMethod, modifier, fOptional); if (pException != nullptr) throw pException; return temp; } @@ -903,22 +903,22 @@ class JitInterfaceWrapper return temp; } - virtual int canCast( + virtual bool canCast( void* child, void* parent) { CorInfoExceptionClass* pException = nullptr; - int temp = _callbacks->canCast(_thisHandle, &pException, child, parent); + bool temp = _callbacks->canCast(_thisHandle, &pException, child, parent); if (pException != nullptr) throw pException; return temp; } - virtual int areTypesEquivalent( + virtual bool areTypesEquivalent( void* cls1, void* cls2) { CorInfoExceptionClass* pException = nullptr; - int temp = _callbacks->areTypesEquivalent(_thisHandle, &pException, cls1, cls2); + bool temp = _callbacks->areTypesEquivalent(_thisHandle, &pException, cls1, cls2); if (pException != nullptr) throw pException; return temp; } @@ -953,12 +953,12 @@ class JitInterfaceWrapper return temp; } - virtual int isMoreSpecificType( + virtual bool isMoreSpecificType( void* cls1, void* cls2) { CorInfoExceptionClass* pException = nullptr; - int temp = _callbacks->isMoreSpecificType(_thisHandle, &pException, cls1, cls2); + bool temp = _callbacks->isMoreSpecificType(_thisHandle, &pException, cls1, cls2); if (pException != nullptr) throw pException; return temp; } @@ -982,20 +982,20 @@ class JitInterfaceWrapper return temp; } - virtual int satisfiesClassConstraints( + virtual bool satisfiesClassConstraints( void* cls) { CorInfoExceptionClass* pException = nullptr; - int temp = _callbacks->satisfiesClassConstraints(_thisHandle, &pException, cls); + bool temp = _callbacks->satisfiesClassConstraints(_thisHandle, &pException, cls); if (pException != nullptr) throw pException; return temp; } - virtual int isSDArray( + virtual bool isSDArray( void* cls) { CorInfoExceptionClass* pException = nullptr; - int temp = _callbacks->isSDArray(_thisHandle, &pException, cls); + bool temp = _callbacks->isSDArray(_thisHandle, &pException, cls); if (pException != nullptr) throw pException; return temp; } @@ -1427,7 +1427,7 @@ class JitInterfaceWrapper virtual void embedGenericHandle( void* pResolvedToken, - int fEmbedParent, + bool fEmbedParent, void* pResult) { CorInfoExceptionClass* pException = nullptr; @@ -1483,9 +1483,9 @@ class JitInterfaceWrapper } virtual void GetProfilingHandle( - int* pbHookFunction, + bool* pbHookFunction, void** pProfilerHandle, - int* pbIndirectedHandles) + bool* pbIndirectedHandles) { CorInfoExceptionClass* pException = nullptr; _callbacks->GetProfilingHandle(_thisHandle, &pException, pbHookFunction, pProfilerHandle, pbIndirectedHandles); @@ -1504,21 +1504,21 @@ class JitInterfaceWrapper if (pException != nullptr) throw pException; } - virtual int canAccessFamily( + virtual bool canAccessFamily( void* hCaller, void* hInstanceType) { CorInfoExceptionClass* pException = nullptr; - int temp = _callbacks->canAccessFamily(_thisHandle, &pException, hCaller, hInstanceType); + bool temp = _callbacks->canAccessFamily(_thisHandle, &pException, hCaller, hInstanceType); if (pException != nullptr) throw pException; return temp; } - virtual int isRIDClassDomainID( + virtual bool isRIDClassDomainID( void* cls) { CorInfoExceptionClass* pException = nullptr; - int temp = _callbacks->isRIDClassDomainID(_thisHandle, &pException, cls); + bool temp = _callbacks->isRIDClassDomainID(_thisHandle, &pException, cls); if (pException != nullptr) throw pException; return temp; } @@ -1662,13 +1662,14 @@ class JitInterfaceWrapper return temp; } - virtual void notifyInstructionSetUsage( + virtual bool notifyInstructionSetUsage( int instructionSet, bool supportEnabled) { CorInfoExceptionClass* pException = nullptr; - _callbacks->notifyInstructionSetUsage(_thisHandle, &pException, instructionSet, supportEnabled); + bool temp = _callbacks->notifyInstructionSetUsage(_thisHandle, &pException, instructionSet, supportEnabled); if (pException != nullptr) throw pException; + return temp; } virtual void allocMem( @@ -1687,8 +1688,8 @@ class JitInterfaceWrapper } virtual void reserveUnwindInfo( - int isFunclet, - int isColdCode, + bool isFunclet, + bool isColdCode, unsigned int unwindSize) { CorInfoExceptionClass* pException = nullptr; @@ -1736,13 +1737,13 @@ class JitInterfaceWrapper if (pException != nullptr) throw pException; } - virtual int logMsg( + virtual bool logMsg( unsigned level, const char* fmt, va_list args) { CorInfoExceptionClass* pException = nullptr; - int temp = _callbacks->logMsg(_thisHandle, &pException, level, fmt, args); + bool 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 82705f094c06a..6b986322f727c 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(); @@ -9071,7 +9071,7 @@ bool CEEInfo::resolveVirtualMethod(CORINFO_DEVIRTUALIZATION_INFO * info) JIT_TO_EE_TRANSITION(); - result = resolveVirtualMethod(info); + result = resolveVirtualMethodHelper(info); EE_TO_JIT_TRANSITION(); @@ -10949,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; { @@ -12813,7 +12813,7 @@ void ThrowExceptionForJit(HRESULT res) // ******************************************************************** //#define PERF_TRACK_METHOD_JITTIMES #ifdef TARGET_AMD64 -bool g_fAllowRel32 = TRUE; +BOOL g_fAllowRel32 = TRUE; #endif @@ -12973,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 @@ -12982,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; @@ -13024,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(), @@ -13187,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); @@ -13360,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; @@ -13443,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) { @@ -13691,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; { @@ -14517,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 c2b207690b0d9..6ae9aa76c921c 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 = NULL); - static CorInfoHelpFunc getNewHelperStatic(MethodTable * pMT, bool * pHasSideEffects = NULL); + CorInfoHelpFunc getNewHelper(CORINFO_RESOLVED_TOKEN * pResolvedToken, CORINFO_METHOD_HANDLE callerHandle, bool * pHasSideEffects); + static CorInfoHelpFunc getNewHelperStatic(MethodTable * pMT, bool * pHasSideEffects); CorInfoHelpFunc getNewArrHelper(CORINFO_CLASS_HANDLE arrayCls); static CorInfoHelpFunc getNewArrHelperStatic(TypeHandle clsHnd); @@ -916,7 +916,7 @@ class CEEInfo : public ICorJitInfo bool convertPInvokeCalliToCall(CORINFO_RESOLVED_TOKEN * pResolvedToken, bool fMustConvert); - void notifyInstructionSetUsage(CORINFO_InstructionSet instructionSet, + bool notifyInstructionSetUsage(CORINFO_InstructionSet instructionSet, bool supportEnabled); void getFunctionEntryPoint(CORINFO_METHOD_HANDLE ftn, /* IN */ @@ -1323,7 +1323,7 @@ class CEEJitInfo : public CEEInfo } #ifdef TARGET_AMD64 - void SetAllowRel32(bool fAllowRel32) + void SetAllowRel32(BOOL fAllowRel32) { LIMITED_METHOD_CONTRACT; m_fAllowRel32 = fAllowRel32; @@ -1331,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; @@ -1361,7 +1361,7 @@ class CEEJitInfo : public CEEInfo m_reserveForJumpStubs = value; } #else - bool JitAgain() + BOOL JitAgain() { LIMITED_METHOD_CONTRACT; return FALSE; @@ -1501,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 @@ -1609,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 @@ -1620,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 986da73d2ed48..431e57ac06da8 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; } -void ZapInfo::notifyInstructionSetUsage(CORINFO_InstructionSet instructionSet, bool supportEnabled) +bool ZapInfo::notifyInstructionSetUsage(CORINFO_InstructionSet instructionSet, bool supportEnabled) { - m_pEEJitInfo->notifyInstructionSetUsage(instructionSet, supportEnabled); + return 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 | CORINFO_CALLINFO_ATYPICAL_CALLSITE)) + if (flags & CORINFO_CALLINFO_LDFTN) { pImport = m_pImage->GetImportTable()->GetMethodImport(ENCODE_METHOD_ENTRY, pResult->hMethod, pResolvedToken, pConstrainedResolvedToken); @@ -2495,10 +2495,7 @@ void ZapInfo::getCallInfo(CORINFO_RESOLVED_TOKEN * pResolvedToken, #ifdef FEATURE_READYTORUN_COMPILER if (IsReadyToRunCompilation() && !pResult->exactContextNeedsRuntimeLookup) { - 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); + ZapImport * pImport = m_pImage->GetImportTable()->GetDynamicHelperCell(ENCODE_VIRTUAL_ENTRY, pResult->hMethod, pResolvedToken); pResult->codePointerLookup.constLookup.accessType = IAT_PVALUE; pResult->codePointerLookup.constLookup.addr = pImport; @@ -3146,8 +3143,6 @@ 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: @@ -3255,8 +3250,7 @@ void ZapInfo::getFieldInfo (CORINFO_RESOLVED_TOKEN * pResolvedToken, UNREACHABLE_MSG("Unexpected static helper"); } - ZapImport * pImport = m_pImage->GetImportTable()->GetDynamicHelperCell( - (CORCOMPILE_FIXUP_BLOB_KIND)(kind | fAtypicalCallsite), pResolvedToken->hClass); + ZapImport * pImport = m_pImage->GetImportTable()->GetDynamicHelperCell(kind, pResolvedToken->hClass); pResult->fieldLookup.accessType = IAT_PVALUE; pResult->fieldLookup.addr = pImport; @@ -3265,8 +3259,7 @@ void ZapInfo::getFieldInfo (CORINFO_RESOLVED_TOKEN * pResolvedToken, } else { - ZapImport * pImport = m_pImage->GetImportTable()->GetDynamicHelperCell( - (CORCOMPILE_FIXUP_BLOB_KIND)(ENCODE_FIELD_ADDRESS | fAtypicalCallsite), pResolvedToken->hField, pResolvedToken); + ZapImport * pImport = m_pImage->GetImportTable()->GetDynamicHelperCell(ENCODE_FIELD_ADDRESS, pResolvedToken->hField, pResolvedToken); pResult->fieldLookup.accessType = IAT_PVALUE; pResult->fieldLookup.addr = pImport; @@ -3725,40 +3718,34 @@ bool ZapInfo::getReadyToRunHelper(CORINFO_RESOLVED_TOKEN * pResolvedToken, ZapImport * pImport = NULL; - DWORD fAtypicalCallsite = (id & CORINFO_HELP_READYTORUN_ATYPICAL_CALLSITE); - id = (CorInfoHelpFunc)(id & ~CORINFO_HELP_READYTORUN_ATYPICAL_CALLSITE); - + bool ignoredSideEffects = false; 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); + m_pEEJitInfo->getNewHelper(pResolvedToken, m_currentMethodHandle, &ignoredSideEffects); if ((getClassAttribs(pResolvedToken->hClass) & CORINFO_FLG_SHAREDINST) != 0) return false; // Requires runtime lookup. - pImport = m_pImage->GetImportTable()->GetDynamicHelperCell( - (CORCOMPILE_FIXUP_BLOB_KIND)(ENCODE_NEW_HELPER | fAtypicalCallsite), pResolvedToken->hClass); + pImport = m_pImage->GetImportTable()->GetDynamicHelperCell(ENCODE_NEW_HELPER, 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( - (CORCOMPILE_FIXUP_BLOB_KIND)(ENCODE_NEW_ARRAY_HELPER | fAtypicalCallsite), pResolvedToken->hClass); + pImport = m_pImage->GetImportTable()->GetDynamicHelperCell(ENCODE_NEW_ARRAY_HELPER, 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( - (CORCOMPILE_FIXUP_BLOB_KIND)(ENCODE_ISINSTANCEOF_HELPER | fAtypicalCallsite), pResolvedToken->hClass); + pImport = m_pImage->GetImportTable()->GetDynamicHelperCell(ENCODE_ISINSTANCEOF_HELPER, 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( - (CORCOMPILE_FIXUP_BLOB_KIND)(ENCODE_CHKCAST_HELPER | fAtypicalCallsite), pResolvedToken->hClass); + pImport = m_pImage->GetImportTable()->GetDynamicHelperCell(ENCODE_CHKCAST_HELPER, pResolvedToken->hClass); break; case CORINFO_HELP_READYTORUN_STATIC_BASE: @@ -3766,8 +3753,7 @@ 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( - (CORCOMPILE_FIXUP_BLOB_KIND)(ENCODE_CCTOR_TRIGGER | fAtypicalCallsite), pResolvedToken->hClass); + pImport = m_pImage->GetImportTable()->GetDynamicHelperCell(ENCODE_CCTOR_TRIGGER, pResolvedToken->hClass); } else { @@ -3783,18 +3769,18 @@ bool ZapInfo::getReadyToRunHelper(CORINFO_RESOLVED_TOKEN * pResolvedToken, if (pGenericLookupKind->runtimeLookupKind == CORINFO_LOOKUP_METHODPARAM) { pImport = m_pImage->GetImportTable()->GetDictionaryLookupCell( - (CORCOMPILE_FIXUP_BLOB_KIND)(ENCODE_DICTIONARY_LOOKUP_METHOD | fAtypicalCallsite), m_currentMethodHandle, pResolvedToken, pGenericLookupKind); + ENCODE_DICTIONARY_LOOKUP_METHOD, m_currentMethodHandle, pResolvedToken, pGenericLookupKind); } else if (pGenericLookupKind->runtimeLookupKind == CORINFO_LOOKUP_THISOBJ) { pImport = m_pImage->GetImportTable()->GetDictionaryLookupCell( - (CORCOMPILE_FIXUP_BLOB_KIND)(ENCODE_DICTIONARY_LOOKUP_THISOBJ | fAtypicalCallsite), m_currentMethodHandle, pResolvedToken, pGenericLookupKind); + ENCODE_DICTIONARY_LOOKUP_THISOBJ, m_currentMethodHandle, pResolvedToken, pGenericLookupKind); } else { _ASSERTE(pGenericLookupKind->runtimeLookupKind == CORINFO_LOOKUP_CLASSPARAM); pImport = m_pImage->GetImportTable()->GetDictionaryLookupCell( - (CORCOMPILE_FIXUP_BLOB_KIND)(ENCODE_DICTIONARY_LOOKUP_TYPE | fAtypicalCallsite), m_currentMethodHandle, pResolvedToken, pGenericLookupKind); + ENCODE_DICTIONARY_LOOKUP_TYPE, m_currentMethodHandle, pResolvedToken, pGenericLookupKind); } break; @@ -4219,7 +4205,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 6c95f55c1fb58..8514cce6ccb29 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); - void notifyInstructionSetUsage(CORINFO_InstructionSet instructionSet, bool supportEnabled); + bool 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 = NULL); + CorInfoHelpFunc getNewHelper(CORINFO_RESOLVED_TOKEN * pResolvedToken, CORINFO_METHOD_HANDLE callerHandle, bool * pHasSideEffects); CorInfoHelpFunc getCastingHelper(CORINFO_RESOLVED_TOKEN * pResolvedToken, bool fThrowing); CorInfoHelpFunc getNewArrHelper(CORINFO_CLASS_HANDLE arrayCls); CorInfoHelpFunc getSharedCCtorHelper(CORINFO_CLASS_HANDLE clsHnd); From fad20205ac85731b3bd419fb813c6c44c3eac8dd Mon Sep 17 00:00:00 2001 From: Rattenkrieg Date: Sun, 13 Dec 2020 00:11:10 +0300 Subject: [PATCH 27/29] bool casing fixes --- .../superpmi-shared/methodcontext.cpp | 44 +++++++++---------- .../ToolBox/superpmi/superpmi/icorjitinfo.cpp | 6 +-- src/coreclr/inc/corinfo.h | 3 ++ src/coreclr/jit/compiler.hpp | 10 ++--- src/coreclr/jit/importer.cpp | 4 +- .../tools/Common/JitInterface/CorInfoImpl.cs | 2 +- src/coreclr/vm/jitinterface.cpp | 2 +- 7 files changed, 36 insertions(+), 35 deletions(-) diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.cpp b/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.cpp index 31cad0f6f52c8..7bda67a58b367 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.cpp +++ b/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.cpp @@ -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; } @@ -4518,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; } @@ -4679,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; } @@ -4820,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) @@ -4941,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, @@ -4978,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, @@ -5380,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) @@ -5486,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) @@ -5532,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)); } @@ -5595,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; } @@ -5877,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; } @@ -6209,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; } @@ -6246,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/icorjitinfo.cpp b/src/coreclr/ToolBox/superpmi/superpmi/icorjitinfo.cpp index 68649edf0b813..0bbbd1f0e2532 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi/icorjitinfo.cpp +++ b/src/coreclr/ToolBox/superpmi/superpmi/icorjitinfo.cpp @@ -171,12 +171,10 @@ void MyICJI::getMethodVTableOffset(CORINFO_METHOD_HANDLE method, jitInstance->mc->repGetMethodVTableOffset(method, offsetOfIndirection, offsetAfterIndirection, isRelative); } -// Find the virtual method in implementingClass that overrides virtualMethod. -// Return null if devirtualization is not possible. bool MyICJI::resolveVirtualMethod(CORINFO_DEVIRTUALIZATION_INFO * info) { - jitInstance->mc->cr->AddCall("tryResolveVirtualMethod"); - bool result = jitInstance->mc->repTryResolveVirtualMethod(virtualMethodContext); + jitInstance->mc->cr->AddCall("resolveVirtualMethod"); + bool result = jitInstance->mc->repResolveVirtualMethod(info); return result; } diff --git a/src/coreclr/inc/corinfo.h b/src/coreclr/inc/corinfo.h index f25ed6cebce09..9992adfdb21a1 100644 --- a/src/coreclr/inc/corinfo.h +++ b/src/coreclr/inc/corinfo.h @@ -698,6 +698,8 @@ 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 @@ -3107,6 +3109,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( CORINFO_InstructionSet instructionSet, bool supportEnabled diff --git a/src/coreclr/jit/compiler.hpp b/src/coreclr/jit/compiler.hpp index f047182cbc55d..d7576d6b4d608 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 7de5bef4a212f..96738f09bea03 100644 --- a/src/coreclr/jit/importer.cpp +++ b/src/coreclr/jit/importer.cpp @@ -21295,8 +21295,8 @@ void Compiler::impDevirtualizeCall(GenTreeCall* call, // check wheter we have returned an instantiating stub for generic DIM if ((isInterface && dvInfo.requiresInstMethodTableArg) || passExtraArgForValueType) { - assert(((SIZE_T)ownerType & CORINFO_CONTEXTFLAGS_MASK) == CORINFO_CONTEXTFLAGS_CLASS); - CORINFO_CLASS_HANDLE exactClassHandle = eeGetClassFromContext(ownerType); + assert(((SIZE_T)dvInfo.context & CORINFO_CONTEXTFLAGS_MASK) == CORINFO_CONTEXTFLAGS_CLASS); + CORINFO_CLASS_HANDLE exactClassHandle = eeGetClassFromContext(dvInfo.context); GenTree* instParam = gtNewIconEmbClsHndNode(exactClassHandle); call->gtCallMethHnd = derivedMethod; if ((Target::g_tgtArgOrder == Target::ARG_ORDER_R2L) || (call->gtCallArgs == nullptr)) diff --git a/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs b/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs index dc08bdace05fd..0cc17045b418d 100644 --- a/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs +++ b/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs @@ -2720,7 +2720,7 @@ private void getLocationOfThisType(CORINFO_METHOD_STRUCT_* context, ref CORINFO_ ppIndirection = null; return null; } - private void GetProfilingHandle(ref bool pbHookFunction, ref void* pProfilerHandle, BOOL* pbIndirectedHandles) + private void GetProfilingHandle(ref bool pbHookFunction, ref void* pProfilerHandle, ref bool pbIndirectedHandles) { throw new NotImplementedException("GetProfilingHandle"); } /// diff --git a/src/coreclr/vm/jitinterface.cpp b/src/coreclr/vm/jitinterface.cpp index 6b986322f727c..3b18afb5712c7 100644 --- a/src/coreclr/vm/jitinterface.cpp +++ b/src/coreclr/vm/jitinterface.cpp @@ -8916,7 +8916,7 @@ bool CEEInfo::resolveVirtualMethodHelper(CORINFO_DEVIRTUALIZATION_INFO * info) TypeHandle OwnerClsHnd = GetTypeFromContext(info->context); pOwnerMT = OwnerClsHnd.GetMethodTable(); - if (!canCastStraightForward && !(pOwnerMT->IsInterface() && pDerivedMT->CanCastToInterface(pOwnerMT))) + if (!canCastStraightForward && !(pOwnerMT->IsInterface() && pObjMT->CanCastToInterface(pOwnerMT))) { return false; } From c5245c55734438b3a5b8d2aca0e22eef0623240f Mon Sep 17 00:00:00 2001 From: Rattenkrieg Date: Thu, 17 Dec 2020 22:28:22 +0300 Subject: [PATCH 28/29] formatting; tests cleanup --- src/coreclr/jit/importer.cpp | 2 +- src/tests/JIT/devirt/precise_context.cs | 21 --------------------- src/tests/JIT/devirt/precise_context.csproj | 13 ------------- 3 files changed, 1 insertion(+), 35 deletions(-) delete mode 100644 src/tests/JIT/devirt/precise_context.cs delete mode 100644 src/tests/JIT/devirt/precise_context.csproj diff --git a/src/coreclr/jit/importer.cpp b/src/coreclr/jit/importer.cpp index 96738f09bea03..fe03b97d34ffc 100644 --- a/src/coreclr/jit/importer.cpp +++ b/src/coreclr/jit/importer.cpp @@ -20926,7 +20926,7 @@ void Compiler::impDevirtualizeCall(GenTreeCall* call, dvInfo.objClass = likelyClass; dvInfo.context = *pContextHandle; - bool canResolve = info.compCompHnd->resolveVirtualMethod(&dvInfo); + bool canResolve = info.compCompHnd->resolveVirtualMethod(&dvInfo); if (!canResolve) { diff --git a/src/tests/JIT/devirt/precise_context.cs b/src/tests/JIT/devirt/precise_context.cs deleted file mode 100644 index 9ad481181d339..0000000000000 --- a/src/tests/JIT/devirt/precise_context.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.Runtime.CompilerServices; - -class G -{ - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public virtual bool MVIRT() => typeof(T) == typeof(string); - //[MethodImpl(MethodImplOptions.AggressiveInlining)] - //public bool MINST() => typeof(T) == typeof(string); -} - -class Program -{ - static int Main() - { - var g = new G(); - var mvirt = g.MVIRT() ? 50 : -1; - //var minst = g.MINST() ? 500 : -1; - return mvirt + 11; - } -} diff --git a/src/tests/JIT/devirt/precise_context.csproj b/src/tests/JIT/devirt/precise_context.csproj deleted file mode 100644 index 6aa1011be68b7..0000000000000 --- a/src/tests/JIT/devirt/precise_context.csproj +++ /dev/null @@ -1,13 +0,0 @@ - - - Exe - true - - - pdbonly - true - - - - - From 2c7bf8ad55962c1703a97d9d5b3c6a3b6efc4155 Mon Sep 17 00:00:00 2001 From: Rattenkrieg Date: Sun, 20 Dec 2020 20:16:25 +0300 Subject: [PATCH 29/29] fixed exact context lookup for non DIMs --- .../superpmi/superpmi-shared/methodcontext.cpp | 2 +- src/coreclr/jit/importer.cpp | 1 + src/coreclr/vm/jitinterface.cpp | 13 ++++++++++--- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.cpp b/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.cpp index 7bda67a58b367..66905de6f3b6e 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.cpp +++ b/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.cpp @@ -4549,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; } diff --git a/src/coreclr/jit/importer.cpp b/src/coreclr/jit/importer.cpp index fe03b97d34ffc..acbb04a7cd82d 100644 --- a/src/coreclr/jit/importer.cpp +++ b/src/coreclr/jit/importer.cpp @@ -20921,6 +20921,7 @@ void Compiler::impDevirtualizeCall(GenTreeCall* call, } // Ask the runtime to determine the method that would be called based on the guessed-for type. + // CORINFO_DEVIRTUALIZATION_INFO dvInfo; dvInfo.virtualMethod = baseMethod; dvInfo.objClass = likelyClass; diff --git a/src/coreclr/vm/jitinterface.cpp b/src/coreclr/vm/jitinterface.cpp index 3b18afb5712c7..b7563082e3ef6 100644 --- a/src/coreclr/vm/jitinterface.cpp +++ b/src/coreclr/vm/jitinterface.cpp @@ -9021,16 +9021,23 @@ bool CEEInfo::resolveVirtualMethodHelper(CORINFO_DEVIRTUALIZATION_INFO * info) // interface method. If so, we'll use the method's class. // MethodTable* pApproxMT = pDevirtMD->GetMethodTable(); - MethodTable* pExactMT = pApproxMT; if (pApproxMT->IsInterface()) { - // Already handled above TODO refactor + if (pDevirtMD->HasClassInstantiation()) + { + // DIMs are handled above + _ASSERTE(info->exactContext != NULL); + } + else + { + info->exactContext = MAKE_CLASSCONTEXT((CORINFO_CLASS_HANDLE) pApproxMT); + } } else { - pExactMT = pDevirtMD->GetExactDeclaringType(pObjMT); + MethodTable* pExactMT = pDevirtMD->GetExactDeclaringType(pObjMT); info->exactContext = MAKE_CLASSCONTEXT((CORINFO_CLASS_HANDLE) pExactMT); }