Skip to content

Commit

Permalink
Define reserve/commit APIs in OSCompatEmscripten
Browse files Browse the repository at this point in the history
Summary:
Define these functions that have been missing in the wasm build for a
while. It happens to work for now, but we shouldn't leave it this way.

Reviewed By: avp

Differential Revision: D47846659

fbshipit-source-id: 0b6b40b5e5c2ae3d3d9ec91aba7e02a81c600b49
  • Loading branch information
neildhar authored and facebook-github-bot committed Aug 2, 2023
1 parent 6c0d4df commit 70af78b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/Support/OSCompatEmscripten.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,20 @@ void vm_free_aligned(void *p, size_t sz) {
vm_free(p, sz);
}

/// Define a no-op implementation of the reserve/commit APIs that just call
/// through to regular allocations.
llvh::ErrorOr<void *>
vm_reserve_aligned(size_t sz, size_t alignment, void *hint) {
return vm_allocate_aligned(sz, alignment, hint);
}
void vm_release_aligned(void *p, size_t sz) {
vm_free_aligned(p, sz);
}
llvh::ErrorOr<void *> vm_commit(void *p, size_t sz) {
return p;
}
void vm_uncommit(void *p, size_t sz) {}

void vm_hugepage(void *p, size_t sz) {
assert(
reinterpret_cast<uintptr_t>(p) % page_size() == 0 &&
Expand Down

0 comments on commit 70af78b

Please sign in to comment.