Skip to content

Commit

Permalink
feat(rpmalloc): update to latest version
Browse files Browse the repository at this point in the history
  • Loading branch information
Spasi committed Jan 18, 2020
1 parent 4c5c32f commit 4434600
Show file tree
Hide file tree
Showing 6 changed files with 1,532 additions and 601 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
DISABLE_WARNINGS()
//#define ENABLE_STATISTICS 1
#define RPMALLOC_CONFIGURABLE 1
#define RPMALLOC_FIRST_CLASS_HEAPS 1
#include "rpmalloc.c"
ENABLE_WARNINGS()

Expand Down Expand Up @@ -123,6 +124,11 @@ JNIEXPORT jlong JNICALL Java_org_lwjgl_system_rpmalloc_RPmalloc_nrpaligned_1allo
return (jlong)(intptr_t)rpaligned_alloc((size_t)alignment, (size_t)size);
}

JNIEXPORT jlong JNICALL Java_org_lwjgl_system_rpmalloc_RPmalloc_nrpaligned_1calloc(JNIEnv *__env, jclass clazz, jlong alignment, jlong num, jlong size) {
UNUSED_PARAMS(__env, clazz)
return (jlong)(intptr_t)rpaligned_calloc((size_t)alignment, (size_t)num, (size_t)size);
}

JNIEXPORT jlong JNICALL Java_org_lwjgl_system_rpmalloc_RPmalloc_nrpmemalign(JNIEnv *__env, jclass clazz, jlong alignment, jlong size) {
UNUSED_PARAMS(__env, clazz)
return (jlong)(intptr_t)rpmemalign((size_t)alignment, (size_t)size);
Expand All @@ -140,4 +146,72 @@ JNIEXPORT jlong JNICALL Java_org_lwjgl_system_rpmalloc_RPmalloc_nrpmalloc_1usabl
return (jlong)rpmalloc_usable_size(ptr);
}

JNIEXPORT jlong JNICALL Java_org_lwjgl_system_rpmalloc_RPmalloc_rpmalloc_1heap_1acquire(JNIEnv *__env, jclass clazz) {
UNUSED_PARAMS(__env, clazz)
return (jlong)(intptr_t)rpmalloc_heap_acquire();
}

JNIEXPORT void JNICALL Java_org_lwjgl_system_rpmalloc_RPmalloc_rpmalloc_1heap_1release(JNIEnv *__env, jclass clazz, jlong heapAddress) {
rpmalloc_heap_t *heap = (rpmalloc_heap_t *)(intptr_t)heapAddress;
UNUSED_PARAMS(__env, clazz)
rpmalloc_heap_release(heap);
}

JNIEXPORT jlong JNICALL Java_org_lwjgl_system_rpmalloc_RPmalloc_nrpmalloc_1heap_1alloc(JNIEnv *__env, jclass clazz, jlong heapAddress, jlong size) {
rpmalloc_heap_t *heap = (rpmalloc_heap_t *)(intptr_t)heapAddress;
UNUSED_PARAMS(__env, clazz)
return (jlong)(intptr_t)rpmalloc_heap_alloc(heap, (size_t)size);
}

JNIEXPORT jlong JNICALL Java_org_lwjgl_system_rpmalloc_RPmalloc_nrpmalloc_1heap_1aligned_1alloc(JNIEnv *__env, jclass clazz, jlong heapAddress, jlong alignment, jlong size) {
rpmalloc_heap_t *heap = (rpmalloc_heap_t *)(intptr_t)heapAddress;
UNUSED_PARAMS(__env, clazz)
return (jlong)(intptr_t)rpmalloc_heap_aligned_alloc(heap, (size_t)alignment, (size_t)size);
}

JNIEXPORT jlong JNICALL Java_org_lwjgl_system_rpmalloc_RPmalloc_nrpmalloc_1heap_1calloc(JNIEnv *__env, jclass clazz, jlong heapAddress, jlong num, jlong size) {
rpmalloc_heap_t *heap = (rpmalloc_heap_t *)(intptr_t)heapAddress;
UNUSED_PARAMS(__env, clazz)
return (jlong)(intptr_t)rpmalloc_heap_calloc(heap, (size_t)num, (size_t)size);
}

JNIEXPORT jlong JNICALL Java_org_lwjgl_system_rpmalloc_RPmalloc_nrpmalloc_1heap_1aligned_1calloc(JNIEnv *__env, jclass clazz, jlong heapAddress, jlong alignment, jlong num, jlong size) {
rpmalloc_heap_t *heap = (rpmalloc_heap_t *)(intptr_t)heapAddress;
UNUSED_PARAMS(__env, clazz)
return (jlong)(intptr_t)rpmalloc_heap_aligned_calloc(heap, (size_t)alignment, (size_t)num, (size_t)size);
}

JNIEXPORT jlong JNICALL Java_org_lwjgl_system_rpmalloc_RPmalloc_nrpmalloc_1heap_1realloc(JNIEnv *__env, jclass clazz, jlong heapAddress, jlong ptrAddress, jlong size, jint flags) {
rpmalloc_heap_t *heap = (rpmalloc_heap_t *)(intptr_t)heapAddress;
void *ptr = (void *)(intptr_t)ptrAddress;
UNUSED_PARAMS(__env, clazz)
return (jlong)(intptr_t)rpmalloc_heap_realloc(heap, ptr, (size_t)size, (unsigned int)flags);
}

JNIEXPORT jlong JNICALL Java_org_lwjgl_system_rpmalloc_RPmalloc_nrpmalloc_1heap_1aligned_1realloc(JNIEnv *__env, jclass clazz, jlong heapAddress, jlong ptrAddress, jlong alignment, jlong size, jint flags) {
rpmalloc_heap_t *heap = (rpmalloc_heap_t *)(intptr_t)heapAddress;
void *ptr = (void *)(intptr_t)ptrAddress;
UNUSED_PARAMS(__env, clazz)
return (jlong)(intptr_t)rpmalloc_heap_aligned_realloc(heap, ptr, (size_t)alignment, (size_t)size, (unsigned int)flags);
}

JNIEXPORT void JNICALL Java_org_lwjgl_system_rpmalloc_RPmalloc_nrpmalloc_1heap_1free(JNIEnv *__env, jclass clazz, jlong heapAddress, jlong ptrAddress) {
rpmalloc_heap_t *heap = (rpmalloc_heap_t *)(intptr_t)heapAddress;
void *ptr = (void *)(intptr_t)ptrAddress;
UNUSED_PARAMS(__env, clazz)
rpmalloc_heap_free(heap, ptr);
}

JNIEXPORT void JNICALL Java_org_lwjgl_system_rpmalloc_RPmalloc_nrpmalloc_1heap_1free_1all(JNIEnv *__env, jclass clazz, jlong heapAddress) {
rpmalloc_heap_t *heap = (rpmalloc_heap_t *)(intptr_t)heapAddress;
UNUSED_PARAMS(__env, clazz)
rpmalloc_heap_free_all(heap);
}

JNIEXPORT void JNICALL Java_org_lwjgl_system_rpmalloc_RPmalloc_rpmalloc_1heap_1thread_1set_1current(JNIEnv *__env, jclass clazz, jlong heapAddress) {
rpmalloc_heap_t *heap = (rpmalloc_heap_t *)(intptr_t)heapAddress;
UNUSED_PARAMS(__env, clazz)
rpmalloc_heap_thread_set_current(heap);
}

EXTERN_C_EXIT
Loading

0 comments on commit 4434600

Please sign in to comment.