Skip to content

Commit

Permalink
[wasm] Don't probe for aot modules unless we were built for AOT (#100802
Browse files Browse the repository at this point in the history
)

Don't probe for aot modules in emscripten builds unless we were explicitly built for AOT, because emscripten dlopen is very expensive

Co-authored-by: Aleksey Kliger (λgeek) <[email protected]>
  • Loading branch information
kg and lambdageek authored Apr 10, 2024
1 parent 4d5e5ff commit b232b67
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/mono/mono/mini/aot-runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -1971,6 +1971,12 @@ load_aot_module (MonoAssemblyLoadContext *alc, MonoAssembly *assembly, gpointer
if (mono_aot_mode == MONO_AOT_MODE_NONE)
return;

#ifdef HOST_BROWSER
// This indicates that we were not built for AOT, so there's no need to probe for AOT modules.
if (mono_aot_mode == MONO_AOT_MODE_INTERP_ONLY)
return;
#endif

if (assembly->image->aot_module)
/*
* Already loaded. This can happen because the assembly loading code might invoke
Expand Down Expand Up @@ -2480,7 +2486,7 @@ load_container_amodule (MonoAssemblyLoadContext *alc)

mono_loader_lock ();
// There might be several threads that passed the first check
// Adding another check to ensure single load of a container assembly due to race condition
// Adding another check to ensure single load of a container assembly due to race condition
if (!container_amodule) {
ERROR_DECL (error);

Expand Down

0 comments on commit b232b67

Please sign in to comment.