Mercurial > hg > graal-jvmci-8
annotate jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaMethodImpl.java @ 23996:11f0412408cd
8173912: [JVMCI] fix memory overhead of JVMCI
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Fri, 03 Feb 2017 21:08:05 +0100 |
parents | 1b8892b4ce9c |
children | 9a740aa0d87b |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
22556
6821ef65ef4c
HotSpotMetaspaceConstantImpl is not a PrimitiveConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
22542
diff
changeset
|
2 * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
4 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
8 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
14 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
18 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
21 * questions. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
22 */ |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22648
diff
changeset
|
23 package jdk.vm.ci.hotspot; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22648
diff
changeset
|
25 import static jdk.vm.ci.hotspot.CompilerToVM.compilerToVM; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22648
diff
changeset
|
26 import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime; |
23749
d6bd0b9cd0b6
remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents:
23734
diff
changeset
|
27 import static jdk.vm.ci.hotspot.HotSpotModifiers.BRIDGE; |
d6bd0b9cd0b6
remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents:
23734
diff
changeset
|
28 import static jdk.vm.ci.hotspot.HotSpotModifiers.SYNTHETIC; |
d6bd0b9cd0b6
remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents:
23734
diff
changeset
|
29 import static jdk.vm.ci.hotspot.HotSpotModifiers.VARARGS; |
d6bd0b9cd0b6
remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents:
23734
diff
changeset
|
30 import static jdk.vm.ci.hotspot.HotSpotModifiers.jvmMethodModifiers; |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22648
diff
changeset
|
31 import static jdk.vm.ci.hotspot.HotSpotVMConfig.config; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22648
diff
changeset
|
32 import static jdk.vm.ci.hotspot.UnsafeAccess.UNSAFE; |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
33 |
22569
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22566
diff
changeset
|
34 import java.lang.annotation.Annotation; |
22704
ce4bec6db0b2
narrow type of HotSpotResolvedJavaMethodImpl.toJavaCache to Executable
Andreas Woess <andreas.woess@oracle.com>
parents:
22672
diff
changeset
|
35 import java.lang.reflect.Executable; |
23789
0cb263db490f
use MethodParameters attribute instead of depending on -g option for sanity checks (JDK-8168915)
Doug Simon <doug.simon@oracle.com>
parents:
23757
diff
changeset
|
36 import java.lang.reflect.Method; |
22569
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22566
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:
22566
diff
changeset
|
38 import java.lang.reflect.Type; |
23789
0cb263db490f
use MethodParameters attribute instead of depending on -g option for sanity checks (JDK-8168915)
Doug Simon <doug.simon@oracle.com>
parents:
23757
diff
changeset
|
39 import java.util.Arrays; |
22569
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22566
diff
changeset
|
40 import java.util.HashMap; |
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22566
diff
changeset
|
41 import java.util.Map; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
42 |
23392
b3a816d3b844
Backed out changeset: a920338dd4d4
Doug Simon <doug.simon@oracle.com>
parents:
23387
diff
changeset
|
43 import jdk.vm.ci.common.JVMCIError; |
23306
7b09dede4552
JVMCI options should not use System.getProperty() directly (JDK-8146820)
Doug Simon <doug.simon@oracle.com>
parents:
22758
diff
changeset
|
44 import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.Option; |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22648
diff
changeset
|
45 import jdk.vm.ci.meta.Constant; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22648
diff
changeset
|
46 import jdk.vm.ci.meta.ConstantPool; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22648
diff
changeset
|
47 import jdk.vm.ci.meta.DefaultProfilingInfo; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22648
diff
changeset
|
48 import jdk.vm.ci.meta.ExceptionHandler; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22648
diff
changeset
|
49 import jdk.vm.ci.meta.JavaMethod; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22648
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:
22648
diff
changeset
|
51 import jdk.vm.ci.meta.LineNumberTable; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22648
diff
changeset
|
52 import jdk.vm.ci.meta.Local; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22648
diff
changeset
|
53 import jdk.vm.ci.meta.LocalVariableTable; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22648
diff
changeset
|
54 import jdk.vm.ci.meta.ProfilingInfo; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22648
diff
changeset
|
55 import jdk.vm.ci.meta.ResolvedJavaMethod; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22648
diff
changeset
|
56 import jdk.vm.ci.meta.ResolvedJavaType; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22648
diff
changeset
|
57 import jdk.vm.ci.meta.Signature; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22648
diff
changeset
|
58 import jdk.vm.ci.meta.SpeculationLog; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22648
diff
changeset
|
59 import jdk.vm.ci.meta.TriState; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
60 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
61 /** |
5775
2c088af17e59
Removed left over Ri* prefixed identifiers
Doug Simon <doug.simon@oracle.com>
parents:
5722
diff
changeset
|
62 * Implementation of {@link JavaMethod} for resolved HotSpot methods. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
63 */ |
23393
1d4ce2d19e52
clean up and minimize JVMCI (JDK-8156835)
Doug Simon <doug.simon@oracle.com>
parents:
23392
diff
changeset
|
64 final class HotSpotResolvedJavaMethodImpl extends HotSpotMethod implements HotSpotResolvedJavaMethod, MetaspaceWrapperObject { |
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
|
65 |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
66 /** |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
67 * Reference to metaspace Method object. |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
68 */ |
13259
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13254
diff
changeset
|
69 private final long metaspaceMethod; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
70 |
18223
17c98fad6980
converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18222
diff
changeset
|
71 private final HotSpotResolvedObjectTypeImpl holder; |
13259
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13254
diff
changeset
|
72 private final HotSpotConstantPool constantPool; |
13254
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
13217
diff
changeset
|
73 private final HotSpotSignature signature; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4220
diff
changeset
|
74 private HotSpotMethodData methodData; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
75 private byte[] code; |
22704
ce4bec6db0b2
narrow type of HotSpotResolvedJavaMethodImpl.toJavaCache to Executable
Andreas Woess <andreas.woess@oracle.com>
parents:
22672
diff
changeset
|
76 private Executable toJavaCache; |
23996
11f0412408cd
8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents:
23992
diff
changeset
|
77 |
11f0412408cd
8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents:
23992
diff
changeset
|
78 /** |
11f0412408cd
8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents:
23992
diff
changeset
|
79 * Only 30% of {@link HotSpotResolvedJavaMethodImpl}s have their name accessed so compute it |
11f0412408cd
8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents:
23992
diff
changeset
|
80 * lazily and cache it. |
11f0412408cd
8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents:
23992
diff
changeset
|
81 */ |
23992
1b8892b4ce9c
lazily cache the name of a HotSpotResolvedJavaMethodImpl
Doug Simon <doug.simon@oracle.com>
parents:
23986
diff
changeset
|
82 private String nameCache; |
5176
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5115
diff
changeset
|
83 |
9760
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
84 /** |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
85 * Gets the holder of a HotSpot metaspace method native object. |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14717
diff
changeset
|
86 * |
9760
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
87 * @param metaspaceMethod a metaspace Method object |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
88 * @return the {@link ResolvedJavaType} corresponding to the holder of the |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
89 * {@code metaspaceMethod} |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
90 */ |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22421
diff
changeset
|
91 private static HotSpotResolvedObjectTypeImpl getHolder(long metaspaceMethod) { |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
92 HotSpotVMConfig config = config(); |
22542
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
93 final long metaspaceConstMethod = UNSAFE.getAddress(metaspaceMethod + config.methodConstMethodOffset); |
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
94 final long metaspaceConstantPool = UNSAFE.getAddress(metaspaceConstMethod + config.constMethodConstantsOffset); |
22582
232c53e17ea0
added CompilerToVM.compilerToVM() for static access to the CompilerToVM instance
Doug Simon <doug.simon@oracle.com>
parents:
22581
diff
changeset
|
95 return compilerToVM().getResolvedJavaType(null, metaspaceConstantPool + config.constantPoolHolderOffset, false); |
9760
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
96 } |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
97 |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
98 /** |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22421
diff
changeset
|
99 * Gets the JVMCI mirror from a HotSpot method. The VM is responsible for ensuring that the |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22421
diff
changeset
|
100 * Method* is kept alive for the duration of this call and the |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22421
diff
changeset
|
101 * {@link HotSpotJVMCIMetaAccessContext} keeps it alive after that. |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22421
diff
changeset
|
102 * |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22421
diff
changeset
|
103 * Called from the VM. |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14717
diff
changeset
|
104 * |
9760
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
105 * @param metaspaceMethod a metaspace Method object |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
106 * @return the {@link ResolvedJavaMethod} corresponding to {@code metaspaceMethod} |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
107 */ |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22421
diff
changeset
|
108 @SuppressWarnings("unused") |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22421
diff
changeset
|
109 private static HotSpotResolvedJavaMethod fromMetaspace(long metaspaceMethod) { |
18223
17c98fad6980
converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18222
diff
changeset
|
110 HotSpotResolvedObjectTypeImpl holder = getHolder(metaspaceMethod); |
9760
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
111 return holder.createMethod(metaspaceMethod); |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
112 } |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9714
diff
changeset
|
113 |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22421
diff
changeset
|
114 HotSpotResolvedJavaMethodImpl(HotSpotResolvedObjectTypeImpl holder, long metaspaceMethod) { |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
115 this.metaspaceMethod = metaspaceMethod; |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
116 this.holder = holder; |
13254
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
13217
diff
changeset
|
117 |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
118 HotSpotVMConfig config = config(); |
13254
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
13217
diff
changeset
|
119 final long constMethod = getConstMethod(); |
13259
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13254
diff
changeset
|
120 |
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13254
diff
changeset
|
121 /* |
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13254
diff
changeset
|
122 * Get the constant pool from the metaspace method. Some methods (e.g. intrinsics for |
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13254
diff
changeset
|
123 * signature-polymorphic method handle methods) have their own constant pool instead of the |
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13254
diff
changeset
|
124 * one from their holder. |
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13254
diff
changeset
|
125 */ |
22542
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
126 final long metaspaceConstantPool = UNSAFE.getAddress(constMethod + config.constMethodConstantsOffset); |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22421
diff
changeset
|
127 if (metaspaceConstantPool == holder.getConstantPool().getMetaspaceConstantPool()) { |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22421
diff
changeset
|
128 this.constantPool = holder.getConstantPool(); |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22421
diff
changeset
|
129 } else { |
23734
2e17c65dddd7
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
Doug Simon <doug.simon@oracle.com>
parents:
23679
diff
changeset
|
130 this.constantPool = compilerToVM().getConstantPool(this); |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22421
diff
changeset
|
131 } |
13259
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13254
diff
changeset
|
132 |
22542
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
133 final int signatureIndex = UNSAFE.getChar(constMethod + config.constMethodSignatureIndexOffset); |
13254
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
13217
diff
changeset
|
134 this.signature = (HotSpotSignature) constantPool.lookupSignature(signatureIndex); |
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 |
13254
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
13217
diff
changeset
|
137 /** |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
13217
diff
changeset
|
138 * Returns a pointer to this method's constant method data structure ( |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22421
diff
changeset
|
139 * {@code Method::_constMethod}). This pointer isn't wrapped since it should be safe to use it |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22421
diff
changeset
|
140 * within the context of this HotSpotResolvedJavaMethodImpl since the Method* and ConstMethod* |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22421
diff
changeset
|
141 * are kept alive as a pair. |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14717
diff
changeset
|
142 * |
13254
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
13217
diff
changeset
|
143 * @return pointer to this method's ConstMethod |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
13217
diff
changeset
|
144 */ |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
13217
diff
changeset
|
145 private long getConstMethod() { |
13259
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13254
diff
changeset
|
146 assert metaspaceMethod != 0; |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
147 return UNSAFE.getAddress(metaspaceMethod + config().methodConstMethodOffset); |
13254
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
13217
diff
changeset
|
148 } |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
13217
diff
changeset
|
149 |
23992
1b8892b4ce9c
lazily cache the name of a HotSpotResolvedJavaMethodImpl
Doug Simon <doug.simon@oracle.com>
parents:
23986
diff
changeset
|
150 public String getName() { |
1b8892b4ce9c
lazily cache the name of a HotSpotResolvedJavaMethodImpl
Doug Simon <doug.simon@oracle.com>
parents:
23986
diff
changeset
|
151 if (nameCache == null) { |
23996
11f0412408cd
8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents:
23992
diff
changeset
|
152 final int nameIndex = UNSAFE.getChar(getConstMethod() + config().constMethodNameIndexOffset); |
11f0412408cd
8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents:
23992
diff
changeset
|
153 nameCache = constantPool.lookupUtf8(nameIndex); |
23992
1b8892b4ce9c
lazily cache the name of a HotSpotResolvedJavaMethodImpl
Doug Simon <doug.simon@oracle.com>
parents:
23986
diff
changeset
|
154 } |
1b8892b4ce9c
lazily cache the name of a HotSpotResolvedJavaMethodImpl
Doug Simon <doug.simon@oracle.com>
parents:
23986
diff
changeset
|
155 return nameCache; |
1b8892b4ce9c
lazily cache the name of a HotSpotResolvedJavaMethodImpl
Doug Simon <doug.simon@oracle.com>
parents:
23986
diff
changeset
|
156 } |
1b8892b4ce9c
lazily cache the name of a HotSpotResolvedJavaMethodImpl
Doug Simon <doug.simon@oracle.com>
parents:
23986
diff
changeset
|
157 |
14158
fd7fcd2d2072
replaced == with .equals() for comparisons between JavaMethod/JavaField/JavaType values
Doug Simon <doug.simon@oracle.com>
parents:
14107
diff
changeset
|
158 @Override |
fd7fcd2d2072
replaced == with .equals() for comparisons between JavaMethod/JavaField/JavaType values
Doug Simon <doug.simon@oracle.com>
parents:
14107
diff
changeset
|
159 public boolean equals(Object obj) { |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22421
diff
changeset
|
160 if (this == obj) { |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22421
diff
changeset
|
161 return true; |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22421
diff
changeset
|
162 } |
18366
c09fc2864097
fixed HotSpotResolvedJavaMethodImpl.equals
Doug Simon <doug.simon@oracle.com>
parents:
18323
diff
changeset
|
163 if (obj instanceof HotSpotResolvedJavaMethodImpl) { |
18222
a8cff27ca2e1
converted HotSpotResolvedJavaMethod to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
164 HotSpotResolvedJavaMethodImpl that = (HotSpotResolvedJavaMethodImpl) obj; |
14158
fd7fcd2d2072
replaced == with .equals() for comparisons between JavaMethod/JavaField/JavaType values
Doug Simon <doug.simon@oracle.com>
parents:
14107
diff
changeset
|
165 return that.metaspaceMethod == metaspaceMethod; |
fd7fcd2d2072
replaced == with .equals() for comparisons between JavaMethod/JavaField/JavaType values
Doug Simon <doug.simon@oracle.com>
parents:
14107
diff
changeset
|
166 } |
fd7fcd2d2072
replaced == with .equals() for comparisons between JavaMethod/JavaField/JavaType values
Doug Simon <doug.simon@oracle.com>
parents:
14107
diff
changeset
|
167 return false; |
fd7fcd2d2072
replaced == with .equals() for comparisons between JavaMethod/JavaField/JavaType values
Doug Simon <doug.simon@oracle.com>
parents:
14107
diff
changeset
|
168 } |
fd7fcd2d2072
replaced == with .equals() for comparisons between JavaMethod/JavaField/JavaType values
Doug Simon <doug.simon@oracle.com>
parents:
14107
diff
changeset
|
169 |
fd7fcd2d2072
replaced == with .equals() for comparisons between JavaMethod/JavaField/JavaType values
Doug Simon <doug.simon@oracle.com>
parents:
14107
diff
changeset
|
170 @Override |
fd7fcd2d2072
replaced == with .equals() for comparisons between JavaMethod/JavaField/JavaType values
Doug Simon <doug.simon@oracle.com>
parents:
14107
diff
changeset
|
171 public int hashCode() { |
fd7fcd2d2072
replaced == with .equals() for comparisons between JavaMethod/JavaField/JavaType values
Doug Simon <doug.simon@oracle.com>
parents:
14107
diff
changeset
|
172 return (int) metaspaceMethod; |
fd7fcd2d2072
replaced == with .equals() for comparisons between JavaMethod/JavaField/JavaType values
Doug Simon <doug.simon@oracle.com>
parents:
14107
diff
changeset
|
173 } |
fd7fcd2d2072
replaced == with .equals() for comparisons between JavaMethod/JavaField/JavaType values
Doug Simon <doug.simon@oracle.com>
parents:
14107
diff
changeset
|
174 |
13306
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
175 /** |
14717 | 176 * Returns this method's flags ({@code Method::_flags}). |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14717
diff
changeset
|
177 * |
14717 | 178 * @return flags of this method |
179 */ | |
180 private int getFlags() { | |
23393
1d4ce2d19e52
clean up and minimize JVMCI (JDK-8156835)
Doug Simon <doug.simon@oracle.com>
parents:
23392
diff
changeset
|
181 // Important: Size of field changed, JDK8 has u1 and JDK9 u2 |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
182 return UNSAFE.getByte(metaspaceMethod + config().methodFlagsOffset); |
14717 | 183 } |
184 | |
185 /** | |
13306
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
186 * Returns this method's constant method flags ({@code ConstMethod::_flags}). |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14717
diff
changeset
|
187 * |
13306
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
188 * @return flags of this method's ConstMethod |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
189 */ |
14717 | 190 private int getConstMethodFlags() { |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
191 return UNSAFE.getChar(getConstMethod() + config().constMethodFlagsOffset); |
13306
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
192 } |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
193 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
194 @Override |
18223
17c98fad6980
converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18222
diff
changeset
|
195 public HotSpotResolvedObjectTypeImpl getDeclaringClass() { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
196 return holder; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
197 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
198 |
7930
fe64b5da8229
Create direct call for Static and Special to avoid out-of-line patching stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7912
diff
changeset
|
199 /** |
fe64b5da8229
Create direct call for Static and Special to avoid out-of-line patching stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7912
diff
changeset
|
200 * Gets the address of the C++ Method object for this method. |
fe64b5da8229
Create direct call for Static and Special to avoid out-of-line patching stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7912
diff
changeset
|
201 */ |
22556
6821ef65ef4c
HotSpotMetaspaceConstantImpl is not a PrimitiveConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
22542
diff
changeset
|
202 public Constant getMetaspaceMethodConstant() { |
22590
3f6488b29c1a
Remove rawValue from HotSpotMetaspaceConstantImpl, patch raw pointer at code installation time.
Roland Schatz <roland.schatz@oracle.com>
parents:
22583
diff
changeset
|
203 return HotSpotMetaspaceConstantImpl.forMetaspaceObject(this, false); |
7930
fe64b5da8229
Create direct call for Static and Special to avoid out-of-line patching stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7912
diff
changeset
|
204 } |
fe64b5da8229
Create direct call for Static and Special to avoid out-of-line patching stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7912
diff
changeset
|
205 |
22598
ed53e370f04c
Make implementation classes package private.
Roland Schatz <roland.schatz@oracle.com>
parents:
22590
diff
changeset
|
206 public long getMetaspacePointer() { |
15088
d3add9b82b71
change to StackIntrospection and Truffle getStackTrace implementation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15040
diff
changeset
|
207 return metaspaceMethod; |
d3add9b82b71
change to StackIntrospection and Truffle getStackTrace implementation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15040
diff
changeset
|
208 } |
d3add9b82b71
change to StackIntrospection and Truffle getStackTrace implementation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15040
diff
changeset
|
209 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
210 @Override |
22556
6821ef65ef4c
HotSpotMetaspaceConstantImpl is not a PrimitiveConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
22542
diff
changeset
|
211 public Constant getEncoding() { |
9380
ee8cd087a731
Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9338
diff
changeset
|
212 return getMetaspaceMethodConstant(); |
ee8cd087a731
Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9338
diff
changeset
|
213 } |
ee8cd087a731
Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9338
diff
changeset
|
214 |
13787 | 215 /** |
216 * Gets the complete set of modifiers for this method which includes the JVM specification | |
217 * modifiers as well as the HotSpot internal modifiers. | |
218 */ | |
219 public int getAllModifiers() { | |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
220 return UNSAFE.getInt(metaspaceMethod + config().methodAccessFlagsOffset); |
13777
b6cecbcfa503
fixed HotSpotResolvedJavaMethod.isSynthetic so that it doesn't do any class loading (JBS:GRAAL-5)
Doug Simon <doug.simon@oracle.com>
parents:
13373
diff
changeset
|
221 } |
b6cecbcfa503
fixed HotSpotResolvedJavaMethod.isSynthetic so that it doesn't do any class loading (JBS:GRAAL-5)
Doug Simon <doug.simon@oracle.com>
parents:
13373
diff
changeset
|
222 |
9380
ee8cd087a731
Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9338
diff
changeset
|
223 @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:
6525
diff
changeset
|
224 public int getModifiers() { |
23749
d6bd0b9cd0b6
remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents:
23734
diff
changeset
|
225 return getAllModifiers() & jvmMethodModifiers(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
226 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
227 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
228 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
229 public boolean canBeStaticallyBound() { |
22032
d1a41fbfcfd2
Replace ResolvedJavaType.isFinal with more meaningful and correct isLeaf
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22011
diff
changeset
|
230 return (isFinal() || isPrivate() || isStatic() || holder.isLeaf()) && isConcrete(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
231 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
232 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
233 @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:
6525
diff
changeset
|
234 public byte[] getCode() { |
14105 | 235 if (getCodeSize() == 0) { |
7912
06ecee106195
added unit tests for bytecode and machine code disassembly
Doug Simon <doug.simon@oracle.com>
parents:
7786
diff
changeset
|
236 return null; |
06ecee106195
added unit tests for bytecode and machine code disassembly
Doug Simon <doug.simon@oracle.com>
parents:
7786
diff
changeset
|
237 } |
13214
3f34b8f91cc5
moved CompilerToVM.isTypeInitialized and isTypeLinked to Java
twisti
parents:
13183
diff
changeset
|
238 if (code == null && holder.isLinked()) { |
22582
232c53e17ea0
added CompilerToVM.compilerToVM() for static access to the CompilerToVM instance
Doug Simon <doug.simon@oracle.com>
parents:
22581
diff
changeset
|
239 code = compilerToVM().getBytecode(this); |
14105 | 240 assert code.length == getCodeSize() : "expected: " + getCodeSize() + ", actual: " + code.length; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
241 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
242 return code; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
243 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
244 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
245 @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:
6525
diff
changeset
|
246 public int getCodeSize() { |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
247 return UNSAFE.getChar(getConstMethod() + config().constMethodCodeSizeOffset); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
248 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
249 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
250 @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:
6525
diff
changeset
|
251 public ExceptionHandler[] getExceptionHandlers() { |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
252 final boolean hasExceptionTable = (getConstMethodFlags() & config().constMethodHasExceptionTable) != 0; |
14105 | 253 if (!hasExceptionTable) { |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
254 return new ExceptionHandler[0]; |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
255 } |
13305
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
256 |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
257 HotSpotVMConfig config = config(); |
22582
232c53e17ea0
added CompilerToVM.compilerToVM() for static access to the CompilerToVM instance
Doug Simon <doug.simon@oracle.com>
parents:
22581
diff
changeset
|
258 final int exceptionTableLength = compilerToVM().getExceptionTableLength(this); |
14105 | 259 ExceptionHandler[] handlers = new ExceptionHandler[exceptionTableLength]; |
22582
232c53e17ea0
added CompilerToVM.compilerToVM() for static access to the CompilerToVM instance
Doug Simon <doug.simon@oracle.com>
parents:
22581
diff
changeset
|
260 long exceptionTableElement = compilerToVM().getExceptionTableStart(this); |
13305
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
261 |
14105 | 262 for (int i = 0; i < exceptionTableLength; i++) { |
22542
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
263 final int startPc = UNSAFE.getChar(exceptionTableElement + config.exceptionTableElementStartPcOffset); |
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
264 final int endPc = UNSAFE.getChar(exceptionTableElement + config.exceptionTableElementEndPcOffset); |
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
265 final int handlerPc = UNSAFE.getChar(exceptionTableElement + config.exceptionTableElementHandlerPcOffset); |
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
266 int catchTypeIndex = UNSAFE.getChar(exceptionTableElement + config.exceptionTableElementCatchTypeIndexOffset); |
13305
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
267 |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
268 JavaType catchType; |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
269 if (catchTypeIndex == 0) { |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
270 catchType = null; |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
271 } else { |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
272 final int opcode = -1; // opcode is not used |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
273 catchType = constantPool.lookupType(catchTypeIndex, opcode); |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
274 |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
275 // Check for Throwable which catches everything. |
18223
17c98fad6980
converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18222
diff
changeset
|
276 if (catchType instanceof HotSpotResolvedObjectTypeImpl) { |
17c98fad6980
converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18222
diff
changeset
|
277 HotSpotResolvedObjectTypeImpl resolvedType = (HotSpotResolvedObjectTypeImpl) catchType; |
13305
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
278 if (resolvedType.mirror() == Throwable.class) { |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
279 catchTypeIndex = 0; |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
280 catchType = null; |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
281 } |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
282 } |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
283 } |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
284 handlers[i] = new ExceptionHandler(startPc, endPc, handlerPc, catchTypeIndex, catchType); |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
285 |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
286 // Go to the next ExceptionTableElement |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
287 exceptionTableElement += config.exceptionTableElementSize; |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
288 } |
13305
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
289 |
a63d65b682a8
moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents:
13264
diff
changeset
|
290 return handlers; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
291 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
292 |
9416 | 293 /** |
14717 | 294 * Returns true if this method has a {@code CallerSensitive} annotation. |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14717
diff
changeset
|
295 * |
9416 | 296 * @return true if CallerSensitive annotation present, false otherwise |
297 */ | |
298 public boolean isCallerSensitive() { | |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
299 return (getFlags() & config().methodFlagsCallerSensitive) != 0; |
14717 | 300 } |
301 | |
302 /** | |
303 * Returns true if this method has a {@code ForceInline} annotation. | |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14717
diff
changeset
|
304 * |
14717 | 305 * @return true if ForceInline annotation present, false otherwise |
306 */ | |
307 public boolean isForceInline() { | |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
308 return (getFlags() & config().methodFlagsForceInline) != 0; |
14717 | 309 } |
310 | |
311 /** | |
23312
fb20e2d4f0bc
Add dummy implementation of HotSpotResolvedJavaMethod.hasReservedAccess for compatibility with JDK9
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23306
diff
changeset
|
312 * Returns true if this method has a {@code ReservedStackAccess} annotation. |
fb20e2d4f0bc
Add dummy implementation of HotSpotResolvedJavaMethod.hasReservedAccess for compatibility with JDK9
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23306
diff
changeset
|
313 * |
fb20e2d4f0bc
Add dummy implementation of HotSpotResolvedJavaMethod.hasReservedAccess for compatibility with JDK9
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23306
diff
changeset
|
314 * @return true if ReservedStackAccess annotation present, false otherwise |
fb20e2d4f0bc
Add dummy implementation of HotSpotResolvedJavaMethod.hasReservedAccess for compatibility with JDK9
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23306
diff
changeset
|
315 */ |
fb20e2d4f0bc
Add dummy implementation of HotSpotResolvedJavaMethod.hasReservedAccess for compatibility with JDK9
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23306
diff
changeset
|
316 public boolean hasReservedStackAccess() { |
fb20e2d4f0bc
Add dummy implementation of HotSpotResolvedJavaMethod.hasReservedAccess for compatibility with JDK9
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23306
diff
changeset
|
317 // Annotation isn't available in JDK8 |
fb20e2d4f0bc
Add dummy implementation of HotSpotResolvedJavaMethod.hasReservedAccess for compatibility with JDK9
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23306
diff
changeset
|
318 return false; |
fb20e2d4f0bc
Add dummy implementation of HotSpotResolvedJavaMethod.hasReservedAccess for compatibility with JDK9
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23306
diff
changeset
|
319 } |
fb20e2d4f0bc
Add dummy implementation of HotSpotResolvedJavaMethod.hasReservedAccess for compatibility with JDK9
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23306
diff
changeset
|
320 |
fb20e2d4f0bc
Add dummy implementation of HotSpotResolvedJavaMethod.hasReservedAccess for compatibility with JDK9
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23306
diff
changeset
|
321 /** |
12532
9b1cc2628961
Extend the CompilerToVM interface to explicitly avoid compilation and inlining of methods
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
12464
diff
changeset
|
322 * Manually adds a DontInline annotation to this method. |
9b1cc2628961
Extend the CompilerToVM interface to explicitly avoid compilation and inlining of methods
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
12464
diff
changeset
|
323 */ |
13953
d587baa55dd7
Add shouldBeInlined method to ResolvedJavaMethod, implement it for HotSpot and use it in the inlining phase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13818
diff
changeset
|
324 public void setNotInlineable() { |
22582
232c53e17ea0
added CompilerToVM.compilerToVM() for static access to the CompilerToVM instance
Doug Simon <doug.simon@oracle.com>
parents:
22581
diff
changeset
|
325 compilerToVM().doNotInlineOrCompile(this); |
12532
9b1cc2628961
Extend the CompilerToVM interface to explicitly avoid compilation and inlining of methods
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
12464
diff
changeset
|
326 } |
9b1cc2628961
Extend the CompilerToVM interface to explicitly avoid compilation and inlining of methods
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
12464
diff
changeset
|
327 |
9b1cc2628961
Extend the CompilerToVM interface to explicitly avoid compilation and inlining of methods
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
12464
diff
changeset
|
328 /** |
9416 | 329 * Returns true if this method is one of the special methods that is ignored by security stack |
330 * walks. | |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14717
diff
changeset
|
331 * |
9416 | 332 * @return true if special method ignored by security stack walks, false otherwise |
333 */ | |
334 public boolean ignoredBySecurityStackWalk() { | |
22582
232c53e17ea0
added CompilerToVM.compilerToVM() for static access to the CompilerToVM instance
Doug Simon <doug.simon@oracle.com>
parents:
22581
diff
changeset
|
335 return compilerToVM().methodIsIgnoredBySecurityStackWalk(this); |
9416 | 336 } |
337 | |
22607
45a23196c66b
Expose hasBalancedMonitors
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22598
diff
changeset
|
338 @Override |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
339 public boolean isClassInitializer() { |
23992
1b8892b4ce9c
lazily cache the name of a HotSpotResolvedJavaMethodImpl
Doug Simon <doug.simon@oracle.com>
parents:
23986
diff
changeset
|
340 return isStatic() && "<clinit>".equals(getName()); |
3733
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 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
343 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
344 public boolean isConstructor() { |
23992
1b8892b4ce9c
lazily cache the name of a HotSpotResolvedJavaMethodImpl
Doug Simon <doug.simon@oracle.com>
parents:
23986
diff
changeset
|
345 return !isStatic() && "<init>".equals(getName()); |
3733
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 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
348 @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:
6525
diff
changeset
|
349 public int getMaxLocals() { |
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
|
350 if (isAbstract() || isNative()) { |
11718
f679f5411fd7
Better handling of methods which have no line number or variable name tables.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11521
diff
changeset
|
351 return 0; |
f679f5411fd7
Better handling of methods which have no line number or variable name tables.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11521
diff
changeset
|
352 } |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
353 HotSpotVMConfig config = config(); |
22542
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
354 return UNSAFE.getChar(getConstMethod() + config.methodMaxLocalsOffset); |
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 |
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:
6525
diff
changeset
|
358 public int getMaxStackSize() { |
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
|
359 if (isAbstract() || isNative()) { |
11718
f679f5411fd7
Better handling of methods which have no line number or variable name tables.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11521
diff
changeset
|
360 return 0; |
f679f5411fd7
Better handling of methods which have no line number or variable name tables.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11521
diff
changeset
|
361 } |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
362 HotSpotVMConfig config = config(); |
22542
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
363 return config.extraStackEntries + UNSAFE.getChar(getConstMethod() + config.constMethodMaxStackOffset); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
364 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
365 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
366 @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:
6525
diff
changeset
|
367 public StackTraceElement asStackTraceElement(int bci) { |
14105 | 368 if (bci < 0 || bci >= getCodeSize()) { |
5250
0f6f647e8a96
bug fix: can only use HotSpot code for constructing a StackTraceElement when the bci is valid
Doug Simon <doug.simon@oracle.com>
parents:
5247
diff
changeset
|
369 // HotSpot code can only construct stack trace elements for valid bcis |
22582
232c53e17ea0
added CompilerToVM.compilerToVM() for static access to the CompilerToVM instance
Doug Simon <doug.simon@oracle.com>
parents:
22581
diff
changeset
|
370 StackTraceElement ste = compilerToVM().getStackTraceElement(this, 0); |
5250
0f6f647e8a96
bug fix: can only use HotSpot code for constructing a StackTraceElement when the bci is valid
Doug Simon <doug.simon@oracle.com>
parents:
5247
diff
changeset
|
371 return new StackTraceElement(ste.getClassName(), ste.getMethodName(), ste.getFileName(), -1); |
0f6f647e8a96
bug fix: can only use HotSpot code for constructing a StackTraceElement when the bci is valid
Doug Simon <doug.simon@oracle.com>
parents:
5247
diff
changeset
|
372 } |
22582
232c53e17ea0
added CompilerToVM.compilerToVM() for static access to the CompilerToVM instance
Doug Simon <doug.simon@oracle.com>
parents:
22581
diff
changeset
|
373 return compilerToVM().getStackTraceElement(this, bci); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
374 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
375 |
18323
301c5e3d683a
removed *Impl types in signatures of Remote interfaces
Doug Simon <doug.simon@oracle.com>
parents:
18293
diff
changeset
|
376 public ResolvedJavaMethod uniqueConcreteMethod(HotSpotResolvedObjectType receiver) { |
16184
8fde32ece68e
use receiver type in findUniqueConcreteMethod
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15843
diff
changeset
|
377 if (receiver.isInterface()) { |
13373
430c9f08728d
moved most CompilerToVM.getUniqueConcreteMethod logic up to Java and replace getUniqueConcreteMethod with findUniqueConcreteMethod
twisti
parents:
13306
diff
changeset
|
378 // Cannot trust interfaces. Because of: |
430c9f08728d
moved most CompilerToVM.getUniqueConcreteMethod logic up to Java and replace getUniqueConcreteMethod with findUniqueConcreteMethod
twisti
parents:
13306
diff
changeset
|
379 // interface I { void foo(); } |
430c9f08728d
moved most CompilerToVM.getUniqueConcreteMethod logic up to Java and replace getUniqueConcreteMethod with findUniqueConcreteMethod
twisti
parents:
13306
diff
changeset
|
380 // class A { public void foo() {} } |
430c9f08728d
moved most CompilerToVM.getUniqueConcreteMethod logic up to Java and replace getUniqueConcreteMethod with findUniqueConcreteMethod
twisti
parents:
13306
diff
changeset
|
381 // class B extends A implements I { } |
430c9f08728d
moved most CompilerToVM.getUniqueConcreteMethod logic up to Java and replace getUniqueConcreteMethod with findUniqueConcreteMethod
twisti
parents:
13306
diff
changeset
|
382 // class C extends B { public void foo() { } } |
430c9f08728d
moved most CompilerToVM.getUniqueConcreteMethod logic up to Java and replace getUniqueConcreteMethod with findUniqueConcreteMethod
twisti
parents:
13306
diff
changeset
|
383 // class D extends B { } |
430c9f08728d
moved most CompilerToVM.getUniqueConcreteMethod logic up to Java and replace getUniqueConcreteMethod with findUniqueConcreteMethod
twisti
parents:
13306
diff
changeset
|
384 // Would lead to identify C.foo() as the unique concrete method for I.foo() without |
430c9f08728d
moved most CompilerToVM.getUniqueConcreteMethod logic up to Java and replace getUniqueConcreteMethod with findUniqueConcreteMethod
twisti
parents:
13306
diff
changeset
|
385 // seeing A.foo(). |
430c9f08728d
moved most CompilerToVM.getUniqueConcreteMethod logic up to Java and replace getUniqueConcreteMethod with findUniqueConcreteMethod
twisti
parents:
13306
diff
changeset
|
386 return null; |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
387 } |
22566
94a604f431d3
CHA with default methods is broken
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22556
diff
changeset
|
388 if (this.isDefault()) { |
94a604f431d3
CHA with default methods is broken
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22556
diff
changeset
|
389 // CHA for default methods doesn't work and may crash the VM |
94a604f431d3
CHA with default methods is broken
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22556
diff
changeset
|
390 return null; |
94a604f431d3
CHA with default methods is broken
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22556
diff
changeset
|
391 } |
22582
232c53e17ea0
added CompilerToVM.compilerToVM() for static access to the CompilerToVM instance
Doug Simon <doug.simon@oracle.com>
parents:
22581
diff
changeset
|
392 return compilerToVM().findUniqueConcreteMethod(((HotSpotResolvedObjectTypeImpl) receiver), this); |
3733
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 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
395 @Override |
7676
ca9061b6694c
getMethodDescriptor does not need to be in the Signature interface
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7530
diff
changeset
|
396 public HotSpotSignature getSignature() { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
397 return signature; |
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 |
14107
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
400 /** |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
401 * Gets the value of {@code Method::_code}. |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14717
diff
changeset
|
402 * |
14107
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
403 * @return the value of {@code Method::_code} |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
404 */ |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
405 private long getCompiledCode() { |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
406 HotSpotVMConfig config = config(); |
22542
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
407 return UNSAFE.getAddress(metaspaceMethod + config.methodCodeOffset); |
14107
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
408 } |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
409 |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
410 /** |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
411 * Returns whether this method has compiled code. |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14717
diff
changeset
|
412 * |
14107
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
413 * @return true if this method has compiled code, false otherwise |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
414 */ |
10639
08e06d4a9e73
Removed API to access method invocation count from Graal.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
10056
diff
changeset
|
415 public boolean hasCompiledCode() { |
14107
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
416 return getCompiledCode() != 0L; |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
417 } |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
418 |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
419 /** |
14607 | 420 * @param level |
421 * @return true if the currently installed code was generated at {@code level}. | |
14107
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
422 */ |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
423 public boolean hasCompiledCodeAtLevel(int level) { |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
424 long compiledCode = getCompiledCode(); |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
425 if (compiledCode != 0) { |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
426 return UNSAFE.getInt(compiledCode + config().nmethodCompLevelOffset) == level; |
14107
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
427 } |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
428 return false; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
429 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
430 |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4220
diff
changeset
|
431 @Override |
21630
9cc3571ef51d
Add getProfilingInfo(boolean includeNormal, boolean includeOSR) to ResolvedJavaMethod
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21629
diff
changeset
|
432 public ProfilingInfo getProfilingInfo(boolean includeNormal, boolean includeOSR) { |
5722
cdc3c0776f9f
removed mechanism for persisting profile information
Doug Simon <doug.simon@oracle.com>
parents:
5721
diff
changeset
|
433 ProfilingInfo info; |
5346
4c3d953f8131
added mechanism (enabled by -G:PICache and -G:PiFilter) for saving/loading method profiling info to/from disk
Doug Simon <doug.simon@oracle.com>
parents:
5344
diff
changeset
|
434 |
22758
a130b51efb07
removed @Option mechanism from JVMCI (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
22710
diff
changeset
|
435 if (methodData == null) { |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
436 long metaspaceMethodData = UNSAFE.getAddress(metaspaceMethod + config().methodDataOffset); |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
437 if (metaspaceMethodData != 0) { |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22421
diff
changeset
|
438 methodData = new HotSpotMethodData(metaspaceMethodData, this); |
23306
7b09dede4552
JVMCI options should not use System.getProperty() directly (JDK-8146820)
Doug Simon <doug.simon@oracle.com>
parents:
22758
diff
changeset
|
439 String methodDataFilter = Option.TraceMethodDataFilter.getString(); |
7b09dede4552
JVMCI options should not use System.getProperty() directly (JDK-8146820)
Doug Simon <doug.simon@oracle.com>
parents:
22758
diff
changeset
|
440 if (methodDataFilter != null && this.format("%H.%n").contains(methodDataFilter)) { |
22371
7d48038267b4
Eliminate jdk.internal.jvmci.debug
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22299
diff
changeset
|
441 System.out.println(methodData.toString()); |
13164
70e6bb85d802
cleaned up HotSpotMethodData tracing a little and enabled it when -Dgraal.traceMethodDataFilter=true
Doug Simon <doug.simon@oracle.com>
parents:
12654
diff
changeset
|
442 } |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6588
diff
changeset
|
443 } |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4220
diff
changeset
|
444 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
445 |
5346
4c3d953f8131
added mechanism (enabled by -G:PICache and -G:PiFilter) for saving/loading method profiling info to/from disk
Doug Simon <doug.simon@oracle.com>
parents:
5344
diff
changeset
|
446 if (methodData == null || (!methodData.hasNormalData() && !methodData.hasExtraData())) { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7483
diff
changeset
|
447 // Be optimistic and return false for exceptionSeen. A methodDataOop is allocated in |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7483
diff
changeset
|
448 // case of a deoptimization. |
8610
5407d1dd6450
API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents:
8217
diff
changeset
|
449 info = DefaultProfilingInfo.get(TriState.FALSE); |
4446 | 450 } else { |
13217
210f58e992a1
Use separate method profile for OSR compilations.
Roland Schatz <roland.schatz@oracle.com>
parents:
13214
diff
changeset
|
451 info = new HotSpotProfilingInfo(methodData, this, includeNormal, includeOSR); |
4446 | 452 } |
5346
4c3d953f8131
added mechanism (enabled by -G:PICache and -G:PiFilter) for saving/loading method profiling info to/from disk
Doug Simon <doug.simon@oracle.com>
parents:
5344
diff
changeset
|
453 return info; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
454 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
455 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
456 @Override |
8611
6c4db417385a
added API to reset the profiling information for a method
Christian Haeubl <haeubl@ssw.jku.at>
parents:
8610
diff
changeset
|
457 public void reprofile() { |
22582
232c53e17ea0
added CompilerToVM.compilerToVM() for static access to the CompilerToVM instance
Doug Simon <doug.simon@oracle.com>
parents:
22581
diff
changeset
|
458 compilerToVM().reprofile(this); |
8611
6c4db417385a
added API to reset the profiling information for a method
Christian Haeubl <haeubl@ssw.jku.at>
parents:
8610
diff
changeset
|
459 } |
6c4db417385a
added API to reset the profiling information for a method
Christian Haeubl <haeubl@ssw.jku.at>
parents:
8610
diff
changeset
|
460 |
6c4db417385a
added API to reset the profiling information for a method
Christian Haeubl <haeubl@ssw.jku.at>
parents:
8610
diff
changeset
|
461 @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:
5536
diff
changeset
|
462 public ConstantPool getConstantPool() { |
13259
b16fb0b7479b
every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents:
13254
diff
changeset
|
463 return constantPool; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
464 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
465 |
5039
f3d2447db2d9
added detection for endless recompilation
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5003
diff
changeset
|
466 @Override |
23789
0cb263db490f
use MethodParameters attribute instead of depending on -g option for sanity checks (JDK-8168915)
Doug Simon <doug.simon@oracle.com>
parents:
23757
diff
changeset
|
467 public Parameter[] getParameters() { |
0cb263db490f
use MethodParameters attribute instead of depending on -g option for sanity checks (JDK-8168915)
Doug Simon <doug.simon@oracle.com>
parents:
23757
diff
changeset
|
468 Executable javaMethod = toJava(); |
0cb263db490f
use MethodParameters attribute instead of depending on -g option for sanity checks (JDK-8168915)
Doug Simon <doug.simon@oracle.com>
parents:
23757
diff
changeset
|
469 if (javaMethod == null) { |
0cb263db490f
use MethodParameters attribute instead of depending on -g option for sanity checks (JDK-8168915)
Doug Simon <doug.simon@oracle.com>
parents:
23757
diff
changeset
|
470 return null; |
0cb263db490f
use MethodParameters attribute instead of depending on -g option for sanity checks (JDK-8168915)
Doug Simon <doug.simon@oracle.com>
parents:
23757
diff
changeset
|
471 } |
0cb263db490f
use MethodParameters attribute instead of depending on -g option for sanity checks (JDK-8168915)
Doug Simon <doug.simon@oracle.com>
parents:
23757
diff
changeset
|
472 |
0cb263db490f
use MethodParameters attribute instead of depending on -g option for sanity checks (JDK-8168915)
Doug Simon <doug.simon@oracle.com>
parents:
23757
diff
changeset
|
473 java.lang.reflect.Parameter[] javaParameters = javaMethod.getParameters(); |
0cb263db490f
use MethodParameters attribute instead of depending on -g option for sanity checks (JDK-8168915)
Doug Simon <doug.simon@oracle.com>
parents:
23757
diff
changeset
|
474 Parameter[] res = new Parameter[javaParameters.length]; |
0cb263db490f
use MethodParameters attribute instead of depending on -g option for sanity checks (JDK-8168915)
Doug Simon <doug.simon@oracle.com>
parents:
23757
diff
changeset
|
475 for (int i = 0; i < res.length; i++) { |
0cb263db490f
use MethodParameters attribute instead of depending on -g option for sanity checks (JDK-8168915)
Doug Simon <doug.simon@oracle.com>
parents:
23757
diff
changeset
|
476 java.lang.reflect.Parameter src = javaParameters[i]; |
23790
224f43824e2b
incomplete API to MethodParameters attribute (JDK-8169331)
Doug Simon <doug.simon@oracle.com>
parents:
23789
diff
changeset
|
477 String paramName = src.isNamePresent() ? src.getName() : null; |
224f43824e2b
incomplete API to MethodParameters attribute (JDK-8169331)
Doug Simon <doug.simon@oracle.com>
parents:
23789
diff
changeset
|
478 res[i] = new Parameter(paramName, src.getModifiers(), this, i); |
23789
0cb263db490f
use MethodParameters attribute instead of depending on -g option for sanity checks (JDK-8168915)
Doug Simon <doug.simon@oracle.com>
parents:
23757
diff
changeset
|
479 } |
0cb263db490f
use MethodParameters attribute instead of depending on -g option for sanity checks (JDK-8168915)
Doug Simon <doug.simon@oracle.com>
parents:
23757
diff
changeset
|
480 return res; |
0cb263db490f
use MethodParameters attribute instead of depending on -g option for sanity checks (JDK-8168915)
Doug Simon <doug.simon@oracle.com>
parents:
23757
diff
changeset
|
481 } |
0cb263db490f
use MethodParameters attribute instead of depending on -g option for sanity checks (JDK-8168915)
Doug Simon <doug.simon@oracle.com>
parents:
23757
diff
changeset
|
482 |
0cb263db490f
use MethodParameters attribute instead of depending on -g option for sanity checks (JDK-8168915)
Doug Simon <doug.simon@oracle.com>
parents:
23757
diff
changeset
|
483 @Override |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
484 public Annotation[][] getParameterAnnotations() { |
22704
ce4bec6db0b2
narrow type of HotSpotResolvedJavaMethodImpl.toJavaCache to Executable
Andreas Woess <andreas.woess@oracle.com>
parents:
22672
diff
changeset
|
485 Executable javaMethod = toJava(); |
23793
e1e98e0ca9b8
ResolvedJavaMethod.getParameterAnnotations cannot return null
Doug Simon <doug.simon@oracle.com>
parents:
23790
diff
changeset
|
486 return javaMethod == null ? new Annotation[signature.getParameterCount(false)][0] : javaMethod.getParameterAnnotations(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
487 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
488 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
489 @Override |
17125
ce1b6453c544
Add ResolvedJavaMethod.getAnnotations
Christian Wimmer <christian.wimmer@oracle.com>
parents:
16615
diff
changeset
|
490 public Annotation[] getAnnotations() { |
22704
ce4bec6db0b2
narrow type of HotSpotResolvedJavaMethodImpl.toJavaCache to Executable
Andreas Woess <andreas.woess@oracle.com>
parents:
22672
diff
changeset
|
491 Executable javaMethod = toJava(); |
23382
c9915c22a5a9
Make all get[Declared]Annotation methods look the same.
Roland Schatz <roland.schatz@oracle.com>
parents:
23378
diff
changeset
|
492 if (javaMethod != null) { |
c9915c22a5a9
Make all get[Declared]Annotation methods look the same.
Roland Schatz <roland.schatz@oracle.com>
parents:
23378
diff
changeset
|
493 return javaMethod.getAnnotations(); |
c9915c22a5a9
Make all get[Declared]Annotation methods look the same.
Roland Schatz <roland.schatz@oracle.com>
parents:
23378
diff
changeset
|
494 } |
c9915c22a5a9
Make all get[Declared]Annotation methods look the same.
Roland Schatz <roland.schatz@oracle.com>
parents:
23378
diff
changeset
|
495 return new Annotation[0]; |
17125
ce1b6453c544
Add ResolvedJavaMethod.getAnnotations
Christian Wimmer <christian.wimmer@oracle.com>
parents:
16615
diff
changeset
|
496 } |
ce1b6453c544
Add ResolvedJavaMethod.getAnnotations
Christian Wimmer <christian.wimmer@oracle.com>
parents:
16615
diff
changeset
|
497 |
ce1b6453c544
Add ResolvedJavaMethod.getAnnotations
Christian Wimmer <christian.wimmer@oracle.com>
parents:
16615
diff
changeset
|
498 @Override |
23376
ae27c683c128
Make ResolvedJava* types extend AnnotatedElement.
Roland Schatz <roland.schatz@oracle.com>
parents:
23312
diff
changeset
|
499 public Annotation[] getDeclaredAnnotations() { |
ae27c683c128
Make ResolvedJava* types extend AnnotatedElement.
Roland Schatz <roland.schatz@oracle.com>
parents:
23312
diff
changeset
|
500 Executable javaMethod = toJava(); |
23382
c9915c22a5a9
Make all get[Declared]Annotation methods look the same.
Roland Schatz <roland.schatz@oracle.com>
parents:
23378
diff
changeset
|
501 if (javaMethod != null) { |
c9915c22a5a9
Make all get[Declared]Annotation methods look the same.
Roland Schatz <roland.schatz@oracle.com>
parents:
23378
diff
changeset
|
502 return javaMethod.getDeclaredAnnotations(); |
c9915c22a5a9
Make all get[Declared]Annotation methods look the same.
Roland Schatz <roland.schatz@oracle.com>
parents:
23378
diff
changeset
|
503 } |
c9915c22a5a9
Make all get[Declared]Annotation methods look the same.
Roland Schatz <roland.schatz@oracle.com>
parents:
23378
diff
changeset
|
504 return new Annotation[0]; |
23376
ae27c683c128
Make ResolvedJava* types extend AnnotatedElement.
Roland Schatz <roland.schatz@oracle.com>
parents:
23312
diff
changeset
|
505 } |
ae27c683c128
Make ResolvedJava* types extend AnnotatedElement.
Roland Schatz <roland.schatz@oracle.com>
parents:
23312
diff
changeset
|
506 |
ae27c683c128
Make ResolvedJava* types extend AnnotatedElement.
Roland Schatz <roland.schatz@oracle.com>
parents:
23312
diff
changeset
|
507 @Override |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
508 public <T extends Annotation> T getAnnotation(Class<T> annotationClass) { |
22704
ce4bec6db0b2
narrow type of HotSpotResolvedJavaMethodImpl.toJavaCache to Executable
Andreas Woess <andreas.woess@oracle.com>
parents:
22672
diff
changeset
|
509 Executable javaMethod = toJava(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
510 return javaMethod == null ? null : javaMethod.getAnnotation(annotationClass); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
511 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
512 |
23749
d6bd0b9cd0b6
remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents:
23734
diff
changeset
|
513 public boolean isBridge() { |
d6bd0b9cd0b6
remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents:
23734
diff
changeset
|
514 return (BRIDGE & getModifiers()) != 0; |
d6bd0b9cd0b6
remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents:
23734
diff
changeset
|
515 } |
d6bd0b9cd0b6
remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents:
23734
diff
changeset
|
516 |
d6bd0b9cd0b6
remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents:
23734
diff
changeset
|
517 @Override |
d6bd0b9cd0b6
remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents:
23734
diff
changeset
|
518 public boolean isSynthetic() { |
d6bd0b9cd0b6
remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents:
23734
diff
changeset
|
519 return (SYNTHETIC & getModifiers()) != 0; |
d6bd0b9cd0b6
remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents:
23734
diff
changeset
|
520 } |
d6bd0b9cd0b6
remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents:
23734
diff
changeset
|
521 |
d6bd0b9cd0b6
remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents:
23734
diff
changeset
|
522 public boolean isVarArgs() { |
d6bd0b9cd0b6
remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents:
23734
diff
changeset
|
523 return (VARARGS & getModifiers()) != 0; |
d6bd0b9cd0b6
remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents:
23734
diff
changeset
|
524 } |
d6bd0b9cd0b6
remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents:
23734
diff
changeset
|
525 |
13183
0266ac3b26c0
JDK8: added support for default methods as well as interfaces containing static and private methods
Doug Simon <doug.simon@oracle.com>
parents:
13164
diff
changeset
|
526 public boolean isDefault() { |
0266ac3b26c0
JDK8: added support for default methods as well as interfaces containing static and private methods
Doug Simon <doug.simon@oracle.com>
parents:
13164
diff
changeset
|
527 if (isConstructor()) { |
0266ac3b26c0
JDK8: added support for default methods as well as interfaces containing static and private methods
Doug Simon <doug.simon@oracle.com>
parents:
13164
diff
changeset
|
528 return false; |
0266ac3b26c0
JDK8: added support for default methods as well as interfaces containing static and private methods
Doug Simon <doug.simon@oracle.com>
parents:
13164
diff
changeset
|
529 } |
0266ac3b26c0
JDK8: added support for default methods as well as interfaces containing static and private methods
Doug Simon <doug.simon@oracle.com>
parents:
13164
diff
changeset
|
530 // Copied from java.lang.Method.isDefault() |
0266ac3b26c0
JDK8: added support for default methods as well as interfaces containing static and private methods
Doug Simon <doug.simon@oracle.com>
parents:
13164
diff
changeset
|
531 int mask = Modifier.ABSTRACT | Modifier.PUBLIC | Modifier.STATIC; |
0266ac3b26c0
JDK8: added support for default methods as well as interfaces containing static and private methods
Doug Simon <doug.simon@oracle.com>
parents:
13164
diff
changeset
|
532 return ((getModifiers() & mask) == Modifier.PUBLIC) && getDeclaringClass().isInterface(); |
0266ac3b26c0
JDK8: added support for default methods as well as interfaces containing static and private methods
Doug Simon <doug.simon@oracle.com>
parents:
13164
diff
changeset
|
533 } |
0266ac3b26c0
JDK8: added support for default methods as well as interfaces containing static and private methods
Doug Simon <doug.simon@oracle.com>
parents:
13164
diff
changeset
|
534 |
9984
f3330a4487eb
added ResolvedJava[Field|Method].isSynthetic()
Doug Simon <doug.simon@oracle.com>
parents:
9928
diff
changeset
|
535 @Override |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
536 public Type[] getGenericParameterTypes() { |
22704
ce4bec6db0b2
narrow type of HotSpotResolvedJavaMethodImpl.toJavaCache to Executable
Andreas Woess <andreas.woess@oracle.com>
parents:
22672
diff
changeset
|
537 Executable javaMethod = toJava(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
538 return javaMethod == null ? null : javaMethod.getGenericParameterTypes(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
539 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
540 |
7053
014727292ae0
removed more usages of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents:
7037
diff
changeset
|
541 public Class<?>[] signatureToTypes() { |
014727292ae0
removed more usages of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents:
7037
diff
changeset
|
542 Signature sig = getSignature(); |
014727292ae0
removed more usages of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents:
7037
diff
changeset
|
543 int count = sig.getParameterCount(false); |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7483
diff
changeset
|
544 Class<?>[] result = new Class<?>[count]; |
7053
014727292ae0
removed more usages of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents:
7037
diff
changeset
|
545 for (int i = 0; i < result.length; ++i) { |
19451
2452e881fad5
Do not eagerly resolve types in lookupType.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18867
diff
changeset
|
546 JavaType parameterType = sig.getParameterType(i, holder); |
2452e881fad5
Do not eagerly resolve types in lookupType.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18867
diff
changeset
|
547 HotSpotResolvedJavaType resolvedParameterType = (HotSpotResolvedJavaType) parameterType.resolve(holder); |
2452e881fad5
Do not eagerly resolve types in lookupType.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18867
diff
changeset
|
548 result[i] = resolvedParameterType.mirror(); |
7053
014727292ae0
removed more usages of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents:
7037
diff
changeset
|
549 } |
014727292ae0
removed more usages of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents:
7037
diff
changeset
|
550 return result; |
014727292ae0
removed more usages of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents:
7037
diff
changeset
|
551 } |
014727292ae0
removed more usages of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents:
7037
diff
changeset
|
552 |
23789
0cb263db490f
use MethodParameters attribute instead of depending on -g option for sanity checks (JDK-8168915)
Doug Simon <doug.simon@oracle.com>
parents:
23757
diff
changeset
|
553 private static Method searchMethods(Method[] methods, String name, Class<?> returnType, Class<?>[] parameterTypes) { |
0cb263db490f
use MethodParameters attribute instead of depending on -g option for sanity checks (JDK-8168915)
Doug Simon <doug.simon@oracle.com>
parents:
23757
diff
changeset
|
554 for (Method m : methods) { |
0cb263db490f
use MethodParameters attribute instead of depending on -g option for sanity checks (JDK-8168915)
Doug Simon <doug.simon@oracle.com>
parents:
23757
diff
changeset
|
555 if (m.getName().equals(name) && returnType.equals(m.getReturnType()) && Arrays.equals(m.getParameterTypes(), parameterTypes)) { |
0cb263db490f
use MethodParameters attribute instead of depending on -g option for sanity checks (JDK-8168915)
Doug Simon <doug.simon@oracle.com>
parents:
23757
diff
changeset
|
556 return m; |
0cb263db490f
use MethodParameters attribute instead of depending on -g option for sanity checks (JDK-8168915)
Doug Simon <doug.simon@oracle.com>
parents:
23757
diff
changeset
|
557 } |
0cb263db490f
use MethodParameters attribute instead of depending on -g option for sanity checks (JDK-8168915)
Doug Simon <doug.simon@oracle.com>
parents:
23757
diff
changeset
|
558 } |
0cb263db490f
use MethodParameters attribute instead of depending on -g option for sanity checks (JDK-8168915)
Doug Simon <doug.simon@oracle.com>
parents:
23757
diff
changeset
|
559 return null; |
0cb263db490f
use MethodParameters attribute instead of depending on -g option for sanity checks (JDK-8168915)
Doug Simon <doug.simon@oracle.com>
parents:
23757
diff
changeset
|
560 } |
0cb263db490f
use MethodParameters attribute instead of depending on -g option for sanity checks (JDK-8168915)
Doug Simon <doug.simon@oracle.com>
parents:
23757
diff
changeset
|
561 |
22704
ce4bec6db0b2
narrow type of HotSpotResolvedJavaMethodImpl.toJavaCache to Executable
Andreas Woess <andreas.woess@oracle.com>
parents:
22672
diff
changeset
|
562 private Executable toJava() { |
15828
34c99f83795b
Cache result of toJava and toJavaConstructor, since it is an expensive operation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15731
diff
changeset
|
563 if (toJavaCache != null) { |
22704
ce4bec6db0b2
narrow type of HotSpotResolvedJavaMethodImpl.toJavaCache to Executable
Andreas Woess <andreas.woess@oracle.com>
parents:
22672
diff
changeset
|
564 return toJavaCache; |
15828
34c99f83795b
Cache result of toJava and toJavaConstructor, since it is an expensive operation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15731
diff
changeset
|
565 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
566 try { |
22704
ce4bec6db0b2
narrow type of HotSpotResolvedJavaMethodImpl.toJavaCache to Executable
Andreas Woess <andreas.woess@oracle.com>
parents:
22672
diff
changeset
|
567 Class<?>[] parameterTypes = signatureToTypes(); |
23789
0cb263db490f
use MethodParameters attribute instead of depending on -g option for sanity checks (JDK-8168915)
Doug Simon <doug.simon@oracle.com>
parents:
23757
diff
changeset
|
568 Class<?> returnType = ((HotSpotResolvedJavaType) getSignature().getReturnType(holder).resolve(holder)).mirror(); |
0cb263db490f
use MethodParameters attribute instead of depending on -g option for sanity checks (JDK-8168915)
Doug Simon <doug.simon@oracle.com>
parents:
23757
diff
changeset
|
569 |
0cb263db490f
use MethodParameters attribute instead of depending on -g option for sanity checks (JDK-8168915)
Doug Simon <doug.simon@oracle.com>
parents:
23757
diff
changeset
|
570 Executable result; |
0cb263db490f
use MethodParameters attribute instead of depending on -g option for sanity checks (JDK-8168915)
Doug Simon <doug.simon@oracle.com>
parents:
23757
diff
changeset
|
571 if (isConstructor()) { |
0cb263db490f
use MethodParameters attribute instead of depending on -g option for sanity checks (JDK-8168915)
Doug Simon <doug.simon@oracle.com>
parents:
23757
diff
changeset
|
572 result = holder.mirror().getDeclaredConstructor(parameterTypes); |
0cb263db490f
use MethodParameters attribute instead of depending on -g option for sanity checks (JDK-8168915)
Doug Simon <doug.simon@oracle.com>
parents:
23757
diff
changeset
|
573 } else { |
0cb263db490f
use MethodParameters attribute instead of depending on -g option for sanity checks (JDK-8168915)
Doug Simon <doug.simon@oracle.com>
parents:
23757
diff
changeset
|
574 // Do not use Method.getDeclaredMethod() as it can return a bridge method |
0cb263db490f
use MethodParameters attribute instead of depending on -g option for sanity checks (JDK-8168915)
Doug Simon <doug.simon@oracle.com>
parents:
23757
diff
changeset
|
575 // when this.isBridge() is false and vice versa. |
23992
1b8892b4ce9c
lazily cache the name of a HotSpotResolvedJavaMethodImpl
Doug Simon <doug.simon@oracle.com>
parents:
23986
diff
changeset
|
576 result = searchMethods(holder.mirror().getDeclaredMethods(), getName(), returnType, parameterTypes); |
23789
0cb263db490f
use MethodParameters attribute instead of depending on -g option for sanity checks (JDK-8168915)
Doug Simon <doug.simon@oracle.com>
parents:
23757
diff
changeset
|
577 } |
15828
34c99f83795b
Cache result of toJava and toJavaConstructor, since it is an expensive operation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15731
diff
changeset
|
578 toJavaCache = result; |
34c99f83795b
Cache result of toJava and toJavaConstructor, since it is an expensive operation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15731
diff
changeset
|
579 return result; |
19967
a5ee3e32dc62
Don't let NoClassDefFoundError leak when reflectively looking up Method
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19822
diff
changeset
|
580 } catch (NoSuchMethodException | NoClassDefFoundError e) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
581 return null; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
582 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
583 } |
4296
d089b71a5237
Add possibility to disable inlining for specific methods.
Andreas Woess <andreas.woess@jku.at>
parents:
4220
diff
changeset
|
584 |
d089b71a5237
Add possibility to disable inlining for specific methods.
Andreas Woess <andreas.woess@jku.at>
parents:
4220
diff
changeset
|
585 @Override |
d089b71a5237
Add possibility to disable inlining for specific methods.
Andreas Woess <andreas.woess@jku.at>
parents:
4220
diff
changeset
|
586 public boolean canBeInlined() { |
23986
6d2c72b822b0
add ResolvedJavaMethod.hasNeverInlineDirective (JDK-8172733)
Doug Simon <doug.simon@oracle.com>
parents:
23793
diff
changeset
|
587 if (hasNeverInlineDirective()) { |
9691 | 588 return false; |
589 } | |
23986
6d2c72b822b0
add ResolvedJavaMethod.hasNeverInlineDirective (JDK-8172733)
Doug Simon <doug.simon@oracle.com>
parents:
23793
diff
changeset
|
590 return compilerToVM().isCompilable(this); |
6d2c72b822b0
add ResolvedJavaMethod.hasNeverInlineDirective (JDK-8172733)
Doug Simon <doug.simon@oracle.com>
parents:
23793
diff
changeset
|
591 } |
6d2c72b822b0
add ResolvedJavaMethod.hasNeverInlineDirective (JDK-8172733)
Doug Simon <doug.simon@oracle.com>
parents:
23793
diff
changeset
|
592 |
6d2c72b822b0
add ResolvedJavaMethod.hasNeverInlineDirective (JDK-8172733)
Doug Simon <doug.simon@oracle.com>
parents:
23793
diff
changeset
|
593 @Override |
6d2c72b822b0
add ResolvedJavaMethod.hasNeverInlineDirective (JDK-8172733)
Doug Simon <doug.simon@oracle.com>
parents:
23793
diff
changeset
|
594 public boolean hasNeverInlineDirective() { |
6d2c72b822b0
add ResolvedJavaMethod.hasNeverInlineDirective (JDK-8172733)
Doug Simon <doug.simon@oracle.com>
parents:
23793
diff
changeset
|
595 return compilerToVM().hasNeverInlineDirective(this); |
13953
d587baa55dd7
Add shouldBeInlined method to ResolvedJavaMethod, implement it for HotSpot and use it in the inlining phase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13818
diff
changeset
|
596 } |
d587baa55dd7
Add shouldBeInlined method to ResolvedJavaMethod, implement it for HotSpot and use it in the inlining phase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13818
diff
changeset
|
597 |
d587baa55dd7
Add shouldBeInlined method to ResolvedJavaMethod, implement it for HotSpot and use it in the inlining phase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13818
diff
changeset
|
598 @Override |
d587baa55dd7
Add shouldBeInlined method to ResolvedJavaMethod, implement it for HotSpot and use it in the inlining phase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13818
diff
changeset
|
599 public boolean shouldBeInlined() { |
14717 | 600 if (isForceInline()) { |
13953
d587baa55dd7
Add shouldBeInlined method to ResolvedJavaMethod, implement it for HotSpot and use it in the inlining phase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13818
diff
changeset
|
601 return true; |
d587baa55dd7
Add shouldBeInlined method to ResolvedJavaMethod, implement it for HotSpot and use it in the inlining phase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13818
diff
changeset
|
602 } |
22582
232c53e17ea0
added CompilerToVM.compilerToVM() for static access to the CompilerToVM instance
Doug Simon <doug.simon@oracle.com>
parents:
22581
diff
changeset
|
603 return compilerToVM().shouldInlineMethod(this); |
4319
3c21eee8ab4d
Add installMethodCallback() to HotSpotRuntime.
Andreas Woess <andreas.woess@jku.at>
parents:
4296
diff
changeset
|
604 } |
4296
d089b71a5237
Add possibility to disable inlining for specific methods.
Andreas Woess <andreas.woess@jku.at>
parents:
4220
diff
changeset
|
605 |
7310
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
606 @Override |
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
607 public LineNumberTable getLineNumberTable() { |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
608 final boolean hasLineNumberTable = (getConstMethodFlags() & config().constMethodHasLineNumberTable) != 0; |
14105 | 609 if (!hasLineNumberTable) { |
11718
f679f5411fd7
Better handling of methods which have no line number or variable name tables.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11521
diff
changeset
|
610 return null; |
f679f5411fd7
Better handling of methods which have no line number or variable name tables.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11521
diff
changeset
|
611 } |
14105 | 612 |
22582
232c53e17ea0
added CompilerToVM.compilerToVM() for static access to the CompilerToVM instance
Doug Simon <doug.simon@oracle.com>
parents:
22581
diff
changeset
|
613 long[] values = compilerToVM().getLineNumberTable(this); |
22420
e3d9e0f9b50c
cleaned up and added more javadoc to CompilerToVM (JDK-8133194)
Doug Simon <doug.simon@oracle.com>
parents:
22414
diff
changeset
|
614 if (values == null || values.length == 0) { |
16387
2bd6dbbd7842
treat empty LineNumberTable as non-existent
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16184
diff
changeset
|
615 // Empty table so treat is as non-existent |
2bd6dbbd7842
treat empty LineNumberTable as non-existent
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16184
diff
changeset
|
616 return null; |
2bd6dbbd7842
treat empty LineNumberTable as non-existent
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16184
diff
changeset
|
617 } |
7310
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
618 assert values.length % 2 == 0; |
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
619 int[] bci = new int[values.length / 2]; |
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
620 int[] line = new int[values.length / 2]; |
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
621 |
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
622 for (int i = 0; i < values.length / 2; i++) { |
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
623 bci[i] = (int) values[i * 2]; |
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
624 line[i] = (int) values[i * 2 + 1]; |
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
625 } |
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
626 |
23393
1d4ce2d19e52
clean up and minimize JVMCI (JDK-8156835)
Doug Simon <doug.simon@oracle.com>
parents:
23392
diff
changeset
|
627 return new LineNumberTable(line, bci); |
7310
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
628 } |
79a7b761755c
Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7212
diff
changeset
|
629 |
7786
8bbbde9d0a52
extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
7676
diff
changeset
|
630 @Override |
8bbbde9d0a52
extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
7676
diff
changeset
|
631 public LocalVariableTable getLocalVariableTable() { |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
632 final boolean hasLocalVariableTable = (getConstMethodFlags() & config().constMethodHasLocalVariableTable) != 0; |
14105 | 633 if (!hasLocalVariableTable) { |
11718
f679f5411fd7
Better handling of methods which have no line number or variable name tables.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11521
diff
changeset
|
634 return null; |
f679f5411fd7
Better handling of methods which have no line number or variable name tables.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11521
diff
changeset
|
635 } |
13306
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
636 |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
637 HotSpotVMConfig config = config(); |
22582
232c53e17ea0
added CompilerToVM.compilerToVM() for static access to the CompilerToVM instance
Doug Simon <doug.simon@oracle.com>
parents:
22581
diff
changeset
|
638 long localVariableTableElement = compilerToVM().getLocalVariableTableStart(this); |
232c53e17ea0
added CompilerToVM.compilerToVM() for static access to the CompilerToVM instance
Doug Simon <doug.simon@oracle.com>
parents:
22581
diff
changeset
|
639 final int localVariableTableLength = compilerToVM().getLocalVariableTableLength(this); |
13306
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
640 Local[] locals = new Local[localVariableTableLength]; |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
641 |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
642 for (int i = 0; i < localVariableTableLength; i++) { |
22542
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
643 final int startBci = UNSAFE.getChar(localVariableTableElement + config.localVariableTableElementStartBciOffset); |
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
644 final int endBci = startBci + UNSAFE.getChar(localVariableTableElement + config.localVariableTableElementLengthOffset); |
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
645 final int nameCpIndex = UNSAFE.getChar(localVariableTableElement + config.localVariableTableElementNameCpIndexOffset); |
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
646 final int typeCpIndex = UNSAFE.getChar(localVariableTableElement + config.localVariableTableElementDescriptorCpIndexOffset); |
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
647 final int slot = UNSAFE.getChar(localVariableTableElement + config.localVariableTableElementSlotOffset); |
13306
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
648 |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
649 String localName = getConstantPool().lookupUtf8(nameCpIndex); |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
650 String localType = getConstantPool().lookupUtf8(typeCpIndex); |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
651 |
23393
1d4ce2d19e52
clean up and minimize JVMCI (JDK-8156835)
Doug Simon <doug.simon@oracle.com>
parents:
23392
diff
changeset
|
652 locals[i] = new Local(localName, runtime().lookupType(localType, holder, false), startBci, endBci, slot); |
13306
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
653 |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
654 // Go to the next LocalVariableTableElement |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
655 localVariableTableElement += config.localVariableTableElementSize; |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
656 } |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
657 |
23393
1d4ce2d19e52
clean up and minimize JVMCI (JDK-8156835)
Doug Simon <doug.simon@oracle.com>
parents:
23392
diff
changeset
|
658 return new LocalVariableTable(locals); |
7786
8bbbde9d0a52
extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
7676
diff
changeset
|
659 } |
8bbbde9d0a52
extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
7676
diff
changeset
|
660 |
6379
ad97777056ec
Checks on vtableEntryOffset to avoid calling to the VM if the holder is not initialized
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5775
diff
changeset
|
661 /** |
12559
ae412befde21
read HotSpotVMConfig fields from HotSpot's vmStructs via annotations
twisti
parents:
12535
diff
changeset
|
662 * Returns the offset of this method into the v-table. The method must have a v-table entry as |
15725
ef6b8d1898e6
Add resolved receiver type to ResolvedJavaMethod.isInVirtualMethodTable in order to be able to do vtable-calls for miranda and default methods
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15722
diff
changeset
|
663 * indicated by {@link #isInVirtualMethodTable(ResolvedJavaType)}, otherwise an exception is |
ef6b8d1898e6
Add resolved receiver type to ResolvedJavaMethod.isInVirtualMethodTable in order to be able to do vtable-calls for miranda and default methods
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15722
diff
changeset
|
664 * thrown. |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14717
diff
changeset
|
665 * |
6379
ad97777056ec
Checks on vtableEntryOffset to avoid calling to the VM if the holder is not initialized
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5775
diff
changeset
|
666 * @return the offset of this method into the v-table |
ad97777056ec
Checks on vtableEntryOffset to avoid calling to the VM if the holder is not initialized
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5775
diff
changeset
|
667 */ |
15725
ef6b8d1898e6
Add resolved receiver type to ResolvedJavaMethod.isInVirtualMethodTable in order to be able to do vtable-calls for miranda and default methods
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15722
diff
changeset
|
668 public int vtableEntryOffset(ResolvedJavaType resolved) { |
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
|
669 if (!isInVirtualMethodTable(resolved)) { |
23392
b3a816d3b844
Backed out changeset: a920338dd4d4
Doug Simon <doug.simon@oracle.com>
parents:
23387
diff
changeset
|
670 throw new JVMCIError("%s does not have a vtable entry in type %s", this, resolved); |
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
|
671 } |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
672 HotSpotVMConfig config = config(); |
18223
17c98fad6980
converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18222
diff
changeset
|
673 final int vtableIndex = getVtableIndex((HotSpotResolvedObjectTypeImpl) resolved); |
23679
b5557b757040
fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents:
23393
diff
changeset
|
674 return config.klassVtableStartOffset + vtableIndex * config.vtableEntrySize + config.vtableEntryMethodOffset; |
5000
b5dc2403c1e7
add option to inline VTable stubs
Lukas Stadler <lukas.stadler@jku.at>
parents:
4600
diff
changeset
|
675 } |
5176
af59b4dfc9e4
compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5115
diff
changeset
|
676 |
9636
ff4e8218d3dd
Remove hasVtableEntry, use isInVirtualMethodTable instead
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9610
diff
changeset
|
677 @Override |
15725
ef6b8d1898e6
Add resolved receiver type to ResolvedJavaMethod.isInVirtualMethodTable in order to be able to do vtable-calls for miranda and default methods
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15722
diff
changeset
|
678 public boolean isInVirtualMethodTable(ResolvedJavaType resolved) { |
18223
17c98fad6980
converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18222
diff
changeset
|
679 if (resolved instanceof HotSpotResolvedObjectTypeImpl) { |
17c98fad6980
converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18222
diff
changeset
|
680 HotSpotResolvedObjectTypeImpl hotspotResolved = (HotSpotResolvedObjectTypeImpl) resolved; |
16615
3812931f9350
Don't read beyond end of known vtable
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16480
diff
changeset
|
681 int vtableIndex = getVtableIndex(hotspotResolved); |
3812931f9350
Don't read beyond end of known vtable
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16480
diff
changeset
|
682 return vtableIndex >= 0 && vtableIndex < hotspotResolved.getVtableLength(); |
3812931f9350
Don't read beyond end of known vtable
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16480
diff
changeset
|
683 } |
3812931f9350
Don't read beyond end of known vtable
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16480
diff
changeset
|
684 return false; |
15725
ef6b8d1898e6
Add resolved receiver type to ResolvedJavaMethod.isInVirtualMethodTable in order to be able to do vtable-calls for miranda and default methods
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15722
diff
changeset
|
685 } |
ef6b8d1898e6
Add resolved receiver type to ResolvedJavaMethod.isInVirtualMethodTable in order to be able to do vtable-calls for miranda and default methods
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15722
diff
changeset
|
686 |
18223
17c98fad6980
converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18222
diff
changeset
|
687 private int getVtableIndex(HotSpotResolvedObjectTypeImpl resolved) { |
15731
7260016882ef
fix assert in HotSpotResolvedJavaMethod.vtableEntryOffset
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15726
diff
changeset
|
688 if (!holder.isLinked()) { |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
689 return config().invalidVtableIndex; |
15731
7260016882ef
fix assert in HotSpotResolvedJavaMethod.vtableEntryOffset
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15726
diff
changeset
|
690 } |
15725
ef6b8d1898e6
Add resolved receiver type to ResolvedJavaMethod.isInVirtualMethodTable in order to be able to do vtable-calls for miranda and default methods
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15722
diff
changeset
|
691 if (holder.isInterface()) { |
16615
3812931f9350
Don't read beyond end of known vtable
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16480
diff
changeset
|
692 if (resolved.isInterface()) { |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
693 return config().invalidVtableIndex; |
15725
ef6b8d1898e6
Add resolved receiver type to ResolvedJavaMethod.isInVirtualMethodTable in order to be able to do vtable-calls for miranda and default methods
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15722
diff
changeset
|
694 } |
22583
c9f8eec77163
CompilerToVm.getVtableIndexForInterfaceMethod must not allow non-interface methods (JDK-8136659)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22582
diff
changeset
|
695 return getVtableIndexForInterfaceMethod(resolved); |
15725
ef6b8d1898e6
Add resolved receiver type to ResolvedJavaMethod.isInVirtualMethodTable in order to be able to do vtable-calls for miranda and default methods
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15722
diff
changeset
|
696 } |
ef6b8d1898e6
Add resolved receiver type to ResolvedJavaMethod.isInVirtualMethodTable in order to be able to do vtable-calls for miranda and default methods
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15722
diff
changeset
|
697 return getVtableIndex(); |
12559
ae412befde21
read HotSpotVMConfig fields from HotSpot's vmStructs via annotations
twisti
parents:
12535
diff
changeset
|
698 } |
ae412befde21
read HotSpotVMConfig fields from HotSpot's vmStructs via annotations
twisti
parents:
12535
diff
changeset
|
699 |
13306
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
700 /** |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
701 * Returns this method's virtual table index. |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14717
diff
changeset
|
702 * |
13306
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
703 * @return virtual table index |
dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents:
13305
diff
changeset
|
704 */ |
12559
ae412befde21
read HotSpotVMConfig fields from HotSpot's vmStructs via annotations
twisti
parents:
12535
diff
changeset
|
705 private int getVtableIndex() { |
15725
ef6b8d1898e6
Add resolved receiver type to ResolvedJavaMethod.isInVirtualMethodTable in order to be able to do vtable-calls for miranda and default methods
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15722
diff
changeset
|
706 assert !holder.isInterface(); |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
707 HotSpotVMConfig config = config(); |
22542
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
708 int result = UNSAFE.getInt(metaspaceMethod + config.methodVtableIndexOffset); |
15102
175111728365
improve canBeStaticallyBound
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15088
diff
changeset
|
709 assert result >= config.nonvirtualVtableIndex : "must be linked"; |
175111728365
improve canBeStaticallyBound
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15088
diff
changeset
|
710 return result; |
9610
ae17e540c5d2
More asserts while getting vtable offsets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9416
diff
changeset
|
711 } |
ae17e540c5d2
More asserts while getting vtable offsets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9416
diff
changeset
|
712 |
22583
c9f8eec77163
CompilerToVm.getVtableIndexForInterfaceMethod must not allow non-interface methods (JDK-8136659)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22582
diff
changeset
|
713 private int getVtableIndexForInterfaceMethod(ResolvedJavaType resolved) { |
18223
17c98fad6980
converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18222
diff
changeset
|
714 HotSpotResolvedObjectTypeImpl hotspotType = (HotSpotResolvedObjectTypeImpl) resolved; |
22583
c9f8eec77163
CompilerToVm.getVtableIndexForInterfaceMethod must not allow non-interface methods (JDK-8136659)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22582
diff
changeset
|
715 return compilerToVM().getVtableIndexForInterfaceMethod(hotspotType, this); |
15725
ef6b8d1898e6
Add resolved receiver type to ResolvedJavaMethod.isInVirtualMethodTable in order to be able to do vtable-calls for miranda and default methods
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15722
diff
changeset
|
716 } |
ef6b8d1898e6
Add resolved receiver type to ResolvedJavaMethod.isInVirtualMethodTable in order to be able to do vtable-calls for miranda and default methods
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15722
diff
changeset
|
717 |
15262
cd51b1253c4c
replaced the link between a HotSpotResolvedJavaMethod and a SpeculationLog with a ClassValue based mechanism (GRAAL-727)
Doug Simon <doug.simon@oracle.com>
parents:
15259
diff
changeset
|
718 /** |
21789
5b9adb645217
fixed remnants of "graal" names in JVMCI code
Doug Simon <doug.simon@oracle.com>
parents:
21630
diff
changeset
|
719 * The {@link SpeculationLog} for methods compiled by JVMCI hang off this per-declaring-type |
15262
cd51b1253c4c
replaced the link between a HotSpotResolvedJavaMethod and a SpeculationLog with a ClassValue based mechanism (GRAAL-727)
Doug Simon <doug.simon@oracle.com>
parents:
15259
diff
changeset
|
720 * {@link ClassValue}. The raw Method* value is safe to use as a key in the map as a) it is |
cd51b1253c4c
replaced the link between a HotSpotResolvedJavaMethod and a SpeculationLog with a ClassValue based mechanism (GRAAL-727)
Doug Simon <doug.simon@oracle.com>
parents:
15259
diff
changeset
|
721 * never moves and b) we never read from it. |
cd51b1253c4c
replaced the link between a HotSpotResolvedJavaMethod and a SpeculationLog with a ClassValue based mechanism (GRAAL-727)
Doug Simon <doug.simon@oracle.com>
parents:
15259
diff
changeset
|
722 * <p> |
cd51b1253c4c
replaced the link between a HotSpotResolvedJavaMethod and a SpeculationLog with a ClassValue based mechanism (GRAAL-727)
Doug Simon <doug.simon@oracle.com>
parents:
15259
diff
changeset
|
723 * One implication is that we will preserve {@link SpeculationLog}s for methods that have been |
cd51b1253c4c
replaced the link between a HotSpotResolvedJavaMethod and a SpeculationLog with a ClassValue based mechanism (GRAAL-727)
Doug Simon <doug.simon@oracle.com>
parents:
15259
diff
changeset
|
724 * redefined via class redefinition. It's tempting to periodically flush such logs but we cannot |
cd51b1253c4c
replaced the link between a HotSpotResolvedJavaMethod and a SpeculationLog with a ClassValue based mechanism (GRAAL-727)
Doug Simon <doug.simon@oracle.com>
parents:
15259
diff
changeset
|
725 * read the JVM_ACC_IS_OBSOLETE bit (or anything else) via the raw pointer as obsoleted methods |
cd51b1253c4c
replaced the link between a HotSpotResolvedJavaMethod and a SpeculationLog with a ClassValue based mechanism (GRAAL-727)
Doug Simon <doug.simon@oracle.com>
parents:
15259
diff
changeset
|
726 * are subject to clean up and deletion (see InstanceKlass::purge_previous_versions_internal). |
cd51b1253c4c
replaced the link between a HotSpotResolvedJavaMethod and a SpeculationLog with a ClassValue based mechanism (GRAAL-727)
Doug Simon <doug.simon@oracle.com>
parents:
15259
diff
changeset
|
727 */ |
cd51b1253c4c
replaced the link between a HotSpotResolvedJavaMethod and a SpeculationLog with a ClassValue based mechanism (GRAAL-727)
Doug Simon <doug.simon@oracle.com>
parents:
15259
diff
changeset
|
728 private static final ClassValue<Map<Long, SpeculationLog>> SpeculationLogs = new ClassValue<Map<Long, SpeculationLog>>() { |
cd51b1253c4c
replaced the link between a HotSpotResolvedJavaMethod and a SpeculationLog with a ClassValue based mechanism (GRAAL-727)
Doug Simon <doug.simon@oracle.com>
parents:
15259
diff
changeset
|
729 @Override |
cd51b1253c4c
replaced the link between a HotSpotResolvedJavaMethod and a SpeculationLog with a ClassValue based mechanism (GRAAL-727)
Doug Simon <doug.simon@oracle.com>
parents:
15259
diff
changeset
|
730 protected Map<Long, SpeculationLog> computeValue(java.lang.Class<?> type) { |
cd51b1253c4c
replaced the link between a HotSpotResolvedJavaMethod and a SpeculationLog with a ClassValue based mechanism (GRAAL-727)
Doug Simon <doug.simon@oracle.com>
parents:
15259
diff
changeset
|
731 return new HashMap<>(4); |
cd51b1253c4c
replaced the link between a HotSpotResolvedJavaMethod and a SpeculationLog with a ClassValue based mechanism (GRAAL-727)
Doug Simon <doug.simon@oracle.com>
parents:
15259
diff
changeset
|
732 } |
cd51b1253c4c
replaced the link between a HotSpotResolvedJavaMethod and a SpeculationLog with a ClassValue based mechanism (GRAAL-727)
Doug Simon <doug.simon@oracle.com>
parents:
15259
diff
changeset
|
733 }; |
cd51b1253c4c
replaced the link between a HotSpotResolvedJavaMethod and a SpeculationLog with a ClassValue based mechanism (GRAAL-727)
Doug Simon <doug.simon@oracle.com>
parents:
15259
diff
changeset
|
734 |
8217
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7930
diff
changeset
|
735 public SpeculationLog getSpeculationLog() { |
15262
cd51b1253c4c
replaced the link between a HotSpotResolvedJavaMethod and a SpeculationLog with a ClassValue based mechanism (GRAAL-727)
Doug Simon <doug.simon@oracle.com>
parents:
15259
diff
changeset
|
736 Map<Long, SpeculationLog> map = SpeculationLogs.get(holder.mirror()); |
cd51b1253c4c
replaced the link between a HotSpotResolvedJavaMethod and a SpeculationLog with a ClassValue based mechanism (GRAAL-727)
Doug Simon <doug.simon@oracle.com>
parents:
15259
diff
changeset
|
737 synchronized (map) { |
cd51b1253c4c
replaced the link between a HotSpotResolvedJavaMethod and a SpeculationLog with a ClassValue based mechanism (GRAAL-727)
Doug Simon <doug.simon@oracle.com>
parents:
15259
diff
changeset
|
738 SpeculationLog log = map.get(this.metaspaceMethod); |
cd51b1253c4c
replaced the link between a HotSpotResolvedJavaMethod and a SpeculationLog with a ClassValue based mechanism (GRAAL-727)
Doug Simon <doug.simon@oracle.com>
parents:
15259
diff
changeset
|
739 if (log == null) { |
cd51b1253c4c
replaced the link between a HotSpotResolvedJavaMethod and a SpeculationLog with a ClassValue based mechanism (GRAAL-727)
Doug Simon <doug.simon@oracle.com>
parents:
15259
diff
changeset
|
740 log = new HotSpotSpeculationLog(); |
cd51b1253c4c
replaced the link between a HotSpotResolvedJavaMethod and a SpeculationLog with a ClassValue based mechanism (GRAAL-727)
Doug Simon <doug.simon@oracle.com>
parents:
15259
diff
changeset
|
741 map.put(metaspaceMethod, log); |
cd51b1253c4c
replaced the link between a HotSpotResolvedJavaMethod and a SpeculationLog with a ClassValue based mechanism (GRAAL-727)
Doug Simon <doug.simon@oracle.com>
parents:
15259
diff
changeset
|
742 } |
cd51b1253c4c
replaced the link between a HotSpotResolvedJavaMethod and a SpeculationLog with a ClassValue based mechanism (GRAAL-727)
Doug Simon <doug.simon@oracle.com>
parents:
15259
diff
changeset
|
743 return log; |
8217
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7930
diff
changeset
|
744 } |
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7930
diff
changeset
|
745 } |
9013
3b0ec709827c
added macro substitutions for the @PolymorphicSignature methods in MethodHandle
Doug Simon <doug.simon@oracle.com>
parents:
8949
diff
changeset
|
746 |
3b0ec709827c
added macro substitutions for the @PolymorphicSignature methods in MethodHandle
Doug Simon <doug.simon@oracle.com>
parents:
8949
diff
changeset
|
747 public int intrinsicId() { |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
748 HotSpotVMConfig config = config(); |
22710
7e7573382a23
Change access to Method::_intrinsic_id back to u1 (JDK8 and JDK9 are different on this)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22708
diff
changeset
|
749 // Important: Size of field changed, JDK8 has u1 and JDK9 u2 |
7e7573382a23
Change access to Method::_intrinsic_id back to u1 (JDK8 and JDK9 are different on this)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22708
diff
changeset
|
750 return UNSAFE.getByte(metaspaceMethod + config.methodIntrinsicIdOffset) & 0xff; |
9013
3b0ec709827c
added macro substitutions for the @PolymorphicSignature methods in MethodHandle
Doug Simon <doug.simon@oracle.com>
parents:
8949
diff
changeset
|
751 } |
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:
9013
diff
changeset
|
752 |
14104 | 753 /** |
754 * Allocates a compile id for this method by asking the VM for one. | |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14717
diff
changeset
|
755 * |
14104 | 756 * @param entryBCI entry bci |
757 * @return compile id | |
758 */ | |
759 public int allocateCompileId(int entryBCI) { | |
22582
232c53e17ea0
added CompilerToVM.compilerToVM() for static access to the CompilerToVM instance
Doug Simon <doug.simon@oracle.com>
parents:
22581
diff
changeset
|
760 return compilerToVM().allocateCompileId(this, entryBCI); |
14104 | 761 } |
762 | |
14107
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
763 public boolean hasCodeAtLevel(int entryBCI, int level) { |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
764 if (entryBCI == config().invocationEntryBci) { |
14107
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
765 return hasCompiledCodeAtLevel(level); |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
766 } |
22582
232c53e17ea0
added CompilerToVM.compilerToVM() for static access to the CompilerToVM instance
Doug Simon <doug.simon@oracle.com>
parents:
22581
diff
changeset
|
767 return compilerToVM().hasCompiledCodeForOSR(this, entryBCI, level); |
14107
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14105
diff
changeset
|
768 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
769 } |