8173584: Add unit test for 8173309
authornever
Mon, 30 Jan 2017 10:30:24 -0800
changeset 43672 b188841d7ac8
parent 43671 a152f2d3320e
child 43673 bf2f6d3f8f5e
8173584: Add unit test for 8173309 Reviewed-by: kvn
hotspot/test/compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java
--- a/hotspot/test/compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java	Mon Jan 30 13:48:14 2017 +0530
+++ b/hotspot/test/compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java	Mon Jan 30 10:30:24 2017 -0800
@@ -44,6 +44,8 @@
  *                   -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
  *                   -XX:CompileCommand=exclude,*::check
  *                   -XX:+DoEscapeAnalysis -XX:-UseCounterDecay
+ *                   -XX:CompileCommand=dontinline,compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest,testFrame
+ *                   -XX:CompileCommand=inline,compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest,recurse
  *                   -Xbatch
  *                   -Dcompiler.jvmci.compilerToVM.MaterializeVirtualObjectTest.invalidate=false
  *                   compiler.jvmci.compilerToVM.MaterializeVirtualObjectTest
@@ -119,14 +121,25 @@
         }
         Asserts.assertTrue(WB.isMethodCompiled(METHOD), getName()
                 + "Method unexpectedly not compiled");
+        Asserts.assertTrue(WB.getMethodCompilationLevel(METHOD) == 4, getName()
+                + "Method not compiled at level 4");
         testFrame("someString", COMPILE_THRESHOLD);
     }
 
     private void testFrame(String str, int iteration) {
         Helper helper = new Helper(str);
-        check(iteration);
+        recurse(2, iteration);
         Asserts.assertTrue((helper.string != null) && (this != null)
-                && (helper != null), getName() + " : some locals are null");
+                           && (helper != null), String.format("%s : some locals are null", getName()));
+    }
+    private void recurse(int depth, int iteration) {
+        if (depth == 0) {
+            check(iteration);
+        } else {
+            Integer s = new Integer(depth);
+            recurse(depth - 1, iteration);
+            Asserts.assertEQ(s.intValue(), depth, String.format("different values: %s != %s", s.intValue(), depth));
+        }
     }
 
     private void check(int iteration) {