diff options
author | Peter Zhu <peter@peterzhu.ca> | 2022-04-01 13:31:19 -0400 |
---|---|---|
committer | Peter Zhu <peter@peterzhu.ca> | 2022-04-04 09:27:14 -0400 |
commit | ea9c09a92c770e9e3cb0f5ceafd42c8407836f7e (patch) | |
tree | 3dd20e3657c26c74a398a6927a8711b8dcb841af | |
parent | c482ee402502cee8bbea7fcb107d44de586bfc49 (diff) |
Disable mmap on WASM
WASM does not have proper support for mmap.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/5749
-rw-r--r-- | gc.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -882,7 +882,12 @@ enum { #endif #ifdef HAVE_MMAP -# if HAVE_CONST_PAGE_SIZE +/* wasmtime does not have proper support for mmap. + * See https://github.com/bytecodealliance/wasmtime/blob/main/docs/WASI-rationale.md#why-no-mmap-and-friends + */ +# if defined(__wasm__) +static const bool HEAP_PAGE_ALLOC_USE_MMAP = false; +# elif HAVE_CONST_PAGE_SIZE /* If we have the HEAP_PAGE and it is a constant, then we can directly use it. */ static const bool HEAP_PAGE_ALLOC_USE_MMAP = (PAGE_SIZE <= HEAP_PAGE_SIZE); # elif defined(PAGE_MAX_SIZE) && (PAGE_MAX_SIZE <= HEAP_PAGE_SIZE) @@ -3632,7 +3637,7 @@ Init_heap(void) { rb_objspace_t *objspace = &rb_objspace; -#if defined(HAVE_MMAP) && !HAVE_CONST_PAGE_SIZE && !defined(PAGE_MAX_SIZE) +#if defined(HAVE_MMAP) && !defined(__wasm__) && !HAVE_CONST_PAGE_SIZE && !defined(PAGE_MAX_SIZE) /* Need to determine if we can use mmap at runtime. */ # ifdef PAGE_SIZE /* If the PAGE_SIZE macro can be used. */ |