From 19857b164b7f2c65551b279c3e4535bad85bee19 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Wed, 22 Jul 2015 16:25:06 +0200 Subject: [PATCH 1/2] 8131761: Fix merge error adding code that was removed in 8077936 Reviewed-by: tschatzl --- hotspot/src/share/vm/oops/oop.hpp | 1 - hotspot/src/share/vm/oops/oop.inline.hpp | 6 +----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/hotspot/src/share/vm/oops/oop.hpp b/hotspot/src/share/vm/oops/oop.hpp index 6186a0a0331..9e7991cf9b2 100644 --- a/hotspot/src/share/vm/oops/oop.hpp +++ b/hotspot/src/share/vm/oops/oop.hpp @@ -200,7 +200,6 @@ class oopDesc { // Access to fields in a instanceOop through these methods. oop obj_field(int offset) const; - volatile oop obj_field_volatile(int offset) const; void obj_field_put(int offset, oop value); void obj_field_put_raw(int offset, oop value); void obj_field_put_volatile(int offset, oop value); diff --git a/hotspot/src/share/vm/oops/oop.inline.hpp b/hotspot/src/share/vm/oops/oop.inline.hpp index 77bef028030..fee5363fde0 100644 --- a/hotspot/src/share/vm/oops/oop.inline.hpp +++ b/hotspot/src/share/vm/oops/oop.inline.hpp @@ -284,11 +284,7 @@ inline oop oopDesc::obj_field(int offset) const { load_decode_heap_oop(obj_field_addr(offset)) : load_decode_heap_oop(obj_field_addr(offset)); } -inline volatile oop oopDesc::obj_field_volatile(int offset) const { - volatile oop value = obj_field(offset); - OrderAccess::acquire(); - return value; -} + inline void oopDesc::obj_field_put(int offset, oop value) { UseCompressedOops ? oop_store(obj_field_addr(offset), value) : oop_store(obj_field_addr(offset), value); From dbdadd5e40ddf62de04d0ea72b09b4f17a9cea05 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Wed, 22 Jul 2015 16:25:20 +0200 Subject: [PATCH 2/2] 8130434: [TESTBUG] Harden TestLargePageUseForAuxMemory for more page size combinations Reviewed-by: tschatzl --- .../gc/g1/TestLargePageUseForAuxMemory.java | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/hotspot/test/gc/g1/TestLargePageUseForAuxMemory.java b/hotspot/test/gc/g1/TestLargePageUseForAuxMemory.java index c7e80c43964..326f23fbee0 100644 --- a/hotspot/test/gc/g1/TestLargePageUseForAuxMemory.java +++ b/hotspot/test/gc/g1/TestLargePageUseForAuxMemory.java @@ -94,29 +94,47 @@ public class TestLargePageUseForAuxMemory { output.shouldHaveExitValue(0); } + private static long gcd(long x, long y) { + while (x > 0) { + long t = x; + x = y % x; + y = t; + } + return y; + } + + private static long lcm(long x, long y) { + return x * (y / gcd(x, y)); + } + public static void main(String[] args) throws Exception { if (!Platform.isDebugBuild()) { System.out.println("Skip tests on non-debug builds because the required option TracePageSizes is a debug-only option."); return; } + // Size that a single card covers. + final int cardSize = 512; WhiteBox wb = WhiteBox.getWhiteBox(); smallPageSize = wb.getVMPageSize(); largePageSize = wb.getVMLargePageSize(); allocGranularity = wb.getVMAllocationGranularity(); + final long heapAlignment = lcm(cardSize * smallPageSize, largePageSize); if (largePageSize == 0) { System.out.println("Skip tests because large page support does not seem to be available on this platform."); return; } + if (largePageSize == smallPageSize) { + System.out.println("Skip tests because large page support does not seem to be available on this platform." + + "Small and large page size are the same."); + return; + } // To get large pages for the card table etc. we need at least a 1G heap (with 4k page size). // 32 bit systems will have problems reserving such an amount of contiguous space, so skip the // test there. if (!Platform.is32bit()) { - // Size that a single card covers. - final int cardSize = 512; - final long heapSizeForCardTableUsingLargePages = largePageSize * cardSize; final long heapSizeDiffForCardTable = Math.max(Math.max(allocGranularity * cardSize, HEAP_REGION_SIZE), largePageSize); @@ -131,7 +149,8 @@ public class TestLargePageUseForAuxMemory { // everywhere. final int bitmapTranslationFactor = 8 * 8; // ObjectAlignmentInBytes * BitsPerByte final long heapSizeForBitmapUsingLargePages = largePageSize * bitmapTranslationFactor; - final long heapSizeDiffForBitmap = Math.max(Math.max(allocGranularity * bitmapTranslationFactor, HEAP_REGION_SIZE), largePageSize); + final long heapSizeDiffForBitmap = Math.max(Math.max(allocGranularity * bitmapTranslationFactor, HEAP_REGION_SIZE), + Math.max(largePageSize, heapAlignment)); Asserts.assertGT(heapSizeForBitmapUsingLargePages, heapSizeDiffForBitmap, "To test we would require to use an invalid heap size");