1 /* 2 * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 package compiler.valhalla.valuetypes; 25 26 import compiler.whitebox.CompilerWhiteBoxTest; 27 import jdk.test.lib.Asserts; 28 import jdk.test.lib.management.InputArguments; 29 import jdk.test.lib.Platform; 30 import jdk.test.lib.process.ProcessTools; 31 import jdk.test.lib.process.OutputAnalyzer; 32 import jdk.test.lib.Utils; 33 import sun.hotspot.WhiteBox; 34 35 import java.lang.annotation.Retention; 36 import java.lang.annotation.RetentionPolicy; 37 import java.lang.annotation.Repeatable; 38 import java.lang.invoke.*; 39 import java.lang.reflect.Method; 40 import java.util.ArrayList; 41 import java.util.Arrays; 42 import java.util.Hashtable; 43 import java.util.LinkedHashMap; 44 import java.util.List; 45 import java.util.Map; 46 import java.util.regex.Matcher; 47 import java.util.regex.Pattern; 48 import java.util.TreeMap; 49 50 // Mark method as test 51 @Retention(RetentionPolicy.RUNTIME) 52 @Repeatable(Tests.class) 53 @interface Test { 54 // Regular expression used to match forbidden IR nodes 55 // in the C2 IR emitted for this test. 56 String failOn() default ""; 57 // Regular expressions used to match and count IR nodes. 58 String[] match() default { }; 59 int[] matchCount() default { }; 60 int valid() default ValueTypeTest.AllFlags; 61 } 62 63 @Retention(RetentionPolicy.RUNTIME) 64 @interface Tests { 65 Test[] value(); 66 } 67 68 // Force method inlining during compilation 69 @Retention(RetentionPolicy.RUNTIME) 70 @interface ForceInline { } 71 72 // Prevent method inlining during compilation 73 @Retention(RetentionPolicy.RUNTIME) 74 @interface DontInline { } 75 76 // Prevent method compilation 77 @Retention(RetentionPolicy.RUNTIME) 78 @interface DontCompile { } 79 80 // Number of warmup iterations 81 @Retention(RetentionPolicy.RUNTIME) 82 @interface Warmup { 83 int value(); 84 } 85 86 public abstract class ValueTypeTest { 87 // Run "jtreg -Dtest.c1=true" to enable experimental C1 testing. 88 static final boolean TEST_C1 = Boolean.getBoolean("test.c1"); 89 90 // Should we execute tests that assume (ValueType[] <: Object[])? 91 static final boolean ENABLE_VALUE_ARRAY_COVARIANCE = Boolean.getBoolean("ValueArrayCovariance"); 92 93 // Random test values 94 public static final int rI = Utils.getRandomInstance().nextInt() % 1000; 95 public static final long rL = Utils.getRandomInstance().nextLong() % 1000; 96 97 // User defined settings 98 protected static final boolean XCOMP = Platform.isComp(); 99 private static final boolean PRINT_GRAPH = true; 100 private static final boolean PRINT_TIMES = Boolean.parseBoolean(System.getProperty("PrintTimes", "false")); 101 private static boolean VERIFY_IR = Boolean.parseBoolean(System.getProperty("VerifyIR", "true")) && !TEST_C1 && !XCOMP; 102 private static final boolean VERIFY_VM = Boolean.parseBoolean(System.getProperty("VerifyVM", "false")); 103 private static final String SCENARIOS = System.getProperty("Scenarios", ""); 104 private static final String TESTLIST = System.getProperty("Testlist", ""); 105 private static final String EXCLUDELIST = System.getProperty("Exclude", ""); 106 private static final int WARMUP = Integer.parseInt(System.getProperty("Warmup", "251")); 107 private static final boolean DUMP_REPLAY = Boolean.parseBoolean(System.getProperty("DumpReplay", "false")); 108 109 // Pre-defined settings 110 private static final List<String> defaultFlags = Arrays.asList( 111 "-XX:-BackgroundCompilation", "-XX:CICompilerCount=1", 112 "-XX:CompileCommand=quiet", 113 "-XX:CompileCommand=compileonly,java.lang.invoke.*::*", 114 "-XX:CompileCommand=compileonly,java.lang.Long::sum", 115 "-XX:CompileCommand=compileonly,java.lang.Object::<init>", 116 "-XX:CompileCommand=compileonly,compiler.valhalla.valuetypes.*::*"); 117 private static final List<String> printFlags = Arrays.asList( 118 "-XX:+PrintCompilation", "-XX:+PrintIdeal", "-XX:+PrintOptoAssembly"); 119 private static final List<String> verifyFlags = Arrays.asList( 120 "-XX:+VerifyOops", "-XX:+VerifyStack", "-XX:+VerifyLastFrame", "-XX:+VerifyBeforeGC", "-XX:+VerifyAfterGC", 121 "-XX:+VerifyDuringGC", "-XX:+VerifyAdapterSharing"); 122 123 protected static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox(); 124 protected static final int ValueTypePassFieldsAsArgsOn = 0x1; 125 protected static final int ValueTypePassFieldsAsArgsOff = 0x2; 126 protected static final int ValueTypeArrayFlattenOn = 0x4; 127 protected static final int ValueTypeArrayFlattenOff = 0x8; 128 protected static final int ValueTypeReturnedAsFieldsOn = 0x10; 129 protected static final int ValueTypeReturnedAsFieldsOff = 0x20; 130 protected static final int AlwaysIncrementalInlineOn = 0x40; 131 protected static final int AlwaysIncrementalInlineOff = 0x80; 132 static final int AllFlags = ValueTypePassFieldsAsArgsOn | ValueTypePassFieldsAsArgsOff | ValueTypeArrayFlattenOn | ValueTypeArrayFlattenOff | ValueTypeReturnedAsFieldsOn; 133 protected static final boolean ValueTypePassFieldsAsArgs = (Boolean)WHITE_BOX.getVMFlag("ValueTypePassFieldsAsArgs"); 134 protected static final boolean ValueTypeArrayFlatten = (Boolean)WHITE_BOX.getVMFlag("ValueArrayFlatten"); 135 protected static final boolean ValueTypeReturnedAsFields = (Boolean)WHITE_BOX.getVMFlag("ValueTypeReturnedAsFields"); 136 protected static final boolean AlwaysIncrementalInline = (Boolean)WHITE_BOX.getVMFlag("AlwaysIncrementalInline"); 137 protected static final int COMP_LEVEL_ANY = -2; 138 protected static final int COMP_LEVEL_FULL_OPTIMIZATION = TEST_C1 ? 1 : 4; 139 protected static final Hashtable<String, Method> tests = new Hashtable<String, Method>(); 140 protected static final boolean USE_COMPILER = WHITE_BOX.getBooleanVMFlag("UseCompiler"); 141 protected static final boolean PRINT_IDEAL = WHITE_BOX.getBooleanVMFlag("PrintIdeal"); 142 143 // Regular expressions used to match nodes in the PrintIdeal output 144 protected static final String START = "(\\d+\\t(.*"; 145 protected static final String MID = ".*)+\\t===.*"; 146 protected static final String END = ")|"; 147 protected static final String ALLOC = "(.*precise klass compiler/valhalla/valuetypes/MyValue.*\\R(.*(nop|spill).*\\R)*.*_new_instance_Java" + END; 148 protected static final String ALLOCA = "(.*precise klass \\[Lcompiler/valhalla/valuetypes/MyValue.*\\R(.*(nop|spill).*\\R)*.*_new_array_Java" + END; 149 protected static final String LOAD = START + "Load(B|S|I|L|F|D|P|N)" + MID + "@compiler/valhalla/valuetypes/MyValue.*" + END; 150 protected static final String LOADK = START + "LoadK" + MID + END; 151 protected static final String STORE = START + "Store(B|C|S|I|L|F|D|P|N)" + MID + "@compiler/valhalla/valuetypes/MyValue.*" + END; 152 protected static final String LOOP = START + "Loop" + MID + "" + END; 153 protected static final String TRAP = START + "CallStaticJava" + MID + "uncommon_trap.*(unstable_if|predicate)" + END; 154 protected static final String RETURN = START + "Return" + MID + "returns" + END; 155 protected static final String LINKTOSTATIC = START + "CallStaticJava" + MID + "linkToStatic" + END; 156 protected static final String NPE = START + "CallStaticJava" + MID + "null_check" + END; 157 protected static final String CALL = START + "CallStaticJava" + MID + END; 158 protected static final String STOREVALUETYPEFIELDS = START + "CallStaticJava" + MID + "store_value_type_fields" + END; 159 protected static final String SCOBJ = "(.*# ScObj.*" + END; 160 161 public static String[] concat(String prefix[], String... extra) { 162 ArrayList<String> list = new ArrayList<String>(); 163 if (prefix != null) { 164 for (String s : prefix) { 165 list.add(s); 166 } 167 } 168 if (extra != null) { 169 for (String s : extra) { 170 list.add(s); 171 } 172 } 173 174 return list.toArray(new String[list.size()]); 175 } 176 177 /** 178 * Override getNumScenarios and getVMParameters if you want to run with more than 179 * the 5 built-in scenarios 180 */ 181 public int getNumScenarios() { 182 if (TEST_C1) { 183 return 1; 184 } else { 185 return 5; 186 } 187 } 188 189 /** 190 * VM paramaters for the 5 built-in test scenarios. If your test needs to append 191 * extra parameters for (some of) these scenarios, override getExtraVMParameters(). 192 */ 193 public String[] getVMParameters(int scenario) { 194 if (TEST_C1) { 195 return new String[] { 196 "-XX:+EnableValhallaC1", 197 }; 198 } 199 200 switch (scenario) { 201 case 0: return new String[] { 202 "-XX:+AlwaysIncrementalInline", 203 "-XX:ValueArrayElemMaxFlatOops=-1", 204 "-XX:ValueArrayElemMaxFlatSize=-1", 205 "-XX:+ValueArrayFlatten", 206 "-XX:ValueFieldMaxFlatSize=-1", 207 "-XX:+ValueTypePassFieldsAsArgs", 208 "-XX:+ValueTypeReturnedAsFields"}; 209 case 1: return new String[] { 210 "-XX:-UseCompressedOops", 211 "-XX:ValueArrayElemMaxFlatOops=-1", 212 "-XX:ValueArrayElemMaxFlatSize=-1", 213 "-XX:+ValueArrayFlatten", 214 "-XX:ValueFieldMaxFlatSize=-1", 215 "-XX:-ValueTypePassFieldsAsArgs", 216 "-XX:-ValueTypeReturnedAsFields"}; 217 case 2: return new String[] { 218 "-DVerifyIR=false", 219 "-XX:-UseCompressedOops", 220 "-XX:ValueArrayElemMaxFlatOops=0", 221 "-XX:ValueArrayElemMaxFlatSize=0", 222 "-XX:-ValueArrayFlatten", 223 "-XX:ValueFieldMaxFlatSize=0", 224 "-XX:+ValueTypePassFieldsAsArgs", 225 "-XX:+ValueTypeReturnedAsFields", 226 "-XX:+StressValueTypePassFieldsAsArgs", 227 "-XX:+StressValueTypeReturnedAsFields"}; 228 case 3: return new String[] { 229 "-DVerifyIR=false", 230 "-XX:+AlwaysIncrementalInline", 231 "-XX:ValueArrayElemMaxFlatOops=0", 232 "-XX:ValueArrayElemMaxFlatSize=0", 233 "-XX:ValueFieldMaxFlatSize=0", 234 "-XX:-ValueTypePassFieldsAsArgs", 235 "-XX:-ValueTypeReturnedAsFields"}; 236 case 4: return new String[] { 237 "-DVerifyIR=false", 238 "-XX:ValueArrayElemMaxFlatOops=-1", 239 "-XX:ValueArrayElemMaxFlatSize=-1", 240 "-XX:+ValueArrayFlatten", 241 "-XX:ValueFieldMaxFlatSize=0", 242 "-XX:+ValueTypePassFieldsAsArgs", 243 "-XX:-ValueTypeReturnedAsFields", 244 "-XX:+StressValueTypePassFieldsAsArgs"}; 245 } 246 247 return null; 248 } 249 250 /** 251 * Override this method to provide extra parameters for selected scenarios 252 */ 253 public String[] getExtraVMParameters(int scenario) { 254 return null; 255 } 256 257 public static void main(String[] args) throws Throwable { 258 if (args.length != 1) { 259 throw new RuntimeException("Usage: @run main/othervm/timeout=120 -Xbootclasspath/a:." + 260 " -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions" + 261 " -XX:+UnlockExperimentalVMOptions -XX:+WhiteBoxAPI -XX:+EnableValhalla" + 262 " compiler.valhalla.valuetypes.ValueTypeTest <YourTestMainClass>"); 263 } 264 String testMainClassName = args[0]; 265 Class testMainClass = Class.forName(testMainClassName); 266 ValueTypeTest test = (ValueTypeTest)testMainClass.newInstance(); 267 List<String> scenarios = null; 268 if (!SCENARIOS.isEmpty()) { 269 scenarios = Arrays.asList(SCENARIOS.split(",")); 270 } 271 for (int i=0; i<test.getNumScenarios(); i++) { 272 if (scenarios == null || scenarios.contains(Integer.toString(i))) { 273 System.out.println("Scenario #" + i + " -------- "); 274 String[] cmds = InputArguments.getVmInputArgs(); 275 cmds = concat(cmds, test.getVMParameters(i)); 276 cmds = concat(cmds, test.getExtraVMParameters(i)); 277 cmds = concat(cmds, testMainClassName); 278 279 OutputAnalyzer oa = ProcessTools.executeTestJvm(cmds); 280 String output = oa.getOutput(); 281 oa.shouldHaveExitValue(0); 282 System.out.println(output); 283 } else { 284 System.out.println("Scenario #" + i + " is skipped due to -Dscenarios=" + SCENARIOS); 285 } 286 } 287 } 288 289 protected ValueTypeTest() { 290 List<String> list = null; 291 List<String> exclude = null; 292 if (!TESTLIST.isEmpty()) { 293 list = Arrays.asList(TESTLIST.split(",")); 294 } 295 if (!EXCLUDELIST.isEmpty()) { 296 exclude = Arrays.asList(EXCLUDELIST.split(",")); 297 } 298 // Gather all test methods and put them in Hashtable 299 for (Method m : getClass().getDeclaredMethods()) { 300 Test[] annos = m.getAnnotationsByType(Test.class); 301 if (annos.length != 0 && 302 ((list == null || list.contains(m.getName())) && (exclude == null || !exclude.contains(m.getName())))) { 303 tests.put(getClass().getSimpleName() + "::" + m.getName(), m); 304 } 305 } 306 } 307 308 protected void run(String[] args, Class<?>... classes) throws Throwable { 309 if (args.length == 0) { 310 // Spawn a new VM instance 311 execute_vm(); 312 } else { 313 // Execute tests 314 run(classes); 315 } 316 } 317 318 private void execute_vm() throws Throwable { 319 Asserts.assertFalse(tests.isEmpty(), "no tests to execute"); 320 ArrayList<String> args = new ArrayList<String>(defaultFlags); 321 String[] vmInputArgs = InputArguments.getVmInputArgs(); 322 for (String arg : vmInputArgs) { 323 if (arg.startsWith("-XX:CompileThreshold")) { 324 // Disable IR verification if non-default CompileThreshold is set 325 VERIFY_IR = false; 326 } 327 } 328 if (VERIFY_IR) { 329 // Add print flags for IR verification 330 args.addAll(printFlags); 331 // Always trap for exception throwing to not confuse IR verification 332 args.add("-XX:-OmitStackTraceInFastThrow"); 333 } 334 if (VERIFY_VM) { 335 args.addAll(verifyFlags); 336 } 337 // Run tests in own process and verify output 338 args.add(getClass().getName()); 339 args.add("run"); 340 // Spawn process with default JVM options from the test's run command 341 String[] cmds = Arrays.copyOf(vmInputArgs, vmInputArgs.length + args.size()); 342 System.arraycopy(args.toArray(), 0, cmds, vmInputArgs.length, args.size()); 343 OutputAnalyzer oa = ProcessTools.executeTestJvm(cmds); 344 // If ideal graph printing is enabled/supported, verify output 345 String output = oa.getOutput(); 346 oa.shouldHaveExitValue(0); 347 if (VERIFY_IR) { 348 if (output.contains("PrintIdeal enabled")) { 349 parseOutput(output); 350 } else { 351 System.out.println(output); 352 System.out.println("WARNING: IR verification failed! Running with -Xint, -Xcomp or release build?"); 353 } 354 } 355 } 356 357 private void parseOutput(String output) throws Exception { 358 Pattern comp_re = Pattern.compile("\\n\\s+\\d+\\s+\\d+\\s+(%| )(s| )(!| )b(n| )\\s+\\S+\\.(?<name>[^.]+::\\S+)\\s+(?<osr>@ \\d+\\s+)?[(]\\d+ bytes[)]\\n"); 359 Matcher m = comp_re.matcher(output); 360 Map<String,String> compilations = new LinkedHashMap<>(); 361 int prev = 0; 362 String methodName = null; 363 while (m.find()) { 364 if (prev == 0) { 365 // Print header 366 System.out.print(output.substring(0, m.start()+1)); 367 } else if (methodName != null) { 368 compilations.put(methodName, output.substring(prev, m.start()+1)); 369 } 370 if (m.group("osr") != null) { 371 methodName = null; 372 } else { 373 methodName = m.group("name"); 374 } 375 prev = m.end(); 376 } 377 if (prev == 0) { 378 // Print header 379 System.out.print(output); 380 } else if (methodName != null) { 381 compilations.put(methodName, output.substring(prev)); 382 } 383 // Iterate over compilation output 384 for (String testName : compilations.keySet()) { 385 Method test = tests.get(testName); 386 if (test == null) { 387 // Skip helper methods 388 continue; 389 } 390 String graph = compilations.get(testName); 391 if (PRINT_GRAPH) { 392 System.out.println("\nGraph for " + testName + "\n" + graph); 393 } 394 // Parse graph using regular expressions to determine if it contains forbidden nodes 395 Test[] annos = test.getAnnotationsByType(Test.class); 396 Test anno = null; 397 for (Test a : annos) { 398 if ((a.valid() & ValueTypePassFieldsAsArgsOn) != 0 && ValueTypePassFieldsAsArgs) { 399 assert anno == null; 400 anno = a; 401 } else if ((a.valid() & ValueTypePassFieldsAsArgsOff) != 0 && !ValueTypePassFieldsAsArgs) { 402 assert anno == null; 403 anno = a; 404 } else if ((a.valid() & ValueTypeArrayFlattenOn) != 0 && ValueTypeArrayFlatten) { 405 assert anno == null; 406 anno = a; 407 } else if ((a.valid() & ValueTypeArrayFlattenOff) != 0 && !ValueTypeArrayFlatten) { 408 assert anno == null; 409 anno = a; 410 } else if ((a.valid() & ValueTypeReturnedAsFieldsOn) != 0 && ValueTypeReturnedAsFields) { 411 assert anno == null; 412 anno = a; 413 } else if ((a.valid() & ValueTypeReturnedAsFieldsOff) != 0 && !ValueTypeReturnedAsFields) { 414 assert anno == null; 415 anno = a; 416 } else if ((a.valid() & AlwaysIncrementalInlineOn) != 0 && AlwaysIncrementalInline) { 417 assert anno == null; 418 anno = a; 419 } else if ((a.valid() & AlwaysIncrementalInlineOff) != 0 && !AlwaysIncrementalInline) { 420 assert anno == null; 421 anno = a; 422 } 423 } 424 assert anno != null; 425 String regexFail = anno.failOn(); 426 if (!regexFail.isEmpty()) { 427 Pattern pattern = Pattern.compile(regexFail.substring(0, regexFail.length()-1)); 428 Matcher matcher = pattern.matcher(graph); 429 boolean found = matcher.find(); 430 Asserts.assertFalse(found, "Graph for '" + testName + "' contains forbidden node:\n" + (found ? matcher.group() : "")); 431 } 432 String[] regexMatch = anno.match(); 433 int[] matchCount = anno.matchCount(); 434 for (int i = 0; i < regexMatch.length; ++i) { 435 Pattern pattern = Pattern.compile(regexMatch[i].substring(0, regexMatch[i].length()-1)); 436 Matcher matcher = pattern.matcher(graph); 437 int count = 0; 438 String nodes = ""; 439 while (matcher.find()) { 440 count++; 441 nodes += matcher.group() + "\n"; 442 } 443 if (matchCount[i] < 0) { 444 Asserts.assertLTE(Math.abs(matchCount[i]), count, "Graph for '" + testName + "' contains different number of match nodes:\n" + nodes); 445 } else { 446 Asserts.assertEQ(matchCount[i], count, "Graph for '" + testName + "' contains different number of match nodes:\n" + nodes); 447 } 448 } 449 tests.remove(testName); 450 System.out.println(testName + " passed"); 451 } 452 // Check if all tests were compiled 453 if (tests.size() != 0) { 454 for (String name : tests.keySet()) { 455 System.out.println("Test '" + name + "' not compiled!"); 456 } 457 throw new RuntimeException("Not all tests were compiled"); 458 } 459 } 460 461 private void setup(Class<?> clazz) { 462 if (XCOMP) { 463 // Don't control compilation if -Xcomp is enabled 464 return; 465 } 466 if (DUMP_REPLAY) { 467 // Generate replay compilation files 468 String directive = "[{ match: \"*.*\", DumpReplay: true }]"; 469 if (WHITE_BOX.addCompilerDirective(directive) != 1) { 470 throw new RuntimeException("Failed to add compiler directive"); 471 } 472 } 473 474 Method[] methods = clazz.getDeclaredMethods(); 475 for (Method m : methods) { 476 if (m.isAnnotationPresent(Test.class)) { 477 // Don't inline tests 478 WHITE_BOX.testSetDontInlineMethod(m, true); 479 } 480 if (m.isAnnotationPresent(DontCompile.class)) { 481 WHITE_BOX.makeMethodNotCompilable(m, COMP_LEVEL_ANY, true); 482 WHITE_BOX.makeMethodNotCompilable(m, COMP_LEVEL_ANY, false); 483 WHITE_BOX.testSetDontInlineMethod(m, true); 484 } 485 if (m.isAnnotationPresent(ForceInline.class)) { 486 WHITE_BOX.testSetForceInlineMethod(m, true); 487 } else if (m.isAnnotationPresent(DontInline.class)) { 488 WHITE_BOX.testSetDontInlineMethod(m, true); 489 } 490 } 491 492 // Compile class initializers 493 WHITE_BOX.enqueueInitializerForCompilation(clazz, COMP_LEVEL_FULL_OPTIMIZATION); 494 } 495 496 private void run(Class<?>... classes) throws Exception { 497 if (USE_COMPILER && PRINT_IDEAL && !XCOMP) { 498 System.out.println("PrintIdeal enabled"); 499 } 500 System.out.format("rI = %d, rL = %d\n", rI, rL); 501 502 setup(getClass()); 503 for (Class<?> clazz : classes) { 504 setup(clazz); 505 } 506 507 // Execute tests 508 TreeMap<Long, String> durations = PRINT_TIMES ? new TreeMap<Long, String>() : null; 509 for (Method test : tests.values()) { 510 long startTime = System.nanoTime(); 511 Method verifier = getClass().getMethod(test.getName() + "_verifier", boolean.class); 512 // Warmup using verifier method 513 Warmup anno = test.getAnnotation(Warmup.class); 514 int warmup = anno == null ? WARMUP : anno.value(); 515 for (int i = 0; i < warmup; ++i) { 516 verifier.invoke(this, true); 517 } 518 // Trigger compilation 519 WHITE_BOX.enqueueMethodForCompilation(test, COMP_LEVEL_FULL_OPTIMIZATION); 520 Asserts.assertTrue(!USE_COMPILER || WHITE_BOX.isMethodCompiled(test, false), test + " not compiled"); 521 // Check result 522 verifier.invoke(this, false); 523 if (PRINT_TIMES) { 524 long endTime = System.nanoTime(); 525 long duration = (endTime - startTime); 526 durations.put(duration, test.getName()); 527 } 528 } 529 530 // Print execution times 531 if (PRINT_TIMES) { 532 System.out.println("\n\nTest execution times:"); 533 for (Map.Entry<Long, String> entry : durations.entrySet()) { 534 System.out.format("%-10s%15d ns\n", entry.getValue() + ":", entry.getKey()); 535 } 536 } 537 } 538 }