Skip to content

Commit e91c55b

Browse files
committed
rebased on master
1 parent aa89550 commit e91c55b

File tree

25 files changed

+429
-6314
lines changed

25 files changed

+429
-6314
lines changed

src/coreclr/ToolBox/superpmi/superpmi-shared/icorjitinfoimpl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
// DO NOT EDIT THIS FILE! IT IS AUTOGENERATED
5-
// To regenerate run the gen script in src/coreclr/tools/Common/JitInterface/ThunkGenerator
5+
// To regenerate run the gen script in src/coreclr/src/tools/Common/JitInterface/ThunkGenerator
66
// and follow the instructions in docs/project/updating-jitinterface.md
77

88
#ifndef _ICorJitInfoImpl
@@ -624,7 +624,7 @@ bool convertPInvokeCalliToCall(
624624
CORINFO_RESOLVED_TOKEN* pResolvedToken,
625625
bool mustConvert);
626626

627-
bool notifyInstructionSetUsage(
627+
void notifyInstructionSetUsage(
628628
CORINFO_InstructionSet instructionSet,
629629
bool supportEnabled);
630630

src/coreclr/ToolBox/superpmi/superpmi-shared/lwmlist.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ LWM(MergeClasses, DLDL, DWORDLONG)
151151
LWM(IsMoreSpecificType, DLDL, DWORD)
152152
LWM(PInvokeMarshalingRequired, PInvokeMarshalingRequiredValue, DWORD)
153153
LWM(ResolveToken, Agnostic_CORINFO_RESOLVED_TOKENin, ResolveTokenValue)
154-
LWM(TryResolveVirtualMethod, Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTin, TryResolveVirtualMethodValue)
154+
LWM(ResolveVirtualMethod, Agnostic_ResolveVirtualMethodKey, Agnostic_ResolveVirtualMethodResult)
155155
LWM(TryResolveToken, Agnostic_CORINFO_RESOLVED_TOKENin, TryResolveTokenValue)
156156
LWM(SatisfiesClassConstraints, DWORDLONG, DWORD)
157157
LWM(SatisfiesMethodConstraints, DLDL, DWORD)

src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.cpp

Lines changed: 64 additions & 69 deletions
Large diffs are not rendered by default.

src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.h

Lines changed: 20 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -123,18 +123,6 @@ class MethodContext
123123
DWORD pMethodSpec_Index;
124124
DWORD cbMethodSpec;
125125
};
126-
struct Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTin
127-
{
128-
DWORDLONG virtualMethod;
129-
DWORDLONG implementingClass;
130-
DWORDLONG ownerType;
131-
};
132-
struct Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTout
133-
{
134-
DWORDLONG devirtualizedMethod;
135-
DWORD requiresInstMethodTableArg;
136-
DWORDLONG patchedOwnerType;
137-
};
138126
struct GetArgTypeValue
139127
{
140128
DWORD flags;
@@ -207,12 +195,6 @@ class MethodContext
207195

208196
Agnostic_CORINFO_RESOLVED_TOKENout outValue;
209197
};
210-
struct Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT
211-
{
212-
Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTin inValue;
213-
214-
Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTout outValue;
215-
};
216198
struct Agnostic_GetFieldInfo
217199
{
218200
Agnostic_CORINFO_RESOLVED_TOKEN ResolvedToken;
@@ -525,6 +507,21 @@ class MethodContext
525507
DWORD result;
526508
};
527509

510+
struct Agnostic_ResolveVirtualMethodKey
511+
{
512+
DWORDLONG virtualMethod;
513+
DWORDLONG objClass;
514+
DWORDLONG context;
515+
};
516+
517+
struct Agnostic_ResolveVirtualMethodResult
518+
{
519+
bool returnValue;
520+
DWORDLONG devirtualizedMethod;
521+
bool requiresInstMethodTableArg;
522+
DWORDLONG exactContext;
523+
};
524+
528525
struct ResolveTokenValue
529526
{
530527
Agnostic_CORINFO_RESOLVED_TOKENout tokenOut;
@@ -537,12 +534,6 @@ class MethodContext
537534
DWORD success;
538535
};
539536

540-
struct TryResolveVirtualMethodValue
541-
{
542-
Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTout contextOut;
543-
DWORD success;
544-
};
545-
546537
struct GetTokenTypeAsHandleValue
547538
{
548539
DWORDLONG hMethod;
@@ -944,10 +935,9 @@ class MethodContext
944935
unsigned* offsetAfterIndirection,
945936
bool* isRelative);
946937

947-
void recTryResolveVirtualMethod(CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT* pResolvedMethod, bool success);
948-
void dmpTryResolveVirtualMethod(const Agnostic_CORINFO_VIRTUAL_METHOD_CALLER_CONTEXTin& key,
949-
const TryResolveVirtualMethodValue& value);
950-
bool repTryResolveVirtualMethod(CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT* pResolvedMethod);
938+
void recResolveVirtualMethod(CORINFO_DEVIRTUALIZATION_INFO * info, bool returnValue);
939+
void dmpResolveVirtualMethod(const Agnostic_ResolveVirtualMethodKey& key, const Agnostic_ResolveVirtualMethodResult& value);
940+
bool repResolveVirtualMethod(CORINFO_DEVIRTUALIZATION_INFO * info);
951941

952942
void recGetUnboxedEntry(CORINFO_METHOD_HANDLE ftn, bool* requiresInstMethodTableArg, CORINFO_METHOD_HANDLE result);
953943
void dmpGetUnboxedEntry(DWORDLONG key, DLD value);
@@ -1391,7 +1381,7 @@ class MethodContext
13911381
};
13921382

13931383
// ********************* Please keep this up-to-date to ease adding more ***************
1394-
// Highest packet number: 181
1384+
// Highest packet number: 184
13951385
// *************************************************************************************
13961386
enum mcPackets
13971387
{
@@ -1546,7 +1536,7 @@ enum mcPackets
15461536
Packet_IsMoreSpecificType = 174, // Added 2/14/2019
15471537
Packet_PInvokeMarshalingRequired = 108,
15481538
Packet_ResolveToken = 109,
1549-
Packet_TryResolveVirtualMethod = 160, // Added 2/13/17 // compatibility-wise is it safe to rename?
1539+
Packet_ResolveVirtualMethod = 160, // Added 2/13/17
15501540
Packet_TryResolveToken = 158, // Added 4/26/2016
15511541
Packet_SatisfiesClassConstraints = 110,
15521542
Packet_SatisfiesMethodConstraints = 111,

src/coreclr/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -230,14 +230,12 @@ void interceptor_ICJI::getMethodVTableOffset(CORINFO_METHOD_HANDLE method,
230230
mc->recGetMethodVTableOffset(method, offsetOfIndirection, offsetAfterIndirection, isRelative);
231231
}
232232

233-
// Find the virtual method in implementingClass that overrides virtualMethod.
234-
// Return false if devirtualization is not possible.
235-
bool interceptor_ICJI::tryResolveVirtualMethod(CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT* virtualMethodContext /* IN, OUT */)
233+
bool interceptor_ICJI::resolveVirtualMethod(CORINFO_DEVIRTUALIZATION_INFO * info)
236234
{
237-
mc->cr->AddCall("tryResolveVirtualMethod");
238-
bool success = original_ICorJitInfo->tryResolveVirtualMethod(virtualMethodContext);
239-
mc->recTryResolveVirtualMethod(virtualMethodContext, success);
240-
return success;
235+
mc->cr->AddCall("resolveVirtualMethod");
236+
bool result = original_ICorJitInfo->resolveVirtualMethod(info);
237+
mc->recResolveVirtualMethod(info, result);
238+
return result;
241239
}
242240

243241
// Get the unboxed entry point for a method, if possible.
@@ -2107,7 +2105,7 @@ DWORD interceptor_ICJI::getExpectedTargetArchitecture()
21072105
return original_ICorJitInfo->getExpectedTargetArchitecture();
21082106
}
21092107

2110-
bool interceptor_ICJI::notifyInstructionSetUsage(CORINFO_InstructionSet instructionSet, bool supported)
2108+
void interceptor_ICJI::notifyInstructionSetUsage(CORINFO_InstructionSet instructionSet, bool supported)
21112109
{
2112-
return original_ICorJitInfo->notifyInstructionSetUsage(instructionSet, supported);
2110+
original_ICorJitInfo->notifyInstructionSetUsage(instructionSet, supported);
21132111
}

src/coreclr/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
// DO NOT EDIT THIS FILE! IT IS AUTOGENERATED
5-
// To regenerate run the gen script in src/coreclr/tools/Common/JitInterface/ThunkGenerator
5+
// To regenerate run the gen script in src/coreclr/src/tools/Common/JitInterface/ThunkGenerator
66
// and follow the instructions in docs/project/updating-jitinterface.md
77

88
#include "standardpch.h"
@@ -1225,12 +1225,12 @@ bool interceptor_ICJI::convertPInvokeCalliToCall(
12251225
return original_ICorJitInfo->convertPInvokeCalliToCall(pResolvedToken, mustConvert);
12261226
}
12271227

1228-
bool interceptor_ICJI::notifyInstructionSetUsage(
1228+
void interceptor_ICJI::notifyInstructionSetUsage(
12291229
CORINFO_InstructionSet instructionSet,
12301230
bool supportEnabled)
12311231
{
12321232
mcs->AddCall("notifyInstructionSetUsage");
1233-
return original_ICorJitInfo->notifyInstructionSetUsage(instructionSet, supportEnabled);
1233+
original_ICorJitInfo->notifyInstructionSetUsage(instructionSet, supportEnabled);
12341234
}
12351235

12361236
void interceptor_ICJI::allocMem(

src/coreclr/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
// DO NOT EDIT THIS FILE! IT IS AUTOGENERATED
5-
// To regenerate run the gen script in src/coreclr/tools/Common/JitInterface/ThunkGenerator
5+
// To regenerate run the gen script in src/coreclr/src/tools/Common/JitInterface/ThunkGenerator
66
// and follow the instructions in docs/project/updating-jitinterface.md
77

88
#include "standardpch.h"
@@ -1072,11 +1072,11 @@ bool interceptor_ICJI::convertPInvokeCalliToCall(
10721072
return original_ICorJitInfo->convertPInvokeCalliToCall(pResolvedToken, mustConvert);
10731073
}
10741074

1075-
bool interceptor_ICJI::notifyInstructionSetUsage(
1075+
void interceptor_ICJI::notifyInstructionSetUsage(
10761076
CORINFO_InstructionSet instructionSet,
10771077
bool supportEnabled)
10781078
{
1079-
return original_ICorJitInfo->notifyInstructionSetUsage(instructionSet, supportEnabled);
1079+
original_ICorJitInfo->notifyInstructionSetUsage(instructionSet, supportEnabled);
10801080
}
10811081

10821082
void interceptor_ICJI::allocMem(

src/coreclr/inc/corinfo.h

Lines changed: 12 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,8 @@ enum CorInfoHelpFunc
595595
CORINFO_HELP_COUNT,
596596
};
597597

598+
#define CORINFO_HELP_READYTORUN_ATYPICAL_CALLSITE 0x40000000
599+
598600
//This describes the signature for a helper method.
599601
enum CorInfoHelpSig
600602
{
@@ -621,7 +623,7 @@ enum CorInfoType
621623
{
622624
CORINFO_TYPE_UNDEF = 0x0,
623625
CORINFO_TYPE_VOID = 0x1,
624-
CORINFO_TYPE_BOOL = 0x2,
626+
CORINFO_TYPE_bool = 0x2,
625627
CORINFO_TYPE_CHAR = 0x3,
626628
CORINFO_TYPE_BYTE = 0x4,
627629
CORINFO_TYPE_UBYTE = 0x5,
@@ -698,25 +700,17 @@ inline bool IsCallerPop(CorInfoCallConv callConv)
698700
}
699701
#endif // UNIX_X86_ABI
700702

701-
// Represents the calling conventions supported with the extensible calling convention syntax
702-
// as well as the original metadata-encoded calling conventions.
703703
enum CorInfoUnmanagedCallConv
704704
{
705705
// These correspond to CorUnmanagedCallingConvention
706+
706707
CORINFO_UNMANAGED_CALLCONV_UNKNOWN,
707708
CORINFO_UNMANAGED_CALLCONV_C,
708709
CORINFO_UNMANAGED_CALLCONV_STDCALL,
709710
CORINFO_UNMANAGED_CALLCONV_THISCALL,
710711
CORINFO_UNMANAGED_CALLCONV_FASTCALL
711-
// New calling conventions supported with the extensible calling convention encoding go here.
712712
};
713713

714-
// Determines whether or not this calling convention is an instance method calling convention.
715-
inline bool callConvIsInstanceMethodCallConv(CorInfoUnmanagedCallConv callConv)
716-
{
717-
return callConv == CORINFO_UNMANAGED_CALLCONV_THISCALL;
718-
}
719-
720714
// These are returned from getMethodOptions
721715
enum CorInfoOptions
722716
{
@@ -824,7 +818,7 @@ enum CORINFO_ACCESS_FLAGS
824818
CORINFO_ACCESS_SET = 0x0200, // Field set (stfld)
825819
CORINFO_ACCESS_ADDRESS = 0x0400, // Field address (ldflda)
826820
CORINFO_ACCESS_INIT_ARRAY = 0x0800, // Field use for InitializeArray
827-
// UNUSED = 0x4000,
821+
CORINFO_ACCESS_ATYPICAL_CALLSITE = 0x4000, // Atypical callsite that cannot be disassembled by delay loading helper
828822
CORINFO_ACCESS_INLINECHECK= 0x8000, // Return fieldFlags and fieldAccessor only. Used by JIT64 during inlining.
829823
};
830824

@@ -1465,7 +1459,7 @@ enum CORINFO_CALLINFO_FLAGS
14651459
CORINFO_CALLINFO_VERIFICATION = 0x0008, // Gets extra verification information.
14661460
CORINFO_CALLINFO_SECURITYCHECKS = 0x0010, // Perform security checks.
14671461
CORINFO_CALLINFO_LDFTN = 0x0020, // Resolving target of LDFTN
1468-
// UNUSED = 0x0040,
1462+
CORINFO_CALLINFO_ATYPICAL_CALLSITE = 0x0040, // Atypical callsite that cannot be disassembled by delay loading helper
14691463
};
14701464

14711465
enum CorInfoIsAccessAllowedResult
@@ -1537,29 +1531,6 @@ struct CORINFO_RESOLVED_TOKEN
15371531
ULONG cbMethodSpec;
15381532
};
15391533

1540-
struct CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT
1541-
{
1542-
//
1543-
// [In] arguments of tryResolveVirtualMethod
1544-
//
1545-
CORINFO_METHOD_HANDLE virtualMethod;
1546-
CORINFO_CLASS_HANDLE implementingClass;
1547-
CORINFO_CONTEXT_HANDLE ownerType;
1548-
1549-
1550-
//
1551-
// [Out] arguments of tryResolveVirtualMethod.
1552-
// - devirtualizedMethod is set to MethodDesc of devirt'ed method iff we were able to devirtualize.
1553-
// invariant is `tryResolveVirtualMethod(...) == (devirtualizedMethod != nullptr)`.
1554-
// - requiresInstMethodTableArg is set to TRUE iff jit has to pass "secret" type handle arg.
1555-
// - patchedOwnerType is set to wrapped CORINFO_CLASS_HANDLE of devirt'ed method table.
1556-
// - (!) two last out params have their meaning only when we devirt'ed into DIM.
1557-
//
1558-
CORINFO_METHOD_HANDLE devirtualizedMethod;
1559-
bool requiresInstMethodTableArg;
1560-
CORINFO_CONTEXT_HANDLE patchedOwnerType;
1561-
};
1562-
15631534
struct CORINFO_CALL_INFO
15641535
{
15651536
CORINFO_METHOD_HANDLE hMethod; //target method handle
@@ -2065,18 +2036,13 @@ class ICorStaticInfo
20652036
// or the method in info->objClass that implements the interface method
20662037
// represented by info->virtualMethod.
20672038
//
2068-
// Return true if devirtualization is possible. `virtualMethodContext.ownerType` is optional
2069-
// and provides additional context for shared interface devirtualization.
2070-
virtual bool tryResolveVirtualMethod(
2071-
CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT * virtualMethodContext /* IN, OUT */
2072-
) = 0;
2073-
2074-
2039+
// Returns false if devirtualization is not possible.
2040+
virtual bool resolveVirtualMethod(CORINFO_DEVIRTUALIZATION_INFO * info) = 0;
20752041

20762042
// Get the unboxed entry point for a method, if possible.
20772043
virtual CORINFO_METHOD_HANDLE getUnboxedEntry(
20782044
CORINFO_METHOD_HANDLE ftn,
2079-
bool* requiresInstMethodTableArg
2045+
bool* requiresInstMethodTableArg = NULL /* OUT */
20802046
) = 0;
20812047

20822048
// Given T, return the type of the default EqualityComparer<T>.
@@ -2332,7 +2298,7 @@ class ICorStaticInfo
23322298

23332299
virtual unsigned getClassAlignmentRequirement (
23342300
CORINFO_CLASS_HANDLE cls,
2335-
bool fDoubleAlignHint = false
2301+
bool fDoubleAlignHint = FALSE
23362302
) = 0;
23372303

23382304
// This is only called for Value classes. It returns a boolean array
@@ -2369,7 +2335,7 @@ class ICorStaticInfo
23692335
virtual CorInfoHelpFunc getNewHelper(
23702336
CORINFO_RESOLVED_TOKEN * pResolvedToken,
23712337
CORINFO_METHOD_HANDLE callerHandle,
2372-
bool * pHasSideEffects
2338+
bool * pHasSideEffects = NULL /* OUT */
23732339
) = 0;
23742340

23752341
// returns the newArr (1-Dim array) helper optimized for "arrayCls."
@@ -3137,8 +3103,7 @@ class ICorDynamicInfo : public ICorStaticInfo
31373103
bool fMustConvert
31383104
) = 0;
31393105

3140-
// Notify EE about intent to use or not to use instruction set in the method. Returns true if the instruction set is supported unconditionally.
3141-
virtual bool notifyInstructionSetUsage(
3106+
virtual void notifyInstructionSetUsage(
31423107
CORINFO_InstructionSet instructionSet,
31433108
bool supportEnabled
31443109
) = 0;

src/coreclr/jit/ICorJitInfo_API_wrapper.hpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
// DO NOT EDIT THIS FILE! IT IS AUTOGENERATED
5-
// To regenerate run the gen script in src/coreclr/tools/Common/JitInterface/ThunkGenerator
5+
// To regenerate run the gen script in src/coreclr/src/tools/Common/JitInterface/ThunkGenerator
66
// and follow the instructions in docs/project/updating-jitinterface.md
77

88
#define API_ENTER(name) wrapComp->CLR_API_Enter(API_##name);
@@ -135,11 +135,12 @@ void WrapICorJitInfo::getMethodVTableOffset(
135135
API_LEAVE(getMethodVTableOffset);
136136
}
137137

138-
bool WrapICorJitInfo::tryResolveVirtualMethod(CORINFO_VIRTUAL_METHOD_CALLER_CONTEXT * virtualMethodContext /* IN, OUT */)
138+
bool WrapICorJitInfo::resolveVirtualMethod(
139+
CORINFO_DEVIRTUALIZATION_INFO* info)
139140
{
140-
API_ENTER(tryResolveVirtualMethod);
141-
bool temp = wrapHnd->tryResolveVirtualMethod(virtualMethodContext);
142-
API_LEAVE(tryResolveVirtualMethod);
141+
API_ENTER(resolveVirtualMethod);
142+
bool temp = wrapHnd->resolveVirtualMethod(info);
143+
API_LEAVE(resolveVirtualMethod);
143144
return temp;
144145
}
145146

@@ -1494,14 +1495,13 @@ bool WrapICorJitInfo::convertPInvokeCalliToCall(
14941495
return temp;
14951496
}
14961497

1497-
bool WrapICorJitInfo::notifyInstructionSetUsage(
1498+
void WrapICorJitInfo::notifyInstructionSetUsage(
14981499
CORINFO_InstructionSet instructionSet,
14991500
bool supportEnabled)
15001501
{
15011502
API_ENTER(notifyInstructionSetUsage);
1502-
bool temp = wrapHnd->notifyInstructionSetUsage(instructionSet, supportEnabled);
1503+
wrapHnd->notifyInstructionSetUsage(instructionSet, supportEnabled);
15031504
API_LEAVE(notifyInstructionSetUsage);
1504-
return temp;
15051505
}
15061506

15071507
void WrapICorJitInfo::allocMem(

0 commit comments

Comments
 (0)