Skip to content

Conversation

@Andersbakken
Copy link
Contributor

Mac on aarch64 uses posix_memmap.c which doesn't do anything with the flag MMAP_MAP_32BIT for that build so this condition ends up asserting unless the mapping ends up in the first 4 gigs worth of addressable space. Not entirely what problems not guaranteeing the mapping to be in that range will cause but as of now it asserts for me every time. It appears the usage of MAP_32BIT isn't functional after MacOS 13 (if I understand this thread correctly #3009)

void *mem;

#if UINTPTR_MAX == UINT64_MAX
#if UINTPTR_MAX == UINT64_MAX && (!defined(__APPLE__) || !defined(__arm64__))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The MMAP_MAP_32BIT is only handled when the target is x86-64 or riscv64, and __APPLE__ isn't defined. See posix os_mmap:
https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/core/shared/platform/common/posix/posix_memmap.c#L83-L98

How about changing to:

#if defined(BUILD_TARGET_X86_64) || defined(BUILD_TARGET_AMD_64) \
    || defined(BUILD_TARGET_RISCV64_LP64D)                       \
    || defined(BUILD_TARGET_RISCV64_LP64)
#ifndef __APPLE__
...
#endif
#endif

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me. Updated now.

condition will end up asserting on the ones where it isn't supported.
Copy link
Collaborator

@yamt yamt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@wenyongh wenyongh merged commit eab409a into bytecodealliance:main Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants