Skip to content

Commit af9b829

Browse files
Merge pull request #67014 from swiftwasm/pr-5212f18969d0b9d9853af4bc8293cb156ac57eec
[wasm][stdlib] Add wasi-libc support for Heap.cpp
2 parents c5058c0 + cc6f53e commit af9b829

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

stdlib/public/runtime/Heap.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,11 @@ using namespace swift;
3232
/// On Apple platforms, \c malloc() is always 16-byte aligned.
3333
static constexpr size_t MALLOC_ALIGN_MASK = 15;
3434

35-
#elif defined(__linux__) || defined(_WIN32)
35+
#elif defined(__linux__) || defined(_WIN32) || defined(__wasi__)
3636
/// On Linux and Windows, \c malloc() returns 16-byte aligned pointers on 64-bit
3737
/// and 8-byte aligned pointers on 32-bit.
38-
#if defined(__LP64) || defined(_WIN64)
38+
/// On wasi-libc, pointers are 16-byte aligned even though 32-bit for SIMD access.
39+
#if defined(__LP64) || defined(_WIN64) || defined(__wasi__)
3940
static constexpr size_t MALLOC_ALIGN_MASK = 15;
4041
#else
4142
static constexpr size_t MALLOC_ALIGN_MASK = 7;

0 commit comments

Comments
 (0)