Skip to content

Commit

Permalink
[marshal] delay dummy string allocation
Browse files Browse the repository at this point in the history
  • Loading branch information
lewurm committed Jun 2, 2017
1 parent 1ca6798 commit 5e23a77
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions mono/metadata/marshal.c
Original file line number Diff line number Diff line change
Expand Up @@ -4027,19 +4027,19 @@ emit_invoke_call (MonoMethodBuilder *mb, MonoMethod *method,
gboolean void_ret = FALSE;
gboolean string_ctor = method && method->string_ctor;

/* to make it work with our special string constructors */
if (!string_dummy) {
MONO_GC_REGISTER_ROOT_SINGLE (string_dummy, MONO_ROOT_SOURCE_MARSHAL, "dummy marshal string");
string_dummy = mono_string_new_wrapper ("dummy");
}

if (virtual_) {
g_assert (sig->hasthis);
g_assert (method->flags & METHOD_ATTRIBUTE_VIRTUAL);
}

if (sig->hasthis) {
if (string_ctor) {
/* to make it work with our special string constructors */
if (!string_dummy) {
MONO_GC_REGISTER_ROOT_SINGLE (string_dummy, MONO_ROOT_SOURCE_MARSHAL, "dummy marshal string");
string_dummy = mono_string_new_wrapper ("dummy");
}

if (mono_gc_is_moving ()) {
mono_mb_emit_ptr (mb, &string_dummy);
mono_mb_emit_byte (mb, CEE_LDIND_REF);
Expand Down

0 comments on commit 5e23a77

Please sign in to comment.