Skip to content

Commit

Permalink
Use a different function for emitting write barriers for gsharedvt ty…
Browse files Browse the repository at this point in the history
…pes which can handle reference types too. Fixes mono#12429.
  • Loading branch information
vargaz committed May 29, 2013
1 parent 4ffdf1c commit 4e7ae2d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
9 changes: 9 additions & 0 deletions mono/mini/jit-icalls.c
Original file line number Diff line number Diff line change
Expand Up @@ -1222,3 +1222,12 @@ mono_object_equals_gsharedvt (gpointer mp, MonoMethod *cmethod, MonoClass *klass
p = mono_object_unbox (res);
return *(gboolean*)p;
}

void
mono_gsharedvt_value_copy (gpointer dest, gpointer src, MonoClass *klass)
{
if (klass->valuetype)
mono_value_copy (dest, src, klass);
else
mono_gc_wbarrier_generic_store (dest, *(MonoObject**)src);
}
2 changes: 2 additions & 0 deletions mono/mini/jit-icalls.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,5 +181,7 @@ int mono_object_gethashcode_gsharedvt (gpointer mp, MonoMethod *cmethod, MonoCla

gboolean mono_object_equals_gsharedvt (gpointer mp, MonoMethod *cmethod, MonoClass *klass, MonoObject *arg) MONO_INTERNAL;

void mono_gsharedvt_value_copy (gpointer dest, gpointer src, MonoClass *klass) MONO_INTERNAL;

#endif /* __MONO_JIT_ICALLS_H__ */

5 changes: 4 additions & 1 deletion mono/mini/method-to-ir.c
Original file line number Diff line number Diff line change
Expand Up @@ -2922,7 +2922,10 @@ mini_emit_stobj (MonoCompile *cfg, MonoInst *dest, MonoInst *src, MonoClass *kla
}
}

mono_emit_jit_icall (cfg, mono_value_copy, iargs);
if (size_ins)
mono_emit_jit_icall (cfg, mono_gsharedvt_value_copy, iargs);
else
mono_emit_jit_icall (cfg, mono_value_copy, iargs);
return;
}
}
Expand Down
1 change: 1 addition & 0 deletions mono/mini/mini.c
Original file line number Diff line number Diff line change
Expand Up @@ -7166,6 +7166,7 @@ mini_init (const char *filename, const char *runtime_version)
register_icall (mono_object_tostring_gsharedvt, "mono_object_tostring_gsharedvt", "object ptr ptr ptr", TRUE);
register_icall (mono_object_gethashcode_gsharedvt, "mono_object_gethashcode_gsharedvt", "int ptr ptr ptr", TRUE);
register_icall (mono_object_equals_gsharedvt, "mono_object_equals_gsharedvt", "int ptr ptr ptr object", TRUE);
register_icall (mono_gsharedvt_value_copy, "mono_gsharedvt_value_copy", "void ptr ptr ptr", TRUE);

register_icall (mono_gc_wbarrier_value_copy_bitmap, "mono_gc_wbarrier_value_copy_bitmap", "void ptr ptr int int", FALSE);

Expand Down

0 comments on commit 4e7ae2d

Please sign in to comment.