Skip to content

Commit fce7192

Browse files
jechterjoncham
authored andcommitted
Use mono_gc_wbarrier_set_field instead of il2cpp_gc_wbarrier_set_field, so we can use barriers on both mono and il2cpp
1 parent 0a730c8 commit fce7192

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

mono/mini/debugger-agent.c

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4178,11 +4178,9 @@ thread_startup (MonoProfiler *prof, uintptr_t tid)
41784178
tls = g_new0 (DebuggerTlsData, 1);
41794179
#endif
41804180
MONO_GC_REGISTER_ROOT_SINGLE (tls->thread, MONO_ROOT_SOURCE_DEBUGGER, NULL, "Debugger Thread Reference");
4181+
mono_gc_wbarrier_set_field(tls, (void**)&tls->thread, thread);
41814182
#ifdef RUNTIME_IL2CPP
4182-
il2cpp_gc_wbarrier_set_field(tls, (void**)&tls->thread, thread);
41834183
tls->il2cpp_context = il2cpp_debugger_get_thread_context ();
4184-
#else
4185-
tls->thread = thread;
41864184
#endif
41874185
mono_native_tls_set_value (debugger_tls_id, tls);
41884186

@@ -4220,11 +4218,7 @@ thread_end (MonoProfiler *prof, uintptr_t tid)
42204218
#ifndef RUNTIME_IL2CPP
42214219
MONO_GC_UNREGISTER_ROOT (tls->thread);
42224220
#endif
4223-
#ifdef RUNTIME_IL2CPP
4224-
il2cpp_gc_wbarrier_set_field(tls, (void**)&tls->thread, NULL);
4225-
#else
4226-
tls->thread = NULL;
4227-
#endif
4221+
mono_gc_wbarrier_set_field(tls, (void**)&tls->thread, NULL);
42284222
}
42294223
}
42304224
mono_loader_unlock ();
@@ -7736,11 +7730,7 @@ decode_value_internal (MonoType *t, int type, MonoDomain *domain, guint8 *addr,
77367730
g_free (vtype_buf);
77377731
return err;
77387732
}
7739-
#ifdef RUNTIME_IL2CPP
7740-
il2cpp_gc_wbarrier_set_field(NULL, (void**)addr, mono_value_box_checked (d, klass, vtype_buf, &error));
7741-
#else
7742-
*(MonoObject**)addr = mono_value_box_checked (d, klass, vtype_buf, &error);
7743-
#endif
7733+
mono_gc_wbarrier_set_field(NULL, (void**)addr, mono_value_box_checked (d, klass, vtype_buf, &error));
77447734
mono_error_cleanup (&error);
77457735
g_free (vtype_buf);
77467736
} else {

0 commit comments

Comments
 (0)