Mercurial > hg > graal-jvmci-8
annotate jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotConstantPool.java @ 23689:d814713e3b02 jvmci-0.13
backport of changes from JDK-8157181
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 16 Jun 2016 00:25:39 +0200 |
parents | eb166b568645 |
children | 9e1235406b59 |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
21552
9579a3c62a9e
use skeleton findbugs jar containing only SuppresFBWarnings to avoid external dependency for JVMCI classes (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21431
diff
changeset
|
2 * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
4 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
8 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
14 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
18 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
21 * questions. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
22 */ |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22605
diff
changeset
|
23 package jdk.vm.ci.hotspot; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22605
diff
changeset
|
25 import static jdk.vm.ci.hotspot.CompilerToVM.compilerToVM; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22605
diff
changeset
|
26 import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22605
diff
changeset
|
27 import static jdk.vm.ci.hotspot.HotSpotVMConfig.config; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22605
diff
changeset
|
28 import static jdk.vm.ci.hotspot.UnsafeAccess.UNSAFE; |
9289
261a43921c5e
rename: HotSpotGraalRuntime.getInstance() -> graalRuntime()
Doug Simon <doug.simon@oracle.com>
parents:
9108
diff
changeset
|
29 |
22569
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22542
diff
changeset
|
30 import java.lang.invoke.MethodHandle; |
14093 | 31 |
23392
b3a816d3b844
Backed out changeset: a920338dd4d4
Doug Simon <doug.simon@oracle.com>
parents:
23387
diff
changeset
|
32 import jdk.vm.ci.common.JVMCIError; |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22605
diff
changeset
|
33 import jdk.vm.ci.meta.ConstantPool; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22605
diff
changeset
|
34 import jdk.vm.ci.meta.JavaConstant; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22605
diff
changeset
|
35 import jdk.vm.ci.meta.JavaField; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22605
diff
changeset
|
36 import jdk.vm.ci.meta.JavaMethod; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22605
diff
changeset
|
37 import jdk.vm.ci.meta.JavaType; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22605
diff
changeset
|
38 import jdk.vm.ci.meta.ResolvedJavaMethod; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22605
diff
changeset
|
39 import jdk.vm.ci.meta.ResolvedJavaType; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22605
diff
changeset
|
40 import jdk.vm.ci.meta.Signature; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
41 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
42 /** |
5775
2c088af17e59
Removed left over Ri* prefixed identifiers
Doug Simon <doug.simon@oracle.com>
parents:
5554
diff
changeset
|
43 * Implementation of {@link ConstantPool} for HotSpot. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
44 */ |
23393
1d4ce2d19e52
clean up and minimize JVMCI (JDK-8156835)
Doug Simon <doug.simon@oracle.com>
parents:
23392
diff
changeset
|
45 final class HotSpotConstantPool implements ConstantPool, MetaspaceWrapperObject { |
5278
74dfa6f86879
removed last remaining references to vmEntries and vmExits
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
46 |
13259
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13254
diff
changeset
|
47 /** |
21720
d915361cc3a1
moved asm, bytecode and asm.test code back to com.oracle.graal name space (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21713
diff
changeset
|
48 * Subset of JVM bytecode opcodes used by {@link HotSpotConstantPool}. |
d915361cc3a1
moved asm, bytecode and asm.test code back to com.oracle.graal name space (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21713
diff
changeset
|
49 */ |
21780
3d15183f3c93
Introduce Compiler interface in jvmci. Use it from jvmci.hotspot.CompilationTask
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21720
diff
changeset
|
50 public static class Bytecodes { |
21720
d915361cc3a1
moved asm, bytecode and asm.test code back to com.oracle.graal name space (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21713
diff
changeset
|
51 public static final int LDC = 18; // 0x12 |
d915361cc3a1
moved asm, bytecode and asm.test code back to com.oracle.graal name space (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21713
diff
changeset
|
52 public static final int LDC_W = 19; // 0x13 |
d915361cc3a1
moved asm, bytecode and asm.test code back to com.oracle.graal name space (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21713
diff
changeset
|
53 public static final int LDC2_W = 20; // 0x14 |
d915361cc3a1
moved asm, bytecode and asm.test code back to com.oracle.graal name space (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21713
diff
changeset
|
54 public static final int GETSTATIC = 178; // 0xB2 |
d915361cc3a1
moved asm, bytecode and asm.test code back to com.oracle.graal name space (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21713
diff
changeset
|
55 public static final int PUTSTATIC = 179; // 0xB3 |
d915361cc3a1
moved asm, bytecode and asm.test code back to com.oracle.graal name space (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21713
diff
changeset
|
56 public static final int GETFIELD = 180; // 0xB4 |
d915361cc3a1
moved asm, bytecode and asm.test code back to com.oracle.graal name space (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21713
diff
changeset
|
57 public static final int PUTFIELD = 181; // 0xB5 |
d915361cc3a1
moved asm, bytecode and asm.test code back to com.oracle.graal name space (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21713
diff
changeset
|
58 public static final int INVOKEVIRTUAL = 182; // 0xB6 |
d915361cc3a1
moved asm, bytecode and asm.test code back to com.oracle.graal name space (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21713
diff
changeset
|
59 public static final int INVOKESPECIAL = 183; // 0xB7 |
d915361cc3a1
moved asm, bytecode and asm.test code back to com.oracle.graal name space (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21713
diff
changeset
|
60 public static final int INVOKESTATIC = 184; // 0xB8 |
d915361cc3a1
moved asm, bytecode and asm.test code back to com.oracle.graal name space (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21713
diff
changeset
|
61 public static final int INVOKEINTERFACE = 185; // 0xB9 |
d915361cc3a1
moved asm, bytecode and asm.test code back to com.oracle.graal name space (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21713
diff
changeset
|
62 public static final int INVOKEDYNAMIC = 186; // 0xBA |
d915361cc3a1
moved asm, bytecode and asm.test code back to com.oracle.graal name space (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21713
diff
changeset
|
63 public static final int NEW = 187; // 0xBB |
d915361cc3a1
moved asm, bytecode and asm.test code back to com.oracle.graal name space (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21713
diff
changeset
|
64 public static final int NEWARRAY = 188; // 0xBC |
d915361cc3a1
moved asm, bytecode and asm.test code back to com.oracle.graal name space (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21713
diff
changeset
|
65 public static final int ANEWARRAY = 189; // 0xBD |
d915361cc3a1
moved asm, bytecode and asm.test code back to com.oracle.graal name space (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21713
diff
changeset
|
66 public static final int CHECKCAST = 192; // 0xC0 |
d915361cc3a1
moved asm, bytecode and asm.test code back to com.oracle.graal name space (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21713
diff
changeset
|
67 public static final int INSTANCEOF = 193; // 0xC1 |
d915361cc3a1
moved asm, bytecode and asm.test code back to com.oracle.graal name space (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21713
diff
changeset
|
68 public static final int MULTIANEWARRAY = 197; // 0xC5 |
d915361cc3a1
moved asm, bytecode and asm.test code back to com.oracle.graal name space (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21713
diff
changeset
|
69 |
d915361cc3a1
moved asm, bytecode and asm.test code back to com.oracle.graal name space (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21713
diff
changeset
|
70 static boolean isInvoke(int opcode) { |
d915361cc3a1
moved asm, bytecode and asm.test code back to com.oracle.graal name space (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21713
diff
changeset
|
71 switch (opcode) { |
d915361cc3a1
moved asm, bytecode and asm.test code back to com.oracle.graal name space (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21713
diff
changeset
|
72 case INVOKEVIRTUAL: |
d915361cc3a1
moved asm, bytecode and asm.test code back to com.oracle.graal name space (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21713
diff
changeset
|
73 case INVOKESPECIAL: |
d915361cc3a1
moved asm, bytecode and asm.test code back to com.oracle.graal name space (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21713
diff
changeset
|
74 case INVOKESTATIC: |
d915361cc3a1
moved asm, bytecode and asm.test code back to com.oracle.graal name space (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21713
diff
changeset
|
75 case INVOKEINTERFACE: |
d915361cc3a1
moved asm, bytecode and asm.test code back to com.oracle.graal name space (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21713
diff
changeset
|
76 case INVOKEDYNAMIC: |
d915361cc3a1
moved asm, bytecode and asm.test code back to com.oracle.graal name space (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21713
diff
changeset
|
77 return true; |
d915361cc3a1
moved asm, bytecode and asm.test code back to com.oracle.graal name space (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21713
diff
changeset
|
78 default: |
d915361cc3a1
moved asm, bytecode and asm.test code back to com.oracle.graal name space (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21713
diff
changeset
|
79 return false; |
d915361cc3a1
moved asm, bytecode and asm.test code back to com.oracle.graal name space (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21713
diff
changeset
|
80 } |
d915361cc3a1
moved asm, bytecode and asm.test code back to com.oracle.graal name space (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21713
diff
changeset
|
81 } |
22089
13a50cb905b7
Only invokevirtual and invokespecial are invokehandle aliases.
twisti
parents:
22054
diff
changeset
|
82 |
13a50cb905b7
Only invokevirtual and invokespecial are invokehandle aliases.
twisti
parents:
22054
diff
changeset
|
83 /** |
13a50cb905b7
Only invokevirtual and invokespecial are invokehandle aliases.
twisti
parents:
22054
diff
changeset
|
84 * See: {@code Rewriter::maybe_rewrite_invokehandle}. |
13a50cb905b7
Only invokevirtual and invokespecial are invokehandle aliases.
twisti
parents:
22054
diff
changeset
|
85 */ |
13a50cb905b7
Only invokevirtual and invokespecial are invokehandle aliases.
twisti
parents:
22054
diff
changeset
|
86 static boolean isInvokeHandleAlias(int opcode) { |
13a50cb905b7
Only invokevirtual and invokespecial are invokehandle aliases.
twisti
parents:
22054
diff
changeset
|
87 switch (opcode) { |
13a50cb905b7
Only invokevirtual and invokespecial are invokehandle aliases.
twisti
parents:
22054
diff
changeset
|
88 case INVOKEVIRTUAL: |
13a50cb905b7
Only invokevirtual and invokespecial are invokehandle aliases.
twisti
parents:
22054
diff
changeset
|
89 case INVOKESPECIAL: |
13a50cb905b7
Only invokevirtual and invokespecial are invokehandle aliases.
twisti
parents:
22054
diff
changeset
|
90 return true; |
13a50cb905b7
Only invokevirtual and invokespecial are invokehandle aliases.
twisti
parents:
22054
diff
changeset
|
91 default: |
13a50cb905b7
Only invokevirtual and invokespecial are invokehandle aliases.
twisti
parents:
22054
diff
changeset
|
92 return false; |
13a50cb905b7
Only invokevirtual and invokespecial are invokehandle aliases.
twisti
parents:
22054
diff
changeset
|
93 } |
13a50cb905b7
Only invokevirtual and invokespecial are invokehandle aliases.
twisti
parents:
22054
diff
changeset
|
94 } |
21720
d915361cc3a1
moved asm, bytecode and asm.test code back to com.oracle.graal name space (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21713
diff
changeset
|
95 } |
d915361cc3a1
moved asm, bytecode and asm.test code back to com.oracle.graal name space (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21713
diff
changeset
|
96 |
d915361cc3a1
moved asm, bytecode and asm.test code back to com.oracle.graal name space (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21713
diff
changeset
|
97 /** |
14529 | 98 * Enum of all {@code JVM_CONSTANT} constants used in the VM. This includes the public and |
99 * internal ones. | |
100 */ | |
101 private enum JVM_CONSTANT { | |
102 // @formatter:off | |
103 Utf8(config().jvmConstantUtf8), | |
104 Integer(config().jvmConstantInteger), | |
105 Long(config().jvmConstantLong), | |
106 Float(config().jvmConstantFloat), | |
107 Double(config().jvmConstantDouble), | |
108 Class(config().jvmConstantClass), | |
109 UnresolvedClass(config().jvmConstantUnresolvedClass), | |
110 UnresolvedClassInError(config().jvmConstantUnresolvedClassInError), | |
111 String(config().jvmConstantString), | |
112 Fieldref(config().jvmConstantFieldref), | |
113 MethodRef(config().jvmConstantMethodref), | |
114 InterfaceMethodref(config().jvmConstantInterfaceMethodref), | |
115 NameAndType(config().jvmConstantNameAndType), | |
116 MethodHandle(config().jvmConstantMethodHandle), | |
117 MethodHandleInError(config().jvmConstantMethodHandleInError), | |
118 MethodType(config().jvmConstantMethodType), | |
14979
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
119 MethodTypeInError(config().jvmConstantMethodTypeInError), |
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
120 InvokeDynamic(config().jvmConstantInvokeDynamic); |
14529 | 121 // @formatter:on |
122 | |
17393
a8186c7f73e9
added table to speed up mapping JVM_CONSTANT tag value to JVM_CONSTANT enum object
Doug Simon <doug.simon@oracle.com>
parents:
15968
diff
changeset
|
123 private final int tag; |
14529 | 124 |
17393
a8186c7f73e9
added table to speed up mapping JVM_CONSTANT tag value to JVM_CONSTANT enum object
Doug Simon <doug.simon@oracle.com>
parents:
15968
diff
changeset
|
125 private static final int ExternalMax = config().jvmConstantExternalMax; |
a8186c7f73e9
added table to speed up mapping JVM_CONSTANT tag value to JVM_CONSTANT enum object
Doug Simon <doug.simon@oracle.com>
parents:
15968
diff
changeset
|
126 private static final int InternalMin = config().jvmConstantInternalMin; |
a8186c7f73e9
added table to speed up mapping JVM_CONSTANT tag value to JVM_CONSTANT enum object
Doug Simon <doug.simon@oracle.com>
parents:
15968
diff
changeset
|
127 private static final int InternalMax = config().jvmConstantInternalMax; |
a8186c7f73e9
added table to speed up mapping JVM_CONSTANT tag value to JVM_CONSTANT enum object
Doug Simon <doug.simon@oracle.com>
parents:
15968
diff
changeset
|
128 |
23297
4b58c92e939b
remove redundant modifiers
Manuel Rigger <rigger.manuel@gmail.com>
parents:
22672
diff
changeset
|
129 JVM_CONSTANT(int tag) { |
17393
a8186c7f73e9
added table to speed up mapping JVM_CONSTANT tag value to JVM_CONSTANT enum object
Doug Simon <doug.simon@oracle.com>
parents:
15968
diff
changeset
|
130 this.tag = tag; |
14529 | 131 } |
132 | |
17393
a8186c7f73e9
added table to speed up mapping JVM_CONSTANT tag value to JVM_CONSTANT enum object
Doug Simon <doug.simon@oracle.com>
parents:
15968
diff
changeset
|
133 /** |
a8186c7f73e9
added table to speed up mapping JVM_CONSTANT tag value to JVM_CONSTANT enum object
Doug Simon <doug.simon@oracle.com>
parents:
15968
diff
changeset
|
134 * Maps JVM_CONSTANT tags to {@link JVM_CONSTANT} values. Using a separate class for lazy |
a8186c7f73e9
added table to speed up mapping JVM_CONSTANT tag value to JVM_CONSTANT enum object
Doug Simon <doug.simon@oracle.com>
parents:
15968
diff
changeset
|
135 * initialization. |
a8186c7f73e9
added table to speed up mapping JVM_CONSTANT tag value to JVM_CONSTANT enum object
Doug Simon <doug.simon@oracle.com>
parents:
15968
diff
changeset
|
136 */ |
a8186c7f73e9
added table to speed up mapping JVM_CONSTANT tag value to JVM_CONSTANT enum object
Doug Simon <doug.simon@oracle.com>
parents:
15968
diff
changeset
|
137 static class TagValueMap { |
a8186c7f73e9
added table to speed up mapping JVM_CONSTANT tag value to JVM_CONSTANT enum object
Doug Simon <doug.simon@oracle.com>
parents:
15968
diff
changeset
|
138 private static final JVM_CONSTANT[] table = new JVM_CONSTANT[ExternalMax + 1 + (InternalMax - InternalMin) + 1]; |
22013
3904e33db5b3
Make sure HotSpotConstantPool.loadReferencedType resolves invokehandle call sites properly. Fixes eager resolution problems at those call sites.
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21798
diff
changeset
|
139 |
17393
a8186c7f73e9
added table to speed up mapping JVM_CONSTANT tag value to JVM_CONSTANT enum object
Doug Simon <doug.simon@oracle.com>
parents:
15968
diff
changeset
|
140 static { |
a8186c7f73e9
added table to speed up mapping JVM_CONSTANT tag value to JVM_CONSTANT enum object
Doug Simon <doug.simon@oracle.com>
parents:
15968
diff
changeset
|
141 assert InternalMin > ExternalMax; |
a8186c7f73e9
added table to speed up mapping JVM_CONSTANT tag value to JVM_CONSTANT enum object
Doug Simon <doug.simon@oracle.com>
parents:
15968
diff
changeset
|
142 for (JVM_CONSTANT e : values()) { |
a8186c7f73e9
added table to speed up mapping JVM_CONSTANT tag value to JVM_CONSTANT enum object
Doug Simon <doug.simon@oracle.com>
parents:
15968
diff
changeset
|
143 table[indexOf(e.tag)] = e; |
14529 | 144 } |
145 } | |
17393
a8186c7f73e9
added table to speed up mapping JVM_CONSTANT tag value to JVM_CONSTANT enum object
Doug Simon <doug.simon@oracle.com>
parents:
15968
diff
changeset
|
146 |
a8186c7f73e9
added table to speed up mapping JVM_CONSTANT tag value to JVM_CONSTANT enum object
Doug Simon <doug.simon@oracle.com>
parents:
15968
diff
changeset
|
147 private static int indexOf(int tag) { |
a8186c7f73e9
added table to speed up mapping JVM_CONSTANT tag value to JVM_CONSTANT enum object
Doug Simon <doug.simon@oracle.com>
parents:
15968
diff
changeset
|
148 if (tag >= InternalMin) { |
a8186c7f73e9
added table to speed up mapping JVM_CONSTANT tag value to JVM_CONSTANT enum object
Doug Simon <doug.simon@oracle.com>
parents:
15968
diff
changeset
|
149 return tag - InternalMin + ExternalMax + 1; |
a8186c7f73e9
added table to speed up mapping JVM_CONSTANT tag value to JVM_CONSTANT enum object
Doug Simon <doug.simon@oracle.com>
parents:
15968
diff
changeset
|
150 } else { |
a8186c7f73e9
added table to speed up mapping JVM_CONSTANT tag value to JVM_CONSTANT enum object
Doug Simon <doug.simon@oracle.com>
parents:
15968
diff
changeset
|
151 assert tag <= ExternalMax; |
a8186c7f73e9
added table to speed up mapping JVM_CONSTANT tag value to JVM_CONSTANT enum object
Doug Simon <doug.simon@oracle.com>
parents:
15968
diff
changeset
|
152 } |
a8186c7f73e9
added table to speed up mapping JVM_CONSTANT tag value to JVM_CONSTANT enum object
Doug Simon <doug.simon@oracle.com>
parents:
15968
diff
changeset
|
153 return tag; |
a8186c7f73e9
added table to speed up mapping JVM_CONSTANT tag value to JVM_CONSTANT enum object
Doug Simon <doug.simon@oracle.com>
parents:
15968
diff
changeset
|
154 } |
a8186c7f73e9
added table to speed up mapping JVM_CONSTANT tag value to JVM_CONSTANT enum object
Doug Simon <doug.simon@oracle.com>
parents:
15968
diff
changeset
|
155 |
a8186c7f73e9
added table to speed up mapping JVM_CONSTANT tag value to JVM_CONSTANT enum object
Doug Simon <doug.simon@oracle.com>
parents:
15968
diff
changeset
|
156 static JVM_CONSTANT get(int tag) { |
a8186c7f73e9
added table to speed up mapping JVM_CONSTANT tag value to JVM_CONSTANT enum object
Doug Simon <doug.simon@oracle.com>
parents:
15968
diff
changeset
|
157 JVM_CONSTANT res = table[indexOf(tag)]; |
a8186c7f73e9
added table to speed up mapping JVM_CONSTANT tag value to JVM_CONSTANT enum object
Doug Simon <doug.simon@oracle.com>
parents:
15968
diff
changeset
|
158 if (res != null) { |
a8186c7f73e9
added table to speed up mapping JVM_CONSTANT tag value to JVM_CONSTANT enum object
Doug Simon <doug.simon@oracle.com>
parents:
15968
diff
changeset
|
159 return res; |
a8186c7f73e9
added table to speed up mapping JVM_CONSTANT tag value to JVM_CONSTANT enum object
Doug Simon <doug.simon@oracle.com>
parents:
15968
diff
changeset
|
160 } |
23392
b3a816d3b844
Backed out changeset: a920338dd4d4
Doug Simon <doug.simon@oracle.com>
parents:
23387
diff
changeset
|
161 throw new JVMCIError("Unknown JVM_CONSTANT tag %s", tag); |
17393
a8186c7f73e9
added table to speed up mapping JVM_CONSTANT tag value to JVM_CONSTANT enum object
Doug Simon <doug.simon@oracle.com>
parents:
15968
diff
changeset
|
162 } |
a8186c7f73e9
added table to speed up mapping JVM_CONSTANT tag value to JVM_CONSTANT enum object
Doug Simon <doug.simon@oracle.com>
parents:
15968
diff
changeset
|
163 } |
a8186c7f73e9
added table to speed up mapping JVM_CONSTANT tag value to JVM_CONSTANT enum object
Doug Simon <doug.simon@oracle.com>
parents:
15968
diff
changeset
|
164 |
a8186c7f73e9
added table to speed up mapping JVM_CONSTANT tag value to JVM_CONSTANT enum object
Doug Simon <doug.simon@oracle.com>
parents:
15968
diff
changeset
|
165 public static JVM_CONSTANT getEnum(int tag) { |
a8186c7f73e9
added table to speed up mapping JVM_CONSTANT tag value to JVM_CONSTANT enum object
Doug Simon <doug.simon@oracle.com>
parents:
15968
diff
changeset
|
166 return TagValueMap.get(tag); |
14529 | 167 } |
168 } | |
169 | |
21252
39ee26e85256
Use boxed cache in HotSpotConstantpool instead of synchronization
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21215
diff
changeset
|
170 private static class LookupTypeCacheElement { |
39ee26e85256
Use boxed cache in HotSpotConstantpool instead of synchronization
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21215
diff
changeset
|
171 int lastCpi = Integer.MIN_VALUE; |
39ee26e85256
Use boxed cache in HotSpotConstantpool instead of synchronization
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21215
diff
changeset
|
172 JavaType javaType; |
39ee26e85256
Use boxed cache in HotSpotConstantpool instead of synchronization
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21215
diff
changeset
|
173 |
23297
4b58c92e939b
remove redundant modifiers
Manuel Rigger <rigger.manuel@gmail.com>
parents:
22672
diff
changeset
|
174 LookupTypeCacheElement(int lastCpi, JavaType javaType) { |
21252
39ee26e85256
Use boxed cache in HotSpotConstantpool instead of synchronization
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21215
diff
changeset
|
175 super(); |
39ee26e85256
Use boxed cache in HotSpotConstantpool instead of synchronization
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21215
diff
changeset
|
176 this.lastCpi = lastCpi; |
39ee26e85256
Use boxed cache in HotSpotConstantpool instead of synchronization
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21215
diff
changeset
|
177 this.javaType = javaType; |
39ee26e85256
Use boxed cache in HotSpotConstantpool instead of synchronization
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21215
diff
changeset
|
178 } |
39ee26e85256
Use boxed cache in HotSpotConstantpool instead of synchronization
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21215
diff
changeset
|
179 } |
39ee26e85256
Use boxed cache in HotSpotConstantpool instead of synchronization
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21215
diff
changeset
|
180 |
14529 | 181 /** |
13259
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13254
diff
changeset
|
182 * Reference to the C++ ConstantPool object. |
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13254
diff
changeset
|
183 */ |
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13254
diff
changeset
|
184 private final long metaspaceConstantPool; |
21252
39ee26e85256
Use boxed cache in HotSpotConstantpool instead of synchronization
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21215
diff
changeset
|
185 private volatile LookupTypeCacheElement lastLookupType; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
186 |
22234
179db500f6e5
Add Java code for reading the constant pool cache plus sun.reflect.ConstantPool substitutions.
twisti
parents:
22100
diff
changeset
|
187 /** |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
188 * Gets the JVMCI mirror from a HotSpot constant pool.The VM is responsible for ensuring that |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
189 * the ConstantPool is kept alive for the duration of this call and the |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
190 * {@link HotSpotJVMCIMetaAccessContext} keeps it alive after that. |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
191 * |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
192 * Called from the VM. |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
193 * |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
194 * @param metaspaceConstantPool a metaspace ConstantPool object |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
195 * @return the {@link HotSpotConstantPool} corresponding to {@code metaspaceConstantPool} |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
196 */ |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
197 @SuppressWarnings("unused") |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
198 private static HotSpotConstantPool fromMetaspace(long metaspaceConstantPool) { |
23677 | 199 HotSpotConstantPool cp = new HotSpotConstantPool(metaspaceConstantPool); |
200 runtime().metaAccessContext.add(cp); | |
201 return cp; | |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
202 } |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
203 |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
204 private HotSpotConstantPool(long metaspaceConstantPool) { |
13259
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13254
diff
changeset
|
205 this.metaspaceConstantPool = metaspaceConstantPool; |
13254
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
206 } |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
207 |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
208 /** |
18223
17c98fad6980
converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18222
diff
changeset
|
209 * Gets the holder for this constant pool as {@link HotSpotResolvedObjectTypeImpl}. |
14979
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
210 * |
14093 | 211 * @return holder for this constant pool |
212 */ | |
14117
2b2f0022900f
removed unnecessary lookupKlassByName method
Doug Simon <doug.simon@oracle.com>
parents:
14093
diff
changeset
|
213 private HotSpotResolvedObjectType getHolder() { |
22582
232c53e17ea0
added CompilerToVM.compilerToVM() for static access to the CompilerToVM instance
Doug Simon <doug.simon@oracle.com>
parents:
22581
diff
changeset
|
214 return compilerToVM().getResolvedJavaType(this, config().constantPoolHolderOffset, false); |
14093 | 215 } |
216 | |
217 /** | |
14052
361acb279104
moved to-constant-pool-index conversion up to Java
twisti
parents:
13261
diff
changeset
|
218 * Converts a raw index from the bytecodes to a constant pool index by adding a |
361acb279104
moved to-constant-pool-index conversion up to Java
twisti
parents:
13261
diff
changeset
|
219 * {@link HotSpotVMConfig#constantPoolCpCacheIndexTag constant}. |
14979
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
220 * |
14052
361acb279104
moved to-constant-pool-index conversion up to Java
twisti
parents:
13261
diff
changeset
|
221 * @param rawIndex index from the bytecode |
361acb279104
moved to-constant-pool-index conversion up to Java
twisti
parents:
13261
diff
changeset
|
222 * @param opcode bytecode to convert the index for |
361acb279104
moved to-constant-pool-index conversion up to Java
twisti
parents:
13261
diff
changeset
|
223 * @return constant pool index |
361acb279104
moved to-constant-pool-index conversion up to Java
twisti
parents:
13261
diff
changeset
|
224 */ |
22234
179db500f6e5
Add Java code for reading the constant pool cache plus sun.reflect.ConstantPool substitutions.
twisti
parents:
22100
diff
changeset
|
225 private static int rawIndexToConstantPoolIndex(int rawIndex, int opcode) { |
14052
361acb279104
moved to-constant-pool-index conversion up to Java
twisti
parents:
13261
diff
changeset
|
226 int index; |
361acb279104
moved to-constant-pool-index conversion up to Java
twisti
parents:
13261
diff
changeset
|
227 if (opcode == Bytecodes.INVOKEDYNAMIC) { |
361acb279104
moved to-constant-pool-index conversion up to Java
twisti
parents:
13261
diff
changeset
|
228 index = rawIndex; |
361acb279104
moved to-constant-pool-index conversion up to Java
twisti
parents:
13261
diff
changeset
|
229 // See: ConstantPool::is_invokedynamic_index |
361acb279104
moved to-constant-pool-index conversion up to Java
twisti
parents:
13261
diff
changeset
|
230 assert index < 0 : "not an invokedynamic constant pool index " + index; |
361acb279104
moved to-constant-pool-index conversion up to Java
twisti
parents:
13261
diff
changeset
|
231 } else { |
361acb279104
moved to-constant-pool-index conversion up to Java
twisti
parents:
13261
diff
changeset
|
232 assert opcode == Bytecodes.GETFIELD || opcode == Bytecodes.PUTFIELD || opcode == Bytecodes.GETSTATIC || opcode == Bytecodes.PUTSTATIC || opcode == Bytecodes.INVOKEINTERFACE || |
21552
9579a3c62a9e
use skeleton findbugs jar containing only SuppresFBWarnings to avoid external dependency for JVMCI classes (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21431
diff
changeset
|
233 opcode == Bytecodes.INVOKEVIRTUAL || opcode == Bytecodes.INVOKESPECIAL || opcode == Bytecodes.INVOKESTATIC : "unexpected invoke opcode " + opcode; |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
234 index = rawIndex + config().constantPoolCpCacheIndexTag; |
14052
361acb279104
moved to-constant-pool-index conversion up to Java
twisti
parents:
13261
diff
changeset
|
235 } |
361acb279104
moved to-constant-pool-index conversion up to Java
twisti
parents:
13261
diff
changeset
|
236 return index; |
361acb279104
moved to-constant-pool-index conversion up to Java
twisti
parents:
13261
diff
changeset
|
237 } |
361acb279104
moved to-constant-pool-index conversion up to Java
twisti
parents:
13261
diff
changeset
|
238 |
361acb279104
moved to-constant-pool-index conversion up to Java
twisti
parents:
13261
diff
changeset
|
239 /** |
14979
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
240 * Decode a constant pool cache index to a constant pool index. |
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
241 * |
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
242 * See {@code ConstantPool::decode_cpcache_index}. |
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
243 * |
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
244 * @param index constant pool cache index |
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
245 * @return decoded index |
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
246 */ |
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
247 private static int decodeConstantPoolCacheIndex(int index) { |
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
248 if (isInvokedynamicIndex(index)) { |
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
249 return decodeInvokedynamicIndex(index); |
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
250 } else { |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
251 return index - config().constantPoolCpCacheIndexTag; |
14979
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
252 } |
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
253 } |
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
254 |
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
255 /** |
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
256 * See {@code ConstantPool::is_invokedynamic_index}. |
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
257 */ |
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
258 private static boolean isInvokedynamicIndex(int index) { |
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
259 return index < 0; |
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
260 } |
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
261 |
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
262 /** |
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
263 * See {@code ConstantPool::decode_invokedynamic_index}. |
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
264 */ |
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
265 private static int decodeInvokedynamicIndex(int i) { |
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
266 assert isInvokedynamicIndex(i) : i; |
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
267 return ~i; |
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
268 } |
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
269 |
22598
ed53e370f04c
Make implementation classes package private.
Roland Schatz <roland.schatz@oracle.com>
parents:
22582
diff
changeset
|
270 long getMetaspaceConstantPool() { |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
271 return metaspaceConstantPool; |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
272 } |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
273 |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
274 public long getMetaspacePointer() { |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
275 return getMetaspaceConstantPool(); |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
276 } |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
277 |
14979
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
278 /** |
14093 | 279 * Gets the constant pool tag at index {@code index}. |
14979
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
280 * |
13254
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
281 * @param index constant pool index |
14093 | 282 * @return constant pool tag |
13254
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
283 */ |
14529 | 284 private JVM_CONSTANT getTagAt(int index) { |
13254
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
285 assertBounds(index); |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
286 HotSpotVMConfig config = config(); |
22542
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
287 final long metaspaceConstantPoolTags = UNSAFE.getAddress(getMetaspaceConstantPool() + config.constantPoolTagsOffset); |
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
288 final int tag = UNSAFE.getByteVolatile(null, metaspaceConstantPoolTags + config.arrayU1DataOffset + index); |
17394
f520089af480
made HotSpotConstantPool.loadReferencedType handle attempts to resolve constant pool indexes that do not refer to a type
Doug Simon <doug.simon@oracle.com>
parents:
17393
diff
changeset
|
289 if (tag == 0) { |
f520089af480
made HotSpotConstantPool.loadReferencedType handle attempts to resolve constant pool indexes that do not refer to a type
Doug Simon <doug.simon@oracle.com>
parents:
17393
diff
changeset
|
290 return null; |
f520089af480
made HotSpotConstantPool.loadReferencedType handle attempts to resolve constant pool indexes that do not refer to a type
Doug Simon <doug.simon@oracle.com>
parents:
17393
diff
changeset
|
291 } |
14529 | 292 return JVM_CONSTANT.getEnum(tag); |
13254
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
293 } |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
294 |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
295 /** |
14093 | 296 * Gets the constant pool entry at index {@code index}. |
14979
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
297 * |
13254
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
298 * @param index constant pool index |
14093 | 299 * @return constant pool entry |
13254
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
300 */ |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
301 private long getEntryAt(int index) { |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
302 assertBounds(index); |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
303 return UNSAFE.getAddress(getMetaspaceConstantPool() + config().constantPoolSize + index * runtime().getHostJVMCIBackend().getTarget().wordSize); |
13254
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
304 } |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
305 |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
306 /** |
14093 | 307 * Gets the integer constant pool entry at index {@code index}. |
14979
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
308 * |
13254
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
309 * @param index constant pool index |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
310 * @return integer constant pool entry at index |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
311 */ |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
312 private int getIntAt(int index) { |
14529 | 313 assertTag(index, JVM_CONSTANT.Integer); |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
314 return UNSAFE.getInt(getMetaspaceConstantPool() + config().constantPoolSize + index * runtime().getHostJVMCIBackend().getTarget().wordSize); |
13254
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
315 } |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
316 |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
317 /** |
14093 | 318 * Gets the long constant pool entry at index {@code index}. |
14979
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
319 * |
13254
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
320 * @param index constant pool index |
14093 | 321 * @return long constant pool entry |
13254
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
322 */ |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
323 private long getLongAt(int index) { |
14529 | 324 assertTag(index, JVM_CONSTANT.Long); |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
325 return UNSAFE.getLong(getMetaspaceConstantPool() + config().constantPoolSize + index * runtime().getHostJVMCIBackend().getTarget().wordSize); |
13254
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
326 } |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
327 |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
328 /** |
14093 | 329 * Gets the float constant pool entry at index {@code index}. |
14979
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
330 * |
13254
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
331 * @param index constant pool index |
14093 | 332 * @return float constant pool entry |
13254
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
333 */ |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
334 private float getFloatAt(int index) { |
14529 | 335 assertTag(index, JVM_CONSTANT.Float); |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
336 return UNSAFE.getFloat(getMetaspaceConstantPool() + config().constantPoolSize + index * runtime().getHostJVMCIBackend().getTarget().wordSize); |
13254
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
337 } |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
338 |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
339 /** |
14093 | 340 * Gets the double constant pool entry at index {@code index}. |
14979
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
341 * |
13254
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
342 * @param index constant pool index |
14093 | 343 * @return float constant pool entry |
13254
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
344 */ |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
345 private double getDoubleAt(int index) { |
14529 | 346 assertTag(index, JVM_CONSTANT.Double); |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
347 return UNSAFE.getDouble(getMetaspaceConstantPool() + config().constantPoolSize + index * runtime().getHostJVMCIBackend().getTarget().wordSize); |
13254
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
348 } |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
349 |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
350 /** |
14093 | 351 * Gets the {@code JVM_CONSTANT_NameAndType} constant pool entry at index {@code index}. |
14979
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
352 * |
14093 | 353 * @param index constant pool index |
354 * @return {@code JVM_CONSTANT_NameAndType} constant pool entry | |
355 */ | |
356 private int getNameAndTypeAt(int index) { | |
14529 | 357 assertTag(index, JVM_CONSTANT.NameAndType); |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
358 return UNSAFE.getInt(getMetaspaceConstantPool() + config().constantPoolSize + index * runtime().getHostJVMCIBackend().getTarget().wordSize); |
14093 | 359 } |
360 | |
361 /** | |
362 * Gets the {@code JVM_CONSTANT_NameAndType} reference index constant pool entry at index | |
363 * {@code index}. | |
14979
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
364 * |
14093 | 365 * @param index constant pool index |
366 * @return {@code JVM_CONSTANT_NameAndType} reference constant pool entry | |
367 */ | |
368 private int getNameAndTypeRefIndexAt(int index) { | |
22582
232c53e17ea0
added CompilerToVM.compilerToVM() for static access to the CompilerToVM instance
Doug Simon <doug.simon@oracle.com>
parents:
22581
diff
changeset
|
369 return compilerToVM().lookupNameAndTypeRefIndexInPool(this, index); |
14093 | 370 } |
371 | |
372 /** | |
22605
f0ec628cb987
fixed javadoc for lookupNameRefInPool and lookupSignatureRefInPool in CompilerToVM and renamed them to lookupNameInPool and lookupSignatureInPool
Doug Simon <doug.simon@oracle.com>
parents:
22598
diff
changeset
|
373 * Gets the name of a {@code JVM_CONSTANT_NameAndType} constant pool entry referenced by another |
f0ec628cb987
fixed javadoc for lookupNameRefInPool and lookupSignatureRefInPool in CompilerToVM and renamed them to lookupNameInPool and lookupSignatureInPool
Doug Simon <doug.simon@oracle.com>
parents:
22598
diff
changeset
|
374 * entry denoted by {@code which}. |
14979
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
375 * |
22605
f0ec628cb987
fixed javadoc for lookupNameRefInPool and lookupSignatureRefInPool in CompilerToVM and renamed them to lookupNameInPool and lookupSignatureInPool
Doug Simon <doug.simon@oracle.com>
parents:
22598
diff
changeset
|
376 * @param which constant pool index or constant pool cache index |
14093 | 377 * @return name as {@link String} |
378 */ | |
22605
f0ec628cb987
fixed javadoc for lookupNameRefInPool and lookupSignatureRefInPool in CompilerToVM and renamed them to lookupNameInPool and lookupSignatureInPool
Doug Simon <doug.simon@oracle.com>
parents:
22598
diff
changeset
|
379 private String getNameOf(int which) { |
f0ec628cb987
fixed javadoc for lookupNameRefInPool and lookupSignatureRefInPool in CompilerToVM and renamed them to lookupNameInPool and lookupSignatureInPool
Doug Simon <doug.simon@oracle.com>
parents:
22598
diff
changeset
|
380 return compilerToVM().lookupNameInPool(this, which); |
14093 | 381 } |
382 | |
383 /** | |
384 * Gets the name reference index of a {@code JVM_CONSTANT_NameAndType} constant pool entry at | |
385 * index {@code index}. | |
14979
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
386 * |
14093 | 387 * @param index constant pool index |
388 * @return name reference index | |
389 */ | |
390 private int getNameRefIndexAt(int index) { | |
391 final int refIndex = getNameAndTypeAt(index); | |
392 // name ref index is in the low 16-bits. | |
393 return refIndex & 0xFFFF; | |
394 } | |
395 | |
396 /** | |
22605
f0ec628cb987
fixed javadoc for lookupNameRefInPool and lookupSignatureRefInPool in CompilerToVM and renamed them to lookupNameInPool and lookupSignatureInPool
Doug Simon <doug.simon@oracle.com>
parents:
22598
diff
changeset
|
397 * Gets the signature of a {@code JVM_CONSTANT_NameAndType} constant pool entry referenced by |
f0ec628cb987
fixed javadoc for lookupNameRefInPool and lookupSignatureRefInPool in CompilerToVM and renamed them to lookupNameInPool and lookupSignatureInPool
Doug Simon <doug.simon@oracle.com>
parents:
22598
diff
changeset
|
398 * another entry denoted by {@code which}. |
14979
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
399 * |
22605
f0ec628cb987
fixed javadoc for lookupNameRefInPool and lookupSignatureRefInPool in CompilerToVM and renamed them to lookupNameInPool and lookupSignatureInPool
Doug Simon <doug.simon@oracle.com>
parents:
22598
diff
changeset
|
400 * @param which constant pool index or constant pool cache index |
14093 | 401 * @return signature as {@link String} |
402 */ | |
22605
f0ec628cb987
fixed javadoc for lookupNameRefInPool and lookupSignatureRefInPool in CompilerToVM and renamed them to lookupNameInPool and lookupSignatureInPool
Doug Simon <doug.simon@oracle.com>
parents:
22598
diff
changeset
|
403 private String getSignatureOf(int which) { |
f0ec628cb987
fixed javadoc for lookupNameRefInPool and lookupSignatureRefInPool in CompilerToVM and renamed them to lookupNameInPool and lookupSignatureInPool
Doug Simon <doug.simon@oracle.com>
parents:
22598
diff
changeset
|
404 return compilerToVM().lookupSignatureInPool(this, which); |
14093 | 405 } |
406 | |
407 /** | |
408 * Gets the signature reference index of a {@code JVM_CONSTANT_NameAndType} constant pool entry | |
409 * at index {@code index}. | |
14979
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
410 * |
14093 | 411 * @param index constant pool index |
412 * @return signature reference index | |
413 */ | |
414 private int getSignatureRefIndexAt(int index) { | |
415 final int refIndex = getNameAndTypeAt(index); | |
416 // signature ref index is in the high 16-bits. | |
417 return refIndex >>> 16; | |
418 } | |
419 | |
420 /** | |
22487
a0e5714d5436
Remove Java implementation of HotSpotConstantPool Cache and ResolvedReferences and HotSpotSymbol.
twisti
parents:
22455
diff
changeset
|
421 * Gets the klass reference index constant pool entry at index {@code index}. |
14979
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
422 * |
14093 | 423 * @param index constant pool index |
424 * @return klass reference index | |
425 */ | |
426 private int getKlassRefIndexAt(int index) { | |
22582
232c53e17ea0
added CompilerToVM.compilerToVM() for static access to the CompilerToVM instance
Doug Simon <doug.simon@oracle.com>
parents:
22581
diff
changeset
|
427 return compilerToVM().lookupKlassRefIndexInPool(this, index); |
14093 | 428 } |
429 | |
430 /** | |
14530
d87b84dade7d
moved CompilerToVM.loadReferencedTypeInPool logic into Java
twisti
parents:
14529
diff
changeset
|
431 * Gets the uncached klass reference index constant pool entry at index {@code index}. See: |
d87b84dade7d
moved CompilerToVM.loadReferencedTypeInPool logic into Java
twisti
parents:
14529
diff
changeset
|
432 * {@code ConstantPool::uncached_klass_ref_index_at}. |
14979
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
433 * |
14530
d87b84dade7d
moved CompilerToVM.loadReferencedTypeInPool logic into Java
twisti
parents:
14529
diff
changeset
|
434 * @param index constant pool index |
d87b84dade7d
moved CompilerToVM.loadReferencedTypeInPool logic into Java
twisti
parents:
14529
diff
changeset
|
435 * @return klass reference index |
d87b84dade7d
moved CompilerToVM.loadReferencedTypeInPool logic into Java
twisti
parents:
14529
diff
changeset
|
436 */ |
22517
0915f5bfdfaa
Adopt some jvmci-9 source changes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22505
diff
changeset
|
437 private int getUncachedKlassRefIndexAt(int index) { |
0915f5bfdfaa
Adopt some jvmci-9 source changes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22505
diff
changeset
|
438 assertTagIsFieldOrMethod(index); |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
439 final int refIndex = UNSAFE.getInt(getMetaspaceConstantPool() + config().constantPoolSize + index * runtime().getHostJVMCIBackend().getTarget().wordSize); |
22517
0915f5bfdfaa
Adopt some jvmci-9 source changes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22505
diff
changeset
|
440 // klass ref index is in the low 16-bits. |
0915f5bfdfaa
Adopt some jvmci-9 source changes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22505
diff
changeset
|
441 return refIndex & 0xFFFF; |
14530
d87b84dade7d
moved CompilerToVM.loadReferencedTypeInPool logic into Java
twisti
parents:
14529
diff
changeset
|
442 } |
d87b84dade7d
moved CompilerToVM.loadReferencedTypeInPool logic into Java
twisti
parents:
14529
diff
changeset
|
443 |
d87b84dade7d
moved CompilerToVM.loadReferencedTypeInPool logic into Java
twisti
parents:
14529
diff
changeset
|
444 /** |
13254
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
445 * Asserts that the constant pool index {@code index} is in the bounds of the constant pool. |
14979
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
446 * |
13254
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
447 * @param index constant pool index |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
448 */ |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
449 private void assertBounds(int index) { |
13261
0ffe9e4bb364
don't go through VM to create HotSpotResolvedObjectType (part 1)
twisti
parents:
13259
diff
changeset
|
450 assert 0 <= index && index < length() : "index " + index + " not between 0 and " + length(); |
13254
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
451 } |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
452 |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
453 /** |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
454 * Asserts that the constant pool tag at index {@code index} is equal to {@code tag}. |
14979
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
455 * |
13254
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
456 * @param index constant pool index |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
457 * @param tag expected tag |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
458 */ |
14529 | 459 private void assertTag(int index, JVM_CONSTANT tag) { |
22234
179db500f6e5
Add Java code for reading the constant pool cache plus sun.reflect.ConstantPool substitutions.
twisti
parents:
22100
diff
changeset
|
460 final JVM_CONSTANT tagAt = getTagAt(index); |
179db500f6e5
Add Java code for reading the constant pool cache plus sun.reflect.ConstantPool substitutions.
twisti
parents:
22100
diff
changeset
|
461 assert tagAt == tag : "constant pool tag at index " + index + " is " + tagAt + " but expected " + tag; |
179db500f6e5
Add Java code for reading the constant pool cache plus sun.reflect.ConstantPool substitutions.
twisti
parents:
22100
diff
changeset
|
462 } |
179db500f6e5
Add Java code for reading the constant pool cache plus sun.reflect.ConstantPool substitutions.
twisti
parents:
22100
diff
changeset
|
463 |
179db500f6e5
Add Java code for reading the constant pool cache plus sun.reflect.ConstantPool substitutions.
twisti
parents:
22100
diff
changeset
|
464 /** |
179db500f6e5
Add Java code for reading the constant pool cache plus sun.reflect.ConstantPool substitutions.
twisti
parents:
22100
diff
changeset
|
465 * Asserts that the constant pool tag at index {@code index} is a {@link JVM_CONSTANT#Fieldref}, |
179db500f6e5
Add Java code for reading the constant pool cache plus sun.reflect.ConstantPool substitutions.
twisti
parents:
22100
diff
changeset
|
466 * or a {@link JVM_CONSTANT#MethodRef}, or a {@link JVM_CONSTANT#InterfaceMethodref}. |
179db500f6e5
Add Java code for reading the constant pool cache plus sun.reflect.ConstantPool substitutions.
twisti
parents:
22100
diff
changeset
|
467 * |
179db500f6e5
Add Java code for reading the constant pool cache plus sun.reflect.ConstantPool substitutions.
twisti
parents:
22100
diff
changeset
|
468 * @param index constant pool index |
179db500f6e5
Add Java code for reading the constant pool cache plus sun.reflect.ConstantPool substitutions.
twisti
parents:
22100
diff
changeset
|
469 */ |
179db500f6e5
Add Java code for reading the constant pool cache plus sun.reflect.ConstantPool substitutions.
twisti
parents:
22100
diff
changeset
|
470 private void assertTagIsFieldOrMethod(int index) { |
179db500f6e5
Add Java code for reading the constant pool cache plus sun.reflect.ConstantPool substitutions.
twisti
parents:
22100
diff
changeset
|
471 final JVM_CONSTANT tagAt = getTagAt(index); |
179db500f6e5
Add Java code for reading the constant pool cache plus sun.reflect.ConstantPool substitutions.
twisti
parents:
22100
diff
changeset
|
472 assert tagAt == JVM_CONSTANT.Fieldref || tagAt == JVM_CONSTANT.MethodRef || tagAt == JVM_CONSTANT.InterfaceMethodref : tagAt; |
13254
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
473 } |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
474 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
475 @Override |
9108 | 476 public int length() { |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
477 return UNSAFE.getInt(getMetaspaceConstantPool() + config().constantPoolLengthOffset); |
9108 | 478 } |
479 | |
480 @Override | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
481 public Object lookupConstant(int cpi) { |
7002
74f0207b82f5
fixed bug in bytecode reconstitution
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
482 assert cpi != 0; |
14529 | 483 final JVM_CONSTANT tag = getTagAt(cpi); |
484 switch (tag) { | |
485 case Integer: | |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
18167
diff
changeset
|
486 return JavaConstant.forInt(getIntAt(cpi)); |
14529 | 487 case Long: |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
18167
diff
changeset
|
488 return JavaConstant.forLong(getLongAt(cpi)); |
14529 | 489 case Float: |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
18167
diff
changeset
|
490 return JavaConstant.forFloat(getFloatAt(cpi)); |
14529 | 491 case Double: |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
18167
diff
changeset
|
492 return JavaConstant.forDouble(getDoubleAt(cpi)); |
14529 | 493 case Class: |
494 case UnresolvedClass: | |
495 case UnresolvedClassInError: | |
496 final int opcode = -1; // opcode is not used | |
497 return lookupType(cpi, opcode); | |
498 case String: | |
22272
b6d504612b3f
fix HotSpotConstantPool#lookupConstant for pseudo-string entries
Andreas Woess <andreas.woess@oracle.com>
parents:
22234
diff
changeset
|
499 /* |
b6d504612b3f
fix HotSpotConstantPool#lookupConstant for pseudo-string entries
Andreas Woess <andreas.woess@oracle.com>
parents:
22234
diff
changeset
|
500 * Normally, we would expect a String here, but anonymous classes can have |
b6d504612b3f
fix HotSpotConstantPool#lookupConstant for pseudo-string entries
Andreas Woess <andreas.woess@oracle.com>
parents:
22234
diff
changeset
|
501 * "pseudo strings" (arbitrary live objects) patched into a String entry. Such |
b6d504612b3f
fix HotSpotConstantPool#lookupConstant for pseudo-string entries
Andreas Woess <andreas.woess@oracle.com>
parents:
22234
diff
changeset
|
502 * entries do not have a symbol in the constant pool slot. |
b6d504612b3f
fix HotSpotConstantPool#lookupConstant for pseudo-string entries
Andreas Woess <andreas.woess@oracle.com>
parents:
22234
diff
changeset
|
503 */ |
22582
232c53e17ea0
added CompilerToVM.compilerToVM() for static access to the CompilerToVM instance
Doug Simon <doug.simon@oracle.com>
parents:
22581
diff
changeset
|
504 Object string = compilerToVM().resolvePossiblyCachedConstantInPool(this, cpi); |
18262
f7d45e2426d4
converted HotSpotObjectConstant to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18223
diff
changeset
|
505 return HotSpotObjectConstantImpl.forObject(string); |
14529 | 506 case MethodHandle: |
507 case MethodHandleInError: | |
508 case MethodType: | |
509 case MethodTypeInError: | |
22582
232c53e17ea0
added CompilerToVM.compilerToVM() for static access to the CompilerToVM instance
Doug Simon <doug.simon@oracle.com>
parents:
22581
diff
changeset
|
510 Object obj = compilerToVM().resolveConstantInPool(this, cpi); |
18262
f7d45e2426d4
converted HotSpotObjectConstant to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18223
diff
changeset
|
511 return HotSpotObjectConstantImpl.forObject(obj); |
14529 | 512 default: |
23392
b3a816d3b844
Backed out changeset: a920338dd4d4
Doug Simon <doug.simon@oracle.com>
parents:
23387
diff
changeset
|
513 throw new JVMCIError("Unknown constant pool tag %s", tag); |
13254
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
514 } |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
515 } |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
516 |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
517 @Override |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
12559
diff
changeset
|
518 public String lookupUtf8(int cpi) { |
14529 | 519 assertTag(cpi, JVM_CONSTANT.Utf8); |
22582
232c53e17ea0
added CompilerToVM.compilerToVM() for static access to the CompilerToVM instance
Doug Simon <doug.simon@oracle.com>
parents:
22581
diff
changeset
|
520 return compilerToVM().getSymbol(getEntryAt(cpi)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
521 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
522 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
523 @Override |
5541
b4c406861c33
More renamings to drop Ri* prefix completely. Deleted graph.BitMap class and replaced with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5534
diff
changeset
|
524 public Signature lookupSignature(int cpi) { |
18540
21384a8fbb64
removed static accesses to HotSpotGraalRuntime from some HotSpot meta API classes
Doug Simon <doug.simon@oracle.com>
parents:
18530
diff
changeset
|
525 return new HotSpotSignature(runtime(), lookupUtf8(cpi)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
526 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
527 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
528 @Override |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
18167
diff
changeset
|
529 public JavaConstant lookupAppendix(int cpi, int opcode) { |
9011
23762f2438b6
support for compiling LambdaForm invocations (invokevirtual instructions that were rewritten to invokehandle instructions)
Doug Simon <doug.simon@oracle.com>
parents:
8945
diff
changeset
|
530 assert Bytecodes.isInvoke(opcode); |
22234
179db500f6e5
Add Java code for reading the constant pool cache plus sun.reflect.ConstantPool substitutions.
twisti
parents:
22100
diff
changeset
|
531 final int index = rawIndexToConstantPoolIndex(cpi, opcode); |
22582
232c53e17ea0
added CompilerToVM.compilerToVM() for static access to the CompilerToVM instance
Doug Simon <doug.simon@oracle.com>
parents:
22581
diff
changeset
|
532 Object appendix = compilerToVM().lookupAppendixInPool(this, index); |
22234
179db500f6e5
Add Java code for reading the constant pool cache plus sun.reflect.ConstantPool substitutions.
twisti
parents:
22100
diff
changeset
|
533 if (appendix == null) { |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14979
diff
changeset
|
534 return null; |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14979
diff
changeset
|
535 } else { |
22234
179db500f6e5
Add Java code for reading the constant pool cache plus sun.reflect.ConstantPool substitutions.
twisti
parents:
22100
diff
changeset
|
536 return HotSpotObjectConstantImpl.forObject(appendix); |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14979
diff
changeset
|
537 } |
8945
7ef66078d837
add basic invokedynamic support
Andreas Woess <andreas.woess@jku.at>
parents:
7084
diff
changeset
|
538 } |
7ef66078d837
add basic invokedynamic support
Andreas Woess <andreas.woess@jku.at>
parents:
7084
diff
changeset
|
539 |
14069
2f37b0e442fe
removed remaining VMToCompiler calls for allocating Graal API objects
Doug Simon <doug.simon@oracle.com>
parents:
14052
diff
changeset
|
540 /** |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
541 * Gets a {@link JavaType} corresponding a given resolved or unresolved type. |
14979
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
542 * |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
543 * @param type either a ResolvedJavaType or a String naming a unresolved type. |
14069
2f37b0e442fe
removed remaining VMToCompiler calls for allocating Graal API objects
Doug Simon <doug.simon@oracle.com>
parents:
14052
diff
changeset
|
544 */ |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
545 private static JavaType getJavaType(final Object type) { |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
546 if (type instanceof String) { |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
547 String name = (String) type; |
18540
21384a8fbb64
removed static accesses to HotSpotGraalRuntime from some HotSpot meta API classes
Doug Simon <doug.simon@oracle.com>
parents:
18530
diff
changeset
|
548 return HotSpotUnresolvedJavaType.create(runtime(), "L" + name + ";"); |
14069
2f37b0e442fe
removed remaining VMToCompiler calls for allocating Graal API objects
Doug Simon <doug.simon@oracle.com>
parents:
14052
diff
changeset
|
549 } else { |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
550 return (JavaType) type; |
14069
2f37b0e442fe
removed remaining VMToCompiler calls for allocating Graal API objects
Doug Simon <doug.simon@oracle.com>
parents:
14052
diff
changeset
|
551 } |
2f37b0e442fe
removed remaining VMToCompiler calls for allocating Graal API objects
Doug Simon <doug.simon@oracle.com>
parents:
14052
diff
changeset
|
552 } |
2f37b0e442fe
removed remaining VMToCompiler calls for allocating Graal API objects
Doug Simon <doug.simon@oracle.com>
parents:
14052
diff
changeset
|
553 |
8945
7ef66078d837
add basic invokedynamic support
Andreas Woess <andreas.woess@jku.at>
parents:
7084
diff
changeset
|
554 @Override |
6588
b89b5038ad7e
removed _'s from method names in CompilerToVM
Doug Simon <doug.simon@oracle.com>
parents:
5775
diff
changeset
|
555 public JavaMethod lookupMethod(int cpi, int opcode) { |
22234
179db500f6e5
Add Java code for reading the constant pool cache plus sun.reflect.ConstantPool substitutions.
twisti
parents:
22100
diff
changeset
|
556 final int index = rawIndexToConstantPoolIndex(cpi, opcode); |
22582
232c53e17ea0
added CompilerToVM.compilerToVM() for static access to the CompilerToVM instance
Doug Simon <doug.simon@oracle.com>
parents:
22581
diff
changeset
|
557 final HotSpotResolvedJavaMethod method = compilerToVM().lookupMethodInPool(this, index, (byte) opcode); |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
558 if (method != null) { |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
559 return method; |
14069
2f37b0e442fe
removed remaining VMToCompiler calls for allocating Graal API objects
Doug Simon <doug.simon@oracle.com>
parents:
14052
diff
changeset
|
560 } else { |
14093 | 561 // Get the method's name and signature. |
22605
f0ec628cb987
fixed javadoc for lookupNameRefInPool and lookupSignatureRefInPool in CompilerToVM and renamed them to lookupNameInPool and lookupSignatureInPool
Doug Simon <doug.simon@oracle.com>
parents:
22598
diff
changeset
|
562 String name = getNameOf(index); |
f0ec628cb987
fixed javadoc for lookupNameRefInPool and lookupSignatureRefInPool in CompilerToVM and renamed them to lookupNameInPool and lookupSignatureInPool
Doug Simon <doug.simon@oracle.com>
parents:
22598
diff
changeset
|
563 HotSpotSignature signature = new HotSpotSignature(runtime(), getSignatureOf(index)); |
14093 | 564 if (opcode == Bytecodes.INVOKEDYNAMIC) { |
18540
21384a8fbb64
removed static accesses to HotSpotGraalRuntime from some HotSpot meta API classes
Doug Simon <doug.simon@oracle.com>
parents:
18530
diff
changeset
|
565 HotSpotResolvedObjectType holder = HotSpotResolvedObjectTypeImpl.fromObjectClass(MethodHandle.class); |
14093 | 566 return new HotSpotMethodUnresolved(name, signature, holder); |
567 } else { | |
568 final int klassIndex = getKlassRefIndexAt(index); | |
22582
232c53e17ea0
added CompilerToVM.compilerToVM() for static access to the CompilerToVM instance
Doug Simon <doug.simon@oracle.com>
parents:
22581
diff
changeset
|
569 final Object type = compilerToVM().lookupKlassInPool(this, klassIndex); |
22455
7ad03bf3d4a9
renames related to using metaspace wrappers instead of raw metaspace values
Doug Simon <doug.simon@oracle.com>
parents:
22454
diff
changeset
|
570 JavaType holder = getJavaType(type); |
14093 | 571 return new HotSpotMethodUnresolved(name, signature, holder); |
572 } | |
14069
2f37b0e442fe
removed remaining VMToCompiler calls for allocating Graal API objects
Doug Simon <doug.simon@oracle.com>
parents:
14052
diff
changeset
|
573 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
574 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
575 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
576 @Override |
5541
b4c406861c33
More renamings to drop Ri* prefix completely. Deleted graph.BitMap class and replaced with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5534
diff
changeset
|
577 public JavaType lookupType(int cpi, int opcode) { |
21252
39ee26e85256
Use boxed cache in HotSpotConstantpool instead of synchronization
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21215
diff
changeset
|
578 final LookupTypeCacheElement elem = this.lastLookupType; |
39ee26e85256
Use boxed cache in HotSpotConstantpool instead of synchronization
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21215
diff
changeset
|
579 if (elem != null && elem.lastCpi == cpi) { |
39ee26e85256
Use boxed cache in HotSpotConstantpool instead of synchronization
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21215
diff
changeset
|
580 return elem.javaType; |
39ee26e85256
Use boxed cache in HotSpotConstantpool instead of synchronization
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21215
diff
changeset
|
581 } else { |
22582
232c53e17ea0
added CompilerToVM.compilerToVM() for static access to the CompilerToVM instance
Doug Simon <doug.simon@oracle.com>
parents:
22581
diff
changeset
|
582 final Object type = compilerToVM().lookupKlassInPool(this, cpi); |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
583 JavaType result = getJavaType(type); |
21431
90c55b9ad309
only put type in HotSpotConstantPool cache if it's resolved
Lukas Stadler <lukas.stadler@oracle.com>
parents:
21411
diff
changeset
|
584 if (result instanceof ResolvedJavaType) { |
90c55b9ad309
only put type in HotSpotConstantPool cache if it's resolved
Lukas Stadler <lukas.stadler@oracle.com>
parents:
21411
diff
changeset
|
585 this.lastLookupType = new LookupTypeCacheElement(cpi, result); |
90c55b9ad309
only put type in HotSpotConstantPool cache if it's resolved
Lukas Stadler <lukas.stadler@oracle.com>
parents:
21411
diff
changeset
|
586 } |
21252
39ee26e85256
Use boxed cache in HotSpotConstantpool instead of synchronization
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21215
diff
changeset
|
587 return result; |
19377
2ff3a30501da
Prototype caching in HotSpotConstantPool.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18867
diff
changeset
|
588 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
589 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
590 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
591 @Override |
23689
d814713e3b02
backport of changes from JDK-8157181
Doug Simon <doug.simon@oracle.com>
parents:
23677
diff
changeset
|
592 public JavaField lookupField(int cpi, ResolvedJavaMethod method, int opcode) { |
22234
179db500f6e5
Add Java code for reading the constant pool cache plus sun.reflect.ConstantPool substitutions.
twisti
parents:
22100
diff
changeset
|
593 final int index = rawIndexToConstantPoolIndex(cpi, opcode); |
14093 | 594 final int nameAndTypeIndex = getNameAndTypeRefIndexAt(index); |
595 final int nameIndex = getNameRefIndexAt(nameAndTypeIndex); | |
596 String name = lookupUtf8(nameIndex); | |
597 final int typeIndex = getSignatureRefIndexAt(nameAndTypeIndex); | |
598 String typeName = lookupUtf8(typeIndex); | |
14117
2b2f0022900f
removed unnecessary lookupKlassByName method
Doug Simon <doug.simon@oracle.com>
parents:
14093
diff
changeset
|
599 JavaType type = runtime().lookupType(typeName, getHolder(), false); |
14093 | 600 |
601 final int holderIndex = getKlassRefIndexAt(index); | |
602 JavaType holder = lookupType(holderIndex, opcode); | |
603 | |
18223
17c98fad6980
converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18222
diff
changeset
|
604 if (holder instanceof HotSpotResolvedObjectTypeImpl) { |
14093 | 605 long[] info = new long[2]; |
22455
7ad03bf3d4a9
renames related to using metaspace wrappers instead of raw metaspace values
Doug Simon <doug.simon@oracle.com>
parents:
22454
diff
changeset
|
606 HotSpotResolvedObjectTypeImpl resolvedHolder; |
14093 | 607 try { |
22582
232c53e17ea0
added CompilerToVM.compilerToVM() for static access to the CompilerToVM instance
Doug Simon <doug.simon@oracle.com>
parents:
22581
diff
changeset
|
608 resolvedHolder = compilerToVM().resolveFieldInPool(this, index, (byte) opcode, info); |
14093 | 609 } catch (Throwable t) { |
610 /* | |
611 * If there was an exception resolving the field we give up and return an unresolved | |
612 * field. | |
613 */ | |
614 return new HotSpotUnresolvedField(holder, name, type); | |
615 } | |
616 final int flags = (int) info[0]; | |
617 final long offset = info[1]; | |
19377
2ff3a30501da
Prototype caching in HotSpotConstantPool.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18867
diff
changeset
|
618 HotSpotResolvedJavaField result = resolvedHolder.createField(name, type, offset, flags); |
2ff3a30501da
Prototype caching in HotSpotConstantPool.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18867
diff
changeset
|
619 return result; |
14069
2f37b0e442fe
removed remaining VMToCompiler calls for allocating Graal API objects
Doug Simon <doug.simon@oracle.com>
parents:
14052
diff
changeset
|
620 } else { |
2f37b0e442fe
removed remaining VMToCompiler calls for allocating Graal API objects
Doug Simon <doug.simon@oracle.com>
parents:
14052
diff
changeset
|
621 return new HotSpotUnresolvedField(holder, name, type); |
2f37b0e442fe
removed remaining VMToCompiler calls for allocating Graal API objects
Doug Simon <doug.simon@oracle.com>
parents:
14052
diff
changeset
|
622 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
623 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
624 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
625 @Override |
22517
0915f5bfdfaa
Adopt some jvmci-9 source changes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22505
diff
changeset
|
626 @SuppressWarnings("fallthrough") |
6588
b89b5038ad7e
removed _'s from method names in CompilerToVM
Doug Simon <doug.simon@oracle.com>
parents:
5775
diff
changeset
|
627 public void loadReferencedType(int cpi, int opcode) { |
14052
361acb279104
moved to-constant-pool-index conversion up to Java
twisti
parents:
13261
diff
changeset
|
628 int index; |
14093 | 629 switch (opcode) { |
630 case Bytecodes.CHECKCAST: | |
631 case Bytecodes.INSTANCEOF: | |
632 case Bytecodes.NEW: | |
633 case Bytecodes.ANEWARRAY: | |
634 case Bytecodes.MULTIANEWARRAY: | |
635 case Bytecodes.LDC: | |
636 case Bytecodes.LDC_W: | |
637 case Bytecodes.LDC2_W: | |
638 index = cpi; | |
639 break; | |
22234
179db500f6e5
Add Java code for reading the constant pool cache plus sun.reflect.ConstantPool substitutions.
twisti
parents:
22100
diff
changeset
|
640 case Bytecodes.INVOKEDYNAMIC: { |
14979
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
641 // invokedynamic instructions point to a constant pool cache entry. |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
642 index = decodeConstantPoolCacheIndex(cpi) + config().constantPoolCpCacheIndexTag; |
22582
232c53e17ea0
added CompilerToVM.compilerToVM() for static access to the CompilerToVM instance
Doug Simon <doug.simon@oracle.com>
parents:
22581
diff
changeset
|
643 index = compilerToVM().constantPoolRemapInstructionOperandFromCache(this, index); |
14979
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
644 break; |
22234
179db500f6e5
Add Java code for reading the constant pool cache plus sun.reflect.ConstantPool substitutions.
twisti
parents:
22100
diff
changeset
|
645 } |
179db500f6e5
Add Java code for reading the constant pool cache plus sun.reflect.ConstantPool substitutions.
twisti
parents:
22100
diff
changeset
|
646 case Bytecodes.GETSTATIC: |
179db500f6e5
Add Java code for reading the constant pool cache plus sun.reflect.ConstantPool substitutions.
twisti
parents:
22100
diff
changeset
|
647 case Bytecodes.PUTSTATIC: |
179db500f6e5
Add Java code for reading the constant pool cache plus sun.reflect.ConstantPool substitutions.
twisti
parents:
22100
diff
changeset
|
648 case Bytecodes.GETFIELD: |
179db500f6e5
Add Java code for reading the constant pool cache plus sun.reflect.ConstantPool substitutions.
twisti
parents:
22100
diff
changeset
|
649 case Bytecodes.PUTFIELD: |
179db500f6e5
Add Java code for reading the constant pool cache plus sun.reflect.ConstantPool substitutions.
twisti
parents:
22100
diff
changeset
|
650 case Bytecodes.INVOKEVIRTUAL: |
179db500f6e5
Add Java code for reading the constant pool cache plus sun.reflect.ConstantPool substitutions.
twisti
parents:
22100
diff
changeset
|
651 case Bytecodes.INVOKESPECIAL: |
179db500f6e5
Add Java code for reading the constant pool cache plus sun.reflect.ConstantPool substitutions.
twisti
parents:
22100
diff
changeset
|
652 case Bytecodes.INVOKESTATIC: |
179db500f6e5
Add Java code for reading the constant pool cache plus sun.reflect.ConstantPool substitutions.
twisti
parents:
22100
diff
changeset
|
653 case Bytecodes.INVOKEINTERFACE: { |
179db500f6e5
Add Java code for reading the constant pool cache plus sun.reflect.ConstantPool substitutions.
twisti
parents:
22100
diff
changeset
|
654 // invoke and field instructions point to a constant pool cache entry. |
22488
b5ebb80da4f1
Correct formatting
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22487
diff
changeset
|
655 index = rawIndexToConstantPoolIndex(cpi, opcode); |
22582
232c53e17ea0
added CompilerToVM.compilerToVM() for static access to the CompilerToVM instance
Doug Simon <doug.simon@oracle.com>
parents:
22581
diff
changeset
|
656 index = compilerToVM().constantPoolRemapInstructionOperandFromCache(this, index); |
22234
179db500f6e5
Add Java code for reading the constant pool cache plus sun.reflect.ConstantPool substitutions.
twisti
parents:
22100
diff
changeset
|
657 break; |
179db500f6e5
Add Java code for reading the constant pool cache plus sun.reflect.ConstantPool substitutions.
twisti
parents:
22100
diff
changeset
|
658 } |
14093 | 659 default: |
23392
b3a816d3b844
Backed out changeset: a920338dd4d4
Doug Simon <doug.simon@oracle.com>
parents:
23387
diff
changeset
|
660 throw JVMCIError.shouldNotReachHere("Unexpected opcode " + opcode); |
14052
361acb279104
moved to-constant-pool-index conversion up to Java
twisti
parents:
13261
diff
changeset
|
661 } |
14530
d87b84dade7d
moved CompilerToVM.loadReferencedTypeInPool logic into Java
twisti
parents:
14529
diff
changeset
|
662 |
22089
13a50cb905b7
Only invokevirtual and invokespecial are invokehandle aliases.
twisti
parents:
22054
diff
changeset
|
663 final JVM_CONSTANT tag = getTagAt(index); |
17394
f520089af480
made HotSpotConstantPool.loadReferencedType handle attempts to resolve constant pool indexes that do not refer to a type
Doug Simon <doug.simon@oracle.com>
parents:
17393
diff
changeset
|
664 if (tag == null) { |
f520089af480
made HotSpotConstantPool.loadReferencedType handle attempts to resolve constant pool indexes that do not refer to a type
Doug Simon <doug.simon@oracle.com>
parents:
17393
diff
changeset
|
665 assert getTagAt(index - 1) == JVM_CONSTANT.Double || getTagAt(index - 1) == JVM_CONSTANT.Long; |
f520089af480
made HotSpotConstantPool.loadReferencedType handle attempts to resolve constant pool indexes that do not refer to a type
Doug Simon <doug.simon@oracle.com>
parents:
17393
diff
changeset
|
666 return; |
f520089af480
made HotSpotConstantPool.loadReferencedType handle attempts to resolve constant pool indexes that do not refer to a type
Doug Simon <doug.simon@oracle.com>
parents:
17393
diff
changeset
|
667 } |
14530
d87b84dade7d
moved CompilerToVM.loadReferencedTypeInPool logic into Java
twisti
parents:
14529
diff
changeset
|
668 switch (tag) { |
22013
3904e33db5b3
Make sure HotSpotConstantPool.loadReferencedType resolves invokehandle call sites properly. Fixes eager resolution problems at those call sites.
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21798
diff
changeset
|
669 case MethodRef: |
14530
d87b84dade7d
moved CompilerToVM.loadReferencedTypeInPool logic into Java
twisti
parents:
14529
diff
changeset
|
670 case Fieldref: |
d87b84dade7d
moved CompilerToVM.loadReferencedTypeInPool logic into Java
twisti
parents:
14529
diff
changeset
|
671 case InterfaceMethodref: |
22517
0915f5bfdfaa
Adopt some jvmci-9 source changes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22505
diff
changeset
|
672 index = getUncachedKlassRefIndexAt(index); |
0915f5bfdfaa
Adopt some jvmci-9 source changes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22505
diff
changeset
|
673 // Read the tag only once because it could change between multiple reads. |
0915f5bfdfaa
Adopt some jvmci-9 source changes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22505
diff
changeset
|
674 final JVM_CONSTANT klassTag = getTagAt(index); |
0915f5bfdfaa
Adopt some jvmci-9 source changes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22505
diff
changeset
|
675 assert klassTag == JVM_CONSTANT.Class || klassTag == JVM_CONSTANT.UnresolvedClass || klassTag == JVM_CONSTANT.UnresolvedClassInError : klassTag; |
0915f5bfdfaa
Adopt some jvmci-9 source changes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22505
diff
changeset
|
676 // fall through |
14530
d87b84dade7d
moved CompilerToVM.loadReferencedTypeInPool logic into Java
twisti
parents:
14529
diff
changeset
|
677 case Class: |
d87b84dade7d
moved CompilerToVM.loadReferencedTypeInPool logic into Java
twisti
parents:
14529
diff
changeset
|
678 case UnresolvedClass: |
d87b84dade7d
moved CompilerToVM.loadReferencedTypeInPool logic into Java
twisti
parents:
14529
diff
changeset
|
679 case UnresolvedClassInError: |
22582
232c53e17ea0
added CompilerToVM.compilerToVM() for static access to the CompilerToVM instance
Doug Simon <doug.simon@oracle.com>
parents:
22581
diff
changeset
|
680 final HotSpotResolvedObjectTypeImpl type = compilerToVM().resolveTypeInPool(this, index); |
14530
d87b84dade7d
moved CompilerToVM.loadReferencedTypeInPool logic into Java
twisti
parents:
14529
diff
changeset
|
681 Class<?> klass = type.mirror(); |
d87b84dade7d
moved CompilerToVM.loadReferencedTypeInPool logic into Java
twisti
parents:
14529
diff
changeset
|
682 if (!klass.isPrimitive() && !klass.isArray()) { |
22542
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
683 UNSAFE.ensureClassInitialized(klass); |
14530
d87b84dade7d
moved CompilerToVM.loadReferencedTypeInPool logic into Java
twisti
parents:
14529
diff
changeset
|
684 } |
22089
13a50cb905b7
Only invokevirtual and invokespecial are invokehandle aliases.
twisti
parents:
22054
diff
changeset
|
685 switch (tag) { |
13a50cb905b7
Only invokevirtual and invokespecial are invokehandle aliases.
twisti
parents:
22054
diff
changeset
|
686 case MethodRef: |
13a50cb905b7
Only invokevirtual and invokespecial are invokehandle aliases.
twisti
parents:
22054
diff
changeset
|
687 if (Bytecodes.isInvokeHandleAlias(opcode)) { |
22234
179db500f6e5
Add Java code for reading the constant pool cache plus sun.reflect.ConstantPool substitutions.
twisti
parents:
22100
diff
changeset
|
688 final int methodRefCacheIndex = rawIndexToConstantPoolIndex(cpi, opcode); |
22089
13a50cb905b7
Only invokevirtual and invokespecial are invokehandle aliases.
twisti
parents:
22054
diff
changeset
|
689 if (isInvokeHandle(methodRefCacheIndex, type)) { |
22582
232c53e17ea0
added CompilerToVM.compilerToVM() for static access to the CompilerToVM instance
Doug Simon <doug.simon@oracle.com>
parents:
22581
diff
changeset
|
690 compilerToVM().resolveInvokeHandleInPool(this, methodRefCacheIndex); |
22089
13a50cb905b7
Only invokevirtual and invokespecial are invokehandle aliases.
twisti
parents:
22054
diff
changeset
|
691 } |
13a50cb905b7
Only invokevirtual and invokespecial are invokehandle aliases.
twisti
parents:
22054
diff
changeset
|
692 } |
22013
3904e33db5b3
Make sure HotSpotConstantPool.loadReferencedType resolves invokehandle call sites properly. Fixes eager resolution problems at those call sites.
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21798
diff
changeset
|
693 } |
14530
d87b84dade7d
moved CompilerToVM.loadReferencedTypeInPool logic into Java
twisti
parents:
14529
diff
changeset
|
694 break; |
15205
affef8631cf4
Add eager resolving for indy call sites
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15193
diff
changeset
|
695 case InvokeDynamic: |
17394
f520089af480
made HotSpotConstantPool.loadReferencedType handle attempts to resolve constant pool indexes that do not refer to a type
Doug Simon <doug.simon@oracle.com>
parents:
17393
diff
changeset
|
696 if (isInvokedynamicIndex(cpi)) { |
22582
232c53e17ea0
added CompilerToVM.compilerToVM() for static access to the CompilerToVM instance
Doug Simon <doug.simon@oracle.com>
parents:
22581
diff
changeset
|
697 compilerToVM().resolveInvokeDynamicInPool(this, cpi); |
15255
cf6aedb39215
Prevent using loadReferencedType with LDC when the constant pool index refers to InvokeDynamic entry but isn't an invokedynamic index.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15205
diff
changeset
|
698 } |
15205
affef8631cf4
Add eager resolving for indy call sites
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15193
diff
changeset
|
699 break; |
14530
d87b84dade7d
moved CompilerToVM.loadReferencedTypeInPool logic into Java
twisti
parents:
14529
diff
changeset
|
700 default: |
d87b84dade7d
moved CompilerToVM.loadReferencedTypeInPool logic into Java
twisti
parents:
14529
diff
changeset
|
701 // nothing |
d87b84dade7d
moved CompilerToVM.loadReferencedTypeInPool logic into Java
twisti
parents:
14529
diff
changeset
|
702 break; |
d87b84dade7d
moved CompilerToVM.loadReferencedTypeInPool logic into Java
twisti
parents:
14529
diff
changeset
|
703 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
704 } |
17394
f520089af480
made HotSpotConstantPool.loadReferencedType handle attempts to resolve constant pool indexes that do not refer to a type
Doug Simon <doug.simon@oracle.com>
parents:
17393
diff
changeset
|
705 |
22089
13a50cb905b7
Only invokevirtual and invokespecial are invokehandle aliases.
twisti
parents:
22054
diff
changeset
|
706 private boolean isInvokeHandle(int methodRefCacheIndex, HotSpotResolvedObjectTypeImpl klass) { |
22582
232c53e17ea0
added CompilerToVM.compilerToVM() for static access to the CompilerToVM instance
Doug Simon <doug.simon@oracle.com>
parents:
22581
diff
changeset
|
707 assertTag(compilerToVM().constantPoolRemapInstructionOperandFromCache(this, methodRefCacheIndex), JVM_CONSTANT.MethodRef); |
22605
f0ec628cb987
fixed javadoc for lookupNameRefInPool and lookupSignatureRefInPool in CompilerToVM and renamed them to lookupNameInPool and lookupSignatureInPool
Doug Simon <doug.simon@oracle.com>
parents:
22598
diff
changeset
|
708 return ResolvedJavaMethod.isSignaturePolymorphic(klass, getNameOf(methodRefCacheIndex), runtime().getHostJVMCIBackend().getMetaAccess()); |
22013
3904e33db5b3
Make sure HotSpotConstantPool.loadReferencedType resolves invokehandle call sites properly. Fixes eager resolution problems at those call sites.
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21798
diff
changeset
|
709 } |
3904e33db5b3
Make sure HotSpotConstantPool.loadReferencedType resolves invokehandle call sites properly. Fixes eager resolution problems at those call sites.
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21798
diff
changeset
|
710 |
17394
f520089af480
made HotSpotConstantPool.loadReferencedType handle attempts to resolve constant pool indexes that do not refer to a type
Doug Simon <doug.simon@oracle.com>
parents:
17393
diff
changeset
|
711 @Override |
f520089af480
made HotSpotConstantPool.loadReferencedType handle attempts to resolve constant pool indexes that do not refer to a type
Doug Simon <doug.simon@oracle.com>
parents:
17393
diff
changeset
|
712 public String toString() { |
f520089af480
made HotSpotConstantPool.loadReferencedType handle attempts to resolve constant pool indexes that do not refer to a type
Doug Simon <doug.simon@oracle.com>
parents:
17393
diff
changeset
|
713 HotSpotResolvedObjectType holder = getHolder(); |
f520089af480
made HotSpotConstantPool.loadReferencedType handle attempts to resolve constant pool indexes that do not refer to a type
Doug Simon <doug.simon@oracle.com>
parents:
17393
diff
changeset
|
714 return "HotSpotConstantPool<" + holder.toJavaName() + ">"; |
f520089af480
made HotSpotConstantPool.loadReferencedType handle attempts to resolve constant pool indexes that do not refer to a type
Doug Simon <doug.simon@oracle.com>
parents:
17393
diff
changeset
|
715 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
716 } |