[sgen] Remove unnecessary and wrong IL code on string managed allocators
authorAlexis Christoforides <alexis@thenull.net>
Thu, 24 Mar 2016 14:06:34 +0000 (10:06 -0400)
committerAlexis Christoforides <alexis@thenull.net>
Thu, 14 Apr 2016 20:55:48 +0000 (16:55 -0400)
This appears to have been copied from Boehm, but here we are not responsible for zeroing.
Also, 's->chars [len]' is not the same as 'align_up (s + size) - 2', so this was corrupting canaries.

mono/metadata/sgen-mono.c

index 0ffea956f7fce324006748046e72fe2a828cdb0a..4cbb36780a9efde8e17be894486b6d4763b370bc 100644 (file)
@@ -1350,14 +1350,6 @@ create_allocator (int atype, gboolean slowpath)
                mono_mb_emit_byte (mb, MONO_CEE_ADD);
                mono_mb_emit_ldarg (mb, 1);
                mono_mb_emit_byte (mb, MONO_CEE_STIND_I4);
-               /* s->chars [len] = 0; */
-               mono_mb_emit_ldloc (mb, p_var);
-               mono_mb_emit_ldloc (mb, size_var);
-               mono_mb_emit_icon (mb, 2);
-               mono_mb_emit_byte (mb, MONO_CEE_SUB);
-               mono_mb_emit_byte (mb, MONO_CEE_ADD);
-               mono_mb_emit_icon (mb, 0);
-               mono_mb_emit_byte (mb, MONO_CEE_STIND_I2);
        }
 
        /*