aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/shedlang/compiler/backends/wasm/WasmMemoryBuilder.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/java/org/shedlang/compiler/backends/wasm/WasmMemoryBuilder.java b/src/main/java/org/shedlang/compiler/backends/wasm/WasmMemoryBuilder.java
index d2a13ee6..1f55af6c 100644
--- a/src/main/java/org/shedlang/compiler/backends/wasm/WasmMemoryBuilder.java
+++ b/src/main/java/org/shedlang/compiler/backends/wasm/WasmMemoryBuilder.java
@@ -23,11 +23,15 @@ public class WasmMemoryBuilder {
this.size = size;
}
+ /**
+ * This adds an import for linear memory, sized according to the data that
+ * has been added to this builder, and adds corresponding data segments.
+ * <p>
+ * This assumes that no memory currently exists in the given module.
+ */
public WasmModule toModule(WasmModule module) {
var pageCount = (size + PAGE_SIZE - 1) / PAGE_SIZE;
- // TODO: we assume that we're in complete control of memory and data segments.
- // Either remove this assumption or document it properly.
module = module
.addImport(new WasmImport(
"env",