diff options
author | Zoltan Varga <vargaz@gmail.com> | 2017-01-21 14:04:22 +0300 |
---|---|---|
committer | Zoltan Varga <vargaz@gmail.com> | 2017-01-21 15:02:10 +0300 |
commit | 6f90ed16121e647dc72ab9863e70cc57bf0ffaeb (patch) | |
tree | ac7ddeec6d646083a5764517bdfa5f399dac48e9 | |
parent | 214f1d3582893ff0f861049c830798f829053da8 (diff) |
[aot] Init the plt before setting acfg->methods_loaded which is accessed outside the lock.mono-4.8.0.472
-rw-r--r-- | mono/mini/aot-runtime.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/mono/mini/aot-runtime.c b/mono/mini/aot-runtime.c index 941d5017d0f..2fd57cf8561 100644 --- a/mono/mini/aot-runtime.c +++ b/mono/mini/aot-runtime.c @@ -3936,15 +3936,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) { |