annotate graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/jvmci/HotSpotUnresolvedJavaType.java @ 21533:b118c9be1d1f

fixed regression preventing hosted CompileTheWorld from running (JBS:GRAAL-53)
author Doug Simon <doug.simon@oracle.com>
date Sun, 24 May 2015 14:44:28 +0200
parents 07b088d61d5d
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 /*
21527
07b088d61d5d added HotSpotJVMCIRuntime* classes, replaced references to HotSpotGraalRuntime in VM with HotSpotJVMCIRuntime (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 */
21527
07b088d61d5d added HotSpotJVMCIRuntime* classes, replaced references to HotSpotGraalRuntime in VM with HotSpotJVMCIRuntime (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21411
diff changeset
23 package com.oracle.graal.hotspot.jvmci;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
24
5507
dc71b06d09f8 Moving classes from cri.ri to api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5504
diff changeset
25 import com.oracle.graal.api.meta.*;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
26
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
27 /**
5775
2c088af17e59 Removed left over Ri* prefixed identifiers
Doug Simon <doug.simon@oracle.com>
parents: 5554
diff changeset
28 * 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
29 */
7084
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7083
diff changeset
30 public class HotSpotUnresolvedJavaType extends HotSpotJavaType {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
31
21527
07b088d61d5d added HotSpotJVMCIRuntime* classes, replaced references to HotSpotGraalRuntime in VM with HotSpotJVMCIRuntime (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21411
diff changeset
32 private final HotSpotJVMCIRuntimeProvider runtime;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
33
21527
07b088d61d5d added HotSpotJVMCIRuntime* classes, replaced references to HotSpotGraalRuntime in VM with HotSpotJVMCIRuntime (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21411
diff changeset
34 public 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
35 super(name);
16492
8853b9304083 made type resolution require an accessing class context
Doug Simon <doug.simon@oracle.com>
parents: 15730
diff changeset
36 assert name.charAt(0) == '[' || name.charAt(name.length() - 1) == ';' : name;
18542
21384a8fbb64 removed static accesses to HotSpotGraalRuntime from some HotSpot meta API classes
Doug Simon <doug.simon@oracle.com>
parents: 18223
diff changeset
37 this.runtime = runtime;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
38 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
39
14069
2f37b0e442fe removed remaining VMToCompiler calls for allocating Graal API objects
Doug Simon <doug.simon@oracle.com>
parents: 13305
diff changeset
40 /**
2f37b0e442fe removed remaining VMToCompiler calls for allocating Graal API objects
Doug Simon <doug.simon@oracle.com>
parents: 13305
diff changeset
41 * 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
42 */
21527
07b088d61d5d added HotSpotJVMCIRuntime* classes, replaced references to HotSpotGraalRuntime in VM with HotSpotJVMCIRuntime (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21411
diff changeset
43 public static HotSpotUnresolvedJavaType create(HotSpotJVMCIRuntimeProvider runtime, String name) {
18542
21384a8fbb64 removed static accesses to HotSpotGraalRuntime from some HotSpot meta API classes
Doug Simon <doug.simon@oracle.com>
parents: 18223
diff changeset
44 return new HotSpotUnresolvedJavaType(name, runtime);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
45 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
46
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
47 @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
48 public JavaType getComponentType() {
15730
920b7bb058a6 Simplify HotSpotUnresolvedJavaType, harmonize toString for HotSpotUnresolvedJavaType and HotSpotResolvedObjectType
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14093
diff changeset
49 assert getName().charAt(0) == '[' : "no array class" + getName();
18542
21384a8fbb64 removed static accesses to HotSpotGraalRuntime from some HotSpot meta API classes
Doug Simon <doug.simon@oracle.com>
parents: 18223
diff changeset
50 return new HotSpotUnresolvedJavaType(getName().substring(1), runtime);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
51 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
52
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
53 @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
54 public JavaType getArrayClass() {
18542
21384a8fbb64 removed static accesses to HotSpotGraalRuntime from some HotSpot meta API classes
Doug Simon <doug.simon@oracle.com>
parents: 18223
diff changeset
55 return new HotSpotUnresolvedJavaType('[' + getName(), runtime);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
56 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
57
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
58 @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
59 public Kind getKind() {
5540
a891c53a295b Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5534
diff changeset
60 return Kind.Object;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
61 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
62
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
63 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
64 public int hashCode() {
15730
920b7bb058a6 Simplify HotSpotUnresolvedJavaType, harmonize toString for HotSpotUnresolvedJavaType and HotSpotResolvedObjectType
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14093
diff changeset
65 return getName().hashCode();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
66 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
67
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
68 @Override
14093
dd783f0ecf17 refactor CompilerToVM interface
twisti
parents: 14069
diff changeset
69 public boolean equals(Object obj) {
dd783f0ecf17 refactor CompilerToVM interface
twisti
parents: 14069
diff changeset
70 if (this == obj) {
dd783f0ecf17 refactor CompilerToVM interface
twisti
parents: 14069
diff changeset
71 return true;
dd783f0ecf17 refactor CompilerToVM interface
twisti
parents: 14069
diff changeset
72 }
dd783f0ecf17 refactor CompilerToVM interface
twisti
parents: 14069
diff changeset
73 if (obj == null || !(obj instanceof HotSpotUnresolvedJavaType)) {
dd783f0ecf17 refactor CompilerToVM interface
twisti
parents: 14069
diff changeset
74 return false;
dd783f0ecf17 refactor CompilerToVM interface
twisti
parents: 14069
diff changeset
75 }
dd783f0ecf17 refactor CompilerToVM interface
twisti
parents: 14069
diff changeset
76 HotSpotUnresolvedJavaType that = (HotSpotUnresolvedJavaType) obj;
15730
920b7bb058a6 Simplify HotSpotUnresolvedJavaType, harmonize toString for HotSpotUnresolvedJavaType and HotSpotResolvedObjectType
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14093
diff changeset
77 return this.getName().equals(that.getName());
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
78 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
79
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
80 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
81 public String toString() {
15730
920b7bb058a6 Simplify HotSpotUnresolvedJavaType, harmonize toString for HotSpotUnresolvedJavaType and HotSpotResolvedObjectType
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14093
diff changeset
82 return "HotSpotType<" + getName() + ", unresolved>";
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
83 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
84
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
85 @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
86 public ResolvedJavaType resolve(ResolvedJavaType accessingClass) {
18542
21384a8fbb64 removed static accesses to HotSpotGraalRuntime from some HotSpot meta API classes
Doug Simon <doug.simon@oracle.com>
parents: 18223
diff changeset
87 return (ResolvedJavaType) runtime.lookupType(getName(), (HotSpotResolvedObjectType) accessingClass, true);
4484
14a00ee82980 Implement eager type resolving.
Andreas Woess <andreas.woess@jku.at>
parents: 4199
diff changeset
88 }
19917
6575b4e3f629 Don't force resolution for unloaded field types
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18542
diff changeset
89
6575b4e3f629 Don't force resolution for unloaded field types
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18542
diff changeset
90 /**
6575b4e3f629 Don't force resolution for unloaded field types
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18542
diff changeset
91 * 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: 18542
diff changeset
92 *
6575b4e3f629 Don't force resolution for unloaded field types
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18542
diff changeset
93 * @param accessingClass
6575b4e3f629 Don't force resolution for unloaded field types
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18542
diff changeset
94 * @return the resolved class or null.
6575b4e3f629 Don't force resolution for unloaded field types
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18542
diff changeset
95 */
6575b4e3f629 Don't force resolution for unloaded field types
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18542
diff changeset
96 ResolvedJavaType reresolve(HotSpotResolvedObjectType accessingClass) {
6575b4e3f629 Don't force resolution for unloaded field types
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18542
diff changeset
97 JavaType type = runtime.lookupType(getName(), accessingClass, false);
6575b4e3f629 Don't force resolution for unloaded field types
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18542
diff changeset
98 if (type instanceof ResolvedJavaType) {
6575b4e3f629 Don't force resolution for unloaded field types
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18542
diff changeset
99 return (ResolvedJavaType) type;
6575b4e3f629 Don't force resolution for unloaded field types
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18542
diff changeset
100 }
6575b4e3f629 Don't force resolution for unloaded field types
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18542
diff changeset
101 return null;
6575b4e3f629 Don't force resolution for unloaded field types
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18542
diff changeset
102 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
103 }