Merge
authorjwilhelm
Mon, 12 Jan 2015 12:51:53 +0100
changeset 28481 35b47bc23a71
parent 28398 43839f0cb0e8 (current diff)
parent 28480 23a93b2e118c (diff)
child 28482 e1a8d03c342f
Merge
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Thu Jan 08 17:11:49 2015 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Mon Jan 12 12:51:53 2015 +0100
@@ -1910,7 +1910,6 @@
   }
 
   void work(uint worker_id) {
-    double start = os::elapsedTime();
     FreeRegionList local_cleanup_list("Local Cleanup List");
     HRRSCleanupTask hrrs_cleanup_task;
     G1NoteEndOfConcMarkClosure g1_note_end(_g1h, &local_cleanup_list,
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Thu Jan 08 17:11:49 2015 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Mon Jan 12 12:51:53 2015 +0100
@@ -1229,7 +1229,6 @@
       TraceCollectorStats tcs(g1mm()->full_collection_counters());
       TraceMemoryManagerStats tms(true /* fullGC */, gc_cause());
 
-      double start = os::elapsedTime();
       g1_policy()->record_full_collection_start();
 
       // Note: When we have a more flexible GC logging framework that
@@ -1436,7 +1435,6 @@
 
       _allocator->init_mutator_alloc_region();
 
-      double end = os::elapsedTime();
       g1_policy()->record_full_collection_end();
 
       if (G1Log::fine()) {
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Thu Jan 08 17:11:49 2015 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Mon Jan 12 12:51:53 2015 +0100
@@ -56,7 +56,6 @@
 class GenerationSpec;
 class OopsInHeapRegionClosure;
 class G1KlassScanClosure;
-class G1ScanHeapEvacClosure;
 class ObjectClosure;
 class SpaceClosure;
 class CompactibleSpaceClosure;
--- a/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.hpp	Thu Jan 08 17:11:49 2015 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.hpp	Mon Jan 12 12:51:53 2015 +0100
@@ -46,9 +46,6 @@
 class G1PrepareCompactClosure;
 
 class G1MarkSweep : AllStatic {
-  friend class VM_G1MarkSweep;
-  friend class Scavenge;
-
  public:
 
   static void invoke_at_safepoint(ReferenceProcessor* rp,
--- a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.hpp	Thu Jan 08 17:11:49 2015 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.hpp	Mon Jan 12 12:51:53 2015 +0100
@@ -31,7 +31,6 @@
 // collection set.
 
 class G1CollectedHeap;
-class CardTableModRefBarrierSet;
 class ConcurrentG1Refine;
 class G1ParPushHeapRSClosure;
 
--- a/hotspot/src/share/vm/utilities/debug.hpp	Thu Jan 08 17:11:49 2015 -0800
+++ b/hotspot/src/share/vm/utilities/debug.hpp	Mon Jan 12 12:51:53 2015 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -225,21 +225,22 @@
 
 void warning(const char* format, ...) ATTRIBUTE_PRINTF(1, 2);
 
-#ifdef ASSERT
-// Compile-time asserts.
-template <bool> struct StaticAssert;
-template <> struct StaticAssert<true> {};
+// Compile-time asserts.  Cond must be a compile-time constant expression that
+// is convertible to bool.  STATIC_ASSERT() can be used anywhere a declaration
+// may appear.
+//
+// Implementation Note: STATIC_ASSERT_FAILURE<true> provides a value member
+// rather than type member that could be used directly in the typedef, because
+// a type member would require conditional use of "typename", depending on
+// whether Cond is dependent or not.  The use of a value member leads to the
+// use of an array type.
 
-// Only StaticAssert<true> is defined, so if cond evaluates to false we get
-// a compile time exception when trying to use StaticAssert<false>.
-#define STATIC_ASSERT(cond)                   \
-  do {                                        \
-    StaticAssert<(cond)> DUMMY_STATIC_ASSERT; \
-    (void)DUMMY_STATIC_ASSERT; /* ignore */   \
-  } while (false)
-#else
-#define STATIC_ASSERT(cond)
-#endif
+template<bool x> struct STATIC_ASSERT_FAILURE;
+template<> struct STATIC_ASSERT_FAILURE<true> { enum { value = 1 }; };
+
+#define STATIC_ASSERT(Cond)                             \
+  typedef char STATIC_ASSERT_FAILURE_ ## __LINE__ [     \
+    STATIC_ASSERT_FAILURE< (Cond) >::value ]
 
 // out of shared space reporting
 enum SharedSpaceType {
--- a/hotspot/test/gc/TestSmallHeap.java	Thu Jan 08 17:11:49 2015 -0800
+++ b/hotspot/test/gc/TestSmallHeap.java	Mon Jan 12 12:51:53 2015 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,34 +26,46 @@
  * @bug 8067438
  * @requires vm.gc=="null"
  * @summary Verify that starting the VM with a small heap works
- * @library /testlibrary
- * @run main/othervm -Xmx4m -XX:+UseParallelGC TestSmallHeap
- * @run main/othervm -Xmx4m -XX:+UseSerialGC TestSmallHeap
- * @run main/othervm -Xmx4m -XX:+UseG1GC TestSmallHeap
- * @run main/othervm -Xmx4m -XX:+UseConcMarkSweepGC -XX:CMSMarkStackSizeMax=1032 TestSmallHeap
+ * @library /testlibrary /../../test/lib
+ * @build TestSmallHeap
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xmx2m -XX:+UseParallelGC TestSmallHeap
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xmx2m -XX:+UseSerialGC TestSmallHeap
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xmx2m -XX:+UseG1GC TestSmallHeap
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xmx2m -XX:+UseConcMarkSweepGC TestSmallHeap
  *
- * Note: It would be nice to verify the minimal supported heap size here,
- * but that turns out to be quite tricky since we align the heap size based
- * on the card table size. And the card table size is aligned based on the
- * minimal pages size provided by the os. This means that on most platforms,
- * where the minimal page size is 4k, we get a minimal heap size of 2m but
- * on Solaris/Sparc we have a page size of 8k and get a minimal heap size
- * of 8m.
+ * Note: It would be nice to verify the minimal supported heap size (2m) here,
+ * but we align the heap size based on the card table size. And the card table
+ * size is aligned based on the minimal pages size provided by the os. This
+ * means that on most platforms, where the minimal page size is 4k, we get a
+ * minimal heap size of 2m but on Solaris/Sparc we have a page size of 8k and
+ * get a minimal heap size of 4m. And on platforms where the page size is 64k
+ * we get a minimal heap size of 32m. We never use large pages for the card table.
+ *
  * There is also no check in the VM for verifying that the maximum heap size
  * is larger than the supported minimal heap size. This means that specifying
- * -Xmx1m on the command line is fine but will give a heap of 2m (or 4m).
- * To work around these rather strange behaviors this test uses 4m for all
- * platforms.
+ * -Xmx1m on the command line is fine but will give a heap of 2m (or 4m or 32m).
+ *
+ * To work around these rather strange behaviors this test uses -Xmx2m but then
+ * calculates what the expected heap size should be. The calculation is a
+ * simplified version of the code in the VM. We assume that the card table will
+ * use one page. Each byte in the card table corresponds to 512 bytes on the heap.
+ * So, the expected heap size is page_size * 512.
  */
 
+import com.oracle.java.testlibrary.*;
+import static com.oracle.java.testlibrary.Asserts.*;
+import sun.hotspot.WhiteBox;
 import sun.management.ManagementFactoryHelper;
-import static com.oracle.java.testlibrary.Asserts.*;
 
 public class TestSmallHeap {
 
     public static void main(String[] args) {
+        WhiteBox wb = WhiteBox.getWhiteBox();
+        int pageSize = wb.getVMPageSize();
+        int heapBytesPerCard = 512;
+        long expectedMaxHeap = pageSize * heapBytesPerCard;
         String maxHeap = ManagementFactoryHelper.getDiagnosticMXBean().getVMOption("MaxHeapSize").getValue();
-        String expectedMaxHeap = "4194304";
-        assertEQ(maxHeap, expectedMaxHeap);
+        assertEQ(Long.parseLong(maxHeap), expectedMaxHeap);
     }
 }