8144073: Refactor hotspot/test/gc/g1/humongousObjects/TestHumongousThreshold.java
authorkzhaldyb
Mon, 14 Mar 2016 20:00:57 +0300
changeset 37417 84ec61d3b87e
parent 37416 9f905b8b3718
child 37419 bac980e1e730
child 37420 47cd6403ca2d
8144073: Refactor hotspot/test/gc/g1/humongousObjects/TestHumongousThreshold.java Reviewed-by: tschatzl, dfazunen
hotspot/test/gc/g1/humongousObjects/TestHumongousThreshold.java
--- a/hotspot/test/gc/g1/humongousObjects/TestHumongousThreshold.java	Wed Apr 06 16:03:02 2016 +0200
+++ b/hotspot/test/gc/g1/humongousObjects/TestHumongousThreshold.java	Mon Mar 14 20:00:57 2016 +0300
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015,2016 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
@@ -70,7 +70,7 @@
     private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
     private static final int REGION_SIZE = WHITE_BOX.g1RegionSize();
     private static final int MAX_CONTINUOUS_SIZE_CHECK = 129;
-    private static final int NON_HUMONGOUS_DIVIDER = 10;
+    private static final int NON_HUMONGOUS_STEPS = 10;
 
     /**
      * The method allocates byte[] with specified size and checks that:
@@ -84,7 +84,7 @@
      * @return allocated byte array
      */
 
-    private static byte[] allocateAndCheck(int arraySize, boolean expectedHumongous) {
+    private static void allocateAndCheck(int arraySize, boolean expectedHumongous) {
         byte[] storage = new byte[arraySize];
         long objectSize = WHITE_BOX.getObjectSize(storage);
         boolean shouldBeHumongous = objectSize > (REGION_SIZE / 2);
@@ -98,7 +98,6 @@
                 "Object should be allocated as " + (shouldBeHumongous ? "humongous"
                         : "non-humongous") + " but it wasn't; Allocation size = " + arraySize + "; Object size = "
                         + objectSize + "; region size = " + REGION_SIZE);
-        return storage;
     }
 
     public static void main(String[] args) {
@@ -108,7 +107,7 @@
         int maxByteArrayNonHumongousSize = (REGION_SIZE / 2) - byteArrayMemoryOverhead;
 
         // Increment for non-humongous testing
-        int nonHumongousStep = maxByteArrayNonHumongousSize / NON_HUMONGOUS_DIVIDER;
+        int nonHumongousStep = maxByteArrayNonHumongousSize / NON_HUMONGOUS_STEPS;
 
         // Maximum byte[] that takes one region
         int maxByteArrayOneRegionSize = REGION_SIZE - byteArrayMemoryOverhead;
@@ -131,10 +130,10 @@
             allocateAndCheck(i, false);
         }
 
-        // Testing allocations with byte[] with length from 0 to nonHumongousStep * NON_HUMONGOUS_DIVIDER
+        // Testing allocations with byte[] with length from 0 to nonHumongousStep * NON_HUMONGOUS_STEPS
         System.out.format("Testing allocations with byte[] with length from 0 to %d with step %d%n",
-                nonHumongousStep * NON_HUMONGOUS_DIVIDER, nonHumongousStep);
-        for (int i = 0; i < NON_HUMONGOUS_DIVIDER; ++i) {
+                nonHumongousStep * NON_HUMONGOUS_STEPS, nonHumongousStep);
+        for (int i = 0; i < NON_HUMONGOUS_STEPS; ++i) {
             allocateAndCheck(i * nonHumongousStep, false);
         }