author | tpivovarova |
Tue, 12 Jul 2016 18:24:48 +0300 | |
changeset 40059 | c2304140ed64 |
parent 39450 | 78e99b030d5f |
child 42607 | acd91f1875d4 |
permissions | -rw-r--r-- |
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
1 |
/* |
35582
c32a0cc19877
8147599: [JVMCI] simplify code installation interface
rschatz
parents:
35148
diff
changeset
|
2 |
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. |
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
4 |
* |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
8 |
* |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
13 |
* accompanied this code). |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
14 |
* |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
18 |
* |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
21 |
* questions. |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
22 |
*/ |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
23 |
|
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
24 |
/** |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
25 |
* @test |
39291
a4efe145313d
8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents:
36209
diff
changeset
|
26 |
* @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") |
36209
8db2a78cbc29
8151156: [TESTBUG] Integrate trivial Hotspot test changes from Jake before Jigsaw M3
ctornqvi
parents:
35823
diff
changeset
|
27 |
* @modules jdk.vm.ci/jdk.vm.ci.hotspot |
8db2a78cbc29
8151156: [TESTBUG] Integrate trivial Hotspot test changes from Jake before Jigsaw M3
ctornqvi
parents:
35823
diff
changeset
|
28 |
* jdk.vm.ci/jdk.vm.ci.code |
8db2a78cbc29
8151156: [TESTBUG] Integrate trivial Hotspot test changes from Jake before Jigsaw M3
ctornqvi
parents:
35823
diff
changeset
|
29 |
* jdk.vm.ci/jdk.vm.ci.code.site |
8db2a78cbc29
8151156: [TESTBUG] Integrate trivial Hotspot test changes from Jake before Jigsaw M3
ctornqvi
parents:
35823
diff
changeset
|
30 |
* jdk.vm.ci/jdk.vm.ci.meta |
8db2a78cbc29
8151156: [TESTBUG] Integrate trivial Hotspot test changes from Jake before Jigsaw M3
ctornqvi
parents:
35823
diff
changeset
|
31 |
* jdk.vm.ci/jdk.vm.ci.runtime |
8db2a78cbc29
8151156: [TESTBUG] Integrate trivial Hotspot test changes from Jake before Jigsaw M3
ctornqvi
parents:
35823
diff
changeset
|
32 |
* jdk.vm.ci/jdk.vm.ci.common |
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
33 |
* @compile CodeInstallerTest.java |
34175
5737d346238e
8142387: Various JVMCI tests fail on unexpected exception
twisti
parents:
34153
diff
changeset
|
34 |
* @run junit/othervm -da:jdk.vm.ci... -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI compiler.jvmci.errors.TestInvalidOopMap |
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
35 |
*/ |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
36 |
|
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
37 |
package compiler.jvmci.errors; |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
38 |
|
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
39 |
import jdk.vm.ci.code.BytecodePosition; |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
40 |
import jdk.vm.ci.code.DebugInfo; |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
41 |
import jdk.vm.ci.code.Location; |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
42 |
import jdk.vm.ci.code.ReferenceMap; |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
43 |
import jdk.vm.ci.code.Register; |
35823
59a847ec6ee3
8146608: [JVMCI] DebugInfo Tests on DeoptimizeALot runs fails in assert(_pc == *pc_addr || pc == *pc_addr) frame::patch_pc() /frame_x86.cpp:285
rschatz
parents:
35582
diff
changeset
|
44 |
import jdk.vm.ci.code.StackSlot; |
35582
c32a0cc19877
8147599: [JVMCI] simplify code installation interface
rschatz
parents:
35148
diff
changeset
|
45 |
import jdk.vm.ci.code.site.DataPatch; |
c32a0cc19877
8147599: [JVMCI] simplify code installation interface
rschatz
parents:
35148
diff
changeset
|
46 |
import jdk.vm.ci.code.site.Infopoint; |
c32a0cc19877
8147599: [JVMCI] simplify code installation interface
rschatz
parents:
35148
diff
changeset
|
47 |
import jdk.vm.ci.code.site.InfopointReason; |
c32a0cc19877
8147599: [JVMCI] simplify code installation interface
rschatz
parents:
35148
diff
changeset
|
48 |
import jdk.vm.ci.code.site.Site; |
c32a0cc19877
8147599: [JVMCI] simplify code installation interface
rschatz
parents:
35148
diff
changeset
|
49 |
import jdk.vm.ci.common.JVMCIError; |
c32a0cc19877
8147599: [JVMCI] simplify code installation interface
rschatz
parents:
35148
diff
changeset
|
50 |
import jdk.vm.ci.hotspot.HotSpotCompiledCode.Comment; |
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
51 |
import jdk.vm.ci.hotspot.HotSpotReferenceMap; |
35582
c32a0cc19877
8147599: [JVMCI] simplify code installation interface
rschatz
parents:
35148
diff
changeset
|
52 |
import jdk.vm.ci.meta.Assumptions.Assumption; |
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
53 |
import jdk.vm.ci.meta.JavaKind; |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
54 |
import jdk.vm.ci.meta.PlatformKind; |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
55 |
import org.junit.Test; |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
56 |
|
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
57 |
/** |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
58 |
* Tests for errors in oop maps. |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
59 |
*/ |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
60 |
public class TestInvalidOopMap extends CodeInstallerTest { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
61 |
|
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
62 |
private static class InvalidReferenceMap extends ReferenceMap { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
63 |
} |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
64 |
|
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
65 |
private void test(ReferenceMap refMap) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
66 |
BytecodePosition pos = new BytecodePosition(null, dummyMethod, 0); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
67 |
DebugInfo info = new DebugInfo(pos); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
68 |
info.setReferenceMap(refMap); |
35823
59a847ec6ee3
8146608: [JVMCI] DebugInfo Tests on DeoptimizeALot runs fails in assert(_pc == *pc_addr || pc == *pc_addr) frame::patch_pc() /frame_x86.cpp:285
rschatz
parents:
35582
diff
changeset
|
69 |
installEmptyCode(new Site[]{new Infopoint(0, info, InfopointReason.SAFEPOINT)}, new Assumption[0], new Comment[0], 16, new DataPatch[0], StackSlot.get(null, 0, true)); |
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
70 |
} |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
71 |
|
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
72 |
@Test(expected = NullPointerException.class) |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
73 |
public void testMissingReferenceMap() { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
74 |
test(null); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
75 |
} |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
76 |
|
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
77 |
@Test(expected = JVMCIError.class) |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
78 |
public void testInvalidReferenceMap() { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
79 |
test(new InvalidReferenceMap()); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
80 |
} |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
81 |
|
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
82 |
@Test(expected = NullPointerException.class) |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
83 |
public void testNullOops() { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
84 |
test(new HotSpotReferenceMap(null, new Location[0], new int[0], 8)); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
85 |
} |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
86 |
|
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
87 |
@Test(expected = NullPointerException.class) |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
88 |
public void testNullBase() { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
89 |
test(new HotSpotReferenceMap(new Location[0], null, new int[0], 8)); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
90 |
} |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
91 |
|
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
92 |
@Test(expected = NullPointerException.class) |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
93 |
public void testNullSize() { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
94 |
test(new HotSpotReferenceMap(new Location[0], new Location[0], null, 8)); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
95 |
} |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
96 |
|
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
97 |
@Test(expected = JVMCIError.class) |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
98 |
public void testInvalidLength() { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
99 |
test(new HotSpotReferenceMap(new Location[1], new Location[2], new int[3], 8)); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
100 |
} |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
101 |
|
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
102 |
@Test(expected = JVMCIError.class) |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
103 |
public void testInvalidShortOop() { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
104 |
PlatformKind kind = arch.getPlatformKind(JavaKind.Short); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
105 |
Register reg = getRegister(kind, 0); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
106 |
|
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
107 |
Location[] oops = new Location[]{Location.register(reg)}; |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
108 |
Location[] base = new Location[]{null}; |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
109 |
int[] size = new int[]{kind.getSizeInBytes()}; |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
110 |
|
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
111 |
test(new HotSpotReferenceMap(oops, base, size, 8)); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
112 |
} |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
diff
changeset
|
113 |
} |