author | dnsimon |
Tue, 26 Jan 2016 11:28:54 -1000 | |
changeset 35604 | 7b6aa6e00062 |
parent 35582 | c32a0cc19877 |
child 36508 | 5f9eee6b383b |
permissions | -rw-r--r-- |
35137
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
1 |
/* |
35582
c32a0cc19877
8147599: [JVMCI] simplify code installation interface
rschatz
parents:
35137
diff
changeset
|
2 |
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. |
35137
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
4 |
* |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
8 |
* |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
13 |
* accompanied this code). |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
14 |
* |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
18 |
* |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
21 |
* questions. |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
22 |
*/ |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
23 |
|
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
24 |
/** |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
25 |
* @test |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
26 |
* @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9") & os.arch != "aarch64" |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
27 |
* @compile CodeInstallationTest.java TestAssembler.java amd64/AMD64TestAssembler.java sparc/SPARCTestAssembler.java |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
28 |
* @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI compiler.jvmci.code.DataPatchTest |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
29 |
*/ |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
30 |
|
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
31 |
package compiler.jvmci.code; |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
32 |
|
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
33 |
import jdk.vm.ci.code.Register; |
35582
c32a0cc19877
8147599: [JVMCI] simplify code installation interface
rschatz
parents:
35137
diff
changeset
|
34 |
import jdk.vm.ci.code.site.DataSectionReference; |
35137
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
35 |
import jdk.vm.ci.hotspot.HotSpotConstant; |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
36 |
import jdk.vm.ci.hotspot.HotSpotVMConfig; |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
37 |
import jdk.vm.ci.meta.ResolvedJavaType; |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
38 |
|
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
39 |
import org.junit.Assume; |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
40 |
import org.junit.Test; |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
41 |
|
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
42 |
/** |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
43 |
* Test code installation with data patches. |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
44 |
*/ |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
45 |
public class DataPatchTest extends CodeInstallationTest { |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
46 |
|
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
47 |
public static Class<?> getConstClass() { |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
48 |
return DataPatchTest.class; |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
49 |
} |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
50 |
|
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
51 |
private void test(TestCompiler compiler) { |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
52 |
test(compiler, getMethod("getConstClass")); |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
53 |
} |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
54 |
|
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
55 |
@Test |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
56 |
public void testInlineObject() { |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
57 |
test(asm -> { |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
58 |
ResolvedJavaType type = metaAccess.lookupJavaType(getConstClass()); |
35604
7b6aa6e00062
8148202: move lookup of Java class and hub from ResolvedJavaType to ConstantReflectionProvider
dnsimon
parents:
35582
diff
changeset
|
59 |
HotSpotConstant c = (HotSpotConstant) constantReflection.asJavaClass(type); |
35137
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
60 |
Register ret = asm.emitLoadPointer(c); |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
61 |
asm.emitPointerRet(ret); |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
62 |
}); |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
63 |
} |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
64 |
|
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
65 |
@Test |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
66 |
public void testInlineNarrowObject() { |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
67 |
Assume.assumeTrue(HotSpotVMConfig.config().useCompressedOops); |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
68 |
test(asm -> { |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
69 |
ResolvedJavaType type = metaAccess.lookupJavaType(getConstClass()); |
35604
7b6aa6e00062
8148202: move lookup of Java class and hub from ResolvedJavaType to ConstantReflectionProvider
dnsimon
parents:
35582
diff
changeset
|
70 |
HotSpotConstant c = (HotSpotConstant) constantReflection.asJavaClass(type); |
35137
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
71 |
Register compressed = asm.emitLoadPointer((HotSpotConstant) c.compress()); |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
72 |
Register ret = asm.emitUncompressPointer(compressed, HotSpotVMConfig.config().narrowOopBase, HotSpotVMConfig.config().narrowOopShift); |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
73 |
asm.emitPointerRet(ret); |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
74 |
}); |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
75 |
} |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
76 |
|
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
77 |
@Test |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
78 |
public void testDataSectionReference() { |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
79 |
test(asm -> { |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
80 |
ResolvedJavaType type = metaAccess.lookupJavaType(getConstClass()); |
35604
7b6aa6e00062
8148202: move lookup of Java class and hub from ResolvedJavaType to ConstantReflectionProvider
dnsimon
parents:
35582
diff
changeset
|
81 |
HotSpotConstant c = (HotSpotConstant) constantReflection.asJavaClass(type); |
35582
c32a0cc19877
8147599: [JVMCI] simplify code installation interface
rschatz
parents:
35137
diff
changeset
|
82 |
DataSectionReference ref = asm.emitDataItem(c); |
35137
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
83 |
Register ret = asm.emitLoadPointer(ref); |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
84 |
asm.emitPointerRet(ret); |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
85 |
}); |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
86 |
} |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
87 |
|
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
88 |
@Test |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
89 |
public void testNarrowDataSectionReference() { |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
90 |
Assume.assumeTrue(HotSpotVMConfig.config().useCompressedOops); |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
91 |
test(asm -> { |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
92 |
ResolvedJavaType type = metaAccess.lookupJavaType(getConstClass()); |
35604
7b6aa6e00062
8148202: move lookup of Java class and hub from ResolvedJavaType to ConstantReflectionProvider
dnsimon
parents:
35582
diff
changeset
|
93 |
HotSpotConstant c = (HotSpotConstant) constantReflection.asJavaClass(type); |
35137
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
94 |
HotSpotConstant cCompressed = (HotSpotConstant) c.compress(); |
35582
c32a0cc19877
8147599: [JVMCI] simplify code installation interface
rschatz
parents:
35137
diff
changeset
|
95 |
DataSectionReference ref = asm.emitDataItem(cCompressed); |
35137
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
96 |
Register compressed = asm.emitLoadNarrowPointer(ref); |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
97 |
Register ret = asm.emitUncompressPointer(compressed, HotSpotVMConfig.config().narrowOopBase, HotSpotVMConfig.config().narrowOopShift); |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
98 |
asm.emitPointerRet(ret); |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
99 |
}); |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
100 |
} |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
101 |
|
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
102 |
@Test |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
103 |
public void testInlineMetadata() { |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
104 |
test(asm -> { |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
105 |
ResolvedJavaType type = metaAccess.lookupJavaType(getConstClass()); |
35604
7b6aa6e00062
8148202: move lookup of Java class and hub from ResolvedJavaType to ConstantReflectionProvider
dnsimon
parents:
35582
diff
changeset
|
106 |
Register klass = asm.emitLoadPointer((HotSpotConstant) constantReflection.asObjectHub(type)); |
35137
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
107 |
Register ret = asm.emitLoadPointer(klass, HotSpotVMConfig.config().classMirrorOffset); |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
108 |
asm.emitPointerRet(ret); |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
109 |
}); |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
110 |
} |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
111 |
|
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
112 |
@Test |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
113 |
public void testInlineNarrowMetadata() { |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
114 |
Assume.assumeTrue(HotSpotVMConfig.config().useCompressedClassPointers); |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
115 |
test(asm -> { |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
116 |
ResolvedJavaType type = metaAccess.lookupJavaType(getConstClass()); |
35604
7b6aa6e00062
8148202: move lookup of Java class and hub from ResolvedJavaType to ConstantReflectionProvider
dnsimon
parents:
35582
diff
changeset
|
117 |
HotSpotConstant hub = (HotSpotConstant) constantReflection.asObjectHub(type); |
35137
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
118 |
Register narrowKlass = asm.emitLoadPointer((HotSpotConstant) hub.compress()); |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
119 |
Register klass = asm.emitUncompressPointer(narrowKlass, HotSpotVMConfig.config().narrowKlassBase, HotSpotVMConfig.config().narrowKlassShift); |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
120 |
Register ret = asm.emitLoadPointer(klass, HotSpotVMConfig.config().classMirrorOffset); |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
121 |
asm.emitPointerRet(ret); |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
122 |
}); |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
123 |
} |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
124 |
|
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
125 |
@Test |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
126 |
public void testMetadataInDataSection() { |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
127 |
test(asm -> { |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
128 |
ResolvedJavaType type = metaAccess.lookupJavaType(getConstClass()); |
35604
7b6aa6e00062
8148202: move lookup of Java class and hub from ResolvedJavaType to ConstantReflectionProvider
dnsimon
parents:
35582
diff
changeset
|
129 |
HotSpotConstant hub = (HotSpotConstant) constantReflection.asObjectHub(type); |
35582
c32a0cc19877
8147599: [JVMCI] simplify code installation interface
rschatz
parents:
35137
diff
changeset
|
130 |
DataSectionReference ref = asm.emitDataItem(hub); |
35137
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
131 |
Register klass = asm.emitLoadPointer(ref); |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
132 |
Register ret = asm.emitLoadPointer(klass, HotSpotVMConfig.config().classMirrorOffset); |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
133 |
asm.emitPointerRet(ret); |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
134 |
}); |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
135 |
} |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
136 |
|
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
137 |
@Test |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
138 |
public void testNarrowMetadataInDataSection() { |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
139 |
Assume.assumeTrue(HotSpotVMConfig.config().useCompressedClassPointers); |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
140 |
test(asm -> { |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
141 |
ResolvedJavaType type = metaAccess.lookupJavaType(getConstClass()); |
35604
7b6aa6e00062
8148202: move lookup of Java class and hub from ResolvedJavaType to ConstantReflectionProvider
dnsimon
parents:
35582
diff
changeset
|
142 |
HotSpotConstant hub = (HotSpotConstant) constantReflection.asObjectHub(type); |
35137
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
143 |
HotSpotConstant narrowHub = (HotSpotConstant) hub.compress(); |
35582
c32a0cc19877
8147599: [JVMCI] simplify code installation interface
rschatz
parents:
35137
diff
changeset
|
144 |
DataSectionReference ref = asm.emitDataItem(narrowHub); |
35137
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
145 |
Register narrowKlass = asm.emitLoadNarrowPointer(ref); |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
146 |
Register klass = asm.emitUncompressPointer(narrowKlass, HotSpotVMConfig.config().narrowKlassBase, HotSpotVMConfig.config().narrowKlassShift); |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
147 |
Register ret = asm.emitLoadPointer(klass, HotSpotVMConfig.config().classMirrorOffset); |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
148 |
asm.emitPointerRet(ret); |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
149 |
}); |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
150 |
} |
c8f8f6de68a7
8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff
changeset
|
151 |
} |