diff options
author | Alon Zakai <azakai@google.com> | 2020-03-27 17:25:49 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-27 17:25:49 -0700 |
commit | d595a45b66cbb4d59472d2954131ee1f4cf6ad8e (patch) | |
tree | aa4c8116f9d57d8b1018b77b1db7ad7e3018ccc4 /src/wasm-emscripten.h | |
parent | 9101f65c7b18ab607c472a3d50b52db66497402f (diff) | |
download | binaryen-d595a45b66cbb4d59472d2954131ee1f4cf6ad8e.tar.gz binaryen-d595a45b66cbb4d59472d2954131ee1f4cf6ad8e.tar.bz2 binaryen-d595a45b66cbb4d59472d2954131ee1f4cf6ad8e.zip |
Avoid fp$ access in MAIN_MODULES (#2704)
Depends on emscripten-core/emscripten#10741
which ensures that table indexes are unique. With that guarantee,
a main module can just add its function pointers into the table, and
use them based on that index. The loader will then see them in the
table and then give other modules the identical function pointer for
a function, ensuring function pointer equality.
This avoids calling fp$ functions during startup for the main
module's own functions (which are slow). We do still call fp$s
of things we import from outside, as we don't have anything to
put in the table for them, we depend on the loader for that.
I suspect this can also be done with SIDE_MODULES, but did not
want to try too much at once.
Diffstat (limited to 'src/wasm-emscripten.h')
-rw-r--r-- | src/wasm-emscripten.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/wasm-emscripten.h b/src/wasm-emscripten.h index c7689b4bc..80277cb18 100644 --- a/src/wasm-emscripten.h +++ b/src/wasm-emscripten.h @@ -32,6 +32,7 @@ public: useStackPointerGlobal(stackPointerOffset == 0) {} void setStandalone(bool standalone_) { standalone = standalone_; } + void setSideModule(bool sideModule_) { sideModule = sideModule_; } void generateRuntimeFunctions(); Function* generateMemoryGrowthFunction(); @@ -72,6 +73,7 @@ private: Address stackPointerOffset; bool useStackPointerGlobal; bool standalone; + bool sideModule; // Used by generateDynCallThunk to track all the dynCall functions created // so far. std::unordered_set<Signature> sigs; |