diff options
| author | Michael Williamson <mike@zwobble.org> | 2023-07-05 22:48:24 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2023-07-05 22:48:24 +0100 |
| commit | 163460c063814f659713ceed417e5f0be4a800d0 (patch) | |
| tree | 8139d49c0ee92bcca553ed3862a8308ec1200b40 /runtime/src | |
| parent | 8017cda831df5cf802a79fce86e7d6f235d7aca9 (diff) | |
Fix WASM implementation of shed__runtime__alloc
Diffstat (limited to 'runtime/src')
| -rw-r--r-- | runtime/src/shed.c | 5 |
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 { |
