Retrieve thread lazily and avoid special case for defer. We were trying to get thread...
[mono.git] / mono / mini / mini-x86.c
index 86ddb41427893ec9429ea134d6dcbf0b75ad8a7f..f6b61bae8cc000152eec0fdd5c0676933663cdf2 100644 (file)
@@ -32,6 +32,7 @@
 #include <mono/utils/mono-memory-model.h>
 #include <mono/utils/mono-hwcap.h>
 #include <mono/utils/mono-threads.h>
+#include <mono/utils/unlocked.h>
 
 #include "trace.h"
 #include "mini-x86.h"
@@ -5641,7 +5642,7 @@ mono_arch_build_imt_trampoline (MonoVTable *vtable, MonoDomain *domain, MonoIMTC
        }
 
        if (!fail_tramp)
-               mono_stats.imt_trampolines_size += code - start;
+               UnlockedAdd (&mono_stats.imt_trampolines_size, code - start);
        g_assert (code - start <= size);
 
 #if DEBUG_IMT