Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.
/ jdk22 Public archive

Commit

Permalink
8322163: runtime/Unsafe/InternalErrorTest.java fails on Alpine after …
Browse files Browse the repository at this point in the history
…JDK-8320886

Reviewed-by: mbaesken
Backport-of: 1230853343c38787c90820d19d0626f0c37540dc
  • Loading branch information
RealCLanger committed Jan 10, 2024
1 parent 6b79e79 commit 28db238
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/hotspot/share/utilities/copy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,16 @@ void Copy::fill_to_memory_atomic(void* to, size_t size, jubyte value) {
}
} else {
// Not aligned, so no need to be atomic.
#ifdef MUSL_LIBC
// This code is used by Unsafe and may hit the next page after truncation of mapped memory.
// Therefore, we use volatile to prevent compilers from replacing the loop by memset which
// may not trigger SIGBUS as needed (observed on Alpine Linux x86_64)
jbyte fill = value;
for (uintptr_t off = 0; off < size; off += sizeof(jbyte)) {
*(volatile jbyte*)(dst + off) = fill;
}
#else
Copy::fill_to_bytes(dst, size, value);
#endif
}
}

1 comment on commit 28db238

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.