From 163460c063814f659713ceed417e5f0be4a800d0 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Wed, 5 Jul 2023 22:48:24 +0100 Subject: Fix WASM implementation of shed__runtime__alloc --- runtime/src/shed.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'runtime/src') 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 { -- cgit v1.2.3