annotate jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotUnresolvedJavaType.java @ 24225:a2dbb6fcc923

Added tag jvmci-0.33 for changeset 3aed4cb813f4
author Doug Simon <doug.simon@oracle.com>
date Fri, 18 Aug 2017 22:47:33 +0200
parents 1bbd4a7c274b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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: 21411
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: 22598
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: 22598
diff changeset
25 import jdk.vm.ci.meta.JavaKind;
1bbd4a7c274b Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22598
diff changeset
26 import jdk.vm.ci.meta.JavaType;
1bbd4a7c274b Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22598
diff changeset
27 import jdk.vm.ci.meta.ResolvedJavaType;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
28
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
29 /**
5775
2c088af17e59 Removed left over Ri* prefixed identifiers
Doug Simon <doug.simon@oracle.com>
parents: 5554
diff changeset
30 * Implementation of {@link JavaType} for unresolved HotSpot classes.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
31 */
22598
ed53e370f04c Make implementation classes package private.
Roland Schatz <roland.schatz@oracle.com>
parents: 22569
diff changeset
32 final class HotSpotUnresolvedJavaType extends HotSpotJavaType {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
33
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: 21411
diff changeset
34 private final HotSpotJVMCIRuntimeProvider runtime;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
35
22598
ed53e370f04c Make implementation classes package private.
Roland Schatz <roland.schatz@oracle.com>
parents: 22569
diff changeset
36 private HotSpotUnresolvedJavaType(String name, HotSpotJVMCIRuntimeProvider runtime) {
7026
f31d374e8195 fixed bug in creation of the name for a HotSpotTypeUnresolved
Doug Simon <doug.simon@oracle.com>
parents: 6950
diff changeset
37 super(name);
16492
8853b9304083 made type resolution require an accessing class context
Doug Simon <doug.simon@oracle.com>
parents: 15730
diff changeset
38 assert name.charAt(0) == '[' || name.charAt(name.length() - 1) == ';' : name;
18540
21384a8fbb64 removed static accesses to HotSpotGraalRuntime from some HotSpot meta API classes
Doug Simon <doug.simon@oracle.com>
parents: 18223
diff changeset
39 this.runtime = runtime;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
40 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
41
14069
2f37b0e442fe removed remaining VMToCompiler calls for allocating Graal API objects
Doug Simon <doug.simon@oracle.com>
parents: 13305
diff changeset
42 /**
2f37b0e442fe removed remaining VMToCompiler calls for allocating Graal API objects
Doug Simon <doug.simon@oracle.com>
parents: 13305
diff changeset
43 * Creates an unresolved type for a valid {@link JavaType#getName() type name}.
2f37b0e442fe removed remaining VMToCompiler calls for allocating Graal API objects
Doug Simon <doug.simon@oracle.com>
parents: 13305
diff changeset
44 */
22598
ed53e370f04c Make implementation classes package private.
Roland Schatz <roland.schatz@oracle.com>
parents: 22569
diff changeset
45 static HotSpotUnresolvedJavaType create(HotSpotJVMCIRuntimeProvider runtime, String name) {
18540
21384a8fbb64 removed static accesses to HotSpotGraalRuntime from some HotSpot meta API classes
Doug Simon <doug.simon@oracle.com>
parents: 18223
diff changeset
46 return new HotSpotUnresolvedJavaType(name, runtime);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
47 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
48
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
49 @Override
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6325
diff changeset
50 public JavaType getComponentType() {
15730
920b7bb058a6 Simplify HotSpotUnresolvedJavaType, harmonize toString for HotSpotUnresolvedJavaType and HotSpotResolvedObjectType
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14093
diff changeset
51 assert getName().charAt(0) == '[' : "no array class" + getName();
18540
21384a8fbb64 removed static accesses to HotSpotGraalRuntime from some HotSpot meta API classes
Doug Simon <doug.simon@oracle.com>
parents: 18223
diff changeset
52 return new HotSpotUnresolvedJavaType(getName().substring(1), runtime);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
53 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
54
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
55 @Override
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6325
diff changeset
56 public JavaType getArrayClass() {
18540
21384a8fbb64 removed static accesses to HotSpotGraalRuntime from some HotSpot meta API classes
Doug Simon <doug.simon@oracle.com>
parents: 18223
diff changeset
57 return new HotSpotUnresolvedJavaType('[' + getName(), runtime);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
58 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
59
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
60 @Override
22536
dc1aeef79e7e Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents: 22054
diff changeset
61 public JavaKind getJavaKind() {
dc1aeef79e7e Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents: 22054
diff changeset
62 return JavaKind.Object;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
63 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
64
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
65 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
66 public int hashCode() {
15730
920b7bb058a6 Simplify HotSpotUnresolvedJavaType, harmonize toString for HotSpotUnresolvedJavaType and HotSpotResolvedObjectType
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14093
diff changeset
67 return getName().hashCode();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
68 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
69
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
70 @Override
14093
dd783f0ecf17 refactor CompilerToVM interface
twisti
parents: 14069
diff changeset
71 public boolean equals(Object obj) {
dd783f0ecf17 refactor CompilerToVM interface
twisti
parents: 14069
diff changeset
72 if (this == obj) {
dd783f0ecf17 refactor CompilerToVM interface
twisti
parents: 14069
diff changeset
73 return true;
dd783f0ecf17 refactor CompilerToVM interface
twisti
parents: 14069
diff changeset
74 }
dd783f0ecf17 refactor CompilerToVM interface
twisti
parents: 14069
diff changeset
75 if (obj == null || !(obj instanceof HotSpotUnresolvedJavaType)) {
dd783f0ecf17 refactor CompilerToVM interface
twisti
parents: 14069
diff changeset
76 return false;
dd783f0ecf17 refactor CompilerToVM interface
twisti
parents: 14069
diff changeset
77 }
dd783f0ecf17 refactor CompilerToVM interface
twisti
parents: 14069
diff changeset
78 HotSpotUnresolvedJavaType that = (HotSpotUnresolvedJavaType) obj;
15730
920b7bb058a6 Simplify HotSpotUnresolvedJavaType, harmonize toString for HotSpotUnresolvedJavaType and HotSpotResolvedObjectType
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14093
diff changeset
79 return this.getName().equals(that.getName());
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
80 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
81
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
82 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
83 public String toString() {
15730
920b7bb058a6 Simplify HotSpotUnresolvedJavaType, harmonize toString for HotSpotUnresolvedJavaType and HotSpotResolvedObjectType
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14093
diff changeset
84 return "HotSpotType<" + getName() + ", unresolved>";
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
85 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
86
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
87 @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: 5540
diff changeset
88 public ResolvedJavaType resolve(ResolvedJavaType accessingClass) {
18540
21384a8fbb64 removed static accesses to HotSpotGraalRuntime from some HotSpot meta API classes
Doug Simon <doug.simon@oracle.com>
parents: 18223
diff changeset
89 return (ResolvedJavaType) runtime.lookupType(getName(), (HotSpotResolvedObjectType) accessingClass, true);
4484
14a00ee82980 Implement eager type resolving.
Andreas Woess <andreas.woess@jku.at>
parents: 4199
diff changeset
90 }
19917
6575b4e3f629 Don't force resolution for unloaded field types
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18540
diff changeset
91
6575b4e3f629 Don't force resolution for unloaded field types
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18540
diff changeset
92 /**
6575b4e3f629 Don't force resolution for unloaded field types
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18540
diff changeset
93 * Try to find a loaded version of this class.
6575b4e3f629 Don't force resolution for unloaded field types
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18540
diff changeset
94 *
6575b4e3f629 Don't force resolution for unloaded field types
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18540
diff changeset
95 * @param accessingClass
6575b4e3f629 Don't force resolution for unloaded field types
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18540
diff changeset
96 * @return the resolved class or null.
6575b4e3f629 Don't force resolution for unloaded field types
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18540
diff changeset
97 */
6575b4e3f629 Don't force resolution for unloaded field types
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18540
diff changeset
98 ResolvedJavaType reresolve(HotSpotResolvedObjectType accessingClass) {
6575b4e3f629 Don't force resolution for unloaded field types
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18540
diff changeset
99 JavaType type = runtime.lookupType(getName(), accessingClass, false);
6575b4e3f629 Don't force resolution for unloaded field types
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18540
diff changeset
100 if (type instanceof ResolvedJavaType) {
6575b4e3f629 Don't force resolution for unloaded field types
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18540
diff changeset
101 return (ResolvedJavaType) type;
6575b4e3f629 Don't force resolution for unloaded field types
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18540
diff changeset
102 }
6575b4e3f629 Don't force resolution for unloaded field types
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18540
diff changeset
103 return null;
6575b4e3f629 Don't force resolution for unloaded field types
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18540
diff changeset
104 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
105 }