mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 03:58:21 +00:00
8372513: Shenandoah: ShenandoahMaxRegionSize can produce an unaligned heap alignment
Reviewed-by: jsikstro, eosterlund, shade
This commit is contained in:
parent
5fe731d55a
commit
5291e1c1e1
@ -37,6 +37,7 @@
|
||||
#include "runtime/globals_extension.hpp"
|
||||
#include "runtime/java.hpp"
|
||||
#include "utilities/defaultStream.hpp"
|
||||
#include "utilities/powerOfTwo.hpp"
|
||||
|
||||
void ShenandoahArguments::initialize() {
|
||||
#if !(defined AARCH64 || defined AMD64 || defined PPC64 || defined RISCV64)
|
||||
@ -205,7 +206,7 @@ void ShenandoahArguments::initialize() {
|
||||
}
|
||||
|
||||
size_t ShenandoahArguments::conservative_max_heap_alignment() {
|
||||
size_t align = ShenandoahMaxRegionSize;
|
||||
size_t align = next_power_of_2(ShenandoahMaxRegionSize);
|
||||
if (UseLargePages) {
|
||||
align = MAX2(align, os::large_page_size());
|
||||
}
|
||||
|
||||
@ -1482,6 +1482,7 @@ void Arguments::set_conservative_max_heap_alignment() {
|
||||
os::vm_allocation_granularity(),
|
||||
os::max_page_size(),
|
||||
GCArguments::compute_heap_alignment());
|
||||
assert(is_power_of_2(_conservative_max_heap_alignment), "Expected to be a power-of-2");
|
||||
}
|
||||
|
||||
jint Arguments::set_ergonomics_flags() {
|
||||
|
||||
@ -192,6 +192,17 @@ public class TestRegionSizeArgs {
|
||||
output.shouldHaveExitValue(0);
|
||||
}
|
||||
|
||||
// This used to assert that _conservative_max_heap_alignment is not a power-of-2.
|
||||
{
|
||||
OutputAnalyzer output = ProcessTools.executeLimitedTestJava("-XX:+UnlockExperimentalVMOptions",
|
||||
"-XX:+UseShenandoahGC",
|
||||
"-Xms100m",
|
||||
"-Xmx1g",
|
||||
"-XX:ShenandoahMaxRegionSize=33m",
|
||||
"-version");
|
||||
output.shouldHaveExitValue(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static void testMaxRegionSize() throws Exception {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user