Make IntPtr.Zero intrinsic
authorEgor Bogatov <egorbo@gmail.com>
Wed, 21 Aug 2019 18:23:19 +0000 (21:23 +0300)
committerEgor Bogatov <egorbo@gmail.com>
Wed, 21 Aug 2019 18:23:19 +0000 (21:23 +0300)
Commit migrated from https://github.com/mono/mono/commit/d3ecd70eadb4b682358e25934b13a88f2a69694e

src/mono/mono/mini/intrinsics.c

index 118e03a..13cee25 100644 (file)
@@ -1865,7 +1865,13 @@ mini_emit_inst_for_field_load (MonoCompile *cfg, MonoClassField *field)
                is_le = (TARGET_BYTE_ORDER == G_LITTLE_ENDIAN);
                EMIT_NEW_ICONST (cfg, ins, is_le);
                return ins;
+       } 
+#ifdef ENABLE_NETCORE
+       else if ((klass == mono_defaults.int_class || klass == mono_defaults.uint_class) && strcmp (field->name, "Zero") == 0) {
+               EMIT_NEW_ICONST (cfg, ins, 0);
+               return ins;
        }
+#endif
        return NULL;
 }
 #else