diff options
| author | Michael Williamson <mike@zwobble.org> | 2023-12-03 20:22:40 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2023-12-03 20:22:40 +0000 |
| commit | 1812ae776a4e1906b20c7845e17d8a0e103eb275 (patch) | |
| tree | b2cd03a5b47fb0c1380093d311f36c428fb446ea /runtime/src | |
| parent | 9e5eb030d1d2a71e453e37fc5f8ba9930122a839 (diff) | |
Use walloc to allocate on wasm32
Diffstat (limited to 'runtime/src')
| -rw-r--r-- | runtime/src/shed.c | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/runtime/src/shed.c b/runtime/src/shed.c index f6d63d0b..478f51c2 100644 --- a/runtime/src/shed.c +++ b/runtime/src/shed.c @@ -10,20 +10,10 @@ ShedObject const shed_unit = 0; #ifdef __WASM__ -uint32_t const PAGE_SIZE = 65536; +void* malloc(unsigned long); -uint32_t wasm_memory_grow(uint32_t pages); - -void* shed__runtime__alloc(size_t size) { - // TODO: implement a more sensible scheme. This allocates a new page on every request. - uint32_t previous_page_count = wasm_memory_grow((size + PAGE_SIZE - 1) / PAGE_SIZE); - return (void*) (previous_page_count * PAGE_SIZE); -} - -#else +#endif void* shed__runtime__alloc(size_t size) { return malloc(size); } - -#endif |
