From 3f2d357f282eb48ffc627c42b2116435fcf1de27 Mon Sep 17 00:00:00 2001 From: Tom Rodriguez Date: Mon, 30 Jan 2017 10:30:24 -0800 Subject: [PATCH] 8173584: Add unit test for 8173309 Reviewed-by: kvn --- .../MaterializeVirtualObjectTest.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/hotspot/test/compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java b/hotspot/test/compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java index dee13cfef8d..ec463e11890 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java @@ -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 @@ public class MaterializeVirtualObjectTest { } 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) {