File tree Expand file tree Collapse file tree 3 files changed +14
-1
lines changed
test/hotspot/jtreg/gc/shenandoah/options Expand file tree Collapse file tree 3 files changed +14
-1
lines changed Original file line number Diff line number Diff line change 3737#include " runtime/globals_extension.hpp"
3838#include " runtime/java.hpp"
3939#include " utilities/defaultStream.hpp"
40+ #include " utilities/powerOfTwo.hpp"
4041
4142void ShenandoahArguments::initialize () {
4243#if !(defined AARCH64 || defined AMD64 || defined PPC64 || defined RISCV64)
@@ -205,7 +206,7 @@ void ShenandoahArguments::initialize() {
205206}
206207
207208size_t ShenandoahArguments::conservative_max_heap_alignment () {
208- size_t align = ShenandoahMaxRegionSize;
209+ size_t align = next_power_of_2 ( ShenandoahMaxRegionSize) ;
209210 if (UseLargePages) {
210211 align = MAX2 (align, os::large_page_size ());
211212 }
Original file line number Diff line number Diff line change @@ -1482,6 +1482,7 @@ void Arguments::set_conservative_max_heap_alignment() {
14821482 os::vm_allocation_granularity (),
14831483 os::max_page_size (),
14841484 GCArguments::compute_heap_alignment ());
1485+ assert (is_power_of_2 (_conservative_max_heap_alignment), " Expected to be a power-of-2" );
14851486}
14861487
14871488jint Arguments::set_ergonomics_flags () {
Original file line number Diff line number Diff line change @@ -192,6 +192,17 @@ private static void testMinRegionSize() throws Exception {
192192 output .shouldHaveExitValue (0 );
193193 }
194194
195+ // This used to assert that _conservative_max_heap_alignment is not a power-of-2.
196+ {
197+ OutputAnalyzer output = ProcessTools .executeLimitedTestJava ("-XX:+UnlockExperimentalVMOptions" ,
198+ "-XX:+UseShenandoahGC" ,
199+ "-Xms100m" ,
200+ "-Xmx1g" ,
201+ "-XX:ShenandoahMaxRegionSize=33m" ,
202+ "-version" );
203+ output .shouldHaveExitValue (0 );
204+ }
205+
195206 }
196207
197208 private static void testMaxRegionSize () throws Exception {
You can’t perform that action at this time.
0 commit comments