зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1734421 - Update wasm2c to support better use of 32-bit virtual space r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D127727
This commit is contained in:
Родитель
d37daf2f82
Коммит
530a9df1f6
|
@ -9,8 +9,8 @@ origin:
|
|||
description: wasm2c fork used for rlbox sandboxing
|
||||
url: https://github.com/PLSysSec/wasm2c_sandbox_compiler
|
||||
|
||||
release: commit 551fd0e7d8f0349562d4402bc626a689e7ecde4f (2021-09-09T00:19:32Z).
|
||||
revision: 551fd0e7d8f0349562d4402bc626a689e7ecde4f
|
||||
release: commit 9670bda8add9702dcd5e785be3525c9fee340506 (2021-10-06T20:20:09Z).
|
||||
revision: 9670bda8add9702dcd5e785be3525c9fee340506
|
||||
|
||||
license: Apache-2.0
|
||||
license-file: LICENSE
|
||||
|
|
|
@ -102,13 +102,13 @@ void wasm_rt_cleanup_func_types(wasm_func_type_t** p_func_type_structs, uint32_t
|
|||
# define WASM_HEAP_RESERVE_SIZE 0x200000000ull
|
||||
# define WASM_HEAP_MAX_ALLOWED_PAGES 65536
|
||||
#elif UINTPTR_MAX == 0xffffffff
|
||||
// Reserve 16MB, aligned to 8MB, max heap is 8MB
|
||||
# define WASM_HEAP_GUARD_PAGE_ALIGNMENT 0x800000ul
|
||||
// Reserve 16MB, unaligned, max heap is 16MB
|
||||
# define WASM_HEAP_GUARD_PAGE_ALIGNMENT 0
|
||||
# define WASM_HEAP_RESERVE_SIZE 0x1000000ul
|
||||
# ifdef WASM_USE_INCREMENTAL_MOVEABLE_MEMORY_ALLOC
|
||||
# define WASM_HEAP_MAX_ALLOWED_PAGES 65536
|
||||
# else
|
||||
# define WASM_HEAP_MAX_ALLOWED_PAGES 128
|
||||
# define WASM_HEAP_MAX_ALLOWED_PAGES 256
|
||||
# endif
|
||||
#else
|
||||
# error "Unknown pointer size"
|
||||
|
|
|
@ -127,8 +127,9 @@ void* os_mmap_aligned(void* addr,
|
|||
}
|
||||
|
||||
// Round up the next address that has addr % alignment = 0
|
||||
const size_t alignment_corrected = alignment == 0? 1 : alignment;
|
||||
uintptr_t aligned_nonoffset =
|
||||
(unaligned + (alignment - 1)) & ~(alignment - 1);
|
||||
(unaligned + (alignment_corrected - 1)) & ~(alignment_corrected - 1);
|
||||
|
||||
// Currently offset 0 is aligned according to alignment
|
||||
// Alignment needs to be enforced at the given offset
|
||||
|
@ -142,7 +143,7 @@ void* os_mmap_aligned(void* addr,
|
|||
// Sanity check
|
||||
if (aligned < unaligned ||
|
||||
(aligned + (requested_length - 1)) > (unaligned + (padded_length - 1)) ||
|
||||
(aligned + alignment_offset) % alignment != 0) {
|
||||
(aligned + alignment_offset) % alignment_corrected != 0) {
|
||||
VERBOSE_LOG("os_mmap_aligned: sanity check fail. aligned: %p\n", (void*) aligned);
|
||||
os_munmap((void*)unaligned, padded_length);
|
||||
return NULL;
|
||||
|
|
|
@ -175,8 +175,9 @@ void* os_mmap_aligned(void* addr,
|
|||
}
|
||||
|
||||
// Round up the next address that has addr % alignment = 0
|
||||
const size_t alignment_corrected = alignment == 0? 1 : alignment;
|
||||
uintptr_t aligned_nonoffset =
|
||||
(unaligned + (alignment - 1)) & ~(alignment - 1);
|
||||
(unaligned + (alignment_corrected - 1)) & ~(alignment_corrected - 1);
|
||||
|
||||
// Currently offset 0 is aligned according to alignment
|
||||
// Alignment needs to be enforced at the given offset
|
||||
|
@ -195,7 +196,7 @@ void* os_mmap_aligned(void* addr,
|
|||
if (aligned < unaligned ||
|
||||
(aligned + (requested_length - 1)) >
|
||||
(unaligned + (padded_length - 1)) ||
|
||||
(aligned + alignment_offset) % alignment != 0) {
|
||||
(aligned + alignment_offset) % alignment_corrected != 0) {
|
||||
VERBOSE_LOG("os_mmap_aligned: sanity check fail. aligned: %p\n", (void*) aligned);
|
||||
os_munmap((void*)unaligned, padded_length);
|
||||
return NULL;
|
||||
|
|
Загрузка…
Ссылка в новой задаче