Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

JIT: import static readonly fields holding frozen objects as const handles #76112

Merged
merged 70 commits into from
Oct 10, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
0fdefe2
handle static readonly for frozen objects in jit
EgorBo Sep 24, 2022
07fdafc
Address Jan's feedback
EgorBo Sep 24, 2022
ad69145
Address feedback
EgorBo Sep 24, 2022
f10b886
Mitigate regressions via getObjectType
EgorBo Sep 24, 2022
9bf46c6
Merge branch 'main' of github.com:dotnet/runtime into frozen-static-r…
EgorBo Sep 24, 2022
97c3cdf
use memcpy
EgorBo Sep 24, 2022
fd7e742
Address feedback
EgorBo Sep 24, 2022
75c40ae
make jit-format happy
EgorBo Sep 24, 2022
283b833
Fix FitsI32 assert
EgorBo Sep 24, 2022
00e3e69
clean up in methodcontext
EgorBo Sep 24, 2022
f7902d2
Update importer.cpp
EgorBo Sep 24, 2022
bf7947f
Implement getObjectType for ILC
EgorBo Sep 24, 2022
3f756d9
Merge branch 'frozen-static-readonly' of github.com:EgorBo/runtime-1 …
EgorBo Sep 24, 2022
5374bea
fix clang/gcc
EgorBo Sep 24, 2022
548dc9c
Update src/coreclr/vm/jitinterface.cpp
EgorBo Sep 24, 2022
1234e97
Address feedback
EgorBo Sep 24, 2022
1c584a1
Initial impl for NativeAOT
EgorBo Sep 25, 2022
1fc50c7
Use PreinitializationInfo
EgorBo Sep 25, 2022
600209f
Handle strings
EgorBo Sep 25, 2022
4cad20a
Update src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs
EgorBo Sep 25, 2022
28f2749
Apply suggestions from code review
EgorBo Sep 25, 2022
594a6c2
Merge branch 'frozen-static-readonly' of github.com:EgorBo/runtime-1 …
EgorBo Sep 25, 2022
a07232d
clean up
EgorBo Sep 25, 2022
0c6fe27
Add a comment
EgorBo Sep 25, 2022
271f442
Fix build
EgorBo Sep 25, 2022
76f6cdc
Fix build
EgorBo Sep 25, 2022
133c268
Address Michal's feedback
EgorBo Sep 26, 2022
8880954
Address Michal's feedback
EgorBo Sep 26, 2022
63cd7cc
Simplify PM switch
EgorBo Sep 26, 2022
2656719
Implement getObjectType for FrozenObjectNode
EgorBo Sep 26, 2022
1006572
Address feedback
EgorBo Sep 26, 2022
543a5f5
Merge branch 'main' of github.com:dotnet/runtime into frozen-static-r…
EgorBo Sep 26, 2022
0d27470
Add isObjectImmutable
EgorBo Sep 26, 2022
48343ee
Update gcinfo.cpp
EgorBo Sep 26, 2022
7264f67
fix getRuntimeTypePointer on NativeAOT
EgorBo Sep 26, 2022
9aa1b6c
Merge branch 'frozen-static-readonly' of github.com:EgorBo/runtime-1 …
EgorBo Sep 26, 2022
8d4048a
fix getRuntimeTypePointer on NativeAOT
EgorBo Sep 26, 2022
edb4cd3
Merge branch 'main' of github.com:dotnet/runtime into frozen-static-r…
EgorBo Sep 26, 2022
0e75429
Merge branch 'main' of github.com:dotnet/runtime into frozen-static-r…
EgorBo Oct 6, 2022
44a8fc6
Fix compilation
EgorBo Oct 6, 2022
256bbd4
Apply suggestions from code review
EgorBo Oct 6, 2022
fefbbe1
ILC: use correct TargetPtrSize
EgorBo Oct 6, 2022
3d06a33
Address feedback
EgorBo Oct 6, 2022
afefe44
Add support for delegates, empty arrays and objects without fields
EgorBo Oct 6, 2022
eece561
Add some comments
EgorBo Oct 6, 2022
e2ae117
Update src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/TypePreinit.cs
EgorBo Oct 6, 2022
34b39cb
Apply suggestions from code review
EgorBo Oct 6, 2022
22baa43
Ah, actually we need that condition, it can be a struct
EgorBo Oct 6, 2022
4752354
Address Jakob's feedback
EgorBo Oct 7, 2022
49ab023
fix compilation
EgorBo Oct 7, 2022
08d59f5
Use AssertMapExistsNoMessage
EgorBo Oct 7, 2022
45cd02b
Address feedback
EgorBo Oct 7, 2022
b578780
Update src/coreclr/vm/jitinterface.cpp
EgorBo Oct 7, 2022
84de4d2
Address feedback
EgorBo Oct 7, 2022
05e2639
fix compilation
EgorBo Oct 7, 2022
771fd6a
Update src/coreclr/vm/jitinterface.cpp
EgorBo Oct 7, 2022
1acf664
Update src/coreclr/vm/jitinterface.cpp
EgorBo Oct 7, 2022
806e985
Address feedback
EgorBo Oct 7, 2022
2a0fc88
add assert
EgorBo Oct 7, 2022
fe169c6
limit to primitives and objects on llc side
EgorBo Oct 7, 2022
30fbd21
fix check
EgorBo Oct 7, 2022
7c2d8dc
Apply suggestions from code review
EgorBo Oct 8, 2022
be7c16f
Fix indention since "if" was removed
EgorBo Oct 8, 2022
5fbe665
Apply suggestions from code review
EgorBo Oct 8, 2022
56908b0
Address feedback, align NativeAOT logic with CoreCLR
EgorBo Oct 8, 2022
cbe5cd0
Update src/coreclr/tools/aot/ILCompiler.RyuJit/JitInterface/CorInfoIm…
EgorBo Oct 8, 2022
76a72d8
Update src/coreclr/vm/jitinterface.cpp
jkotas Oct 8, 2022
aa5be51
Keep IsThreadStatic on vm side
EgorBo Oct 8, 2022
0f8b7cd
Merge branch 'main' of github.com:dotnet/runtime into frozen-static-r…
EgorBo Oct 9, 2022
e4ce64d
Merge branch 'main' of github.com:dotnet/runtime into frozen-static-r…
EgorBo Oct 10, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/coreclr/inc/corinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -3150,6 +3150,11 @@ class ICorDynamicInfo : public ICorStaticInfo
void **ppIndirection = NULL
) = 0;

// Returns frozen object handle if field is a static readonly field of an initialized type
virtual void* getFrozenHandleFromInitedStaticField(
CORINFO_FIELD_HANDLE field
) = 0;

// If pIsSpeculative is NULL, return the class handle for the value of ref-class typed
// static readonly fields, if there is a unique location for the static and the class
// is already initialized.
Expand Down
3 changes: 3 additions & 0 deletions src/coreclr/inc/icorjitinfoimpl_generated.h
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,9 @@ void* getFieldAddress(
CORINFO_FIELD_HANDLE field,
void** ppIndirection) override;

void* getFrozenHandleFromInitedStaticField(
CORINFO_FIELD_HANDLE field) override;

CORINFO_CLASS_HANDLE getStaticFieldCurrentClass(
CORINFO_FIELD_HANDLE field,
bool* pIsSpeculative) override;
Expand Down
10 changes: 5 additions & 5 deletions src/coreclr/inc/jiteeversionguid.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ typedef const GUID *LPCGUID;
#define GUID_DEFINED
#endif // !GUID_DEFINED

constexpr GUID JITEEVersionIdentifier = { /* 11b4ea58-c400-4c3d-995e-4e2f0676f6e8 */
0x11b4ea58,
0xc400,
0x4c3d,
{0x99, 0x5e, 0x4e, 0x2f, 0x6, 0x76, 0xf6, 0xe8}
constexpr GUID JITEEVersionIdentifier = { /* ebc78c0f-f765-41ea-9cf3-519e36dc6ce2 */
0xebc78c0f,
0xf765,
0x41ea,
{0x9c, 0xf3, 0x51, 0x9e, 0x36, 0xdc, 0x6c, 0xe2}
};

//////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/jit/ICorJitInfo_API_names.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ DEF_CLR_API(canAccessFamily)
DEF_CLR_API(isRIDClassDomainID)
DEF_CLR_API(getClassDomainID)
DEF_CLR_API(getFieldAddress)
DEF_CLR_API(getFrozenHandleFromInitedStaticField)
DEF_CLR_API(getStaticFieldCurrentClass)
DEF_CLR_API(getVarArgsHandle)
DEF_CLR_API(canGetVarArgsHandle)
Expand Down
9 changes: 9 additions & 0 deletions src/coreclr/jit/ICorJitInfo_API_wrapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1450,6 +1450,15 @@ void* WrapICorJitInfo::getFieldAddress(
return temp;
}

void* WrapICorJitInfo::getFrozenHandleFromInitedStaticField(
CORINFO_FIELD_HANDLE field)
{
API_ENTER(getFrozenHandleFromInitedStaticField);
void* temp = wrapHnd->getFrozenHandleFromInitedStaticField(field);
API_LEAVE(getFrozenHandleFromInitedStaticField);
return temp;
}

CORINFO_CLASS_HANDLE WrapICorJitInfo::getStaticFieldCurrentClass(
CORINFO_FIELD_HANDLE field,
bool* pIsSpeculative)
Expand Down
43 changes: 30 additions & 13 deletions src/coreclr/jit/importer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15287,30 +15287,47 @@ void Compiler::impImportBlockCode(BasicBlock* block)
// Replace static read-only fields with constant if possible
if ((aflags & CORINFO_ACCESS_GET) && (fieldInfo.fieldFlags & CORINFO_FLG_FIELD_FINAL) &&
!(fieldInfo.fieldFlags & CORINFO_FLG_FIELD_STATIC_IN_HEAP) &&
(varTypeIsIntegral(lclTyp) || varTypeIsFloating(lclTyp)))
(varTypeIsIntegral(lclTyp) || varTypeIsFloating(lclTyp) || (lclTyp == TYP_REF)))
{
CorInfoInitClassResult initClassResult =
info.compCompHnd->initClass(resolvedToken.hField, info.compMethodHnd,
impTokenLookupContextHandle);

if (initClassResult & CORINFO_INITCLASS_INITIALIZED)
{
void** pFldAddr = nullptr;
void* fldAddr =
info.compCompHnd->getFieldAddress(resolvedToken.hField, (void**)&pFldAddr);
if (varTypeIsIntegral(lclTyp) || varTypeIsFloating(lclTyp))
{
void** pFldAddr = nullptr;
void* fldAddr =
info.compCompHnd->getFieldAddress(resolvedToken.hField, (void**)&pFldAddr);

// We should always be able to access this static's address directly
//
assert(pFldAddr == nullptr);
// We should always be able to access this static's address directly
//
assert(pFldAddr == nullptr);

op1 = impImportStaticReadOnlyField(fldAddr, lclTyp);
op1 = impImportStaticReadOnlyField(fldAddr, lclTyp);

// Widen small types since we're propagating the value
// instead of producing an indir.
//
op1->gtType = genActualType(lclTyp);
// Widen small types since we're propagating the value
// instead of producing an indir.
//
op1->gtType = genActualType(lclTyp);

goto FIELD_DONE;
goto FIELD_DONE;
}
else
{
assert(lclTyp == TYP_REF);
void* frozenHandle =
info.compCompHnd->getFrozenHandleFromInitedStaticField(resolvedToken.hField);
if (frozenHandle != nullptr)
{
setMethodHasFrozenObjects();
op1 = gtNewIconEmbHndNode(frozenHandle, nullptr, GTF_ICON_OBJ_HDL, nullptr);
op1->gtType = TYP_REF;
INDEBUG(op1->AsIntCon()->gtTargetHandle = (size_t)frozenHandle);
goto FIELD_DONE;
}
}
}
}

Expand Down
76 changes: 46 additions & 30 deletions src/coreclr/tools/Common/JitInterface/CorInfoBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2198,6 +2198,21 @@ private static uint _getClassDomainID(IntPtr thisHandle, IntPtr* ppException, CO
}
}

[UnmanagedCallersOnly]
private static void* _getFrozenHandleFromInitedStaticField(IntPtr thisHandle, IntPtr* ppException, CORINFO_FIELD_STRUCT_* field)
{
var _this = GetThis(thisHandle);
try
{
return _this.getFrozenHandleFromInitedStaticField(field);
}
catch (Exception ex)
{
*ppException = _this.AllocException(ex);
return default;
}
}

[UnmanagedCallersOnly]
private static CORINFO_CLASS_STRUCT_* _getStaticFieldCurrentClass(IntPtr thisHandle, IntPtr* ppException, CORINFO_FIELD_STRUCT_* field, byte* pIsSpeculative)
{
Expand Down Expand Up @@ -2625,7 +2640,7 @@ private static uint _getJitFlags(IntPtr thisHandle, IntPtr* ppException, CORJIT_

private static IntPtr GetUnmanagedCallbacks()
{
void** callbacks = (void**)Marshal.AllocCoTaskMem(sizeof(IntPtr) * 177);
void** callbacks = (void**)Marshal.AllocCoTaskMem(sizeof(IntPtr) * 178);

callbacks[0] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_METHOD_STRUCT_*, byte>)&_isIntrinsic;
callbacks[1] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_METHOD_STRUCT_*, uint>)&_getMethodAttribs;
Expand Down Expand Up @@ -2775,35 +2790,36 @@ private static IntPtr GetUnmanagedCallbacks()
callbacks[145] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, byte>)&_isRIDClassDomainID;
callbacks[146] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*, void**, uint>)&_getClassDomainID;
callbacks[147] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_FIELD_STRUCT_*, void**, void*>)&_getFieldAddress;
callbacks[148] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_FIELD_STRUCT_*, byte*, CORINFO_CLASS_STRUCT_*>)&_getStaticFieldCurrentClass;
callbacks[149] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_SIG_INFO*, void**, IntPtr>)&_getVarArgsHandle;
callbacks[150] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_SIG_INFO*, byte>)&_canGetVarArgsHandle;
callbacks[151] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_MODULE_STRUCT_*, mdToken, void**, InfoAccessType>)&_constructStringLiteral;
callbacks[152] = (delegate* unmanaged<IntPtr, IntPtr*, void**, InfoAccessType>)&_emptyStringLiteral;
callbacks[153] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_FIELD_STRUCT_*, void**, uint>)&_getFieldThreadLocalStoreID;
callbacks[154] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_MODULE_STRUCT_*, CORINFO_MODULE_STRUCT_*, void>)&_addActiveDependency;
callbacks[155] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_METHOD_STRUCT_*, CORINFO_CLASS_STRUCT_*, CORINFO_METHOD_STRUCT_*, DelegateCtorArgs*, CORINFO_METHOD_STRUCT_*>)&_GetDelegateCtor;
callbacks[156] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_METHOD_STRUCT_*, void>)&_MethodCompileComplete;
callbacks[157] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_RESOLVED_TOKEN*, CORINFO_SIG_INFO*, CORINFO_GET_TAILCALL_HELPERS_FLAGS, CORINFO_TAILCALL_HELPERS*, byte>)&_getTailCallHelpers;
callbacks[158] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_RESOLVED_TOKEN*, byte, byte>)&_convertPInvokeCalliToCall;
callbacks[159] = (delegate* unmanaged<IntPtr, IntPtr*, InstructionSet, byte, byte>)&_notifyInstructionSetUsage;
callbacks[160] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CONST_LOOKUP*, void>)&_updateEntryPointForTailCall;
callbacks[161] = (delegate* unmanaged<IntPtr, IntPtr*, AllocMemArgs*, void>)&_allocMem;
callbacks[162] = (delegate* unmanaged<IntPtr, IntPtr*, byte, byte, uint, void>)&_reserveUnwindInfo;
callbacks[163] = (delegate* unmanaged<IntPtr, IntPtr*, byte*, byte*, uint, uint, uint, byte*, CorJitFuncKind, void>)&_allocUnwindInfo;
callbacks[164] = (delegate* unmanaged<IntPtr, IntPtr*, UIntPtr, void*>)&_allocGCInfo;
callbacks[165] = (delegate* unmanaged<IntPtr, IntPtr*, uint, void>)&_setEHcount;
callbacks[166] = (delegate* unmanaged<IntPtr, IntPtr*, uint, CORINFO_EH_CLAUSE*, void>)&_setEHinfo;
callbacks[167] = (delegate* unmanaged<IntPtr, IntPtr*, uint, byte*, IntPtr, byte>)&_logMsg;
callbacks[168] = (delegate* unmanaged<IntPtr, IntPtr*, byte*, int, byte*, int>)&_doAssert;
callbacks[169] = (delegate* unmanaged<IntPtr, IntPtr*, CorJitResult, void>)&_reportFatalError;
callbacks[170] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_METHOD_STRUCT_*, PgoInstrumentationSchema**, uint*, byte**, PgoSource*, HRESULT>)&_getPgoInstrumentationResults;
callbacks[171] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_METHOD_STRUCT_*, PgoInstrumentationSchema*, uint, byte**, HRESULT>)&_allocPgoInstrumentationBySchema;
callbacks[172] = (delegate* unmanaged<IntPtr, IntPtr*, uint, CORINFO_SIG_INFO*, CORINFO_METHOD_STRUCT_*, void>)&_recordCallSite;
callbacks[173] = (delegate* unmanaged<IntPtr, IntPtr*, void*, void*, void*, ushort, ushort, int, void>)&_recordRelocation;
callbacks[174] = (delegate* unmanaged<IntPtr, IntPtr*, void*, ushort>)&_getRelocTypeHint;
callbacks[175] = (delegate* unmanaged<IntPtr, IntPtr*, uint>)&_getExpectedTargetArchitecture;
callbacks[176] = (delegate* unmanaged<IntPtr, IntPtr*, CORJIT_FLAGS*, uint, uint>)&_getJitFlags;
callbacks[148] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_FIELD_STRUCT_*, void*>)&_getFrozenHandleFromInitedStaticField;
callbacks[149] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_FIELD_STRUCT_*, byte*, CORINFO_CLASS_STRUCT_*>)&_getStaticFieldCurrentClass;
callbacks[150] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_SIG_INFO*, void**, IntPtr>)&_getVarArgsHandle;
callbacks[151] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_SIG_INFO*, byte>)&_canGetVarArgsHandle;
callbacks[152] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_MODULE_STRUCT_*, mdToken, void**, InfoAccessType>)&_constructStringLiteral;
callbacks[153] = (delegate* unmanaged<IntPtr, IntPtr*, void**, InfoAccessType>)&_emptyStringLiteral;
callbacks[154] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_FIELD_STRUCT_*, void**, uint>)&_getFieldThreadLocalStoreID;
callbacks[155] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_MODULE_STRUCT_*, CORINFO_MODULE_STRUCT_*, void>)&_addActiveDependency;
callbacks[156] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_METHOD_STRUCT_*, CORINFO_CLASS_STRUCT_*, CORINFO_METHOD_STRUCT_*, DelegateCtorArgs*, CORINFO_METHOD_STRUCT_*>)&_GetDelegateCtor;
callbacks[157] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_METHOD_STRUCT_*, void>)&_MethodCompileComplete;
callbacks[158] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_RESOLVED_TOKEN*, CORINFO_SIG_INFO*, CORINFO_GET_TAILCALL_HELPERS_FLAGS, CORINFO_TAILCALL_HELPERS*, byte>)&_getTailCallHelpers;
callbacks[159] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_RESOLVED_TOKEN*, byte, byte>)&_convertPInvokeCalliToCall;
callbacks[160] = (delegate* unmanaged<IntPtr, IntPtr*, InstructionSet, byte, byte>)&_notifyInstructionSetUsage;
callbacks[161] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_CONST_LOOKUP*, void>)&_updateEntryPointForTailCall;
callbacks[162] = (delegate* unmanaged<IntPtr, IntPtr*, AllocMemArgs*, void>)&_allocMem;
callbacks[163] = (delegate* unmanaged<IntPtr, IntPtr*, byte, byte, uint, void>)&_reserveUnwindInfo;
callbacks[164] = (delegate* unmanaged<IntPtr, IntPtr*, byte*, byte*, uint, uint, uint, byte*, CorJitFuncKind, void>)&_allocUnwindInfo;
callbacks[165] = (delegate* unmanaged<IntPtr, IntPtr*, UIntPtr, void*>)&_allocGCInfo;
callbacks[166] = (delegate* unmanaged<IntPtr, IntPtr*, uint, void>)&_setEHcount;
callbacks[167] = (delegate* unmanaged<IntPtr, IntPtr*, uint, CORINFO_EH_CLAUSE*, void>)&_setEHinfo;
callbacks[168] = (delegate* unmanaged<IntPtr, IntPtr*, uint, byte*, IntPtr, byte>)&_logMsg;
callbacks[169] = (delegate* unmanaged<IntPtr, IntPtr*, byte*, int, byte*, int>)&_doAssert;
callbacks[170] = (delegate* unmanaged<IntPtr, IntPtr*, CorJitResult, void>)&_reportFatalError;
callbacks[171] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_METHOD_STRUCT_*, PgoInstrumentationSchema**, uint*, byte**, PgoSource*, HRESULT>)&_getPgoInstrumentationResults;
callbacks[172] = (delegate* unmanaged<IntPtr, IntPtr*, CORINFO_METHOD_STRUCT_*, PgoInstrumentationSchema*, uint, byte**, HRESULT>)&_allocPgoInstrumentationBySchema;
callbacks[173] = (delegate* unmanaged<IntPtr, IntPtr*, uint, CORINFO_SIG_INFO*, CORINFO_METHOD_STRUCT_*, void>)&_recordCallSite;
callbacks[174] = (delegate* unmanaged<IntPtr, IntPtr*, void*, void*, void*, ushort, ushort, int, void>)&_recordRelocation;
callbacks[175] = (delegate* unmanaged<IntPtr, IntPtr*, void*, ushort>)&_getRelocTypeHint;
callbacks[176] = (delegate* unmanaged<IntPtr, IntPtr*, uint>)&_getExpectedTargetArchitecture;
callbacks[177] = (delegate* unmanaged<IntPtr, IntPtr*, CORJIT_FLAGS*, uint, uint>)&_getJitFlags;

return (IntPtr)callbacks;
}
Expand Down
7 changes: 7 additions & 0 deletions src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3306,6 +3306,13 @@ private uint getClassDomainID(CORINFO_CLASS_STRUCT_* cls, ref void* ppIndirectio
}
}

#pragma warning disable CA1822 // Mark members as static
EgorBo marked this conversation as resolved.
Show resolved Hide resolved
private void* getFrozenHandleFromInitedStaticField(CORINFO_FIELD_STRUCT_* field)
EgorBo marked this conversation as resolved.
Show resolved Hide resolved
#pragma warning restore CA1822 // Mark members as static
EgorBo marked this conversation as resolved.
Show resolved Hide resolved
{
return null;
}

private CORINFO_CLASS_STRUCT_* getStaticFieldCurrentClass(CORINFO_FIELD_STRUCT_* field, byte* pIsSpeculative)
{
if (pIsSpeculative != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ FUNCTIONS
bool isRIDClassDomainID(CORINFO_CLASS_HANDLE cls);
unsigned getClassDomainID (CORINFO_CLASS_HANDLE cls, void **ppIndirection);
void* getFieldAddress(CORINFO_FIELD_HANDLE field, VOIDSTARSTAR ppIndirection);
void* getFrozenHandleFromInitedStaticField(CORINFO_FIELD_HANDLE field);
CORINFO_CLASS_HANDLE getStaticFieldCurrentClass(CORINFO_FIELD_HANDLE field, BoolStar pIsSpeculative);
CORINFO_VARARGS_HANDLE getVarArgsHandle(CORINFO_SIG_INFO *pSig, void **ppIndirection);
bool canGetVarArgsHandle(CORINFO_SIG_INFO *pSig);
Expand Down
10 changes: 10 additions & 0 deletions src/coreclr/tools/aot/jitinterface/jitinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ struct JitInterfaceCallbacks
bool (* isRIDClassDomainID)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_CLASS_HANDLE cls);
unsigned (* getClassDomainID)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_CLASS_HANDLE cls, void** ppIndirection);
void* (* getFieldAddress)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_FIELD_HANDLE field, void** ppIndirection);
void* (* getFrozenHandleFromInitedStaticField)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_FIELD_HANDLE field);
CORINFO_CLASS_HANDLE (* getStaticFieldCurrentClass)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_FIELD_HANDLE field, bool* pIsSpeculative);
CORINFO_VARARGS_HANDLE (* getVarArgsHandle)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_SIG_INFO* pSig, void** ppIndirection);
bool (* canGetVarArgsHandle)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_SIG_INFO* pSig);
Expand Down Expand Up @@ -1623,6 +1624,15 @@ class JitInterfaceWrapper : public ICorJitInfo
return temp;
}

virtual void* getFrozenHandleFromInitedStaticField(
CORINFO_FIELD_HANDLE field)
{
CorInfoExceptionClass* pException = nullptr;
void* temp = _callbacks->getFrozenHandleFromInitedStaticField(_thisHandle, &pException, field);
if (pException != nullptr) throw pException;
return temp;
}

virtual CORINFO_CLASS_HANDLE getStaticFieldCurrentClass(
CORINFO_FIELD_HANDLE field,
bool* pIsSpeculative)
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/tools/superpmi/superpmi-shared/lwmlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ LWM(GetDelegateCtor, Agnostic_GetDelegateCtorIn, Agnostic_GetDelegateCtorOut)
LWM(GetEEInfo, DWORD, Agnostic_CORINFO_EE_INFO)
LWM(GetEHinfo, DLD, Agnostic_CORINFO_EH_CLAUSE)
LWM(GetFieldAddress, DWORDLONG, Agnostic_GetFieldAddress)
LWM(GetFrozenHandleFromInitedStaticField, DWORDLONG, DWORDLONG)
LWM(GetStaticFieldCurrentClass, DWORDLONG, Agnostic_GetStaticFieldCurrentClass)
LWM(GetFieldClass, DWORDLONG, DWORDLONG)
LWM(GetFieldInClass, DLD, DWORDLONG)
Expand Down
Loading