Skip to content

Commit f204f50

Browse files
committed
Fix AOT failures
1 parent 993fb25 commit f204f50

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

src/coreclr/jit/importercalls.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3927,6 +3927,17 @@ GenTree* Compiler::impIntrinsic(CORINFO_CLASS_HANDLE clsHnd,
39273927

39283928
impPopStack(sig->numArgs);
39293929

3930+
if (ctor == NO_METHOD_HANDLE &&
3931+
info.compCompHnd->initClass(nullptr, nullptr, MAKE_CLASSCONTEXT(type)) !=
3932+
CORINFO_INITCLASS_INITIALIZED)
3933+
{
3934+
GenTreeCall* cctorCall = fgGetSharedCCtor(type);
3935+
if (cctorCall != nullptr)
3936+
{
3937+
impAppendTree(cctorCall, CHECK_SPILL_ALL, impCurStmtDI, false);
3938+
}
3939+
}
3940+
39303941
GenTree* instance;
39313942
unsigned lclNum = lvaGrabTemp(true DEBUGARG("NewObj constructor temp"));
39323943
if (structFastpath)
@@ -4020,11 +4031,6 @@ GenTree* Compiler::impIntrinsic(CORINFO_CLASS_HANDLE clsHnd,
40204031

40214032
impAppendTree(invoke, CHECK_SPILL_ALL, impCurStmtDI, false);
40224033
}
4023-
else if (info.compCompHnd->initClass(nullptr, nullptr, MAKE_CLASSCONTEXT(type)) !=
4024-
CORINFO_INITCLASS_INITIALIZED)
4025-
{
4026-
impAppendTree(fgGetSharedCCtor(type), CHECK_SPILL_ALL, impCurStmtDI, false);
4027-
}
40284034

40294035
return gtNewLclvNode(lclNum, JITtype2varType(sig->retType));
40304036
}

src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2864,7 +2864,7 @@ private CorInfoInitClassResult initClass(CORINFO_FIELD_STRUCT_* field, CORINFO_M
28642864
!_compilation.HasLazyStaticConstructor(type)
28652865
)
28662866
{
2867-
return CorInfoInitClassResult.CORINFO_INITCLASS_NOT_REQUIRED;
2867+
return CorInfoInitClassResult.CORINFO_INITCLASS_INITIALIZED;
28682868
}
28692869
#endif
28702870

0 commit comments

Comments
 (0)