Skip to content

Commit

Permalink
rebased on master
Browse files Browse the repository at this point in the history
  • Loading branch information
Rattenkrieg committed Dec 12, 2020
1 parent aa89550 commit e91c55b
Show file tree
Hide file tree
Showing 25 changed files with 429 additions and 6,314 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -624,7 +624,7 @@ bool convertPInvokeCalliToCall(
CORINFO_RESOLVED_TOKEN* pResolvedToken,
bool mustConvert);

bool notifyInstructionSetUsage(
void notifyInstructionSetUsage(
CORINFO_InstructionSet instructionSet,
bool supportEnabled);

Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/ToolBox/superpmi/superpmi-shared/lwmlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
133 changes: 64 additions & 69 deletions src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.cpp

Large diffs are not rendered by default.

50 changes: 20 additions & 30 deletions src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -537,12 +534,6 @@ class MethodContext
DWORD success;
};

struct TryResolveVirtualMethodValue
{
Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTout contextOut;
DWORD success;
};

struct GetTokenTypeAsHandleValue
{
DWORDLONG hMethod;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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(
Expand Down
59 changes: 12 additions & 47 deletions src/coreclr/inc/corinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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,
Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -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.
};

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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<T>.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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."
Expand Down Expand Up @@ -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;
Expand Down
16 changes: 8 additions & 8 deletions src/coreclr/jit/ICorJitInfo_API_wrapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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(
Expand Down
Loading

0 comments on commit e91c55b

Please sign in to comment.