summaryrefslogtreecommitdiff
path: root/src/ext
diff options
context:
space:
mode:
Diffstat (limited to 'src/ext')
-rw-r--r--src/ext/equix/CMakeLists.txt1
-rw-r--r--src/ext/equix/hashx/src/virtual_memory.c2
-rw-r--r--src/ext/equix/hashx/src/virtual_memory.h5
-rw-r--r--src/ext/equix/src/context.c4
4 files changed, 11 insertions, 1 deletions
diff --git a/src/ext/equix/CMakeLists.txt b/src/ext/equix/CMakeLists.txt
index 3c4606566f..a9d0665408 100644
--- a/src/ext/equix/CMakeLists.txt
+++ b/src/ext/equix/CMakeLists.txt
@@ -11,6 +11,7 @@ set(EQUIX_VERSION_STR "${EQUIX_VERSION}.${EQUIX_VERSION_MINOR}.${EQUIX_VERSION_P
project(equix)
add_definitions(-DHASHX_SIZE=8)
+add_definitions(-DEQUIX_SUPPORT_HUGEPAGES)
add_subdirectory("hashx")
diff --git a/src/ext/equix/hashx/src/virtual_memory.c b/src/ext/equix/hashx/src/virtual_memory.c
index 564325b641..2dff6f7552 100644
--- a/src/ext/equix/hashx/src/virtual_memory.c
+++ b/src/ext/equix/hashx/src/virtual_memory.c
@@ -90,6 +90,7 @@ bool hashx_vm_rx(void* ptr, size_t bytes) {
return page_protect(ptr, bytes, PAGE_EXECUTE_READ);
}
+#ifdef EQUIX_SUPPORT_HUGEPAGES
void* hashx_vm_alloc_huge(size_t bytes) {
void* mem;
#ifdef HASHX_WIN
@@ -124,6 +125,7 @@ void* hashx_vm_alloc_huge(size_t bytes) {
#endif
return mem;
}
+#endif /* EQUIX_SUPPORT_HUGEPAGES */
void hashx_vm_free(void* ptr, size_t bytes) {
if (!ptr) {
diff --git a/src/ext/equix/hashx/src/virtual_memory.h b/src/ext/equix/hashx/src/virtual_memory.h
index 9780d218c2..63633bed3f 100644
--- a/src/ext/equix/hashx/src/virtual_memory.h
+++ b/src/ext/equix/hashx/src/virtual_memory.h
@@ -14,7 +14,10 @@
HASHX_PRIVATE void* hashx_vm_alloc(size_t size);
HASHX_PRIVATE bool hashx_vm_rw(void* ptr, size_t size);
HASHX_PRIVATE bool hashx_vm_rx(void* ptr, size_t size);
-HASHX_PRIVATE void* hashx_vm_alloc_huge(size_t size);
HASHX_PRIVATE void hashx_vm_free(void* ptr, size_t size);
+#ifdef EQUIX_SUPPORT_HUGEPAGES
+HASHX_PRIVATE void* hashx_vm_alloc_huge(size_t size);
+#endif
+
#endif
diff --git a/src/ext/equix/src/context.c b/src/ext/equix/src/context.c
index 28edf5e104..3ae4fdf9cf 100644
--- a/src/ext/equix/src/context.c
+++ b/src/ext/equix/src/context.c
@@ -27,7 +27,11 @@ equix_ctx* equix_alloc(equix_ctx_flags flags) {
if (flags & EQUIX_CTX_SOLVE) {
if (flags & EQUIX_CTX_HUGEPAGES) {
+#ifdef EQUIX_SUPPORT_HUGEPAGES
ctx->heap = hashx_vm_alloc_huge(sizeof(solver_heap));
+#else
+ ctx->heap = NULL;
+#endif
}
else {
ctx->heap = malloc(sizeof(solver_heap));