From 1812ae776a4e1906b20c7845e17d8a0e103eb275 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sun, 3 Dec 2023 20:22:40 +0000 Subject: Use walloc to allocate on wasm32 --- runtime/src/shed.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'runtime/src') 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 -- cgit v1.2.3