Skip to content

Commit

Permalink
wasi: Implement GC_displayMem
Browse files Browse the repository at this point in the history
All we have is the builtin memory.size, which is exposed by sbrk(0).
  • Loading branch information
agoode committed Feb 25, 2024
1 parent b9a16d0 commit af7f6ea
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion runtime/platform/wasi.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ void GC_release (void *base, __attribute__ ((unused)) size_t length) {
}

void GC_displayMem (void) {
printf ("GC_displayMem() not implemented on WASI\n");
size_t memory_size = (size_t) sbrk(0);
size_t pages = memory_size / PAGESIZE;
printf ("memory.size: pages=%zu, pagesize=%d, total=%zu\n",
pages, PAGESIZE, memory_size);
}

void GC_diskBack_close (__attribute__ ((unused)) void *data) {
Expand Down

0 comments on commit af7f6ea

Please sign in to comment.