Mercurial > hg > graal-jvmci-8
annotate jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotConstantPool.java @ 22672:1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
author | Tom Rodriguez <tom.rodriguez@oracle.com> |
---|---|
date | Thu, 08 Oct 2015 17:28:41 -0700 |
parents | jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotConstantPool.java@f0ec628cb987 |
children | 4b58c92e939b |
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 |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22605
diff
changeset
|
32 import jdk.vm.ci.common.JVMCIError; |
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 */ |
22598
ed53e370f04c
Make implementation classes package private.
Roland Schatz <roland.schatz@oracle.com>
parents:
22582
diff
changeset
|
45 final class HotSpotConstantPool implements ConstantPool, HotSpotProxified, 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 |
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
|
129 private JVM_CONSTANT(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
|
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 } |
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
|
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 |
39ee26e85256
Use boxed cache in HotSpotConstantpool instead of synchronization
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21215
diff
changeset
|
174 public LookupTypeCacheElement(int lastCpi, JavaType javaType) { |
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) { |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
199 return new HotSpotConstantPool(metaspaceConstantPool); |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
200 } |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
201 |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
202 private HotSpotConstantPool(long metaspaceConstantPool) { |
13259
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13254
diff
changeset
|
203 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
|
204 } |
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
|
205 |
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 /** |
18223
17c98fad6980
converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18222
diff
changeset
|
207 * 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
|
208 * |
14093 | 209 * @return holder for this constant pool |
210 */ | |
14117
2b2f0022900f
removed unnecessary lookupKlassByName method
Doug Simon <doug.simon@oracle.com>
parents:
14093
diff
changeset
|
211 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
|
212 return compilerToVM().getResolvedJavaType(this, config().constantPoolHolderOffset, false); |
14093 | 213 } |
214 | |
215 /** | |
14052
361acb279104
moved to-constant-pool-index conversion up to Java
twisti
parents:
13261
diff
changeset
|
216 * 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
|
217 * {@link HotSpotVMConfig#constantPoolCpCacheIndexTag constant}. |
14979
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
218 * |
14052
361acb279104
moved to-constant-pool-index conversion up to Java
twisti
parents:
13261
diff
changeset
|
219 * @param rawIndex index from the bytecode |
361acb279104
moved to-constant-pool-index conversion up to Java
twisti
parents:
13261
diff
changeset
|
220 * @param opcode bytecode to convert the index for |
361acb279104
moved to-constant-pool-index conversion up to Java
twisti
parents:
13261
diff
changeset
|
221 * @return constant pool index |
361acb279104
moved to-constant-pool-index conversion up to Java
twisti
parents:
13261
diff
changeset
|
222 */ |
22234
179db500f6e5
Add Java code for reading the constant pool cache plus sun.reflect.ConstantPool substitutions.
twisti
parents:
22100
diff
changeset
|
223 private static int rawIndexToConstantPoolIndex(int rawIndex, int opcode) { |
14052
361acb279104
moved to-constant-pool-index conversion up to Java
twisti
parents:
13261
diff
changeset
|
224 int index; |
361acb279104
moved to-constant-pool-index conversion up to Java
twisti
parents:
13261
diff
changeset
|
225 if (opcode == Bytecodes.INVOKEDYNAMIC) { |
361acb279104
moved to-constant-pool-index conversion up to Java
twisti
parents:
13261
diff
changeset
|
226 index = rawIndex; |
361acb279104
moved to-constant-pool-index conversion up to Java
twisti
parents:
13261
diff
changeset
|
227 // See: ConstantPool::is_invokedynamic_index |
361acb279104
moved to-constant-pool-index conversion up to Java
twisti
parents:
13261
diff
changeset
|
228 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
|
229 } else { |
361acb279104
moved to-constant-pool-index conversion up to Java
twisti
parents:
13261
diff
changeset
|
230 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
|
231 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
|
232 index = rawIndex + config().constantPoolCpCacheIndexTag; |
14052
361acb279104
moved to-constant-pool-index conversion up to Java
twisti
parents:
13261
diff
changeset
|
233 } |
361acb279104
moved to-constant-pool-index conversion up to Java
twisti
parents:
13261
diff
changeset
|
234 return index; |
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 |
361acb279104
moved to-constant-pool-index conversion up to Java
twisti
parents:
13261
diff
changeset
|
237 /** |
14979
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
238 * 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
|
239 * |
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
240 * See {@code ConstantPool::decode_cpcache_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 * @param index constant pool cache index |
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
243 * @return decoded index |
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
244 */ |
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
245 private static int decodeConstantPoolCacheIndex(int index) { |
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
246 if (isInvokedynamicIndex(index)) { |
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
247 return decodeInvokedynamicIndex(index); |
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
248 } else { |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
249 return index - config().constantPoolCpCacheIndexTag; |
14979
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
250 } |
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
251 } |
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 * See {@code ConstantPool::is_invokedynamic_index}. |
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 private static boolean isInvokedynamicIndex(int index) { |
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
257 return index < 0; |
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
258 } |
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
259 |
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 * See {@code ConstantPool::decode_invokedynamic_index}. |
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 private static int decodeInvokedynamicIndex(int i) { |
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
264 assert isInvokedynamicIndex(i) : i; |
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
265 return ~i; |
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
266 } |
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
267 |
22598
ed53e370f04c
Make implementation classes package private.
Roland Schatz <roland.schatz@oracle.com>
parents:
22582
diff
changeset
|
268 long getMetaspaceConstantPool() { |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
269 return metaspaceConstantPool; |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
270 } |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
271 |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
272 public long getMetaspacePointer() { |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
273 return getMetaspaceConstantPool(); |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
274 } |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
275 |
14979
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
276 /** |
14093 | 277 * 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
|
278 * |
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
|
279 * @param index constant pool index |
14093 | 280 * @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
|
281 */ |
14529 | 282 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
|
283 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
|
284 HotSpotVMConfig config = config(); |
22542
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
285 final long metaspaceConstantPoolTags = UNSAFE.getAddress(getMetaspaceConstantPool() + config.constantPoolTagsOffset); |
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
286 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
|
287 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
|
288 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
|
289 } |
14529 | 290 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
|
291 } |
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
|
292 |
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 /** |
14093 | 294 * 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
|
295 * |
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
|
296 * @param index constant pool index |
14093 | 297 * @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
|
298 */ |
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
|
299 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
|
300 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
|
301 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
|
302 } |
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
|
303 |
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 /** |
14093 | 305 * 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
|
306 * |
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
|
307 * @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
|
308 * @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
|
309 */ |
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 private int getIntAt(int index) { |
14529 | 311 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
|
312 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
|
313 } |
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
|
314 |
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 /** |
14093 | 316 * 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
|
317 * |
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
|
318 * @param index constant pool index |
14093 | 319 * @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
|
320 */ |
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
|
321 private long getLongAt(int index) { |
14529 | 322 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
|
323 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
|
324 } |
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
|
325 |
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 /** |
14093 | 327 * 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
|
328 * |
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
|
329 * @param index constant pool index |
14093 | 330 * @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
|
331 */ |
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
|
332 private float getFloatAt(int index) { |
14529 | 333 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
|
334 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
|
335 } |
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
|
336 |
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 /** |
14093 | 338 * 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
|
339 * |
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
|
340 * @param index constant pool index |
14093 | 341 * @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
|
342 */ |
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
|
343 private double getDoubleAt(int index) { |
14529 | 344 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
|
345 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
|
346 } |
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
|
347 |
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 /** |
14093 | 349 * 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
|
350 * |
14093 | 351 * @param index constant pool index |
352 * @return {@code JVM_CONSTANT_NameAndType} constant pool entry | |
353 */ | |
354 private int getNameAndTypeAt(int index) { | |
14529 | 355 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
|
356 return UNSAFE.getInt(getMetaspaceConstantPool() + config().constantPoolSize + index * runtime().getHostJVMCIBackend().getTarget().wordSize); |
14093 | 357 } |
358 | |
359 /** | |
360 * Gets the {@code JVM_CONSTANT_NameAndType} reference index constant pool entry at index | |
361 * {@code index}. | |
14979
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
362 * |
14093 | 363 * @param index constant pool index |
364 * @return {@code JVM_CONSTANT_NameAndType} reference constant pool entry | |
365 */ | |
366 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
|
367 return compilerToVM().lookupNameAndTypeRefIndexInPool(this, index); |
14093 | 368 } |
369 | |
370 /** | |
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
|
371 * 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
|
372 * entry denoted by {@code which}. |
14979
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
373 * |
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
|
374 * @param which constant pool index or constant pool cache index |
14093 | 375 * @return name as {@link String} |
376 */ | |
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
|
377 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
|
378 return compilerToVM().lookupNameInPool(this, which); |
14093 | 379 } |
380 | |
381 /** | |
382 * Gets the name reference index of a {@code JVM_CONSTANT_NameAndType} constant pool entry at | |
383 * index {@code index}. | |
14979
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
384 * |
14093 | 385 * @param index constant pool index |
386 * @return name reference index | |
387 */ | |
388 private int getNameRefIndexAt(int index) { | |
389 final int refIndex = getNameAndTypeAt(index); | |
390 // name ref index is in the low 16-bits. | |
391 return refIndex & 0xFFFF; | |
392 } | |
393 | |
394 /** | |
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
|
395 * 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
|
396 * 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
|
397 * |
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
|
398 * @param which constant pool index or constant pool cache index |
14093 | 399 * @return signature as {@link String} |
400 */ | |
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
|
401 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
|
402 return compilerToVM().lookupSignatureInPool(this, which); |
14093 | 403 } |
404 | |
405 /** | |
406 * Gets the signature reference index of a {@code JVM_CONSTANT_NameAndType} constant pool entry | |
407 * at index {@code index}. | |
14979
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
408 * |
14093 | 409 * @param index constant pool index |
410 * @return signature reference index | |
411 */ | |
412 private int getSignatureRefIndexAt(int index) { | |
413 final int refIndex = getNameAndTypeAt(index); | |
414 // signature ref index is in the high 16-bits. | |
415 return refIndex >>> 16; | |
416 } | |
417 | |
418 /** | |
22487
a0e5714d5436
Remove Java implementation of HotSpotConstantPool Cache and ResolvedReferences and HotSpotSymbol.
twisti
parents:
22455
diff
changeset
|
419 * 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
|
420 * |
14093 | 421 * @param index constant pool index |
422 * @return klass reference index | |
423 */ | |
424 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
|
425 return compilerToVM().lookupKlassRefIndexInPool(this, index); |
14093 | 426 } |
427 | |
428 /** | |
14530
d87b84dade7d
moved CompilerToVM.loadReferencedTypeInPool logic into Java
twisti
parents:
14529
diff
changeset
|
429 * 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
|
430 * {@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
|
431 * |
14530
d87b84dade7d
moved CompilerToVM.loadReferencedTypeInPool logic into Java
twisti
parents:
14529
diff
changeset
|
432 * @param index constant pool index |
d87b84dade7d
moved CompilerToVM.loadReferencedTypeInPool logic into Java
twisti
parents:
14529
diff
changeset
|
433 * @return klass reference index |
d87b84dade7d
moved CompilerToVM.loadReferencedTypeInPool logic into Java
twisti
parents:
14529
diff
changeset
|
434 */ |
22517
0915f5bfdfaa
Adopt some jvmci-9 source changes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22505
diff
changeset
|
435 private int getUncachedKlassRefIndexAt(int index) { |
0915f5bfdfaa
Adopt some jvmci-9 source changes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22505
diff
changeset
|
436 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
|
437 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
|
438 // 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
|
439 return refIndex & 0xFFFF; |
14530
d87b84dade7d
moved CompilerToVM.loadReferencedTypeInPool logic into Java
twisti
parents:
14529
diff
changeset
|
440 } |
d87b84dade7d
moved CompilerToVM.loadReferencedTypeInPool logic into Java
twisti
parents:
14529
diff
changeset
|
441 |
d87b84dade7d
moved CompilerToVM.loadReferencedTypeInPool logic into Java
twisti
parents:
14529
diff
changeset
|
442 /** |
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
|
443 * 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
|
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 * @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
|
446 */ |
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 private void assertBounds(int index) { |
13261
0ffe9e4bb364
don't go through VM to create HotSpotResolvedObjectType (part 1)
twisti
parents:
13259
diff
changeset
|
448 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
|
449 } |
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
|
450 |
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 * 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
|
453 * |
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
|
454 * @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
|
455 * @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
|
456 */ |
14529 | 457 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
|
458 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
|
459 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
|
460 } |
179db500f6e5
Add Java code for reading the constant pool cache plus sun.reflect.ConstantPool substitutions.
twisti
parents:
22100
diff
changeset
|
461 |
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 * 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
|
464 * 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
|
465 * |
179db500f6e5
Add Java code for reading the constant pool cache plus sun.reflect.ConstantPool substitutions.
twisti
parents:
22100
diff
changeset
|
466 * @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
|
467 */ |
179db500f6e5
Add Java code for reading the constant pool cache plus sun.reflect.ConstantPool substitutions.
twisti
parents:
22100
diff
changeset
|
468 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
|
469 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
|
470 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
|
471 } |
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
|
472 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
473 @Override |
9108 | 474 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
|
475 return UNSAFE.getInt(getMetaspaceConstantPool() + config().constantPoolLengthOffset); |
9108 | 476 } |
477 | |
478 @Override | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
479 public Object lookupConstant(int cpi) { |
7002
74f0207b82f5
fixed bug in bytecode reconstitution
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
480 assert cpi != 0; |
14529 | 481 final JVM_CONSTANT tag = getTagAt(cpi); |
482 switch (tag) { | |
483 case Integer: | |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
18167
diff
changeset
|
484 return JavaConstant.forInt(getIntAt(cpi)); |
14529 | 485 case Long: |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
18167
diff
changeset
|
486 return JavaConstant.forLong(getLongAt(cpi)); |
14529 | 487 case Float: |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
18167
diff
changeset
|
488 return JavaConstant.forFloat(getFloatAt(cpi)); |
14529 | 489 case Double: |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
18167
diff
changeset
|
490 return JavaConstant.forDouble(getDoubleAt(cpi)); |
14529 | 491 case Class: |
492 case UnresolvedClass: | |
493 case UnresolvedClassInError: | |
494 final int opcode = -1; // opcode is not used | |
495 return lookupType(cpi, opcode); | |
496 case String: | |
22272
b6d504612b3f
fix HotSpotConstantPool#lookupConstant for pseudo-string entries
Andreas Woess <andreas.woess@oracle.com>
parents:
22234
diff
changeset
|
497 /* |
b6d504612b3f
fix HotSpotConstantPool#lookupConstant for pseudo-string entries
Andreas Woess <andreas.woess@oracle.com>
parents:
22234
diff
changeset
|
498 * 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
|
499 * "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
|
500 * 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
|
501 */ |
22582
232c53e17ea0
added CompilerToVM.compilerToVM() for static access to the CompilerToVM instance
Doug Simon <doug.simon@oracle.com>
parents:
22581
diff
changeset
|
502 Object string = compilerToVM().resolvePossiblyCachedConstantInPool(this, cpi); |
18262
f7d45e2426d4
converted HotSpotObjectConstant to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18223
diff
changeset
|
503 return HotSpotObjectConstantImpl.forObject(string); |
14529 | 504 case MethodHandle: |
505 case MethodHandleInError: | |
506 case MethodType: | |
507 case MethodTypeInError: | |
22582
232c53e17ea0
added CompilerToVM.compilerToVM() for static access to the CompilerToVM instance
Doug Simon <doug.simon@oracle.com>
parents:
22581
diff
changeset
|
508 Object obj = compilerToVM().resolveConstantInPool(this, cpi); |
18262
f7d45e2426d4
converted HotSpotObjectConstant to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18223
diff
changeset
|
509 return HotSpotObjectConstantImpl.forObject(obj); |
14529 | 510 default: |
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
|
511 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
|
512 } |
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
|
513 } |
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 @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
|
516 public String lookupUtf8(int cpi) { |
14529 | 517 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
|
518 return compilerToVM().getSymbol(getEntryAt(cpi)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
519 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
520 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
521 @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
|
522 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
|
523 return new HotSpotSignature(runtime(), lookupUtf8(cpi)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
524 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
525 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
526 @Override |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
18167
diff
changeset
|
527 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
|
528 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
|
529 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
|
530 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
|
531 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
|
532 return null; |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14979
diff
changeset
|
533 } else { |
22234
179db500f6e5
Add Java code for reading the constant pool cache plus sun.reflect.ConstantPool substitutions.
twisti
parents:
22100
diff
changeset
|
534 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
|
535 } |
8945
7ef66078d837
add basic invokedynamic support
Andreas Woess <andreas.woess@jku.at>
parents:
7084
diff
changeset
|
536 } |
7ef66078d837
add basic invokedynamic support
Andreas Woess <andreas.woess@jku.at>
parents:
7084
diff
changeset
|
537 |
14069
2f37b0e442fe
removed remaining VMToCompiler calls for allocating Graal API objects
Doug Simon <doug.simon@oracle.com>
parents:
14052
diff
changeset
|
538 /** |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
539 * 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
|
540 * |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
541 * @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
|
542 */ |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
543 private static JavaType getJavaType(final Object type) { |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
544 if (type instanceof String) { |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
545 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
|
546 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
|
547 } else { |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
548 return (JavaType) type; |
14069
2f37b0e442fe
removed remaining VMToCompiler calls for allocating Graal API objects
Doug Simon <doug.simon@oracle.com>
parents:
14052
diff
changeset
|
549 } |
2f37b0e442fe
removed remaining VMToCompiler calls for allocating Graal API objects
Doug Simon <doug.simon@oracle.com>
parents:
14052
diff
changeset
|
550 } |
2f37b0e442fe
removed remaining VMToCompiler calls for allocating Graal API objects
Doug Simon <doug.simon@oracle.com>
parents:
14052
diff
changeset
|
551 |
8945
7ef66078d837
add basic invokedynamic support
Andreas Woess <andreas.woess@jku.at>
parents:
7084
diff
changeset
|
552 @Override |
6588
b89b5038ad7e
removed _'s from method names in CompilerToVM
Doug Simon <doug.simon@oracle.com>
parents:
5775
diff
changeset
|
553 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
|
554 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
|
555 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
|
556 if (method != null) { |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
557 return method; |
14069
2f37b0e442fe
removed remaining VMToCompiler calls for allocating Graal API objects
Doug Simon <doug.simon@oracle.com>
parents:
14052
diff
changeset
|
558 } else { |
14093 | 559 // 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
|
560 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
|
561 HotSpotSignature signature = new HotSpotSignature(runtime(), getSignatureOf(index)); |
14093 | 562 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
|
563 HotSpotResolvedObjectType holder = HotSpotResolvedObjectTypeImpl.fromObjectClass(MethodHandle.class); |
14093 | 564 return new HotSpotMethodUnresolved(name, signature, holder); |
565 } else { | |
566 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
|
567 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
|
568 JavaType holder = getJavaType(type); |
14093 | 569 return new HotSpotMethodUnresolved(name, signature, holder); |
570 } | |
14069
2f37b0e442fe
removed remaining VMToCompiler calls for allocating Graal API objects
Doug Simon <doug.simon@oracle.com>
parents:
14052
diff
changeset
|
571 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
572 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
573 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
574 @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
|
575 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
|
576 final LookupTypeCacheElement elem = this.lastLookupType; |
39ee26e85256
Use boxed cache in HotSpotConstantpool instead of synchronization
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21215
diff
changeset
|
577 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
|
578 return elem.javaType; |
39ee26e85256
Use boxed cache in HotSpotConstantpool instead of synchronization
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21215
diff
changeset
|
579 } else { |
22582
232c53e17ea0
added CompilerToVM.compilerToVM() for static access to the CompilerToVM instance
Doug Simon <doug.simon@oracle.com>
parents:
22581
diff
changeset
|
580 final Object type = compilerToVM().lookupKlassInPool(this, cpi); |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
581 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
|
582 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
|
583 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
|
584 } |
21252
39ee26e85256
Use boxed cache in HotSpotConstantpool instead of synchronization
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21215
diff
changeset
|
585 return result; |
19377
2ff3a30501da
Prototype caching in HotSpotConstantPool.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18867
diff
changeset
|
586 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
587 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
588 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
589 @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
|
590 public JavaField lookupField(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
|
591 final int index = rawIndexToConstantPoolIndex(cpi, opcode); |
14093 | 592 final int nameAndTypeIndex = getNameAndTypeRefIndexAt(index); |
593 final int nameIndex = getNameRefIndexAt(nameAndTypeIndex); | |
594 String name = lookupUtf8(nameIndex); | |
595 final int typeIndex = getSignatureRefIndexAt(nameAndTypeIndex); | |
596 String typeName = lookupUtf8(typeIndex); | |
14117
2b2f0022900f
removed unnecessary lookupKlassByName method
Doug Simon <doug.simon@oracle.com>
parents:
14093
diff
changeset
|
597 JavaType type = runtime().lookupType(typeName, getHolder(), false); |
14093 | 598 |
599 final int holderIndex = getKlassRefIndexAt(index); | |
600 JavaType holder = lookupType(holderIndex, opcode); | |
601 | |
18223
17c98fad6980
converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18222
diff
changeset
|
602 if (holder instanceof HotSpotResolvedObjectTypeImpl) { |
14093 | 603 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
|
604 HotSpotResolvedObjectTypeImpl resolvedHolder; |
14093 | 605 try { |
22582
232c53e17ea0
added CompilerToVM.compilerToVM() for static access to the CompilerToVM instance
Doug Simon <doug.simon@oracle.com>
parents:
22581
diff
changeset
|
606 resolvedHolder = compilerToVM().resolveFieldInPool(this, index, (byte) opcode, info); |
14093 | 607 } catch (Throwable t) { |
608 /* | |
609 * If there was an exception resolving the field we give up and return an unresolved | |
610 * field. | |
611 */ | |
612 return new HotSpotUnresolvedField(holder, name, type); | |
613 } | |
614 final int flags = (int) info[0]; | |
615 final long offset = info[1]; | |
19377
2ff3a30501da
Prototype caching in HotSpotConstantPool.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18867
diff
changeset
|
616 HotSpotResolvedJavaField result = resolvedHolder.createField(name, type, offset, flags); |
2ff3a30501da
Prototype caching in HotSpotConstantPool.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18867
diff
changeset
|
617 return result; |
14069
2f37b0e442fe
removed remaining VMToCompiler calls for allocating Graal API objects
Doug Simon <doug.simon@oracle.com>
parents:
14052
diff
changeset
|
618 } else { |
2f37b0e442fe
removed remaining VMToCompiler calls for allocating Graal API objects
Doug Simon <doug.simon@oracle.com>
parents:
14052
diff
changeset
|
619 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
|
620 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
621 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
622 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
623 @Override |
22517
0915f5bfdfaa
Adopt some jvmci-9 source changes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22505
diff
changeset
|
624 @SuppressWarnings("fallthrough") |
6588
b89b5038ad7e
removed _'s from method names in CompilerToVM
Doug Simon <doug.simon@oracle.com>
parents:
5775
diff
changeset
|
625 public void loadReferencedType(int cpi, int opcode) { |
14052
361acb279104
moved to-constant-pool-index conversion up to Java
twisti
parents:
13261
diff
changeset
|
626 int index; |
14093 | 627 switch (opcode) { |
628 case Bytecodes.CHECKCAST: | |
629 case Bytecodes.INSTANCEOF: | |
630 case Bytecodes.NEW: | |
631 case Bytecodes.ANEWARRAY: | |
632 case Bytecodes.MULTIANEWARRAY: | |
633 case Bytecodes.LDC: | |
634 case Bytecodes.LDC_W: | |
635 case Bytecodes.LDC2_W: | |
636 index = cpi; | |
637 break; | |
22234
179db500f6e5
Add Java code for reading the constant pool cache plus sun.reflect.ConstantPool substitutions.
twisti
parents:
22100
diff
changeset
|
638 case Bytecodes.INVOKEDYNAMIC: { |
14979
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
639 // 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
|
640 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
|
641 index = compilerToVM().constantPoolRemapInstructionOperandFromCache(this, index); |
14979
5dfaaa91be37
fixed com.oracle.graal.hotspot.meta.HotSpotConstantPool.loadReferencedType(int, int) for invokedynamic
twisti
parents:
14530
diff
changeset
|
642 break; |
22234
179db500f6e5
Add Java code for reading the constant pool cache plus sun.reflect.ConstantPool substitutions.
twisti
parents:
22100
diff
changeset
|
643 } |
179db500f6e5
Add Java code for reading the constant pool cache plus sun.reflect.ConstantPool substitutions.
twisti
parents:
22100
diff
changeset
|
644 case Bytecodes.GETSTATIC: |
179db500f6e5
Add Java code for reading the constant pool cache plus sun.reflect.ConstantPool substitutions.
twisti
parents:
22100
diff
changeset
|
645 case Bytecodes.PUTSTATIC: |
179db500f6e5
Add Java code for reading the constant pool cache plus sun.reflect.ConstantPool substitutions.
twisti
parents:
22100
diff
changeset
|
646 case Bytecodes.GETFIELD: |
179db500f6e5
Add Java code for reading the constant pool cache plus sun.reflect.ConstantPool substitutions.
twisti
parents:
22100
diff
changeset
|
647 case Bytecodes.PUTFIELD: |
179db500f6e5
Add Java code for reading the constant pool cache plus sun.reflect.ConstantPool substitutions.
twisti
parents:
22100
diff
changeset
|
648 case Bytecodes.INVOKEVIRTUAL: |
179db500f6e5
Add Java code for reading the constant pool cache plus sun.reflect.ConstantPool substitutions.
twisti
parents:
22100
diff
changeset
|
649 case Bytecodes.INVOKESPECIAL: |
179db500f6e5
Add Java code for reading the constant pool cache plus sun.reflect.ConstantPool substitutions.
twisti
parents:
22100
diff
changeset
|
650 case Bytecodes.INVOKESTATIC: |
179db500f6e5
Add Java code for reading the constant pool cache plus sun.reflect.ConstantPool substitutions.
twisti
parents:
22100
diff
changeset
|
651 case Bytecodes.INVOKEINTERFACE: { |
179db500f6e5
Add Java code for reading the constant pool cache plus sun.reflect.ConstantPool substitutions.
twisti
parents:
22100
diff
changeset
|
652 // 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
|
653 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
|
654 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
|
655 break; |
179db500f6e5
Add Java code for reading the constant pool cache plus sun.reflect.ConstantPool substitutions.
twisti
parents:
22100
diff
changeset
|
656 } |
14093 | 657 default: |
22234
179db500f6e5
Add Java code for reading the constant pool cache plus sun.reflect.ConstantPool substitutions.
twisti
parents:
22100
diff
changeset
|
658 throw JVMCIError.shouldNotReachHere("Unexpected opcode " + opcode); |
14052
361acb279104
moved to-constant-pool-index conversion up to Java
twisti
parents:
13261
diff
changeset
|
659 } |
14530
d87b84dade7d
moved CompilerToVM.loadReferencedTypeInPool logic into Java
twisti
parents:
14529
diff
changeset
|
660 |
22089
13a50cb905b7
Only invokevirtual and invokespecial are invokehandle aliases.
twisti
parents:
22054
diff
changeset
|
661 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
|
662 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
|
663 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
|
664 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
|
665 } |
14530
d87b84dade7d
moved CompilerToVM.loadReferencedTypeInPool logic into Java
twisti
parents:
14529
diff
changeset
|
666 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
|
667 case MethodRef: |
14530
d87b84dade7d
moved CompilerToVM.loadReferencedTypeInPool logic into Java
twisti
parents:
14529
diff
changeset
|
668 case Fieldref: |
d87b84dade7d
moved CompilerToVM.loadReferencedTypeInPool logic into Java
twisti
parents:
14529
diff
changeset
|
669 case InterfaceMethodref: |
22517
0915f5bfdfaa
Adopt some jvmci-9 source changes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22505
diff
changeset
|
670 index = getUncachedKlassRefIndexAt(index); |
0915f5bfdfaa
Adopt some jvmci-9 source changes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22505
diff
changeset
|
671 // 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
|
672 final JVM_CONSTANT klassTag = getTagAt(index); |
0915f5bfdfaa
Adopt some jvmci-9 source changes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22505
diff
changeset
|
673 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
|
674 // fall through |
14530
d87b84dade7d
moved CompilerToVM.loadReferencedTypeInPool logic into Java
twisti
parents:
14529
diff
changeset
|
675 case Class: |
d87b84dade7d
moved CompilerToVM.loadReferencedTypeInPool logic into Java
twisti
parents:
14529
diff
changeset
|
676 case UnresolvedClass: |
d87b84dade7d
moved CompilerToVM.loadReferencedTypeInPool logic into Java
twisti
parents:
14529
diff
changeset
|
677 case UnresolvedClassInError: |
22582
232c53e17ea0
added CompilerToVM.compilerToVM() for static access to the CompilerToVM instance
Doug Simon <doug.simon@oracle.com>
parents:
22581
diff
changeset
|
678 final HotSpotResolvedObjectTypeImpl type = compilerToVM().resolveTypeInPool(this, index); |
14530
d87b84dade7d
moved CompilerToVM.loadReferencedTypeInPool logic into Java
twisti
parents:
14529
diff
changeset
|
679 Class<?> klass = type.mirror(); |
d87b84dade7d
moved CompilerToVM.loadReferencedTypeInPool logic into Java
twisti
parents:
14529
diff
changeset
|
680 if (!klass.isPrimitive() && !klass.isArray()) { |
22542
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
681 UNSAFE.ensureClassInitialized(klass); |
14530
d87b84dade7d
moved CompilerToVM.loadReferencedTypeInPool logic into Java
twisti
parents:
14529
diff
changeset
|
682 } |
22089
13a50cb905b7
Only invokevirtual and invokespecial are invokehandle aliases.
twisti
parents:
22054
diff
changeset
|
683 switch (tag) { |
13a50cb905b7
Only invokevirtual and invokespecial are invokehandle aliases.
twisti
parents:
22054
diff
changeset
|
684 case MethodRef: |
13a50cb905b7
Only invokevirtual and invokespecial are invokehandle aliases.
twisti
parents:
22054
diff
changeset
|
685 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
|
686 final int methodRefCacheIndex = rawIndexToConstantPoolIndex(cpi, opcode); |
22089
13a50cb905b7
Only invokevirtual and invokespecial are invokehandle aliases.
twisti
parents:
22054
diff
changeset
|
687 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
|
688 compilerToVM().resolveInvokeHandleInPool(this, methodRefCacheIndex); |
22089
13a50cb905b7
Only invokevirtual and invokespecial are invokehandle aliases.
twisti
parents:
22054
diff
changeset
|
689 } |
13a50cb905b7
Only invokevirtual and invokespecial are invokehandle aliases.
twisti
parents:
22054
diff
changeset
|
690 } |
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
|
691 } |
14530
d87b84dade7d
moved CompilerToVM.loadReferencedTypeInPool logic into Java
twisti
parents:
14529
diff
changeset
|
692 break; |
15205
affef8631cf4
Add eager resolving for indy call sites
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15193
diff
changeset
|
693 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
|
694 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
|
695 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
|
696 } |
15205
affef8631cf4
Add eager resolving for indy call sites
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15193
diff
changeset
|
697 break; |
14530
d87b84dade7d
moved CompilerToVM.loadReferencedTypeInPool logic into Java
twisti
parents:
14529
diff
changeset
|
698 default: |
d87b84dade7d
moved CompilerToVM.loadReferencedTypeInPool logic into Java
twisti
parents:
14529
diff
changeset
|
699 // nothing |
d87b84dade7d
moved CompilerToVM.loadReferencedTypeInPool logic into Java
twisti
parents:
14529
diff
changeset
|
700 break; |
d87b84dade7d
moved CompilerToVM.loadReferencedTypeInPool logic into Java
twisti
parents:
14529
diff
changeset
|
701 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
702 } |
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
|
703 |
22089
13a50cb905b7
Only invokevirtual and invokespecial are invokehandle aliases.
twisti
parents:
22054
diff
changeset
|
704 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
|
705 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
|
706 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
|
707 } |
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
|
708 |
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
|
709 @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
|
710 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
|
711 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
|
712 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
|
713 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
714 } |