Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 05b7cb4

Browse files
authored
Skip dummy null argument for string constructors under CoreRT ABI (#6498)
1 parent 4c5d72f commit 05b7cb4

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/jit/importer.cpp

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6830,7 +6830,7 @@ var_types Compiler::impImportCall(OPCODE opcode,
68306830
//-------------------------------------------------------------------------
68316831
// The "this" pointer
68326832

6833-
if (!(mflags & CORINFO_FLG_STATIC) || opcode == CEE_NEWOBJ)
6833+
if (!(mflags & CORINFO_FLG_STATIC) && !((opcode == CEE_NEWOBJ) && (newobjThis == nullptr)))
68346834
{
68356835
GenTreePtr obj;
68366836

@@ -11736,10 +11736,18 @@ MATH_MAYBE_CALL_NO_OVF: ovfl = false;
1173611736
// At present this can only be String
1173711737
else if (clsFlags & CORINFO_FLG_VAROBJSIZE)
1173811738
{
11739-
// This is the case for variable-sized objects that are not
11740-
// arrays. In this case, call the constructor with a null 'this'
11741-
// pointer
11742-
newObjThisPtr = gtNewIconNode(0, TYP_REF);
11739+
if (eeGetEEInfo()->targetAbi == CORINFO_CORERT_ABI)
11740+
{
11741+
// The dummy argument does not exist in CoreRT
11742+
newObjThisPtr = nullptr;
11743+
}
11744+
else
11745+
{
11746+
// This is the case for variable-sized objects that are not
11747+
// arrays. In this case, call the constructor with a null 'this'
11748+
// pointer
11749+
newObjThisPtr = gtNewIconNode(0, TYP_REF);
11750+
}
1174311751

1174411752
/* Remember that this basic block contains 'new' of an object */
1174511753
block->bbFlags |= BBF_HAS_NEWOBJ;

0 commit comments

Comments
 (0)