diff options
| author | Michael Williamson <mike@zwobble.org> | 2023-12-21 16:25:47 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2023-12-21 16:25:47 +0000 |
| commit | 4ff129c58d805a6c5887c1d6a1063a238e37d70b (patch) | |
| tree | 7ea2d46e02cce2b31ddd9b9fa626b2b13b9fdd28 /src/main/java | |
| parent | 02fd97978738c8127be0903a4c63bee93f99dca1 (diff) | |
Document behaviour of WasmMemoryBuilder
Diffstat (limited to 'src/main/java')
| -rw-r--r-- | src/main/java/org/shedlang/compiler/backends/wasm/WasmMemoryBuilder.java | 8 |
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", |
