aboutsummaryrefslogtreecommitdiff
path: root/runtime/src
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2023-07-05 22:48:24 +0100
committerMichael Williamson <mike@zwobble.org>2023-07-05 22:48:24 +0100
commit163460c063814f659713ceed417e5f0be4a800d0 (patch)
tree8139d49c0ee92bcca553ed3862a8308ec1200b40 /runtime/src
parent8017cda831df5cf802a79fce86e7d6f235d7aca9 (diff)
Fix WASM implementation of shed__runtime__alloc
Diffstat (limited to 'runtime/src')
-rw-r--r--runtime/src/shed.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/runtime/src/shed.c b/runtime/src/shed.c
index bee5c439..2de1798e 100644
--- a/runtime/src/shed.c
+++ b/runtime/src/shed.c
@@ -17,11 +17,12 @@ ShedObject const shed_unit = 0;
uint32_t const PAGE_SIZE = 65536;
-void* wasm_memory_grow(uint32_t pages);
+uint32_t wasm_memory_grow(uint32_t pages);
void* shed__runtime__alloc(uint32_t size) {
// TODO: implement a more sensible scheme. This allocates a new page on every request.
- return wasm_memory_grow((size + PAGE_SIZE - 1) / PAGE_SIZE);
+ uint32_t previous_page_count = wasm_memory_grow((size + PAGE_SIZE - 1) / PAGE_SIZE);
+ return (void*) (previous_page_count * PAGE_SIZE);
}
typedef struct __wasi_ciovec_t {