summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/tools/wasm-split/instrumenter.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/tools/wasm-split/instrumenter.cpp b/src/tools/wasm-split/instrumenter.cpp
index 79d6a98a4..36875bfc0 100644
--- a/src/tools/wasm-split/instrumenter.cpp
+++ b/src/tools/wasm-split/instrumenter.cpp
@@ -266,7 +266,20 @@ void Instrumenter::addProfileExport() {
}
}
- // TODO: export the memory if it is not already exported.
+ // Export the memory if it is not already exported.
+ bool memoryExported = false;
+ for (auto& ex : wasm->exports) {
+ if (ex->kind == ExternalKind::Memory) {
+ memoryExported = true;
+ break;
+ }
+ }
+ if (!memoryExported) {
+ wasm->addExport(
+ Builder::makeExport("profile-memory",
+ Names::getValidExportName(*wasm, wasm->memory.name),
+ ExternalKind::Memory));
+ }
}
} // namespace wasm