//-------------------------------------------------------------------------
// The "this" pointer
- if (!(mflags & CORINFO_FLG_STATIC) || opcode == CEE_NEWOBJ)
+ if (!(mflags & CORINFO_FLG_STATIC) && !((opcode == CEE_NEWOBJ) && (newobjThis == nullptr)))
{
GenTreePtr obj;
// At present this can only be String
else if (clsFlags & CORINFO_FLG_VAROBJSIZE)
{
- // This is the case for variable-sized objects that are not
- // arrays. In this case, call the constructor with a null 'this'
- // pointer
- newObjThisPtr = gtNewIconNode(0, TYP_REF);
+ if (eeGetEEInfo()->targetAbi == CORINFO_CORERT_ABI)
+ {
+ // The dummy argument does not exist in CoreRT
+ newObjThisPtr = nullptr;
+ }
+ else
+ {
+ // This is the case for variable-sized objects that are not
+ // arrays. In this case, call the constructor with a null 'this'
+ // pointer
+ newObjThisPtr = gtNewIconNode(0, TYP_REF);
+ }
/* Remember that this basic block contains 'new' of an object */
block->bbFlags |= BBF_HAS_NEWOBJ;