diff options
Diffstat (limited to 'src/tools/wasm-ctor-eval.cpp')
-rw-r--r-- | src/tools/wasm-ctor-eval.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/tools/wasm-ctor-eval.cpp b/src/tools/wasm-ctor-eval.cpp index c0730877a..8b8eaa4ad 100644 --- a/src/tools/wasm-ctor-eval.cpp +++ b/src/tools/wasm-ctor-eval.cpp @@ -162,9 +162,9 @@ public: memorySize = total / Memory::kPageSize; } - // flatten memory into a single segment - void flattenMemory() { - MemoryUtils::flatten(wasm.memory); + // flatten memory into a single segment, return true if successful + bool flattenMemory() { + return MemoryUtils::flatten(wasm.memory); } }; @@ -321,7 +321,9 @@ void evalCtors(Module& wasm, std::vector<std::string> ctors) { // create an instance for evalling EvallingModuleInstance instance(wasm, &interface); // flatten memory, so we do not depend on the layout of data segments - instance.flattenMemory(); + if (!instance.flattenMemory()) { + Fatal() << " ...stopping since could not flatten memory\n"; + } // set up the stack area and other environment details instance.setupEnvironment(); // we should not add new globals from here on; as a result, using |