diff options
author | Thomas Lively <7121787+tlively@users.noreply.github.com> | 2021-09-03 17:14:23 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-03 17:14:23 -0700 |
commit | 0ce4ebc853d89f19b22a8622304725a7bc423661 (patch) | |
tree | 6a6319849fad5e1ed4a84a5ed18af3a0185d6ca4 /test/lit/wasm-split/call_exports.mjs | |
parent | 99ccc313b2c1d91bbfcee48fe99d70a2867befbc (diff) | |
download | binaryen-0ce4ebc853d89f19b22a8622304725a7bc423661.tar.gz binaryen-0ce4ebc853d89f19b22a8622304725a7bc423661.tar.bz2 binaryen-0ce4ebc853d89f19b22a8622304725a7bc423661.zip |
[wasm-split] Add an option for recording profile data in memory (#4120)
To avoid requiring a static memory allocation, wasm-split's instrumentation
defaults to recording profile data in Wasm globals. This causes problems for
multithreaded applications because the globals are thread-local, but it is not
always feasible to arrange for a separate profile to be dumped on each thread.
To simplify the profiling of such multithreaded applications, add a new
instrumentation mode that stores the profiling data in shared memory instead of
in globals. This allows a single profile to be written that correctly reflects
the called functions on all threads.
This new mode is not on by default because it requires users to ensure that the
program will not trample the in-memory profiling data. The data is stored
beginning at address zero and occupies one byte per declared function in the
instrumented module. Emscripten can be told to leave this memory free using the
GLOBAL_BASE option.
Diffstat (limited to 'test/lit/wasm-split/call_exports.mjs')
-rw-r--r-- | test/lit/wasm-split/call_exports.mjs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/test/lit/wasm-split/call_exports.mjs b/test/lit/wasm-split/call_exports.mjs index 546564d2e..592fbad48 100644 --- a/test/lit/wasm-split/call_exports.mjs +++ b/test/lit/wasm-split/call_exports.mjs @@ -20,6 +20,6 @@ for (let i = 4; i < process.argv.length; i++) { } // Create and read the profile -let profileSize = instance.exports['__write_profile'](0, 2**32 - 1); -let profileData = Buffer.from(instance.exports.memory.buffer, 0, profileSize); +let profileSize = instance.exports['__write_profile'](1024, 2**32 - 1024); +let profileData = Buffer.from(instance.exports.memory.buffer, 1024, profileSize); fs.writeFileSync(outFile, profileData); |