[aot] Init the plt before setting acfg->methods_loaded which is accessed outside...
authorZoltan Varga <vargaz@gmail.com>
Sat, 21 Jan 2017 11:04:22 +0000 (06:04 -0500)
committerZoltan Varga <vargaz@gmail.com>
Sat, 21 Jan 2017 11:06:29 +0000 (06:06 -0500)
mono/mini/aot-runtime.c

index 86c6fbb5d0dd4399fc48b8f4c7f05b03aac69d15..ed2b485a626d415b54fda77ef970106282fca802 100644 (file)
@@ -3958,15 +3958,18 @@ load_method (MonoDomain *domain, MonoAotModule *amodule, MonoImage *image, MonoM
 
        amodule_lock (amodule);
 
-       InterlockedIncrement (&mono_jit_stats.methods_aot);
-
-       amodule->methods_loaded [method_index / 32] |= 1 << (method_index % 32);
-
        init_plt (amodule);
 
+       InterlockedIncrement (&mono_jit_stats.methods_aot);
+
        if (method && method->wrapper_type)
                g_hash_table_insert (amodule->method_to_code, method, code);
 
+       /* Commit changes since methods_loaded is accessed outside the lock */
+       mono_memory_barrier ();
+
+       amodule->methods_loaded [method_index / 32] |= 1 << (method_index % 32);
+
        amodule_unlock (amodule);
 
        if (mono_profiler_get_events () & MONO_PROFILE_JIT_COMPILATION) {