changeset 27418:a13fdcbaa345

8060479: [TESTBUG] compiler/codecache/CheckSegmentedCodeCache.java test fails with product build Summary: Added check for product build and compute minimum code cache size accordingly. Reviewed-by: kvn, iignatyev
author thartmann
date Fri, 24 Oct 2014 08:27:39 +0200
parents 576e2b527e1c
children a934f24b4dcf
files hotspot/test/compiler/codecache/CheckSegmentedCodeCache.java
diffstat 1 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hotspot/test/compiler/codecache/CheckSegmentedCodeCache.java	Fri Oct 24 08:22:33 2014 +0200
+++ b/hotspot/test/compiler/codecache/CheckSegmentedCodeCache.java	Fri Oct 24 08:27:39 2014 +0200
@@ -22,15 +22,20 @@
  */
 
 import com.oracle.java.testlibrary.*;
+import sun.hotspot.WhiteBox;
 
 /*
  * @test CheckSegmentedCodeCache
  * @bug 8015774
+ * @library /testlibrary /testlibrary/whitebox
  * @summary "Checks VM options related to the segmented code cache"
- * @library /testlibrary
- * @run main/othervm CheckSegmentedCodeCache
+ * @build CheckSegmentedCodeCache
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI CheckSegmentedCodeCache
  */
 public class CheckSegmentedCodeCache {
+  private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
   // Code heap names
   private static final String NON_METHOD = "CodeHeap 'non-nmethods'";
   private static final String PROFILED = "CodeHeap 'profiled nmethods'";
@@ -133,8 +138,12 @@
     failsWith(pb, "Invalid code heap sizes");
 
     // Fails if not enough space for VM internal code
+    long minUseSpace = WHITE_BOX.getUintxVMFlag("CodeCacheMinimumUseSpace");
+    long minFreeSpace = WHITE_BOX.getUintxVMFlag("CodeCacheMinimumFreeSpace");
+    // minimum size: (CodeCacheMinimumUseSpace DEBUG_ONLY(* 3)) + CodeCacheMinimumFreeSpace
+    long minSize = (Platform.isDebugBuild() ? 3 : 1) * minUseSpace + minFreeSpace;
     pb = ProcessTools.createJavaProcessBuilder("-XX:+SegmentedCodeCache",
-                                               "-XX:ReservedCodeCacheSize=1700K",
+                                               "-XX:ReservedCodeCacheSize=" + minSize,
                                                "-XX:InitialCodeCacheSize=100K");
     failsWith(pb, "Not enough space in non-nmethod code heap to run VM");
   }