Skip to content

Commit

Permalink
Handle old glibc compile-time versions, which don't include aligned_a…
Browse files Browse the repository at this point in the history
…lloc.
  • Loading branch information
schmelter-sap committed Jul 11, 2024
1 parent bfa0930 commit 9699b4d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/hotspot/os/posix/malloctrace/mallocTracePosix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1160,7 +1160,7 @@ void* MallocStatisticImpl::memalign_hook(size_t align, size_t size, void* caller
void* MallocStatisticImpl::aligned_alloc_hook(size_t align, size_t size, void* caller_address) {
void* result = real_malloc_funcs->aligned_alloc(align, size);
uint64_t hash = ptr_hash(result);
#if !defined(__APPLE__)
#if !(defined(__APPLE__) || (defined(__GLIBC__) && !defined(_ISOC11_SOURCE)))
address real_func = (address) aligned_alloc;
#else
address real_func = (address) aligned_alloc_hook;
Expand Down
4 changes: 2 additions & 2 deletions test/hotspot/jtreg/runtime/malloctrace/libtestmallochooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ static void do_alloc_with_stack_impl(int size, int type) {
mem = memalign(128, size);
break;
#endif
#if !defined(__APPLE__)
#if !(defined(__APPLE__) || (defined(__GLIBC__) && !defined(_ISOC11_SOURCE)))
case 5:
mem = aligned_alloc(128, size);
break;
Expand Down Expand Up @@ -213,7 +213,7 @@ Java_MallocHooksTest_doRandomMemOps(JNIEnv *env, jclass cls, jint nrOfOps, jint
TRACK(MEMALIGN, roots[idx] == NULL ? 0 : funcs->malloc_size(roots[idx]));
#endif
} else if (what < 28) {
#if !defined(__APPLE__)
#if !(defined(__APPLE__) || (defined(__GLIBC__) && !defined(_ISOC11_SOURCE)))
roots[idx] = aligned_alloc(64, malloc_size + 1);
TRACK(ALIGNED_ALLOC, roots[idx] == NULL ? 0 : funcs->malloc_size(roots[idx]));
#endif
Expand Down

0 comments on commit 9699b4d

Please sign in to comment.