RFR: 8166191: Missing spaces in log message

chihiro ito chihiro.ito at oracle.com
Mon Apr 10 18:04:22 UTC 2017


Hi all,

Could I have a reviews for this fix, please? This patch add spaces 
following each ":" like a JDK 8 log in log message.

Log message that ran JDK 9 with -Xlog:gc+ergo+heap=debug option is 
following.
[0.019s][debug][gc,ergo,heap] Expand the heap. requested expansion 
amount: 10485760B expansion amount: 10485760B

Log message that ran JDK 8 with -XX:+PrintAdaptiveSizePolicy option is 
following.
0.124: [G1Ergonomics (Heap Sizing) expand the heap, requested expansion 
amount: 10485760 bytes, attempted expansion amount: 10485760 bytes]

Bug:
Missing spaces in log message
https://bugs.openjdk.java.net/browse/JDK-8166191


diff --git a/src/share/vm/gc/g1/g1CollectedHeap.cpp 
b/src/share/vm/gc/g1/g1CollectedHeap.cpp
--- a/src/share/vm/gc/g1/g1CollectedHeap.cpp
+++ b/src/share/vm/gc/g1/g1CollectedHeap.cpp
@@ -1615,7 +1615,7 @@
    aligned_expand_bytes = align_size_up(aligned_expand_bytes,
                                         HeapRegion::GrainBytes);

-  log_debug(gc, ergo, heap)("Expand the heap. requested expansion 
amount:" SIZE_FORMAT "B expansion amount:" SIZE_FORMAT "B",
+  log_debug(gc, ergo, heap)("Expand the heap. requested expansion 
amount: " SIZE_FORMAT "B expansion amount: " SIZE_FORMAT "B",
                              expand_bytes, aligned_expand_bytes);

    if (is_maximal_no_gc()) {
diff --git a/test/gc/g1/TestGCLogMessages.java 
b/test/gc/g1/TestGCLogMessages.java
--- a/test/gc/g1/TestGCLogMessages.java
+++ b/test/gc/g1/TestGCLogMessages.java
@@ -23,7 +23,7 @@

  /*
   * @test TestGCLogMessages
- * @bug 8035406 8027295 8035398 8019342 8027959 8048179 8027962 8069330 
8076463 8150630 8160055
+ * @bug 8035406 8027295 8035398 8019342 8027959 8048179 8027962 8069330 
8076463 8150630 8160055 8166191
   * @summary Ensure the output for a minor GC with G1
   * includes the expected necessary messages.
   * @key gc
@@ -131,6 +131,7 @@
          new TestGCLogMessages().testNormalLogs();
          new TestGCLogMessages().testWithToSpaceExhaustionLogs();
          new TestGCLogMessages().testWithInitialMark();
+        new TestGCLogMessages().testExpandHeap();
      }

      private void testNormalLogs() throws Exception {
@@ -205,6 +206,22 @@
          output.shouldContain("Clear Claimed Marks");
          output.shouldHaveExitValue(0);
      }
+
+    private void testExpandHeap() throws Exception {
+        ProcessBuilder pb = 
ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
+ "-Xmx10M",
+ "-Xbootclasspath/a:.",
+ "-Xlog:gc+ergo+heap=debug",
+ "-XX:+UnlockDiagnosticVMOptions",
+ "-XX:+WhiteBoxAPI",
+ GCTest.class.getName());
+
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        output.shouldContain("Expand the heap. requested expansion 
amount: ")
+        .shouldContain("B expansion amount: ")
+        .shouldHaveExitValue(0);
+    }
+

      static class GCTest {
          private static byte[] garbage;

Thanks,
Chihiro



More information about the hotspot-gc-dev mailing list