Skip to content

Commit 0a2420c

Browse files
committed
Optimizated the page size wasmer
1 parent 22923ce commit 0a2420c

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

libc-top-half/musl/src/internal/libc.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ struct __libc {
5151
#ifndef PAGE_SIZE
5252
#define PAGE_SIZE libc.page_size
5353
#endif
54+
#ifndef LINUX_PAGE_SIZE
55+
#define LINUX_PAGE_SIZE 4096
56+
#endif
5457

5558
extern hidden struct __libc __libc;
5659
#define libc __libc

libc-top-half/musl/src/thread/pthread_create.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,9 @@ _Noreturn void wasi_thread_start(int tid, void *p)
306306
* Instead, round up to a sane alignment.
307307
* Note: PAGE_SIZE is rather big on WASM. (65536)
308308
*/
309-
#define ROUND(x) (((x)+16-1)&-16)
309+
// As wasmer uses mmap on linux, rounding to a linux page size
310+
// makes sense
311+
#define ROUND(x) (((x)+LINUX_PAGE_SIZE-1)&-LINUX_PAGE_SIZE)
310312
#endif
311313

312314
/* pthread_key_create.c overrides this */

0 commit comments

Comments
 (0)