[wasm] Implement GC support. Embedder must provide main loop pumping function request...
[mono.git] / mono / metadata / sgen-mono.c
index 7f2a233401d7da565051c04dbd08f7faf851c95d..df39ea5c5676d099098001fde4f2b65e9abf026d 100644 (file)
@@ -2361,6 +2361,10 @@ sgen_client_scan_thread_data (void *start_nursery, void *end_nursery, gboolean p
 {
        scan_area_arg_start = start_nursery;
        scan_area_arg_end = end_nursery;
+#ifdef HOST_WASM
+       //Under WASM we don't scan thread stacks and we can't trust the values we find there either.
+       return;
+#endif
 
        FOREACH_THREAD (info) {
                int skip_reason = 0;
@@ -2803,7 +2807,7 @@ void
 sgen_client_gchandle_created (int handle_type, GCObject *obj, guint32 handle)
 {
 #ifndef DISABLE_PERFCOUNTERS
-       mono_perfcounters->gc_num_handles++;
+       InterlockedIncrement (&mono_perfcounters->gc_num_handles);
 #endif
 
        MONO_PROFILER_RAISE (gc_handle_created, (handle, handle_type, obj));
@@ -2813,7 +2817,7 @@ void
 sgen_client_gchandle_destroyed (int handle_type, guint32 handle)
 {
 #ifndef DISABLE_PERFCOUNTERS
-       mono_perfcounters->gc_num_handles--;
+       InterlockedDecrement (&mono_perfcounters->gc_num_handles);
 #endif
 
        MONO_PROFILER_RAISE (gc_handle_deleted, (handle, handle_type));