author | lmesnik |
Fri, 17 Jun 2016 13:07:27 +0300 | |
changeset 39291 | a4efe145313d |
parent 38152 | 80e5da81fb2c |
child 40059 | c2304140ed64 |
permissions | -rw-r--r-- |
33160 | 1 |
/* |
36209
8db2a78cbc29
8151156: [TESTBUG] Integrate trivial Hotspot test changes from Jake before Jigsaw M3
ctornqvi
parents:
35835
diff
changeset
|
2 |
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. |
33160 | 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 |
||
25 |
/** |
|
26 |
* @test |
|
27 |
* @bug 8136421 |
|
39291
a4efe145313d
8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents:
38152
diff
changeset
|
28 |
* @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") |
33160 | 29 |
* @library /testlibrary / |
38152
80e5da81fb2c
8154258: [TESTBUG] Various serviceability tests fail compilation
dsamersoff
parents:
36209
diff
changeset
|
30 |
* @modules java.base/jdk.internal.misc |
36209
8db2a78cbc29
8151156: [TESTBUG] Integrate trivial Hotspot test changes from Jake before Jigsaw M3
ctornqvi
parents:
35835
diff
changeset
|
31 |
* @modules jdk.vm.ci/jdk.vm.ci.runtime |
33160 | 32 |
* @run main/othervm -XX:+UnlockExperimentalVMOptions |
33 |
* -Dcompiler.jvmci.JVM_GetJVMCIRuntimeTest.positive=true |
|
34 |
* -XX:+EnableJVMCI |
|
35 |
* compiler.jvmci.JVM_GetJVMCIRuntimeTest |
|
36 |
* @run main/othervm -XX:+UnlockExperimentalVMOptions |
|
37 |
* -Dcompiler.jvmci.JVM_GetJVMCIRuntimeTest.positive=false |
|
38 |
* -XX:-EnableJVMCI |
|
39 |
* compiler.jvmci.JVM_GetJVMCIRuntimeTest |
|
35835
7fade08f69b2
8149076: [JVMCI] missing ResourceMark in JVMCIRuntime::initialize_HotSpotJVMCIRuntime
never
parents:
35148
diff
changeset
|
40 |
* @run main/othervm -XX:+UnlockExperimentalVMOptions |
7fade08f69b2
8149076: [JVMCI] missing ResourceMark in JVMCIRuntime::initialize_HotSpotJVMCIRuntime
never
parents:
35148
diff
changeset
|
41 |
* -Dcompiler.jvmci.JVM_GetJVMCIRuntimeTest.positive=true |
7fade08f69b2
8149076: [JVMCI] missing ResourceMark in JVMCIRuntime::initialize_HotSpotJVMCIRuntime
never
parents:
35148
diff
changeset
|
42 |
* -Dcompiler.jvmci.JVM_GetJVMCIRuntimeTest.threaded=true |
7fade08f69b2
8149076: [JVMCI] missing ResourceMark in JVMCIRuntime::initialize_HotSpotJVMCIRuntime
never
parents:
35148
diff
changeset
|
43 |
* -XX:+EnableJVMCI |
7fade08f69b2
8149076: [JVMCI] missing ResourceMark in JVMCIRuntime::initialize_HotSpotJVMCIRuntime
never
parents:
35148
diff
changeset
|
44 |
* compiler.jvmci.JVM_GetJVMCIRuntimeTest |
7fade08f69b2
8149076: [JVMCI] missing ResourceMark in JVMCIRuntime::initialize_HotSpotJVMCIRuntime
never
parents:
35148
diff
changeset
|
45 |
* @run main/othervm -XX:+UnlockExperimentalVMOptions |
7fade08f69b2
8149076: [JVMCI] missing ResourceMark in JVMCIRuntime::initialize_HotSpotJVMCIRuntime
never
parents:
35148
diff
changeset
|
46 |
* -Dcompiler.jvmci.JVM_GetJVMCIRuntimeTest.positive=false |
7fade08f69b2
8149076: [JVMCI] missing ResourceMark in JVMCIRuntime::initialize_HotSpotJVMCIRuntime
never
parents:
35148
diff
changeset
|
47 |
* -Dcompiler.jvmci.JVM_GetJVMCIRuntimeTest.threaded=true |
7fade08f69b2
8149076: [JVMCI] missing ResourceMark in JVMCIRuntime::initialize_HotSpotJVMCIRuntime
never
parents:
35148
diff
changeset
|
48 |
* -XX:-EnableJVMCI |
7fade08f69b2
8149076: [JVMCI] missing ResourceMark in JVMCIRuntime::initialize_HotSpotJVMCIRuntime
never
parents:
35148
diff
changeset
|
49 |
* compiler.jvmci.JVM_GetJVMCIRuntimeTest |
33160 | 50 |
|
51 |
*/ |
|
52 |
||
53 |
package compiler.jvmci; |
|
54 |
||
55 |
import jdk.vm.ci.runtime.JVMCI; |
|
56 |
import jdk.test.lib.Asserts; |
|
57 |
||
35835
7fade08f69b2
8149076: [JVMCI] missing ResourceMark in JVMCIRuntime::initialize_HotSpotJVMCIRuntime
never
parents:
35148
diff
changeset
|
58 |
public class JVM_GetJVMCIRuntimeTest implements Runnable { |
33160 | 59 |
private static final boolean IS_POSITIVE = Boolean.getBoolean( |
60 |
"compiler.jvmci.JVM_GetJVMCIRuntimeTest.positive"); |
|
35835
7fade08f69b2
8149076: [JVMCI] missing ResourceMark in JVMCIRuntime::initialize_HotSpotJVMCIRuntime
never
parents:
35148
diff
changeset
|
61 |
private static final boolean IN_THREAD = Boolean.getBoolean( |
7fade08f69b2
8149076: [JVMCI] missing ResourceMark in JVMCIRuntime::initialize_HotSpotJVMCIRuntime
never
parents:
35148
diff
changeset
|
62 |
"compiler.jvmci.JVM_GetJVMCIRuntimeTest.threaded"); |
33160 | 63 |
|
35835
7fade08f69b2
8149076: [JVMCI] missing ResourceMark in JVMCIRuntime::initialize_HotSpotJVMCIRuntime
never
parents:
35148
diff
changeset
|
64 |
public static void main(String[] args) throws Throwable { |
7fade08f69b2
8149076: [JVMCI] missing ResourceMark in JVMCIRuntime::initialize_HotSpotJVMCIRuntime
never
parents:
35148
diff
changeset
|
65 |
JVM_GetJVMCIRuntimeTest instance = new JVM_GetJVMCIRuntimeTest(); |
7fade08f69b2
8149076: [JVMCI] missing ResourceMark in JVMCIRuntime::initialize_HotSpotJVMCIRuntime
never
parents:
35148
diff
changeset
|
66 |
if (IN_THREAD) { |
7fade08f69b2
8149076: [JVMCI] missing ResourceMark in JVMCIRuntime::initialize_HotSpotJVMCIRuntime
never
parents:
35148
diff
changeset
|
67 |
Thread t = new Thread(instance); |
7fade08f69b2
8149076: [JVMCI] missing ResourceMark in JVMCIRuntime::initialize_HotSpotJVMCIRuntime
never
parents:
35148
diff
changeset
|
68 |
t.start(); |
7fade08f69b2
8149076: [JVMCI] missing ResourceMark in JVMCIRuntime::initialize_HotSpotJVMCIRuntime
never
parents:
35148
diff
changeset
|
69 |
t.join(); |
7fade08f69b2
8149076: [JVMCI] missing ResourceMark in JVMCIRuntime::initialize_HotSpotJVMCIRuntime
never
parents:
35148
diff
changeset
|
70 |
} else { |
7fade08f69b2
8149076: [JVMCI] missing ResourceMark in JVMCIRuntime::initialize_HotSpotJVMCIRuntime
never
parents:
35148
diff
changeset
|
71 |
instance.run(); |
7fade08f69b2
8149076: [JVMCI] missing ResourceMark in JVMCIRuntime::initialize_HotSpotJVMCIRuntime
never
parents:
35148
diff
changeset
|
72 |
} |
33160 | 73 |
} |
74 |
||
35835
7fade08f69b2
8149076: [JVMCI] missing ResourceMark in JVMCIRuntime::initialize_HotSpotJVMCIRuntime
never
parents:
35148
diff
changeset
|
75 |
public void run() { |
33160 | 76 |
Object result; |
77 |
try { |
|
35835
7fade08f69b2
8149076: [JVMCI] missing ResourceMark in JVMCIRuntime::initialize_HotSpotJVMCIRuntime
never
parents:
35148
diff
changeset
|
78 |
result = JVMCI.getRuntime(); |
33160 | 79 |
} catch (InternalError e) { |
80 |
if (IS_POSITIVE) { |
|
81 |
throw new AssertionError("unexpected exception", e); |
|
82 |
} |
|
83 |
return; |
|
84 |
} |
|
85 |
if (!IS_POSITIVE) { |
|
86 |
throw new AssertionError("didn't get expected exception"); |
|
87 |
} |
|
88 |
Asserts.assertNotNull(result, |
|
89 |
"initializeRuntime returned null"); |
|
35835
7fade08f69b2
8149076: [JVMCI] missing ResourceMark in JVMCIRuntime::initialize_HotSpotJVMCIRuntime
never
parents:
35148
diff
changeset
|
90 |
Asserts.assertEQ(result, JVMCI.getRuntime(), |
33160 | 91 |
"initializeRuntime returns different results"); |
92 |
||
93 |
} |
|
94 |
} |