1 /* |
1 /* |
2 * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. |
3 * Copyright 2016 Azul Systems, Inc. All Rights Reserved. |
3 * Copyright 2016 Azul Systems, Inc. All Rights Reserved. |
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5 * |
5 * |
6 * This code is free software; you can redistribute it and/or modify it |
6 * This code is free software; you can redistribute it and/or modify it |
7 * under the terms of the GNU General Public License version 2 only, as |
7 * under the terms of the GNU General Public License version 2 only, as |
38 import jdk.test.lib.process.ProcessTools; |
38 import jdk.test.lib.process.ProcessTools; |
39 |
39 |
40 public class TestOnSpinWait { |
40 public class TestOnSpinWait { |
41 |
41 |
42 public static void main(String[] args) throws Exception { |
42 public static void main(String[] args) throws Exception { |
43 |
43 // Test C2 compiler |
44 // Test C1 compiler |
|
45 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( |
44 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( |
46 "-XX:+IgnoreUnrecognizedVMOptions", "-showversion", |
|
47 "-XX:+TieredCompilation", "-XX:TieredStopAtLevel=1", "-Xbatch", |
|
48 "-XX:+PrintCompilation", "-XX:+UnlockDiagnosticVMOptions", |
|
49 "-XX:+PrintInlining", Launcher.class.getName()); |
|
50 |
|
51 OutputAnalyzer analyzer = new OutputAnalyzer(pb.start()); |
|
52 |
|
53 analyzer.shouldHaveExitValue(0); |
|
54 |
|
55 // The test is applicable only to C1 (present in Server VM). |
|
56 analyzer.shouldContain("java.lang.Thread::onSpinWait (1 bytes) intrinsic"); |
|
57 |
|
58 // Test C2 compiler |
|
59 pb = ProcessTools.createJavaProcessBuilder( |
|
60 "-XX:+IgnoreUnrecognizedVMOptions", "-showversion", |
45 "-XX:+IgnoreUnrecognizedVMOptions", "-showversion", |
61 "-XX:-TieredCompilation", "-Xbatch", |
46 "-XX:-TieredCompilation", "-Xbatch", |
62 "-XX:+PrintCompilation", "-XX:+UnlockDiagnosticVMOptions", |
47 "-XX:+PrintCompilation", "-XX:+UnlockDiagnosticVMOptions", |
63 "-XX:+PrintInlining", Launcher.class.getName()); |
48 "-XX:+PrintInlining", Launcher.class.getName()); |
64 |
49 |
65 analyzer = new OutputAnalyzer(pb.start()); |
50 OutputAnalyzer analyzer = new OutputAnalyzer(pb.start()); |
66 |
51 |
67 analyzer.shouldHaveExitValue(0); |
52 analyzer.shouldHaveExitValue(0); |
68 |
53 |
69 // The test is applicable only to C2 (present in Server VM). |
54 // The test is applicable only to C2 (present in Server VM). |
70 if (analyzer.getStderr().contains("Server VM")) { |
55 if (analyzer.getStderr().contains("Server VM")) { |