Mercurial > hg > graal-jvmci-8
annotate jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java @ 24148:4f3ad306ac6e jvmci-0.28
Process _jvmci_loader_parent oop along _jvmci_loader
author | Gilles Duboscq <gilles.m.duboscq@oracle.com> |
---|---|
date | Fri, 16 Jun 2017 19:28:31 +0200 |
parents | b01354ea98ec |
children | 26a414946c56 |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
23987
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
2 * Copyright (c) 2011, 2017, 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 |
22569
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22556
diff
changeset
|
25 import static java.util.Objects.requireNonNull; |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22598
diff
changeset
|
26 import static jdk.vm.ci.hotspot.CompilerToVM.compilerToVM; |
24100
839dcc4f2cf6
handle signature polymorphic methods correctly (JDK-8161550)
Doug Simon <doug.simon@oracle.com>
parents:
23996
diff
changeset
|
27 import static jdk.vm.ci.hotspot.HotSpotConstantPool.isSignaturePolymorphicHolder; |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22598
diff
changeset
|
28 import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime; |
23749
d6bd0b9cd0b6
remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents:
23738
diff
changeset
|
29 import static jdk.vm.ci.hotspot.HotSpotModifiers.jvmClassModifiers; |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22598
diff
changeset
|
30 import static jdk.vm.ci.hotspot.HotSpotVMConfig.config; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22598
diff
changeset
|
31 import static jdk.vm.ci.hotspot.UnsafeAccess.UNSAFE; |
15722
c583759bbcfd
ResolvedJavaType.resolveMethod now takes a callerType that is used to check access rules. Make it work for default methods.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15311
diff
changeset
|
32 |
22569
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22556
diff
changeset
|
33 import java.lang.annotation.Annotation; |
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22556
diff
changeset
|
34 import java.lang.reflect.Array; |
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22556
diff
changeset
|
35 import java.lang.reflect.Constructor; |
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22556
diff
changeset
|
36 import java.lang.reflect.Method; |
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22556
diff
changeset
|
37 import java.lang.reflect.Modifier; |
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22556
diff
changeset
|
38 import java.nio.ByteOrder; |
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22556
diff
changeset
|
39 import java.util.HashMap; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
40 |
23392
b3a816d3b844
Backed out changeset: a920338dd4d4
Doug Simon <doug.simon@oracle.com>
parents:
23387
diff
changeset
|
41 import jdk.vm.ci.common.JVMCIError; |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22598
diff
changeset
|
42 import jdk.vm.ci.meta.Assumptions.AssumptionResult; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22598
diff
changeset
|
43 import jdk.vm.ci.meta.Assumptions.ConcreteMethod; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22598
diff
changeset
|
44 import jdk.vm.ci.meta.Assumptions.ConcreteSubtype; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22598
diff
changeset
|
45 import jdk.vm.ci.meta.Assumptions.LeafType; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22598
diff
changeset
|
46 import jdk.vm.ci.meta.Assumptions.NoFinalizableSubclass; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22598
diff
changeset
|
47 import jdk.vm.ci.meta.Constant; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22598
diff
changeset
|
48 import jdk.vm.ci.meta.JavaConstant; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22598
diff
changeset
|
49 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
|
50 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
|
51 import jdk.vm.ci.meta.ResolvedJavaField; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22598
diff
changeset
|
52 import jdk.vm.ci.meta.ResolvedJavaMethod; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22598
diff
changeset
|
53 import jdk.vm.ci.meta.ResolvedJavaType; |
3733
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 /** |
5775
2c088af17e59
Removed left over Ri* prefixed identifiers
Doug Simon <doug.simon@oracle.com>
parents:
5760
diff
changeset
|
56 * Implementation of {@link JavaType} for resolved non-primitive HotSpot classes. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
57 */ |
23393
1d4ce2d19e52
clean up and minimize JVMCI (JDK-8156835)
Doug Simon <doug.simon@oracle.com>
parents:
23392
diff
changeset
|
58 final class HotSpotResolvedObjectTypeImpl extends HotSpotResolvedJavaType implements HotSpotResolvedObjectType, MetaspaceWrapperObject { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
59 |
23987
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
60 private static final HotSpotResolvedJavaField[] NO_FIELDS = new HotSpotResolvedJavaField[0]; |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
61 private static final int METHOD_CACHE_ARRAY_CAPACITY = 8; |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
62 |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6699
diff
changeset
|
63 /** |
13261
0ffe9e4bb364
don't go through VM to create HotSpotResolvedObjectType (part 1)
twisti
parents:
13260
diff
changeset
|
64 * The Java class this type represents. |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6699
diff
changeset
|
65 */ |
13261
0ffe9e4bb364
don't go through VM to create HotSpotResolvedObjectType (part 1)
twisti
parents:
13260
diff
changeset
|
66 private final Class<?> javaClass; |
23987
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
67 private HotSpotResolvedJavaMethodImpl[] methodCacheArray; |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
68 private HashMap<Long, HotSpotResolvedJavaMethodImpl> methodCacheHashMap; |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6699
diff
changeset
|
69 private HotSpotResolvedJavaField[] instanceFields; |
18223
17c98fad6980
converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18222
diff
changeset
|
70 private HotSpotResolvedObjectTypeImpl[] interfaces; |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22432
diff
changeset
|
71 private HotSpotConstantPool constantPool; |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22432
diff
changeset
|
72 final HotSpotJVMCIMetaAccessContext context; |
18556
7484f5fcd41d
removed a usages of HotSpotGraalRuntime.unsafeReadWord(); tidied up some comments
Doug Simon <doug.simon@oracle.com>
parents:
18534
diff
changeset
|
73 private HotSpotResolvedObjectType arrayOfType; |
18167
2bf5ea10eea7
sharpened return types for HotSpot specific Graal API implementations
Doug Simon <doug.simon@oracle.com>
parents:
17156
diff
changeset
|
74 |
2bf5ea10eea7
sharpened return types for HotSpot specific Graal API implementations
Doug Simon <doug.simon@oracle.com>
parents:
17156
diff
changeset
|
75 /** |
21789
5b9adb645217
fixed remnants of "graal" names in JVMCI code
Doug Simon <doug.simon@oracle.com>
parents:
21556
diff
changeset
|
76 * Gets the JVMCI mirror for a {@link Class} object. |
18167
2bf5ea10eea7
sharpened return types for HotSpot specific Graal API implementations
Doug Simon <doug.simon@oracle.com>
parents:
17156
diff
changeset
|
77 * |
2bf5ea10eea7
sharpened return types for HotSpot specific Graal API implementations
Doug Simon <doug.simon@oracle.com>
parents:
17156
diff
changeset
|
78 * @return the {@link HotSpotResolvedJavaType} corresponding to {@code javaClass} |
2bf5ea10eea7
sharpened return types for HotSpot specific Graal API implementations
Doug Simon <doug.simon@oracle.com>
parents:
17156
diff
changeset
|
79 */ |
22598
ed53e370f04c
Make implementation classes package private.
Roland Schatz <roland.schatz@oracle.com>
parents:
22590
diff
changeset
|
80 static HotSpotResolvedObjectTypeImpl fromObjectClass(Class<?> javaClass) { |
18223
17c98fad6980
converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18222
diff
changeset
|
81 return (HotSpotResolvedObjectTypeImpl) runtime().fromClass(javaClass); |
18167
2bf5ea10eea7
sharpened return types for HotSpot specific Graal API implementations
Doug Simon <doug.simon@oracle.com>
parents:
17156
diff
changeset
|
82 } |
5760
87e8baf5447c
added snippets for lowering array creation and initialization (in NewObjectSnippets)
Doug Simon <doug.simon@oracle.com>
parents:
5686
diff
changeset
|
83 |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6699
diff
changeset
|
84 /** |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22432
diff
changeset
|
85 * Gets the JVMCI mirror from a HotSpot type. Since {@link Class} is already a proxy for the |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22432
diff
changeset
|
86 * underlying Klass*, it is used instead of the raw Klass*. |
14980 | 87 * |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22432
diff
changeset
|
88 * Called from the VM. |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22432
diff
changeset
|
89 * |
22455
7ad03bf3d4a9
renames related to using metaspace wrappers instead of raw metaspace values
Doug Simon <doug.simon@oracle.com>
parents:
22454
diff
changeset
|
90 * @param javaClass a {@link Class} object |
7ad03bf3d4a9
renames related to using metaspace wrappers instead of raw metaspace values
Doug Simon <doug.simon@oracle.com>
parents:
22454
diff
changeset
|
91 * @return the {@link ResolvedJavaType} corresponding to {@code javaClass} |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6699
diff
changeset
|
92 */ |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22432
diff
changeset
|
93 @SuppressWarnings("unused") |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22432
diff
changeset
|
94 private static HotSpotResolvedObjectTypeImpl fromMetaspace(Class<?> javaClass) { |
18167
2bf5ea10eea7
sharpened return types for HotSpot specific Graal API implementations
Doug Simon <doug.simon@oracle.com>
parents:
17156
diff
changeset
|
95 return fromObjectClass(javaClass); |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6699
diff
changeset
|
96 } |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6699
diff
changeset
|
97 |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6699
diff
changeset
|
98 /** |
21789
5b9adb645217
fixed remnants of "graal" names in JVMCI code
Doug Simon <doug.simon@oracle.com>
parents:
21556
diff
changeset
|
99 * Creates the JVMCI mirror for a {@link Class} object. |
14980 | 100 * |
13261
0ffe9e4bb364
don't go through VM to create HotSpotResolvedObjectType (part 1)
twisti
parents:
13260
diff
changeset
|
101 * <p> |
13479 | 102 * <b>NOTE</b>: Creating an instance of this class does not install the mirror for the |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22432
diff
changeset
|
103 * {@link Class} type. Use {@link #fromObjectClass(Class)} or {@link #fromMetaspace(Class)} |
18556
7484f5fcd41d
removed a usages of HotSpotGraalRuntime.unsafeReadWord(); tidied up some comments
Doug Simon <doug.simon@oracle.com>
parents:
18534
diff
changeset
|
104 * instead. |
13261
0ffe9e4bb364
don't go through VM to create HotSpotResolvedObjectType (part 1)
twisti
parents:
13260
diff
changeset
|
105 * </p> |
14980 | 106 * |
13261
0ffe9e4bb364
don't go through VM to create HotSpotResolvedObjectType (part 1)
twisti
parents:
13260
diff
changeset
|
107 * @param javaClass the Class to create the mirror for |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22432
diff
changeset
|
108 * @param context |
13261
0ffe9e4bb364
don't go through VM to create HotSpotResolvedObjectType (part 1)
twisti
parents:
13260
diff
changeset
|
109 */ |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22432
diff
changeset
|
110 HotSpotResolvedObjectTypeImpl(Class<?> javaClass, HotSpotJVMCIMetaAccessContext context) { |
13261
0ffe9e4bb364
don't go through VM to create HotSpotResolvedObjectType (part 1)
twisti
parents:
13260
diff
changeset
|
111 super(getSignatureName(javaClass)); |
0ffe9e4bb364
don't go through VM to create HotSpotResolvedObjectType (part 1)
twisti
parents:
13260
diff
changeset
|
112 this.javaClass = javaClass; |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22432
diff
changeset
|
113 this.context = context; |
13261
0ffe9e4bb364
don't go through VM to create HotSpotResolvedObjectType (part 1)
twisti
parents:
13260
diff
changeset
|
114 assert getName().charAt(0) != '[' || isArray() : getName(); |
0ffe9e4bb364
don't go through VM to create HotSpotResolvedObjectType (part 1)
twisti
parents:
13260
diff
changeset
|
115 } |
0ffe9e4bb364
don't go through VM to create HotSpotResolvedObjectType (part 1)
twisti
parents:
13260
diff
changeset
|
116 |
0ffe9e4bb364
don't go through VM to create HotSpotResolvedObjectType (part 1)
twisti
parents:
13260
diff
changeset
|
117 /** |
0ffe9e4bb364
don't go through VM to create HotSpotResolvedObjectType (part 1)
twisti
parents:
13260
diff
changeset
|
118 * Returns the name of this type as it would appear in a signature. |
0ffe9e4bb364
don't go through VM to create HotSpotResolvedObjectType (part 1)
twisti
parents:
13260
diff
changeset
|
119 */ |
0ffe9e4bb364
don't go through VM to create HotSpotResolvedObjectType (part 1)
twisti
parents:
13260
diff
changeset
|
120 private static String getSignatureName(Class<?> javaClass) { |
0ffe9e4bb364
don't go through VM to create HotSpotResolvedObjectType (part 1)
twisti
parents:
13260
diff
changeset
|
121 if (javaClass.isArray()) { |
0ffe9e4bb364
don't go through VM to create HotSpotResolvedObjectType (part 1)
twisti
parents:
13260
diff
changeset
|
122 return javaClass.getName().replace('.', '/'); |
0ffe9e4bb364
don't go through VM to create HotSpotResolvedObjectType (part 1)
twisti
parents:
13260
diff
changeset
|
123 } |
0ffe9e4bb364
don't go through VM to create HotSpotResolvedObjectType (part 1)
twisti
parents:
13260
diff
changeset
|
124 return "L" + javaClass.getName().replace('.', '/') + ";"; |
0ffe9e4bb364
don't go through VM to create HotSpotResolvedObjectType (part 1)
twisti
parents:
13260
diff
changeset
|
125 } |
0ffe9e4bb364
don't go through VM to create HotSpotResolvedObjectType (part 1)
twisti
parents:
13260
diff
changeset
|
126 |
0ffe9e4bb364
don't go through VM to create HotSpotResolvedObjectType (part 1)
twisti
parents:
13260
diff
changeset
|
127 /** |
14091
ed92bc6900d5
simplified HotSpotResolvedObjectType.FieldInfo.getType(); encapsulated all access to javaClass in HotSpotResolvedObjectType more
Doug Simon <doug.simon@oracle.com>
parents:
14069
diff
changeset
|
128 * Gets the metaspace Klass for this type. |
13261
0ffe9e4bb364
don't go through VM to create HotSpotResolvedObjectType (part 1)
twisti
parents:
13260
diff
changeset
|
129 */ |
22598
ed53e370f04c
Make implementation classes package private.
Roland Schatz <roland.schatz@oracle.com>
parents:
22590
diff
changeset
|
130 long getMetaspaceKlass() { |
22536
dc1aeef79e7e
Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22516
diff
changeset
|
131 if (HotSpotJVMCIRuntime.getHostWordKind() == JavaKind.Long) { |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
132 return UNSAFE.getLong(javaClass, (long) config().klassOffset); |
18556
7484f5fcd41d
removed a usages of HotSpotGraalRuntime.unsafeReadWord(); tidied up some comments
Doug Simon <doug.simon@oracle.com>
parents:
18534
diff
changeset
|
133 } |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
134 return UNSAFE.getInt(javaClass, (long) config().klassOffset) & 0xFFFFFFFFL; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
135 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
136 |
23673
7ef84c807bfe
8159010: [JVMCI] crashes with class redefinition
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23393
diff
changeset
|
137 @Override |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22432
diff
changeset
|
138 public long getMetaspacePointer() { |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22432
diff
changeset
|
139 return getMetaspaceKlass(); |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22432
diff
changeset
|
140 } |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22432
diff
changeset
|
141 |
23673
7ef84c807bfe
8159010: [JVMCI] crashes with class redefinition
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23393
diff
changeset
|
142 /** |
7ef84c807bfe
8159010: [JVMCI] crashes with class redefinition
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23393
diff
changeset
|
143 * The Klass* for this object is kept alive by the direct reference to {@link #javaClass} so no |
7ef84c807bfe
8159010: [JVMCI] crashes with class redefinition
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23393
diff
changeset
|
144 * extra work is required. |
7ef84c807bfe
8159010: [JVMCI] crashes with class redefinition
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23393
diff
changeset
|
145 */ |
7ef84c807bfe
8159010: [JVMCI] crashes with class redefinition
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23393
diff
changeset
|
146 @Override |
7ef84c807bfe
8159010: [JVMCI] crashes with class redefinition
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23393
diff
changeset
|
147 public boolean isRegistered() { |
7ef84c807bfe
8159010: [JVMCI] crashes with class redefinition
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23393
diff
changeset
|
148 return true; |
7ef84c807bfe
8159010: [JVMCI] crashes with class redefinition
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23393
diff
changeset
|
149 } |
7ef84c807bfe
8159010: [JVMCI] crashes with class redefinition
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23393
diff
changeset
|
150 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
151 @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:
6430
diff
changeset
|
152 public int getModifiers() { |
22011
4c9d4fe1cbd8
Add ModifiersProvider.isSynthetic, isVarArgs and isBridge.
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21798
diff
changeset
|
153 if (isArray()) { |
4c9d4fe1cbd8
Add ModifiersProvider.isSynthetic, isVarArgs and isBridge.
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21798
diff
changeset
|
154 return (getElementalType().getModifiers() & (Modifier.PUBLIC | Modifier.PRIVATE | Modifier.PROTECTED)) | Modifier.FINAL | Modifier.ABSTRACT; |
4c9d4fe1cbd8
Add ModifiersProvider.isSynthetic, isVarArgs and isBridge.
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21798
diff
changeset
|
155 } else { |
23749
d6bd0b9cd0b6
remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents:
23738
diff
changeset
|
156 return getAccessFlags() & jvmClassModifiers(); |
22011
4c9d4fe1cbd8
Add ModifiersProvider.isSynthetic, isVarArgs and isBridge.
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21798
diff
changeset
|
157 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
158 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
159 |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6699
diff
changeset
|
160 public int getAccessFlags() { |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
161 HotSpotVMConfig config = config(); |
22542
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
162 return UNSAFE.getInt(getMetaspaceKlass() + config.klassAccessFlagsOffset); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
163 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
164 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
165 @Override |
18223
17c98fad6980
converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18222
diff
changeset
|
166 public HotSpotResolvedObjectType getArrayClass() { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
167 if (arrayOfType == null) { |
18167
2bf5ea10eea7
sharpened return types for HotSpot specific Graal API implementations
Doug Simon <doug.simon@oracle.com>
parents:
17156
diff
changeset
|
168 arrayOfType = fromObjectClass(Array.newInstance(mirror(), 0).getClass()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
169 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
170 return arrayOfType; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
171 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
172 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
173 @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:
6430
diff
changeset
|
174 public ResolvedJavaType getComponentType() { |
15040
288c23143d47
Fix most raw type references.
Josef Eisl <josef.eisl@jku.at>
parents:
15018
diff
changeset
|
175 Class<?> javaComponentType = mirror().getComponentType(); |
22422
a98a02bad801
Add simple interface to control caching policy for ResolvedJavaTypes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22254
diff
changeset
|
176 return javaComponentType == null ? null : runtime().fromClass(javaComponentType); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
177 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
178 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
179 @Override |
19801
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
180 public AssumptionResult<ResolvedJavaType> findLeafConcreteSubtype() { |
23340
22c3bdf28fff
Don't generate LeafType assumptions for isLeaf == true types
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23338
diff
changeset
|
181 if (isLeaf()) { |
22c3bdf28fff
Don't generate LeafType assumptions for isLeaf == true types
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23338
diff
changeset
|
182 // No assumptions are required. |
22c3bdf28fff
Don't generate LeafType assumptions for isLeaf == true types
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23338
diff
changeset
|
183 return new AssumptionResult<>(this); |
22c3bdf28fff
Don't generate LeafType assumptions for isLeaf == true types
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23338
diff
changeset
|
184 } |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
185 HotSpotVMConfig config = config(); |
7060
06d5f450f32b
rename: ResolvedJavaType.isArrayClass() -> ResolvedJavaType.isArray()
Doug Simon <doug.simon@oracle.com>
parents:
7059
diff
changeset
|
186 if (isArray()) { |
23338
a3471785190d
findLeafConcreteSubtype should handle arrays of leaf concrete subtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23336
diff
changeset
|
187 ResolvedJavaType elementalType = getElementalType(); |
a3471785190d
findLeafConcreteSubtype should handle arrays of leaf concrete subtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23336
diff
changeset
|
188 AssumptionResult<ResolvedJavaType> elementType = elementalType.findLeafConcreteSubtype(); |
a3471785190d
findLeafConcreteSubtype should handle arrays of leaf concrete subtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23336
diff
changeset
|
189 if (elementType != null && elementType.getResult().equals(elementalType)) { |
a3471785190d
findLeafConcreteSubtype should handle arrays of leaf concrete subtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23336
diff
changeset
|
190 /* |
a3471785190d
findLeafConcreteSubtype should handle arrays of leaf concrete subtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23336
diff
changeset
|
191 * If the elementType is leaf then the array is leaf under the same assumptions but |
a3471785190d
findLeafConcreteSubtype should handle arrays of leaf concrete subtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23336
diff
changeset
|
192 * only if the element type is exactly the leaf type. The element type can be |
a3471785190d
findLeafConcreteSubtype should handle arrays of leaf concrete subtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23336
diff
changeset
|
193 * abstract even if there is only one implementor of the abstract type. |
a3471785190d
findLeafConcreteSubtype should handle arrays of leaf concrete subtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23336
diff
changeset
|
194 */ |
a3471785190d
findLeafConcreteSubtype should handle arrays of leaf concrete subtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23336
diff
changeset
|
195 AssumptionResult<ResolvedJavaType> result = new AssumptionResult<>(this); |
a3471785190d
findLeafConcreteSubtype should handle arrays of leaf concrete subtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23336
diff
changeset
|
196 result.add(elementType); |
a3471785190d
findLeafConcreteSubtype should handle arrays of leaf concrete subtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23336
diff
changeset
|
197 return result; |
a3471785190d
findLeafConcreteSubtype should handle arrays of leaf concrete subtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23336
diff
changeset
|
198 } |
a3471785190d
findLeafConcreteSubtype should handle arrays of leaf concrete subtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23336
diff
changeset
|
199 return null; |
7225
31c4d9f9e922
adder better CHA support
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7221
diff
changeset
|
200 } else if (isInterface()) { |
19801
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
201 HotSpotResolvedObjectTypeImpl implementor = getSingleImplementor(); |
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
202 /* |
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
203 * If the implementor field contains itself that indicates that the interface has more |
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
204 * than one implementors (see: InstanceKlass::add_implementor). |
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
205 */ |
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
206 if (implementor == null || implementor.equals(this)) { |
13478
fe03864a2c72
replaced CompilerToVM.getUniqueImplementor with getKlassImplementor and moved the logic into Java
twisti
parents:
13375
diff
changeset
|
207 return null; |
fe03864a2c72
replaced CompilerToVM.getUniqueImplementor with getKlassImplementor and moved the logic into Java
twisti
parents:
13375
diff
changeset
|
208 } |
fe03864a2c72
replaced CompilerToVM.getUniqueImplementor with getKlassImplementor and moved the logic into Java
twisti
parents:
13375
diff
changeset
|
209 |
19801
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
210 assert !implementor.isInterface(); |
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
211 if (implementor.isAbstract() || !implementor.isLeafClass()) { |
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
212 AssumptionResult<ResolvedJavaType> leafConcreteSubtype = implementor.findLeafConcreteSubtype(); |
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
213 if (leafConcreteSubtype != null) { |
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
214 assert !leafConcreteSubtype.getResult().equals(implementor); |
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
215 AssumptionResult<ResolvedJavaType> newResult = new AssumptionResult<>(leafConcreteSubtype.getResult(), new ConcreteSubtype(this, implementor)); |
20009
426e45c75771
Properly accumulate assumptions
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19801
diff
changeset
|
216 // Accumulate leaf assumptions and return the combined result. |
19801
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
217 newResult.add(leafConcreteSubtype); |
20009
426e45c75771
Properly accumulate assumptions
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19801
diff
changeset
|
218 return newResult; |
19801
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
219 } |
13478
fe03864a2c72
replaced CompilerToVM.getUniqueImplementor with getKlassImplementor and moved the logic into Java
twisti
parents:
13375
diff
changeset
|
220 return null; |
fe03864a2c72
replaced CompilerToVM.getUniqueImplementor with getKlassImplementor and moved the logic into Java
twisti
parents:
13375
diff
changeset
|
221 } |
23340
22c3bdf28fff
Don't generate LeafType assumptions for isLeaf == true types
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23338
diff
changeset
|
222 return concreteSubtype(implementor); |
4433
b494d6f329a3
some more checkcast opts
Lukas Stadler <lukas.stadler@jku.at>
parents:
4220
diff
changeset
|
223 } else { |
18223
17c98fad6980
converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18222
diff
changeset
|
224 HotSpotResolvedObjectTypeImpl type = this; |
15311
820c6d353358
added ModifiersProvider as superinterface for ResolvedJava[Method|Field|Type] and implemented all checks against modifiers as default methods
Doug Simon <doug.simon@oracle.com>
parents:
15291
diff
changeset
|
225 while (type.isAbstract()) { |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22432
diff
changeset
|
226 HotSpotResolvedObjectTypeImpl subklass = type.getSubklass(); |
22542
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
227 if (subklass == null || UNSAFE.getAddress(subklass.getMetaspaceKlass() + config.nextSiblingOffset) != 0) { |
7037
dd81042f4eb1
added unit tests for ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
7030
diff
changeset
|
228 return null; |
dd81042f4eb1
added unit tests for ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
7030
diff
changeset
|
229 } |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22432
diff
changeset
|
230 type = subklass; |
7037
dd81042f4eb1
added unit tests for ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
7030
diff
changeset
|
231 } |
15311
820c6d353358
added ModifiersProvider as superinterface for ResolvedJava[Method|Field|Type] and implemented all checks against modifiers as default methods
Doug Simon <doug.simon@oracle.com>
parents:
15291
diff
changeset
|
232 if (type.isAbstract() || type.isInterface() || !type.isLeafClass()) { |
7037
dd81042f4eb1
added unit tests for ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
7030
diff
changeset
|
233 return null; |
dd81042f4eb1
added unit tests for ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
7030
diff
changeset
|
234 } |
19801
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
235 if (this.isAbstract()) { |
23340
22c3bdf28fff
Don't generate LeafType assumptions for isLeaf == true types
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23338
diff
changeset
|
236 return concreteSubtype(type); |
19801
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
237 } else { |
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
238 assert this.equals(type); |
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
239 return new AssumptionResult<>(type, new LeafType(type)); |
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
240 } |
4433
b494d6f329a3
some more checkcast opts
Lukas Stadler <lukas.stadler@jku.at>
parents:
4220
diff
changeset
|
241 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
242 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
243 |
23340
22c3bdf28fff
Don't generate LeafType assumptions for isLeaf == true types
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23338
diff
changeset
|
244 private AssumptionResult<ResolvedJavaType> concreteSubtype(HotSpotResolvedObjectTypeImpl type) { |
22c3bdf28fff
Don't generate LeafType assumptions for isLeaf == true types
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23338
diff
changeset
|
245 if (type.isLeaf()) { |
22c3bdf28fff
Don't generate LeafType assumptions for isLeaf == true types
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23338
diff
changeset
|
246 return new AssumptionResult<>(type, new ConcreteSubtype(this, type)); |
22c3bdf28fff
Don't generate LeafType assumptions for isLeaf == true types
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23338
diff
changeset
|
247 } else { |
22c3bdf28fff
Don't generate LeafType assumptions for isLeaf == true types
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23338
diff
changeset
|
248 return new AssumptionResult<>(type, new LeafType(type), new ConcreteSubtype(this, type)); |
22c3bdf28fff
Don't generate LeafType assumptions for isLeaf == true types
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23338
diff
changeset
|
249 } |
22c3bdf28fff
Don't generate LeafType assumptions for isLeaf == true types
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23338
diff
changeset
|
250 } |
22c3bdf28fff
Don't generate LeafType assumptions for isLeaf == true types
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23338
diff
changeset
|
251 |
13478
fe03864a2c72
replaced CompilerToVM.getUniqueImplementor with getKlassImplementor and moved the logic into Java
twisti
parents:
13375
diff
changeset
|
252 /** |
fe03864a2c72
replaced CompilerToVM.getUniqueImplementor with getKlassImplementor and moved the logic into Java
twisti
parents:
13375
diff
changeset
|
253 * Returns if type {@code type} is a leaf class. This is the case if the |
fe03864a2c72
replaced CompilerToVM.getUniqueImplementor with getKlassImplementor and moved the logic into Java
twisti
parents:
13375
diff
changeset
|
254 * {@code Klass::_subklass} field of the underlying class is zero. |
14980 | 255 * |
13478
fe03864a2c72
replaced CompilerToVM.getUniqueImplementor with getKlassImplementor and moved the logic into Java
twisti
parents:
13375
diff
changeset
|
256 * @return true if the type is a leaf class |
fe03864a2c72
replaced CompilerToVM.getUniqueImplementor with getKlassImplementor and moved the logic into Java
twisti
parents:
13375
diff
changeset
|
257 */ |
fe03864a2c72
replaced CompilerToVM.getUniqueImplementor with getKlassImplementor and moved the logic into Java
twisti
parents:
13375
diff
changeset
|
258 private boolean isLeafClass() { |
23991
4913d70f630b
Use direct memory access when checking for a leaf class.
Christian Haeubl <christian.haeubl@oracle.com>
parents:
23989
diff
changeset
|
259 return UNSAFE.getLong(this.getMetaspaceKlass() + config().subklassOffset) == 0; |
13478
fe03864a2c72
replaced CompilerToVM.getUniqueImplementor with getKlassImplementor and moved the logic into Java
twisti
parents:
13375
diff
changeset
|
260 } |
fe03864a2c72
replaced CompilerToVM.getUniqueImplementor with getKlassImplementor and moved the logic into Java
twisti
parents:
13375
diff
changeset
|
261 |
fe03864a2c72
replaced CompilerToVM.getUniqueImplementor with getKlassImplementor and moved the logic into Java
twisti
parents:
13375
diff
changeset
|
262 /** |
fe03864a2c72
replaced CompilerToVM.getUniqueImplementor with getKlassImplementor and moved the logic into Java
twisti
parents:
13375
diff
changeset
|
263 * Returns the {@code Klass::_subklass} field of the underlying metaspace klass for the given |
fe03864a2c72
replaced CompilerToVM.getUniqueImplementor with getKlassImplementor and moved the logic into Java
twisti
parents:
13375
diff
changeset
|
264 * type {@code type}. |
14980 | 265 * |
13478
fe03864a2c72
replaced CompilerToVM.getUniqueImplementor with getKlassImplementor and moved the logic into Java
twisti
parents:
13375
diff
changeset
|
266 * @return value of the subklass field as metaspace klass pointer |
fe03864a2c72
replaced CompilerToVM.getUniqueImplementor with getKlassImplementor and moved the logic into Java
twisti
parents:
13375
diff
changeset
|
267 */ |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22432
diff
changeset
|
268 private HotSpotResolvedObjectTypeImpl getSubklass() { |
22582
232c53e17ea0
added CompilerToVM.compilerToVM() for static access to the CompilerToVM instance
Doug Simon <doug.simon@oracle.com>
parents:
22581
diff
changeset
|
269 return compilerToVM().getResolvedJavaType(this, config().subklassOffset, false); |
13478
fe03864a2c72
replaced CompilerToVM.getUniqueImplementor with getKlassImplementor and moved the logic into Java
twisti
parents:
13375
diff
changeset
|
270 } |
fe03864a2c72
replaced CompilerToVM.getUniqueImplementor with getKlassImplementor and moved the logic into Java
twisti
parents:
13375
diff
changeset
|
271 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
272 @Override |
18223
17c98fad6980
converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18222
diff
changeset
|
273 public HotSpotResolvedObjectTypeImpl getSuperclass() { |
15040
288c23143d47
Fix most raw type references.
Josef Eisl <josef.eisl@jku.at>
parents:
15018
diff
changeset
|
274 Class<?> javaSuperclass = mirror().getSuperclass(); |
22505
575eb1036ea9
fixed all existing -Xlint warnings
Doug Simon <doug.simon@oracle.com>
parents:
22455
diff
changeset
|
275 return javaSuperclass == null ? null : fromObjectClass(javaSuperclass); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
276 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
277 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
278 @Override |
18223
17c98fad6980
converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18222
diff
changeset
|
279 public HotSpotResolvedObjectTypeImpl[] getInterfaces() { |
6699
d79098b9db3b
Support for interfaces in the Graal API: Make interfaces implemented by a ResolvedJavaType available; change semantics of ResolvedJavaType.getSuperclass to return null for interfaces (to conform with java.lang.Class); change semantics of ResolvedJavaType.isInstanceClass to return false for interfaces.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6588
diff
changeset
|
280 if (interfaces == null) { |
15040
288c23143d47
Fix most raw type references.
Josef Eisl <josef.eisl@jku.at>
parents:
15018
diff
changeset
|
281 Class<?>[] javaInterfaces = mirror().getInterfaces(); |
18223
17c98fad6980
converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18222
diff
changeset
|
282 HotSpotResolvedObjectTypeImpl[] result = new HotSpotResolvedObjectTypeImpl[javaInterfaces.length]; |
6699
d79098b9db3b
Support for interfaces in the Graal API: Make interfaces implemented by a ResolvedJavaType available; change semantics of ResolvedJavaType.getSuperclass to return null for interfaces (to conform with java.lang.Class); change semantics of ResolvedJavaType.isInstanceClass to return false for interfaces.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6588
diff
changeset
|
283 for (int i = 0; i < javaInterfaces.length; i++) { |
18167
2bf5ea10eea7
sharpened return types for HotSpot specific Graal API implementations
Doug Simon <doug.simon@oracle.com>
parents:
17156
diff
changeset
|
284 result[i] = fromObjectClass(javaInterfaces[i]); |
6699
d79098b9db3b
Support for interfaces in the Graal API: Make interfaces implemented by a ResolvedJavaType available; change semantics of ResolvedJavaType.getSuperclass to return null for interfaces (to conform with java.lang.Class); change semantics of ResolvedJavaType.isInstanceClass to return false for interfaces.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6588
diff
changeset
|
285 } |
d79098b9db3b
Support for interfaces in the Graal API: Make interfaces implemented by a ResolvedJavaType available; change semantics of ResolvedJavaType.getSuperclass to return null for interfaces (to conform with java.lang.Class); change semantics of ResolvedJavaType.isInstanceClass to return false for interfaces.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6588
diff
changeset
|
286 interfaces = result; |
d79098b9db3b
Support for interfaces in the Graal API: Make interfaces implemented by a ResolvedJavaType available; change semantics of ResolvedJavaType.getSuperclass to return null for interfaces (to conform with java.lang.Class); change semantics of ResolvedJavaType.isInstanceClass to return false for interfaces.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6588
diff
changeset
|
287 } |
d79098b9db3b
Support for interfaces in the Graal API: Make interfaces implemented by a ResolvedJavaType available; change semantics of ResolvedJavaType.getSuperclass to return null for interfaces (to conform with java.lang.Class); change semantics of ResolvedJavaType.isInstanceClass to return false for interfaces.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6588
diff
changeset
|
288 return interfaces; |
d79098b9db3b
Support for interfaces in the Graal API: Make interfaces implemented by a ResolvedJavaType available; change semantics of ResolvedJavaType.getSuperclass to return null for interfaces (to conform with java.lang.Class); change semantics of ResolvedJavaType.isInstanceClass to return false for interfaces.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6588
diff
changeset
|
289 } |
d79098b9db3b
Support for interfaces in the Graal API: Make interfaces implemented by a ResolvedJavaType available; change semantics of ResolvedJavaType.getSuperclass to return null for interfaces (to conform with java.lang.Class); change semantics of ResolvedJavaType.isInstanceClass to return false for interfaces.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6588
diff
changeset
|
290 |
18182
e8c54fd622a4
Add ResolvedJavaType.getImplementor().
Josef Eisl <josef.eisl@jku.at>
parents:
18176
diff
changeset
|
291 @Override |
18223
17c98fad6980
converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18222
diff
changeset
|
292 public HotSpotResolvedObjectTypeImpl getSingleImplementor() { |
18182
e8c54fd622a4
Add ResolvedJavaType.getImplementor().
Josef Eisl <josef.eisl@jku.at>
parents:
18176
diff
changeset
|
293 if (!isInterface()) { |
23392
b3a816d3b844
Backed out changeset: a920338dd4d4
Doug Simon <doug.simon@oracle.com>
parents:
23387
diff
changeset
|
294 throw new JVMCIError("Cannot call getSingleImplementor() on a non-interface type: %s", this); |
18182
e8c54fd622a4
Add ResolvedJavaType.getImplementor().
Josef Eisl <josef.eisl@jku.at>
parents:
18176
diff
changeset
|
295 } |
22582
232c53e17ea0
added CompilerToVM.compilerToVM() for static access to the CompilerToVM instance
Doug Simon <doug.simon@oracle.com>
parents:
22581
diff
changeset
|
296 return compilerToVM().getImplementor(this); |
18182
e8c54fd622a4
Add ResolvedJavaType.getImplementor().
Josef Eisl <josef.eisl@jku.at>
parents:
18176
diff
changeset
|
297 } |
e8c54fd622a4
Add ResolvedJavaType.getImplementor().
Josef Eisl <josef.eisl@jku.at>
parents:
18176
diff
changeset
|
298 |
18223
17c98fad6980
converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18222
diff
changeset
|
299 public HotSpotResolvedObjectTypeImpl getSupertype() { |
7060
06d5f450f32b
rename: ResolvedJavaType.isArrayClass() -> ResolvedJavaType.isArray()
Doug Simon <doug.simon@oracle.com>
parents:
7059
diff
changeset
|
300 if (isArray()) { |
7037
dd81042f4eb1
added unit tests for ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
7030
diff
changeset
|
301 ResolvedJavaType componentType = getComponentType(); |
14091
ed92bc6900d5
simplified HotSpotResolvedObjectType.FieldInfo.getType(); encapsulated all access to javaClass in HotSpotResolvedObjectType more
Doug Simon <doug.simon@oracle.com>
parents:
14069
diff
changeset
|
302 if (mirror() == Object[].class || componentType.isPrimitive()) { |
18167
2bf5ea10eea7
sharpened return types for HotSpot specific Graal API implementations
Doug Simon <doug.simon@oracle.com>
parents:
17156
diff
changeset
|
303 return fromObjectClass(Object.class); |
7037
dd81042f4eb1
added unit tests for ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
7030
diff
changeset
|
304 } |
18223
17c98fad6980
converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18222
diff
changeset
|
305 return (HotSpotResolvedObjectTypeImpl) ((HotSpotResolvedObjectTypeImpl) componentType).getSupertype().getArrayClass(); |
7037
dd81042f4eb1
added unit tests for ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
7030
diff
changeset
|
306 } |
dd81042f4eb1
added unit tests for ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
7030
diff
changeset
|
307 if (isInterface()) { |
18167
2bf5ea10eea7
sharpened return types for HotSpot specific Graal API implementations
Doug Simon <doug.simon@oracle.com>
parents:
17156
diff
changeset
|
308 return fromObjectClass(Object.class); |
7037
dd81042f4eb1
added unit tests for ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
7030
diff
changeset
|
309 } |
dd81042f4eb1
added unit tests for ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
7030
diff
changeset
|
310 return getSuperclass(); |
dd81042f4eb1
added unit tests for ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
7030
diff
changeset
|
311 } |
dd81042f4eb1
added unit tests for ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
7030
diff
changeset
|
312 |
6699
d79098b9db3b
Support for interfaces in the Graal API: Make interfaces implemented by a ResolvedJavaType available; change semantics of ResolvedJavaType.getSuperclass to return null for interfaces (to conform with java.lang.Class); change semantics of ResolvedJavaType.isInstanceClass to return false for interfaces.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6588
diff
changeset
|
313 @Override |
18223
17c98fad6980
converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18222
diff
changeset
|
314 public HotSpotResolvedObjectType findLeastCommonAncestor(ResolvedJavaType otherType) { |
7059
e4d9f153934f
removed ResolvedJavaType.toJava() and introduced ResolvedJavaType.isPrimitive()
Doug Simon <doug.simon@oracle.com>
parents:
7057
diff
changeset
|
315 if (otherType.isPrimitive()) { |
4635
f35c183f33ce
fixed checkcast when inlining more than one method
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4484
diff
changeset
|
316 return null; |
f35c183f33ce
fixed checkcast when inlining more than one method
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4484
diff
changeset
|
317 } else { |
18223
17c98fad6980
converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18222
diff
changeset
|
318 HotSpotResolvedObjectTypeImpl t1 = this; |
17c98fad6980
converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18222
diff
changeset
|
319 HotSpotResolvedObjectTypeImpl t2 = (HotSpotResolvedObjectTypeImpl) otherType; |
7037
dd81042f4eb1
added unit tests for ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
7030
diff
changeset
|
320 while (true) { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7359
diff
changeset
|
321 if (t1.isAssignableFrom(t2)) { |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7359
diff
changeset
|
322 return t1; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7359
diff
changeset
|
323 } |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7359
diff
changeset
|
324 if (t2.isAssignableFrom(t1)) { |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7359
diff
changeset
|
325 return t2; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7359
diff
changeset
|
326 } |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7359
diff
changeset
|
327 t1 = t1.getSupertype(); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7359
diff
changeset
|
328 t2 = t2.getSupertype(); |
7037
dd81042f4eb1
added unit tests for ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
7030
diff
changeset
|
329 } |
4635
f35c183f33ce
fixed checkcast when inlining more than one method
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4484
diff
changeset
|
330 } |
f35c183f33ce
fixed checkcast when inlining more than one method
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4484
diff
changeset
|
331 } |
f35c183f33ce
fixed checkcast when inlining more than one method
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4484
diff
changeset
|
332 |
f35c183f33ce
fixed checkcast when inlining more than one method
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4484
diff
changeset
|
333 @Override |
19800
3362ba500371
Connect required Assumptions with answer to CHA query
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19743
diff
changeset
|
334 public AssumptionResult<Boolean> hasFinalizableSubclass() { |
9126
bc26f978b0ce
HotSpotResolvedObjectType: implement hasFinalizeSubclass() correctly
Bernhard Urban <bernhard.urban@jku.at>
parents:
9100
diff
changeset
|
335 assert !isArray(); |
22582
232c53e17ea0
added CompilerToVM.compilerToVM() for static access to the CompilerToVM instance
Doug Simon <doug.simon@oracle.com>
parents:
22581
diff
changeset
|
336 if (!compilerToVM().hasFinalizableSubclass(this)) { |
19801
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
337 return new AssumptionResult<>(false, new NoFinalizableSubclass(this)); |
19800
3362ba500371
Connect required Assumptions with answer to CHA query
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19743
diff
changeset
|
338 } |
3362ba500371
Connect required Assumptions with answer to CHA query
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19743
diff
changeset
|
339 return new AssumptionResult<>(true); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
340 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
341 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
342 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
343 public boolean hasFinalizer() { |
23738
1140503536ae
Backport style fixes and comments from jdk9.
Roland Schatz <roland.schatz@oracle.com>
parents:
23734
diff
changeset
|
344 return (getAccessFlags() & config().klassHasFinalizerFlag) != 0; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
345 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
346 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
347 @Override |
7059
e4d9f153934f
removed ResolvedJavaType.toJava() and introduced ResolvedJavaType.isPrimitive()
Doug Simon <doug.simon@oracle.com>
parents:
7057
diff
changeset
|
348 public boolean isPrimitive() { |
e4d9f153934f
removed ResolvedJavaType.toJava() and introduced ResolvedJavaType.isPrimitive()
Doug Simon <doug.simon@oracle.com>
parents:
7057
diff
changeset
|
349 return false; |
e4d9f153934f
removed ResolvedJavaType.toJava() and introduced ResolvedJavaType.isPrimitive()
Doug Simon <doug.simon@oracle.com>
parents:
7057
diff
changeset
|
350 } |
e4d9f153934f
removed ResolvedJavaType.toJava() and introduced ResolvedJavaType.isPrimitive()
Doug Simon <doug.simon@oracle.com>
parents:
7057
diff
changeset
|
351 |
e4d9f153934f
removed ResolvedJavaType.toJava() and introduced ResolvedJavaType.isPrimitive()
Doug Simon <doug.simon@oracle.com>
parents:
7057
diff
changeset
|
352 @Override |
7060
06d5f450f32b
rename: ResolvedJavaType.isArrayClass() -> ResolvedJavaType.isArray()
Doug Simon <doug.simon@oracle.com>
parents:
7059
diff
changeset
|
353 public boolean isArray() { |
14091
ed92bc6900d5
simplified HotSpotResolvedObjectType.FieldInfo.getType(); encapsulated all access to javaClass in HotSpotResolvedObjectType more
Doug Simon <doug.simon@oracle.com>
parents:
14069
diff
changeset
|
354 return mirror().isArray(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
355 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
356 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
357 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
358 public boolean isInitialized() { |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
359 return isArray() ? true : getInitState() == config().instanceKlassStateFullyInitialized; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
360 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
361 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
362 @Override |
11520
7cca436d600b
Add isLinked method to ResolvedJavaType
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11431
diff
changeset
|
363 public boolean isLinked() { |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
364 return isArray() ? true : getInitState() >= config().instanceKlassStateLinked; |
13259
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13258
diff
changeset
|
365 } |
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13258
diff
changeset
|
366 |
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13258
diff
changeset
|
367 /** |
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13258
diff
changeset
|
368 * Returns the value of the state field {@code InstanceKlass::_init_state} of the metaspace |
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13258
diff
changeset
|
369 * klass. |
14980 | 370 * |
13259
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13258
diff
changeset
|
371 * @return state field value of this type |
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13258
diff
changeset
|
372 */ |
16386
9ce3b1efc4e7
InstanceKlass::_init_state only exists for InstanceKlasses
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16384
diff
changeset
|
373 private int getInitState() { |
9ce3b1efc4e7
InstanceKlass::_init_state only exists for InstanceKlasses
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16384
diff
changeset
|
374 assert !isArray() : "_init_state only exists in InstanceKlass"; |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
375 return UNSAFE.getByte(getMetaspaceKlass() + config().instanceKlassInitStateOffset) & 0xFF; |
11520
7cca436d600b
Add isLinked method to ResolvedJavaType
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11431
diff
changeset
|
376 } |
7cca436d600b
Add isLinked method to ResolvedJavaType
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11431
diff
changeset
|
377 |
7cca436d600b
Add isLinked method to ResolvedJavaType
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11431
diff
changeset
|
378 @Override |
6549
15e04f248d6b
Add functionality to initialize a type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6539
diff
changeset
|
379 public void initialize() { |
13214
3f34b8f91cc5
moved CompilerToVM.isTypeInitialized and isTypeLinked to Java
twisti
parents:
12559
diff
changeset
|
380 if (!isInitialized()) { |
22542
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
381 UNSAFE.ensureClassInitialized(mirror()); |
13214
3f34b8f91cc5
moved CompilerToVM.isTypeInitialized and isTypeLinked to Java
twisti
parents:
12559
diff
changeset
|
382 assert isInitialized(); |
6549
15e04f248d6b
Add functionality to initialize a type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6539
diff
changeset
|
383 } |
15e04f248d6b
Add functionality to initialize a type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6539
diff
changeset
|
384 } |
15e04f248d6b
Add functionality to initialize a type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6539
diff
changeset
|
385 |
15e04f248d6b
Add functionality to initialize a type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6539
diff
changeset
|
386 @Override |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
18182
diff
changeset
|
387 public boolean isInstance(JavaConstant obj) { |
22536
dc1aeef79e7e
Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22516
diff
changeset
|
388 if (obj.getJavaKind() == JavaKind.Object && !obj.isNull()) { |
18290
e7d219e9d01f
removed HotSpotObjectConstantImpl.asObject()
Doug Simon <doug.simon@oracle.com>
parents:
18266
diff
changeset
|
389 return mirror().isInstance(((HotSpotObjectConstantImpl) obj).object()); |
7015
62818f156081
added ResolvedJavaType.isClass(Class c) to replace some uses of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents:
6996
diff
changeset
|
390 } |
62818f156081
added ResolvedJavaType.isClass(Class c) to replace some uses of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents:
6996
diff
changeset
|
391 return false; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
392 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
393 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
394 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
395 public boolean isInstanceClass() { |
7060
06d5f450f32b
rename: ResolvedJavaType.isArrayClass() -> ResolvedJavaType.isArray()
Doug Simon <doug.simon@oracle.com>
parents:
7059
diff
changeset
|
396 return !isArray() && !isInterface(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
397 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
398 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
399 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
400 public boolean isInterface() { |
14091
ed92bc6900d5
simplified HotSpotResolvedObjectType.FieldInfo.getType(); encapsulated all access to javaClass in HotSpotResolvedObjectType more
Doug Simon <doug.simon@oracle.com>
parents:
14069
diff
changeset
|
401 return mirror().isInterface(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
402 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
403 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
404 @Override |
7097
6644cecbd3a7
Replace ResolvedJavaType.isAssignableTo with isAssignableFrom to be consistent with java.lang.Class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7096
diff
changeset
|
405 public boolean isAssignableFrom(ResolvedJavaType other) { |
9835
fcfedd3dd2eb
ResolvedJavaType.isAssignableFrom must not be called with null argument. Check that with assertions in HotSpot implementation.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9289
diff
changeset
|
406 assert other != null; |
18223
17c98fad6980
converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18222
diff
changeset
|
407 if (other instanceof HotSpotResolvedObjectTypeImpl) { |
17c98fad6980
converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18222
diff
changeset
|
408 HotSpotResolvedObjectTypeImpl otherType = (HotSpotResolvedObjectTypeImpl) other; |
14091
ed92bc6900d5
simplified HotSpotResolvedObjectType.FieldInfo.getType(); encapsulated all access to javaClass in HotSpotResolvedObjectType more
Doug Simon <doug.simon@oracle.com>
parents:
14069
diff
changeset
|
409 return mirror().isAssignableFrom(otherType.mirror()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
410 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
411 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
412 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
413 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
414 @Override |
16491
4d7a9829315e
moved isJavaLangObject(ResolvedJavaType type) from MetaUtil to be a default method in ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
16476
diff
changeset
|
415 public boolean isJavaLangObject() { |
4d7a9829315e
moved isJavaLangObject(ResolvedJavaType type) from MetaUtil to be a default method in ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
16476
diff
changeset
|
416 return javaClass.equals(Object.class); |
4d7a9829315e
moved isJavaLangObject(ResolvedJavaType type) from MetaUtil to be a default method in ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
16476
diff
changeset
|
417 } |
4d7a9829315e
moved isJavaLangObject(ResolvedJavaType type) from MetaUtil to be a default method in ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
16476
diff
changeset
|
418 |
4d7a9829315e
moved isJavaLangObject(ResolvedJavaType type) from MetaUtil to be a default method in ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
16476
diff
changeset
|
419 @Override |
22536
dc1aeef79e7e
Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22516
diff
changeset
|
420 public JavaKind getJavaKind() { |
dc1aeef79e7e
Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22516
diff
changeset
|
421 return JavaKind.Object; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
422 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
423 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
424 @Override |
23347
7ae6a635fad0
8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23340
diff
changeset
|
425 public ResolvedJavaMethod resolveMethod(ResolvedJavaMethod method, ResolvedJavaType callerType) { |
7ae6a635fad0
8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23340
diff
changeset
|
426 assert !callerType.isArray(); |
7ae6a635fad0
8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23340
diff
changeset
|
427 if (isInterface()) { |
7ae6a635fad0
8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23340
diff
changeset
|
428 // Methods can only be resolved against concrete types |
16384
5d7b90ab9787
Ensure that uniqueConcreteMethod is called with a resolved concrete method
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16184
diff
changeset
|
429 return null; |
5d7b90ab9787
Ensure that uniqueConcreteMethod is called with a resolved concrete method
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16184
diff
changeset
|
430 } |
24100
839dcc4f2cf6
handle signature polymorphic methods correctly (JDK-8161550)
Doug Simon <doug.simon@oracle.com>
parents:
23996
diff
changeset
|
431 if (method.isConcrete() && method.getDeclaringClass().equals(this) && method.isPublic() && !isSignaturePolymorphicHolder(method.getDeclaringClass())) { |
14604
bd7cf02d1756
added fast path for HotSpotResolvedObjectType.resolveMethod() when the receiver is the declarer of the method
Doug Simon <doug.simon@oracle.com>
parents:
14158
diff
changeset
|
432 return method; |
bd7cf02d1756
added fast path for HotSpotResolvedObjectType.resolveMethod() when the receiver is the declarer of the method
Doug Simon <doug.simon@oracle.com>
parents:
14158
diff
changeset
|
433 } |
15722
c583759bbcfd
ResolvedJavaType.resolveMethod now takes a callerType that is used to check access rules. Make it work for default methods.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15311
diff
changeset
|
434 if (!method.getDeclaringClass().isAssignableFrom(this)) { |
c583759bbcfd
ResolvedJavaType.resolveMethod now takes a callerType that is used to check access rules. Make it work for default methods.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15311
diff
changeset
|
435 return null; |
c583759bbcfd
ResolvedJavaType.resolveMethod now takes a callerType that is used to check access rules. Make it work for default methods.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15311
diff
changeset
|
436 } |
18222
a8cff27ca2e1
converted HotSpotResolvedJavaMethod to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18194
diff
changeset
|
437 HotSpotResolvedJavaMethodImpl hotSpotMethod = (HotSpotResolvedJavaMethodImpl) method; |
18223
17c98fad6980
converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18222
diff
changeset
|
438 HotSpotResolvedObjectTypeImpl hotSpotCallerType = (HotSpotResolvedObjectTypeImpl) callerType; |
22582
232c53e17ea0
added CompilerToVM.compilerToVM() for static access to the CompilerToVM instance
Doug Simon <doug.simon@oracle.com>
parents:
22581
diff
changeset
|
439 return compilerToVM().resolveMethod(this, hotSpotMethod, hotSpotCallerType); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
440 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
441 |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22432
diff
changeset
|
442 public HotSpotConstantPool getConstantPool() { |
23673
7ef84c807bfe
8159010: [JVMCI] crashes with class redefinition
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23393
diff
changeset
|
443 if (constantPool == null || !isArray() && UNSAFE.getAddress(getMetaspaceKlass() + config().instanceKlassConstantsOffset) != constantPool.getMetaspaceConstantPool()) { |
7ef84c807bfe
8159010: [JVMCI] crashes with class redefinition
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23393
diff
changeset
|
444 /* |
7ef84c807bfe
8159010: [JVMCI] crashes with class redefinition
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23393
diff
changeset
|
445 * If the pointer to the ConstantPool has changed since this was last read refresh the |
7ef84c807bfe
8159010: [JVMCI] crashes with class redefinition
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23393
diff
changeset
|
446 * HotSpotConstantPool wrapper object. This ensures that uses of the constant pool are |
7ef84c807bfe
8159010: [JVMCI] crashes with class redefinition
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23393
diff
changeset
|
447 * operating on the latest one and that HotSpotResolvedJavaMethodImpls will be able to |
7ef84c807bfe
8159010: [JVMCI] crashes with class redefinition
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23393
diff
changeset
|
448 * use the shared copy instead of creating their own instance. |
7ef84c807bfe
8159010: [JVMCI] crashes with class redefinition
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23393
diff
changeset
|
449 */ |
23734
2e17c65dddd7
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
Doug Simon <doug.simon@oracle.com>
parents:
23703
diff
changeset
|
450 constantPool = compilerToVM().getConstantPool(this); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
451 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
452 return constantPool; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
453 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
454 |
5616
310ed6650682
added check to ensure fast path allocation is never used for types that don't allow it
Doug Simon <doug.simon@oracle.com>
parents:
5554
diff
changeset
|
455 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7359
diff
changeset
|
456 * Gets the instance size of this type. If an instance of this type cannot be fast path |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7359
diff
changeset
|
457 * allocated, then the returned value is negative (its absolute value gives the size). Must not |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7359
diff
changeset
|
458 * be called if this is an array or interface type. |
5616
310ed6650682
added check to ensure fast path allocation is never used for types that don't allow it
Doug Simon <doug.simon@oracle.com>
parents:
5554
diff
changeset
|
459 */ |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
460 public int instanceSize() { |
7060
06d5f450f32b
rename: ResolvedJavaType.isArrayClass() -> ResolvedJavaType.isArray()
Doug Simon <doug.simon@oracle.com>
parents:
7059
diff
changeset
|
461 assert !isArray(); |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6699
diff
changeset
|
462 assert !isInterface(); |
13261
0ffe9e4bb364
don't go through VM to create HotSpotResolvedObjectType (part 1)
twisti
parents:
13260
diff
changeset
|
463 |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
464 HotSpotVMConfig config = config(); |
22254
efeabef8df70
Improve DynamicNewArrayNode code generation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22165
diff
changeset
|
465 final int layoutHelper = layoutHelper(); |
13261
0ffe9e4bb364
don't go through VM to create HotSpotResolvedObjectType (part 1)
twisti
parents:
13260
diff
changeset
|
466 assert layoutHelper > config.klassLayoutHelperNeutralValue : "must be instance"; |
0ffe9e4bb364
don't go through VM to create HotSpotResolvedObjectType (part 1)
twisti
parents:
13260
diff
changeset
|
467 |
0ffe9e4bb364
don't go through VM to create HotSpotResolvedObjectType (part 1)
twisti
parents:
13260
diff
changeset
|
468 // See: Klass::layout_helper_size_in_bytes |
0ffe9e4bb364
don't go through VM to create HotSpotResolvedObjectType (part 1)
twisti
parents:
13260
diff
changeset
|
469 int size = layoutHelper & ~config.klassLayoutHelperInstanceSlowPathBit; |
0ffe9e4bb364
don't go through VM to create HotSpotResolvedObjectType (part 1)
twisti
parents:
13260
diff
changeset
|
470 |
0ffe9e4bb364
don't go through VM to create HotSpotResolvedObjectType (part 1)
twisti
parents:
13260
diff
changeset
|
471 // See: Klass::layout_helper_needs_slow_path |
0ffe9e4bb364
don't go through VM to create HotSpotResolvedObjectType (part 1)
twisti
parents:
13260
diff
changeset
|
472 boolean needsSlowPath = (layoutHelper & config.klassLayoutHelperInstanceSlowPathBit) != 0; |
0ffe9e4bb364
don't go through VM to create HotSpotResolvedObjectType (part 1)
twisti
parents:
13260
diff
changeset
|
473 |
0ffe9e4bb364
don't go through VM to create HotSpotResolvedObjectType (part 1)
twisti
parents:
13260
diff
changeset
|
474 return needsSlowPath ? -size : size; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
475 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
476 |
22254
efeabef8df70
Improve DynamicNewArrayNode code generation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22165
diff
changeset
|
477 public int layoutHelper() { |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
478 HotSpotVMConfig config = config(); |
22542
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
479 return UNSAFE.getInt(getMetaspaceKlass() + config.klassLayoutHelperOffset); |
22254
efeabef8df70
Improve DynamicNewArrayNode code generation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22165
diff
changeset
|
480 } |
efeabef8df70
Improve DynamicNewArrayNode code generation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22165
diff
changeset
|
481 |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22432
diff
changeset
|
482 synchronized HotSpotResolvedJavaMethod createMethod(long metaspaceMethod) { |
23987
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
483 // Maintain cache as array. |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
484 if (methodCacheArray == null) { |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
485 methodCacheArray = new HotSpotResolvedJavaMethodImpl[METHOD_CACHE_ARRAY_CAPACITY]; |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6699
diff
changeset
|
486 } |
23987
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
487 |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
488 int i = 0; |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
489 for (; i < methodCacheArray.length; ++i) { |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
490 HotSpotResolvedJavaMethodImpl curMethod = methodCacheArray[i]; |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
491 if (curMethod == null) { |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
492 HotSpotResolvedJavaMethodImpl newMethod = new HotSpotResolvedJavaMethodImpl(this, metaspaceMethod); |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
493 methodCacheArray[i] = newMethod; |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
494 context.add(newMethod); |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
495 return newMethod; |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
496 } else if (curMethod.getMetaspacePointer() == metaspaceMethod) { |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
497 return curMethod; |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
498 } |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6699
diff
changeset
|
499 } |
23987
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
500 |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
501 // Fall-back to hash table. |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
502 if (methodCacheHashMap == null) { |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
503 methodCacheHashMap = new HashMap<>(); |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
504 } |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
505 |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
506 HotSpotResolvedJavaMethodImpl lookupResult = methodCacheHashMap.get(metaspaceMethod); |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
507 if (lookupResult == null) { |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
508 HotSpotResolvedJavaMethodImpl newMethod = new HotSpotResolvedJavaMethodImpl(this, metaspaceMethod); |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
509 methodCacheHashMap.put(metaspaceMethod, newMethod); |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
510 context.add(lookupResult); |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
511 return newMethod; |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
512 } else { |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
513 return lookupResult; |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
514 } |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6699
diff
changeset
|
515 } |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6699
diff
changeset
|
516 |
16615
3812931f9350
Don't read beyond end of known vtable
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16575
diff
changeset
|
517 public int getVtableLength() { |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
518 HotSpotVMConfig config = config(); |
16615
3812931f9350
Don't read beyond end of known vtable
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16575
diff
changeset
|
519 if (isInterface() || isArray()) { |
3812931f9350
Don't read beyond end of known vtable
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16575
diff
changeset
|
520 /* Everything has the core vtable of java.lang.Object */ |
23679
b5557b757040
fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents:
23677
diff
changeset
|
521 return config.baseVtableLength(); |
16615
3812931f9350
Don't read beyond end of known vtable
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16575
diff
changeset
|
522 } |
23679
b5557b757040
fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents:
23677
diff
changeset
|
523 int result = UNSAFE.getInt(getMetaspaceKlass() + config.klassVtableLengthOffset) / (config.vtableEntrySize / config.heapWordSize); |
b5557b757040
fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents:
23677
diff
changeset
|
524 assert result >= config.baseVtableLength() : UNSAFE.getInt(getMetaspaceKlass() + config.klassVtableLengthOffset) + " " + config.vtableEntrySize; |
16615
3812931f9350
Don't read beyond end of known vtable
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16575
diff
changeset
|
525 return result; |
3812931f9350
Don't read beyond end of known vtable
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16575
diff
changeset
|
526 } |
3812931f9350
Don't read beyond end of known vtable
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16575
diff
changeset
|
527 |
23989
115d4e0d7b87
removed HotSpotResolvedJavaFieldImpl.name field
Doug Simon <doug.simon@oracle.com>
parents:
23987
diff
changeset
|
528 synchronized HotSpotResolvedJavaField createField(JavaType type, long offset, int rawFlags, int index) { |
115d4e0d7b87
removed HotSpotResolvedJavaFieldImpl.name field
Doug Simon <doug.simon@oracle.com>
parents:
23987
diff
changeset
|
529 return new HotSpotResolvedJavaFieldImpl(this, type, offset, rawFlags, index); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
530 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
531 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
532 @Override |
19800
3362ba500371
Connect required Assumptions with answer to CHA query
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19743
diff
changeset
|
533 public AssumptionResult<ResolvedJavaMethod> findUniqueConcreteMethod(ResolvedJavaMethod method) { |
16184
8fde32ece68e
use receiver type in findUniqueConcreteMethod
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15839
diff
changeset
|
534 HotSpotResolvedJavaMethod hmethod = (HotSpotResolvedJavaMethod) method; |
18323
301c5e3d683a
removed *Impl types in signatures of Remote interfaces
Doug Simon <doug.simon@oracle.com>
parents:
18290
diff
changeset
|
535 HotSpotResolvedObjectType declaredHolder = hmethod.getDeclaringClass(); |
16184
8fde32ece68e
use receiver type in findUniqueConcreteMethod
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15839
diff
changeset
|
536 /* |
8fde32ece68e
use receiver type in findUniqueConcreteMethod
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15839
diff
changeset
|
537 * Sometimes the receiver type in the graph hasn't stabilized to a subtype of declared |
8fde32ece68e
use receiver type in findUniqueConcreteMethod
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15839
diff
changeset
|
538 * holder, usually because of phis, so make sure that the type is related to the declared |
16384
5d7b90ab9787
Ensure that uniqueConcreteMethod is called with a resolved concrete method
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16184
diff
changeset
|
539 * type before using it for lookup. Unlinked types should also be ignored because we can't |
5d7b90ab9787
Ensure that uniqueConcreteMethod is called with a resolved concrete method
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16184
diff
changeset
|
540 * resolve the proper method to invoke. Generally unlinked types in invokes should result in |
5d7b90ab9787
Ensure that uniqueConcreteMethod is called with a resolved concrete method
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16184
diff
changeset
|
541 * a deopt instead since they can't really be used if they aren't linked yet. |
16184
8fde32ece68e
use receiver type in findUniqueConcreteMethod
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15839
diff
changeset
|
542 */ |
16384
5d7b90ab9787
Ensure that uniqueConcreteMethod is called with a resolved concrete method
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16184
diff
changeset
|
543 if (!declaredHolder.isAssignableFrom(this) || this.isArray() || this.equals(declaredHolder) || !isLinked() || isInterface()) { |
19800
3362ba500371
Connect required Assumptions with answer to CHA query
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19743
diff
changeset
|
544 ResolvedJavaMethod result = hmethod.uniqueConcreteMethod(declaredHolder); |
3362ba500371
Connect required Assumptions with answer to CHA query
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19743
diff
changeset
|
545 if (result != null) { |
19801
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
546 return new AssumptionResult<>(result, new ConcreteMethod(method, declaredHolder, result)); |
19800
3362ba500371
Connect required Assumptions with answer to CHA query
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19743
diff
changeset
|
547 } |
3362ba500371
Connect required Assumptions with answer to CHA query
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19743
diff
changeset
|
548 return null; |
16184
8fde32ece68e
use receiver type in findUniqueConcreteMethod
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15839
diff
changeset
|
549 } |
8fde32ece68e
use receiver type in findUniqueConcreteMethod
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15839
diff
changeset
|
550 /* |
18789 | 551 * The holder may be a subtype of the declaredHolder so make sure to resolve the method to |
16184
8fde32ece68e
use receiver type in findUniqueConcreteMethod
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15839
diff
changeset
|
552 * the correct method for the subtype. |
8fde32ece68e
use receiver type in findUniqueConcreteMethod
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15839
diff
changeset
|
553 */ |
22165
af6cc957bf04
Remove dummy parameter `includeAbstract` from `ResolvedJavaType#resolveMethod()`;
Josef Eisl <josef.eisl@jku.at>
parents:
22054
diff
changeset
|
554 HotSpotResolvedJavaMethod resolvedMethod = (HotSpotResolvedJavaMethod) resolveMethod(hmethod, this); |
16384
5d7b90ab9787
Ensure that uniqueConcreteMethod is called with a resolved concrete method
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16184
diff
changeset
|
555 if (resolvedMethod == null) { |
5d7b90ab9787
Ensure that uniqueConcreteMethod is called with a resolved concrete method
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16184
diff
changeset
|
556 // The type isn't known to implement the method. |
5d7b90ab9787
Ensure that uniqueConcreteMethod is called with a resolved concrete method
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16184
diff
changeset
|
557 return null; |
16184
8fde32ece68e
use receiver type in findUniqueConcreteMethod
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15839
diff
changeset
|
558 } |
8fde32ece68e
use receiver type in findUniqueConcreteMethod
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15839
diff
changeset
|
559 |
19800
3362ba500371
Connect required Assumptions with answer to CHA query
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19743
diff
changeset
|
560 ResolvedJavaMethod result = resolvedMethod.uniqueConcreteMethod(this); |
3362ba500371
Connect required Assumptions with answer to CHA query
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19743
diff
changeset
|
561 if (result != null) { |
19801
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
562 return new AssumptionResult<>(result, new ConcreteMethod(method, this, result)); |
19800
3362ba500371
Connect required Assumptions with answer to CHA query
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19743
diff
changeset
|
563 } |
3362ba500371
Connect required Assumptions with answer to CHA query
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19743
diff
changeset
|
564 return null; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
565 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
566 |
23996
11f0412408cd
8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents:
23991
diff
changeset
|
567 FieldInfo createFieldInfo(int index) { |
11f0412408cd
8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents:
23991
diff
changeset
|
568 return new FieldInfo(index); |
11f0412408cd
8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents:
23991
diff
changeset
|
569 } |
11f0412408cd
8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents:
23991
diff
changeset
|
570 |
14012 | 571 /** |
572 * This class represents the field information for one field contained in the fields array of an | |
573 * {@code InstanceKlass}. The implementation is similar to the native {@code FieldInfo} class. | |
574 */ | |
23996
11f0412408cd
8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents:
23991
diff
changeset
|
575 class FieldInfo { |
14012 | 576 /** |
577 * Native pointer into the array of Java shorts. | |
578 */ | |
579 private final long metaspaceData; | |
580 | |
581 /** | |
582 * Creates a field info for the field in the fields array at index {@code index}. | |
14980 | 583 * |
14012 | 584 * @param index index to the fields array |
585 */ | |
23297
4b58c92e939b
remove redundant modifiers
Manuel Rigger <rigger.manuel@gmail.com>
parents:
23290
diff
changeset
|
586 FieldInfo(int index) { |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
587 HotSpotVMConfig config = config(); |
14012 | 588 // Get Klass::_fields |
22542
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
589 final long metaspaceFields = UNSAFE.getAddress(getMetaspaceKlass() + config.instanceKlassFieldsOffset); |
14012 | 590 assert config.fieldInfoFieldSlots == 6 : "revisit the field parsing code"; |
23700
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
23679
diff
changeset
|
591 int offset = config.fieldInfoFieldSlots * Short.BYTES * index; |
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
23679
diff
changeset
|
592 metaspaceData = metaspaceFields + config.arrayU2DataOffset + offset; |
14012 | 593 } |
594 | |
595 private int getAccessFlags() { | |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
596 return readFieldSlot(config().fieldInfoAccessFlagsOffset); |
14012 | 597 } |
598 | |
23996
11f0412408cd
8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents:
23991
diff
changeset
|
599 private int getNameIndex() { |
11f0412408cd
8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents:
23991
diff
changeset
|
600 return readFieldSlot(config().fieldInfoNameIndexOffset); |
11f0412408cd
8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents:
23991
diff
changeset
|
601 } |
11f0412408cd
8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents:
23991
diff
changeset
|
602 |
14012 | 603 private int getSignatureIndex() { |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
604 return readFieldSlot(config().fieldInfoSignatureIndexOffset); |
14012 | 605 } |
606 | |
607 public int getOffset() { | |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
608 HotSpotVMConfig config = config(); |
14012 | 609 final int lowPacked = readFieldSlot(config.fieldInfoLowPackedOffset); |
610 final int highPacked = readFieldSlot(config.fieldInfoHighPackedOffset); | |
611 final int offset = ((highPacked << Short.SIZE) | lowPacked) >> config.fieldInfoTagSize; | |
612 return offset; | |
613 } | |
614 | |
615 /** | |
616 * Helper method to read an entry (slot) from the field array. Currently field info is laid | |
617 * on top an array of Java shorts. | |
618 */ | |
619 private int readFieldSlot(int index) { | |
23700
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
23679
diff
changeset
|
620 int offset = Short.BYTES * index; |
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
23679
diff
changeset
|
621 return UNSAFE.getChar(metaspaceData + offset); |
14012 | 622 } |
623 | |
624 /** | |
23996
11f0412408cd
8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents:
23991
diff
changeset
|
625 * Returns the name of this field as a {@link String}. If the field is an internal field the |
11f0412408cd
8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents:
23991
diff
changeset
|
626 * name index is pointing into the vmSymbols table. |
11f0412408cd
8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents:
23991
diff
changeset
|
627 */ |
11f0412408cd
8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents:
23991
diff
changeset
|
628 public String getName() { |
11f0412408cd
8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents:
23991
diff
changeset
|
629 final int nameIndex = getNameIndex(); |
11f0412408cd
8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents:
23991
diff
changeset
|
630 return isInternal() ? config().symbolAt(nameIndex) : getConstantPool().lookupUtf8(nameIndex); |
11f0412408cd
8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents:
23991
diff
changeset
|
631 } |
11f0412408cd
8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents:
23991
diff
changeset
|
632 |
11f0412408cd
8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents:
23991
diff
changeset
|
633 /** |
14012 | 634 * Returns the signature of this field as {@link String}. If the field is an internal field |
635 * the signature index is pointing into the vmSymbols table. | |
636 */ | |
637 public String getSignature() { | |
638 final int signatureIndex = getSignatureIndex(); | |
23703
9ac04c6047c8
sync with jdk9 changes for JDK-8159613
Doug Simon <doug.simon@oracle.com>
parents:
23700
diff
changeset
|
639 return isInternal() ? config().symbolAt(signatureIndex) : getConstantPool().lookupUtf8(signatureIndex); |
14012 | 640 } |
641 | |
642 public JavaType getType() { | |
643 String signature = getSignature(); | |
18223
17c98fad6980
converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18222
diff
changeset
|
644 return runtime().lookupType(signature, HotSpotResolvedObjectTypeImpl.this, false); |
14012 | 645 } |
646 | |
647 private boolean isInternal() { | |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
648 return (getAccessFlags() & config().jvmAccFieldInternal) != 0; |
14012 | 649 } |
650 | |
651 public boolean isStatic() { | |
652 return Modifier.isStatic(getAccessFlags()); | |
653 } | |
654 | |
655 public boolean hasGenericSignature() { | |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
656 return (getAccessFlags() & config().jvmAccFieldHasGenericSignature) != 0; |
14012 | 657 } |
658 } | |
659 | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
660 @Override |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6699
diff
changeset
|
661 public ResolvedJavaField[] getInstanceFields(boolean includeSuperclasses) { |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6699
diff
changeset
|
662 if (instanceFields == null) { |
7060
06d5f450f32b
rename: ResolvedJavaType.isArrayClass() -> ResolvedJavaType.isArray()
Doug Simon <doug.simon@oracle.com>
parents:
7059
diff
changeset
|
663 if (isArray() || isInterface()) { |
23987
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
664 instanceFields = NO_FIELDS; |
6293
6550737d7807
an empty array is now returned by ResolvedJavaType.declaredFields() for array and primitive types
Doug Simon <doug.simon@oracle.com>
parents:
6277
diff
changeset
|
665 } else { |
23987
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
666 HotSpotResolvedJavaField[] prepend = NO_FIELDS; |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
667 if (getSuperclass() != null) { |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
668 prepend = (HotSpotResolvedJavaField[]) getSuperclass().getInstanceFields(true); |
14012 | 669 } |
23987
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
670 instanceFields = getFields(false, prepend); |
6293
6550737d7807
an empty array is now returned by ResolvedJavaType.declaredFields() for array and primitive types
Doug Simon <doug.simon@oracle.com>
parents:
6277
diff
changeset
|
671 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
672 } |
23987
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
673 if (!includeSuperclasses && getSuperclass() != null) { |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
674 int superClassFieldCount = getSuperclass().getInstanceFields(true).length; |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
675 if (superClassFieldCount == instanceFields.length) { |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
676 // This class does not have any instance fields of its own. |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
677 return NO_FIELDS; |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
678 } else if (superClassFieldCount != 0) { |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
679 HotSpotResolvedJavaField[] result = new HotSpotResolvedJavaField[instanceFields.length - superClassFieldCount]; |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
680 System.arraycopy(instanceFields, superClassFieldCount, result, 0, result.length); |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
681 return result; |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
682 } else { |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
683 // The super classes of this class do not have any instance fields. |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6699
diff
changeset
|
684 } |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6699
diff
changeset
|
685 } |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6699
diff
changeset
|
686 return instanceFields; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
687 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
688 |
15839
2838203d4231
Add method ResolvedJavaType.getStaticFields
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15730
diff
changeset
|
689 @Override |
2838203d4231
Add method ResolvedJavaType.getStaticFields
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15730
diff
changeset
|
690 public ResolvedJavaField[] getStaticFields() { |
2838203d4231
Add method ResolvedJavaType.getStaticFields
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15730
diff
changeset
|
691 if (isArray()) { |
2838203d4231
Add method ResolvedJavaType.getStaticFields
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15730
diff
changeset
|
692 return new HotSpotResolvedJavaField[0]; |
2838203d4231
Add method ResolvedJavaType.getStaticFields
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15730
diff
changeset
|
693 } else { |
23987
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
694 return getFields(true, NO_FIELDS); |
15839
2838203d4231
Add method ResolvedJavaType.getStaticFields
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15730
diff
changeset
|
695 } |
2838203d4231
Add method ResolvedJavaType.getStaticFields
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15730
diff
changeset
|
696 } |
2838203d4231
Add method ResolvedJavaType.getStaticFields
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15730
diff
changeset
|
697 |
14012 | 698 /** |
23989
115d4e0d7b87
removed HotSpotResolvedJavaFieldImpl.name field
Doug Simon <doug.simon@oracle.com>
parents:
23987
diff
changeset
|
699 * Gets the instance or static fields of this class. |
14980 | 700 * |
23989
115d4e0d7b87
removed HotSpotResolvedJavaFieldImpl.name field
Doug Simon <doug.simon@oracle.com>
parents:
23987
diff
changeset
|
701 * @param retrieveStaticFields specifies whether to return instance or static fields |
115d4e0d7b87
removed HotSpotResolvedJavaFieldImpl.name field
Doug Simon <doug.simon@oracle.com>
parents:
23987
diff
changeset
|
702 * @param prepend an array to be prepended to the returned result |
14012 | 703 */ |
23987
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
704 private HotSpotResolvedJavaField[] getFields(boolean retrieveStaticFields, HotSpotResolvedJavaField[] prepend) { |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
705 HotSpotVMConfig config = config(); |
22542
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
706 final long metaspaceFields = UNSAFE.getAddress(getMetaspaceKlass() + config.instanceKlassFieldsOffset); |
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
707 int metaspaceFieldsLength = UNSAFE.getInt(metaspaceFields + config.arrayU1LengthOffset); |
23987
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
708 int resultCount = 0; |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
709 int index = 0; |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
710 for (int i = 0; i < metaspaceFieldsLength; i += config.fieldInfoFieldSlots, index++) { |
14012 | 711 FieldInfo field = new FieldInfo(index); |
712 if (field.hasGenericSignature()) { | |
713 metaspaceFieldsLength--; | |
714 } | |
23987
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
715 |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
716 if (field.isStatic() == retrieveStaticFields) { |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
717 resultCount++; |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
718 } |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
719 } |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
720 |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
721 if (resultCount == 0) { |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
722 return prepend; |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
723 } |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
724 |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
725 int prependLength = prepend.length; |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
726 resultCount += prependLength; |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
727 |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
728 HotSpotResolvedJavaField[] result = new HotSpotResolvedJavaField[resultCount]; |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
729 if (prependLength != 0) { |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
730 System.arraycopy(prepend, 0, result, 0, prependLength); |
14012 | 731 } |
23987
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
732 |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
733 int resultIndex = prependLength; |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
734 for (int i = 0; i < index; ++i) { |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
735 FieldInfo field = new FieldInfo(i); |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
736 if (field.isStatic() == retrieveStaticFields) { |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
737 int offset = field.getOffset(); |
23989
115d4e0d7b87
removed HotSpotResolvedJavaFieldImpl.name field
Doug Simon <doug.simon@oracle.com>
parents:
23987
diff
changeset
|
738 HotSpotResolvedJavaField resolvedJavaField = createField(field.getType(), offset, field.getAccessFlags(), i); |
23987
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
739 |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
740 // Make sure the result is sorted by offset. |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
741 int j; |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
742 for (j = resultIndex - 1; j >= prependLength && result[j].offset() > offset; j--) { |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
743 result[j + 1] = result[j]; |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
744 } |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
745 result[j + 1] = resolvedJavaField; |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
746 resultIndex++; |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
747 } |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
748 } |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
749 |
33421fb951da
Fix footprint issue in HotSpotResolvedObjectTypeImpl by reducing use of java.util.HashMap.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
23749
diff
changeset
|
750 return result; |
14012 | 751 } |
752 | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
753 @Override |
7053
014727292ae0
removed more usages of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents:
7045
diff
changeset
|
754 public Class<?> mirror() { |
13261
0ffe9e4bb364
don't go through VM to create HotSpotResolvedObjectType (part 1)
twisti
parents:
13260
diff
changeset
|
755 return javaClass; |
7053
014727292ae0
removed more usages of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents:
7045
diff
changeset
|
756 } |
014727292ae0
removed more usages of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents:
7045
diff
changeset
|
757 |
014727292ae0
removed more usages of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents:
7045
diff
changeset
|
758 @Override |
7307
dc3e86fd3be1
Introduce cutomization capability for canonicalizer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7226
diff
changeset
|
759 public String getSourceFileName() { |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
760 HotSpotVMConfig config = config(); |
22542
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
761 final int sourceFileNameIndex = UNSAFE.getChar(getMetaspaceKlass() + config.instanceKlassSourceFileNameIndexOffset); |
13254
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
13214
diff
changeset
|
762 if (sourceFileNameIndex == 0) { |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
13214
diff
changeset
|
763 return null; |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
13214
diff
changeset
|
764 } |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22432
diff
changeset
|
765 return getConstantPool().lookupUtf8(sourceFileNameIndex); |
7307
dc3e86fd3be1
Introduce cutomization capability for canonicalizer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7226
diff
changeset
|
766 } |
dc3e86fd3be1
Introduce cutomization capability for canonicalizer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7226
diff
changeset
|
767 |
dc3e86fd3be1
Introduce cutomization capability for canonicalizer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7226
diff
changeset
|
768 @Override |
22432
e4f0d819fe22
Add getAnnotations() method to ResolvedJavaType and ResolvedJavaField
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22422
diff
changeset
|
769 public Annotation[] getAnnotations() { |
e4f0d819fe22
Add getAnnotations() method to ResolvedJavaType and ResolvedJavaField
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22422
diff
changeset
|
770 return mirror().getAnnotations(); |
e4f0d819fe22
Add getAnnotations() method to ResolvedJavaType and ResolvedJavaField
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22422
diff
changeset
|
771 } |
e4f0d819fe22
Add getAnnotations() method to ResolvedJavaType and ResolvedJavaField
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22422
diff
changeset
|
772 |
e4f0d819fe22
Add getAnnotations() method to ResolvedJavaType and ResolvedJavaField
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22422
diff
changeset
|
773 @Override |
23376
ae27c683c128
Make ResolvedJava* types extend AnnotatedElement.
Roland Schatz <roland.schatz@oracle.com>
parents:
23375
diff
changeset
|
774 public Annotation[] getDeclaredAnnotations() { |
ae27c683c128
Make ResolvedJava* types extend AnnotatedElement.
Roland Schatz <roland.schatz@oracle.com>
parents:
23375
diff
changeset
|
775 return mirror().getDeclaredAnnotations(); |
ae27c683c128
Make ResolvedJava* types extend AnnotatedElement.
Roland Schatz <roland.schatz@oracle.com>
parents:
23375
diff
changeset
|
776 } |
ae27c683c128
Make ResolvedJava* types extend AnnotatedElement.
Roland Schatz <roland.schatz@oracle.com>
parents:
23375
diff
changeset
|
777 |
ae27c683c128
Make ResolvedJava* types extend AnnotatedElement.
Roland Schatz <roland.schatz@oracle.com>
parents:
23375
diff
changeset
|
778 @Override |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
779 public <T extends Annotation> T getAnnotation(Class<T> annotationClass) { |
14091
ed92bc6900d5
simplified HotSpotResolvedObjectType.FieldInfo.getType(); encapsulated all access to javaClass in HotSpotResolvedObjectType more
Doug Simon <doug.simon@oracle.com>
parents:
14069
diff
changeset
|
780 return mirror().getAnnotation(annotationClass); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
781 } |
4484
14a00ee82980
Implement eager type resolving.
Andreas Woess <andreas.woess@jku.at>
parents:
4433
diff
changeset
|
782 |
16492
8853b9304083
made type resolution require an accessing class context
Doug Simon <doug.simon@oracle.com>
parents:
16491
diff
changeset
|
783 /** |
16575
adafceb4da4a
improved name and documentation for method implementing fast-path check for type resolution
Doug Simon <doug.simon@oracle.com>
parents:
16492
diff
changeset
|
784 * Performs a fast-path check that this type is resolved in the context of a given accessing |
adafceb4da4a
improved name and documentation for method implementing fast-path check for type resolution
Doug Simon <doug.simon@oracle.com>
parents:
16492
diff
changeset
|
785 * class. A negative result does not mean this type is not resolved with respect to |
adafceb4da4a
improved name and documentation for method implementing fast-path check for type resolution
Doug Simon <doug.simon@oracle.com>
parents:
16492
diff
changeset
|
786 * {@code accessingClass}. That can only be determined by |
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
|
787 * {@linkplain HotSpotJVMCIRuntime#lookupType(String, HotSpotResolvedObjectType, boolean) |
16575
adafceb4da4a
improved name and documentation for method implementing fast-path check for type resolution
Doug Simon <doug.simon@oracle.com>
parents:
16492
diff
changeset
|
788 * re-resolving} the type. |
16492
8853b9304083
made type resolution require an accessing class context
Doug Simon <doug.simon@oracle.com>
parents:
16491
diff
changeset
|
789 */ |
16575
adafceb4da4a
improved name and documentation for method implementing fast-path check for type resolution
Doug Simon <doug.simon@oracle.com>
parents:
16492
diff
changeset
|
790 public boolean isDefinitelyResolvedWithRespectTo(ResolvedJavaType accessingClass) { |
16492
8853b9304083
made type resolution require an accessing class context
Doug Simon <doug.simon@oracle.com>
parents:
16491
diff
changeset
|
791 assert accessingClass != null; |
8853b9304083
made type resolution require an accessing class context
Doug Simon <doug.simon@oracle.com>
parents:
16491
diff
changeset
|
792 ResolvedJavaType elementType = getElementalType(); |
8853b9304083
made type resolution require an accessing class context
Doug Simon <doug.simon@oracle.com>
parents:
16491
diff
changeset
|
793 if (elementType.isPrimitive()) { |
8853b9304083
made type resolution require an accessing class context
Doug Simon <doug.simon@oracle.com>
parents:
16491
diff
changeset
|
794 // Primitive type resolution is context free. |
8853b9304083
made type resolution require an accessing class context
Doug Simon <doug.simon@oracle.com>
parents:
16491
diff
changeset
|
795 return true; |
8853b9304083
made type resolution require an accessing class context
Doug Simon <doug.simon@oracle.com>
parents:
16491
diff
changeset
|
796 } |
8853b9304083
made type resolution require an accessing class context
Doug Simon <doug.simon@oracle.com>
parents:
16491
diff
changeset
|
797 if (elementType.getName().startsWith("Ljava/")) { |
8853b9304083
made type resolution require an accessing class context
Doug Simon <doug.simon@oracle.com>
parents:
16491
diff
changeset
|
798 // Classes in a java.* package can only be defined by the |
8853b9304083
made type resolution require an accessing class context
Doug Simon <doug.simon@oracle.com>
parents:
16491
diff
changeset
|
799 // boot class loader. This is enforced by ClassLoader.preDefineClass() |
8853b9304083
made type resolution require an accessing class context
Doug Simon <doug.simon@oracle.com>
parents:
16491
diff
changeset
|
800 assert mirror().getClassLoader() == null; |
8853b9304083
made type resolution require an accessing class context
Doug Simon <doug.simon@oracle.com>
parents:
16491
diff
changeset
|
801 return true; |
8853b9304083
made type resolution require an accessing class context
Doug Simon <doug.simon@oracle.com>
parents:
16491
diff
changeset
|
802 } |
8853b9304083
made type resolution require an accessing class context
Doug Simon <doug.simon@oracle.com>
parents:
16491
diff
changeset
|
803 ClassLoader thisCl = mirror().getClassLoader(); |
18223
17c98fad6980
converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18222
diff
changeset
|
804 ClassLoader accessingClassCl = ((HotSpotResolvedObjectTypeImpl) accessingClass).mirror().getClassLoader(); |
16492
8853b9304083
made type resolution require an accessing class context
Doug Simon <doug.simon@oracle.com>
parents:
16491
diff
changeset
|
805 return thisCl == accessingClassCl; |
8853b9304083
made type resolution require an accessing class context
Doug Simon <doug.simon@oracle.com>
parents:
16491
diff
changeset
|
806 } |
8853b9304083
made type resolution require an accessing class context
Doug Simon <doug.simon@oracle.com>
parents:
16491
diff
changeset
|
807 |
4484
14a00ee82980
Implement eager type resolving.
Andreas Woess <andreas.woess@jku.at>
parents:
4433
diff
changeset
|
808 @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
|
809 public ResolvedJavaType resolve(ResolvedJavaType accessingClass) { |
16575
adafceb4da4a
improved name and documentation for method implementing fast-path check for type resolution
Doug Simon <doug.simon@oracle.com>
parents:
16492
diff
changeset
|
810 if (isDefinitelyResolvedWithRespectTo(requireNonNull(accessingClass))) { |
16492
8853b9304083
made type resolution require an accessing class context
Doug Simon <doug.simon@oracle.com>
parents:
16491
diff
changeset
|
811 return this; |
8853b9304083
made type resolution require an accessing class context
Doug Simon <doug.simon@oracle.com>
parents:
16491
diff
changeset
|
812 } |
18223
17c98fad6980
converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18222
diff
changeset
|
813 HotSpotResolvedObjectTypeImpl accessingType = (HotSpotResolvedObjectTypeImpl) accessingClass; |
16492
8853b9304083
made type resolution require an accessing class context
Doug Simon <doug.simon@oracle.com>
parents:
16491
diff
changeset
|
814 return (ResolvedJavaType) runtime().lookupType(getName(), accessingType, true); |
4484
14a00ee82980
Implement eager type resolving.
Andreas Woess <andreas.woess@jku.at>
parents:
4433
diff
changeset
|
815 } |
5326
a53162ca8219
introduced HotSpotKlassOop type to convey a klassOop value from the compiler to the C++ code instead of relying on the C++ code automagically converting a HotSpotTypeResolvedImpl value to a klassOop
Doug Simon <doug.simon@oracle.com>
parents:
5287
diff
changeset
|
816 |
7037
dd81042f4eb1
added unit tests for ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
7030
diff
changeset
|
817 /** |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
18182
diff
changeset
|
818 * Gets the metaspace Klass boxed in a {@link JavaConstant}. |
7037
dd81042f4eb1
added unit tests for ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
7030
diff
changeset
|
819 */ |
22556
6821ef65ef4c
HotSpotMetaspaceConstantImpl is not a PrimitiveConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
22551
diff
changeset
|
820 public Constant klass() { |
22590
3f6488b29c1a
Remove rawValue from HotSpotMetaspaceConstantImpl, patch raw pointer at code installation time.
Roland Schatz <roland.schatz@oracle.com>
parents:
22582
diff
changeset
|
821 return HotSpotMetaspaceConstantImpl.forMetaspaceObject(this, false); |
12559
ae412befde21
read HotSpotVMConfig fields from HotSpot's vmStructs via annotations
twisti
parents:
12456
diff
changeset
|
822 } |
ae412befde21
read HotSpotVMConfig fields from HotSpot's vmStructs via annotations
twisti
parents:
12456
diff
changeset
|
823 |
5466
af07e798947d
lifted fast subtype check into checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
5326
diff
changeset
|
824 public boolean isPrimaryType() { |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
825 return config().secondarySuperCacheOffset != superCheckOffset(); |
5466
af07e798947d
lifted fast subtype check into checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
5326
diff
changeset
|
826 } |
af07e798947d
lifted fast subtype check into checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
5326
diff
changeset
|
827 |
af07e798947d
lifted fast subtype check into checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
5326
diff
changeset
|
828 public int superCheckOffset() { |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
829 HotSpotVMConfig config = config(); |
22542
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
830 return UNSAFE.getInt(getMetaspaceKlass() + config.superCheckOffsetOffset); |
5466
af07e798947d
lifted fast subtype check into checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
5326
diff
changeset
|
831 } |
5686
6cb39a47da14
replaced loading of instance prototype header word with a constant obtained from HotSpotResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
5682
diff
changeset
|
832 |
6375
1d7c73b5d787
terminology change to match C++ code and biased locking paper: "initial mark word" -> "prototype mark word"
Doug Simon <doug.simon@oracle.com>
parents:
6367
diff
changeset
|
833 public long prototypeMarkWord() { |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
834 HotSpotVMConfig config = config(); |
7147
88d626e2c2a8
added TLAB fast refill stub for array allocation
Doug Simon <doug.simon@oracle.com>
parents:
7143
diff
changeset
|
835 if (isArray()) { |
12559
ae412befde21
read HotSpotVMConfig fields from HotSpot's vmStructs via annotations
twisti
parents:
12456
diff
changeset
|
836 return config.arrayPrototypeMarkWord(); |
7147
88d626e2c2a8
added TLAB fast refill stub for array allocation
Doug Simon <doug.simon@oracle.com>
parents:
7143
diff
changeset
|
837 } else { |
22542
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
838 return UNSAFE.getAddress(getMetaspaceKlass() + config.prototypeMarkWordOffset); |
7147
88d626e2c2a8
added TLAB fast refill stub for array allocation
Doug Simon <doug.simon@oracle.com>
parents:
7143
diff
changeset
|
839 } |
5686
6cb39a47da14
replaced loading of instance prototype header word with a constant obtained from HotSpotResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
5682
diff
changeset
|
840 } |
7049
ccade022ec83
virtualization of unsafeload and unsafestore
Lukas Stadler <lukas.stadler@jku.at>
parents:
7037
diff
changeset
|
841 |
ccade022ec83
virtualization of unsafeload and unsafestore
Lukas Stadler <lukas.stadler@jku.at>
parents:
7037
diff
changeset
|
842 @Override |
22536
dc1aeef79e7e
Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22516
diff
changeset
|
843 public ResolvedJavaField findInstanceFieldWithOffset(long offset, JavaKind expectedEntryKind) { |
7049
ccade022ec83
virtualization of unsafeload and unsafestore
Lukas Stadler <lukas.stadler@jku.at>
parents:
7037
diff
changeset
|
844 ResolvedJavaField[] declaredFields = getInstanceFields(true); |
24111
8abcd8e1285d
missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents:
24100
diff
changeset
|
845 return findFieldWithOffset(offset, expectedEntryKind, declaredFields); |
8abcd8e1285d
missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents:
24100
diff
changeset
|
846 } |
8abcd8e1285d
missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents:
24100
diff
changeset
|
847 |
8abcd8e1285d
missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents:
24100
diff
changeset
|
848 public ResolvedJavaField findStaticFieldWithOffset(long offset, JavaKind expectedEntryKind) { |
8abcd8e1285d
missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents:
24100
diff
changeset
|
849 ResolvedJavaField[] declaredFields = getStaticFields(); |
8abcd8e1285d
missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents:
24100
diff
changeset
|
850 return findFieldWithOffset(offset, expectedEntryKind, declaredFields); |
8abcd8e1285d
missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents:
24100
diff
changeset
|
851 } |
8abcd8e1285d
missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents:
24100
diff
changeset
|
852 |
8abcd8e1285d
missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents:
24100
diff
changeset
|
853 private static ResolvedJavaField findFieldWithOffset(long offset, JavaKind expectedEntryKind, ResolvedJavaField[] declaredFields) { |
7049
ccade022ec83
virtualization of unsafeload and unsafestore
Lukas Stadler <lukas.stadler@jku.at>
parents:
7037
diff
changeset
|
854 for (ResolvedJavaField field : declaredFields) { |
18950
3fc907b46313
[SPARC] Fix Partial Escape Analysis for SPARC in Truffle
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
18867
diff
changeset
|
855 HotSpotResolvedJavaField resolvedField = (HotSpotResolvedJavaField) field; |
3fc907b46313
[SPARC] Fix Partial Escape Analysis for SPARC in Truffle
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
18867
diff
changeset
|
856 long resolvedFieldOffset = resolvedField.offset(); |
3fc907b46313
[SPARC] Fix Partial Escape Analysis for SPARC in Truffle
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
18867
diff
changeset
|
857 // @formatter:off |
3fc907b46313
[SPARC] Fix Partial Escape Analysis for SPARC in Truffle
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
18867
diff
changeset
|
858 if (ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN && |
3fc907b46313
[SPARC] Fix Partial Escape Analysis for SPARC in Truffle
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
18867
diff
changeset
|
859 expectedEntryKind.isPrimitive() && |
22536
dc1aeef79e7e
Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22516
diff
changeset
|
860 !expectedEntryKind.equals(JavaKind.Void) && |
dc1aeef79e7e
Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22516
diff
changeset
|
861 resolvedField.getJavaKind().isPrimitive()) { |
18950
3fc907b46313
[SPARC] Fix Partial Escape Analysis for SPARC in Truffle
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
18867
diff
changeset
|
862 resolvedFieldOffset += |
22536
dc1aeef79e7e
Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22516
diff
changeset
|
863 resolvedField.getJavaKind().getByteCount() - |
dc1aeef79e7e
Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22516
diff
changeset
|
864 Math.min(resolvedField.getJavaKind().getByteCount(), 4 + expectedEntryKind.getByteCount()); |
18950
3fc907b46313
[SPARC] Fix Partial Escape Analysis for SPARC in Truffle
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
18867
diff
changeset
|
865 } |
3fc907b46313
[SPARC] Fix Partial Escape Analysis for SPARC in Truffle
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
18867
diff
changeset
|
866 if (resolvedFieldOffset == offset) { |
7049
ccade022ec83
virtualization of unsafeload and unsafestore
Lukas Stadler <lukas.stadler@jku.at>
parents:
7037
diff
changeset
|
867 return field; |
ccade022ec83
virtualization of unsafeload and unsafestore
Lukas Stadler <lukas.stadler@jku.at>
parents:
7037
diff
changeset
|
868 } |
18950
3fc907b46313
[SPARC] Fix Partial Escape Analysis for SPARC in Truffle
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
18867
diff
changeset
|
869 // @formatter:on |
7049
ccade022ec83
virtualization of unsafeload and unsafestore
Lukas Stadler <lukas.stadler@jku.at>
parents:
7037
diff
changeset
|
870 } |
ccade022ec83
virtualization of unsafeload and unsafestore
Lukas Stadler <lukas.stadler@jku.at>
parents:
7037
diff
changeset
|
871 return null; |
ccade022ec83
virtualization of unsafeload and unsafestore
Lukas Stadler <lukas.stadler@jku.at>
parents:
7037
diff
changeset
|
872 } |
7819
aa022eaf1569
class file path retrieval
Michael Haupt <michael.haupt@oracle.com>
parents:
7530
diff
changeset
|
873 |
aa022eaf1569
class file path retrieval
Michael Haupt <michael.haupt@oracle.com>
parents:
7530
diff
changeset
|
874 @Override |
7829
a44887443b0c
support for inner classes (local/member) in meta API
Michael Haupt <michael.haupt@oracle.com>
parents:
7828
diff
changeset
|
875 public boolean isLocal() { |
a44887443b0c
support for inner classes (local/member) in meta API
Michael Haupt <michael.haupt@oracle.com>
parents:
7828
diff
changeset
|
876 return mirror().isLocalClass(); |
a44887443b0c
support for inner classes (local/member) in meta API
Michael Haupt <michael.haupt@oracle.com>
parents:
7828
diff
changeset
|
877 } |
a44887443b0c
support for inner classes (local/member) in meta API
Michael Haupt <michael.haupt@oracle.com>
parents:
7828
diff
changeset
|
878 |
a44887443b0c
support for inner classes (local/member) in meta API
Michael Haupt <michael.haupt@oracle.com>
parents:
7828
diff
changeset
|
879 @Override |
a44887443b0c
support for inner classes (local/member) in meta API
Michael Haupt <michael.haupt@oracle.com>
parents:
7828
diff
changeset
|
880 public boolean isMember() { |
a44887443b0c
support for inner classes (local/member) in meta API
Michael Haupt <michael.haupt@oracle.com>
parents:
7828
diff
changeset
|
881 return mirror().isMemberClass(); |
a44887443b0c
support for inner classes (local/member) in meta API
Michael Haupt <michael.haupt@oracle.com>
parents:
7828
diff
changeset
|
882 } |
a44887443b0c
support for inner classes (local/member) in meta API
Michael Haupt <michael.haupt@oracle.com>
parents:
7828
diff
changeset
|
883 |
a44887443b0c
support for inner classes (local/member) in meta API
Michael Haupt <michael.haupt@oracle.com>
parents:
7828
diff
changeset
|
884 @Override |
18223
17c98fad6980
converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18222
diff
changeset
|
885 public HotSpotResolvedObjectTypeImpl getEnclosingType() { |
7829
a44887443b0c
support for inner classes (local/member) in meta API
Michael Haupt <michael.haupt@oracle.com>
parents:
7828
diff
changeset
|
886 final Class<?> encl = mirror().getEnclosingClass(); |
18167
2bf5ea10eea7
sharpened return types for HotSpot specific Graal API implementations
Doug Simon <doug.simon@oracle.com>
parents:
17156
diff
changeset
|
887 return encl == null ? null : fromObjectClass(encl); |
7829
a44887443b0c
support for inner classes (local/member) in meta API
Michael Haupt <michael.haupt@oracle.com>
parents:
7828
diff
changeset
|
888 } |
9100
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
8959
diff
changeset
|
889 |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
8959
diff
changeset
|
890 @Override |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
8959
diff
changeset
|
891 public ResolvedJavaMethod[] getDeclaredConstructors() { |
15040
288c23143d47
Fix most raw type references.
Josef Eisl <josef.eisl@jku.at>
parents:
15018
diff
changeset
|
892 Constructor<?>[] constructors = mirror().getDeclaredConstructors(); |
9100
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
8959
diff
changeset
|
893 ResolvedJavaMethod[] result = new ResolvedJavaMethod[constructors.length]; |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
8959
diff
changeset
|
894 for (int i = 0; i < constructors.length; i++) { |
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
|
895 result[i] = runtime().getHostJVMCIBackend().getMetaAccess().lookupJavaMethod(constructors[i]); |
9100
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
8959
diff
changeset
|
896 assert result[i].isConstructor(); |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
8959
diff
changeset
|
897 } |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
8959
diff
changeset
|
898 return result; |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
8959
diff
changeset
|
899 } |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
8959
diff
changeset
|
900 |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
8959
diff
changeset
|
901 @Override |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
8959
diff
changeset
|
902 public ResolvedJavaMethod[] getDeclaredMethods() { |
14091
ed92bc6900d5
simplified HotSpotResolvedObjectType.FieldInfo.getType(); encapsulated all access to javaClass in HotSpotResolvedObjectType more
Doug Simon <doug.simon@oracle.com>
parents:
14069
diff
changeset
|
903 Method[] methods = mirror().getDeclaredMethods(); |
9100
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
8959
diff
changeset
|
904 ResolvedJavaMethod[] result = new ResolvedJavaMethod[methods.length]; |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
8959
diff
changeset
|
905 for (int i = 0; i < methods.length; i++) { |
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
|
906 result[i] = runtime().getHostJVMCIBackend().getMetaAccess().lookupJavaMethod(methods[i]); |
9100
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
8959
diff
changeset
|
907 assert !result[i].isConstructor(); |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
8959
diff
changeset
|
908 } |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
8959
diff
changeset
|
909 return result; |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
8959
diff
changeset
|
910 } |
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
8959
diff
changeset
|
911 |
11952
c0807f5fdca5
added ResolvedJavaType.getClassInititalizer()
Doug Simon <doug.simon@oracle.com>
parents:
11823
diff
changeset
|
912 public ResolvedJavaMethod getClassInitializer() { |
22582
232c53e17ea0
added CompilerToVM.compilerToVM() for static access to the CompilerToVM instance
Doug Simon <doug.simon@oracle.com>
parents:
22581
diff
changeset
|
913 return compilerToVM().getClassInitializer(this); |
9985
e6bd1004082a
added HotSpotResolvedObjectType.getMethods() to get all methods of a class including those (such as <clinit>) not normally exposed by Java reflection
Doug Simon <doug.simon@oracle.com>
parents:
9835
diff
changeset
|
914 } |
e6bd1004082a
added HotSpotResolvedObjectType.getMethods() to get all methods of a class including those (such as <clinit>) not normally exposed by Java reflection
Doug Simon <doug.simon@oracle.com>
parents:
9835
diff
changeset
|
915 |
9100
d24955427b0b
Remove MetaUtil.getMirrorOrFail; Add necessary functionality to the Graal API so that all previous usages of java.lang.Class can now use ResolvedJavaType
Christian Wimmer <christian.wimmer@oracle.com>
parents:
8959
diff
changeset
|
916 @Override |
13305
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13295
diff
changeset
|
917 public String toString() { |
15730
920b7bb058a6
Simplify HotSpotUnresolvedJavaType, harmonize toString for HotSpotUnresolvedJavaType and HotSpotResolvedObjectType
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15726
diff
changeset
|
918 return "HotSpotType<" + getName() + ", resolved>"; |
13305
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13295
diff
changeset
|
919 } |
17156
ac6e25901d62
Add trusted interface concept and use it for WordBase, fix a NPE and some tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16615
diff
changeset
|
920 |
ac6e25901d62
Add trusted interface concept and use it for WordBase, fix a NPE and some tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16615
diff
changeset
|
921 @Override |
23373
802821d82a92
Rename isAllocationCloneable to isCloneableWithAllocation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23366
diff
changeset
|
922 public boolean isCloneableWithAllocation() { |
23357
b05ad394cfd5
Add ResolvedJavaType.isAllocationClonable
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23354
diff
changeset
|
923 return (getAccessFlags() & config().jvmAccIsCloneable) != 0; |
b05ad394cfd5
Add ResolvedJavaType.isAllocationClonable
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23354
diff
changeset
|
924 } |
24138
b01354ea98ec
bring jvmci-8 more into sync with jvmci-9
Doug Simon <doug.simon@oracle.com>
parents:
24128
diff
changeset
|
925 |
b01354ea98ec
bring jvmci-8 more into sync with jvmci-9
Doug Simon <doug.simon@oracle.com>
parents:
24128
diff
changeset
|
926 public long getFingerprint() { |
b01354ea98ec
bring jvmci-8 more into sync with jvmci-9
Doug Simon <doug.simon@oracle.com>
parents:
24128
diff
changeset
|
927 return 0L; |
b01354ea98ec
bring jvmci-8 more into sync with jvmci-9
Doug Simon <doug.simon@oracle.com>
parents:
24128
diff
changeset
|
928 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
929 } |