annotate jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaMethod.java @ 23393:1d4ce2d19e52

clean up and minimize JVMCI (JDK-8156835)
author Doug Simon <doug.simon@oracle.com>
date Thu, 12 May 2016 20:57:31 +0200
parents fb20e2d4f0bc
children 724fbad94ee3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1 /*
22598
ed53e370f04c Make implementation classes package private.
Roland Schatz <roland.schatz@oracle.com>
parents: 22569
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
22569
ec96f33a101d updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents: 22054
diff changeset
25 import java.lang.reflect.Modifier;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
26
22672
1bbd4a7c274b Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22648
diff changeset
27 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
28 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
29 import jdk.vm.ci.meta.ResolvedJavaType;
21556
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21552
diff changeset
30
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
31 /**
5775
2c088af17e59 Removed left over Ri* prefixed identifiers
Doug Simon <doug.simon@oracle.com>
parents: 5722
diff changeset
32 * 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
33 */
18222
a8cff27ca2e1 converted HotSpotResolvedJavaMethod to an interface
Doug Simon <doug.simon@oracle.com>
parents: 18187
diff changeset
34 public interface HotSpotResolvedJavaMethod extends ResolvedJavaMethod {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
35
9416
16c354398d09 intrinsify Reflection.getCallerClass
twisti
parents: 9380
diff changeset
36 /**
14717
aa1a43bfdf4e make HotSpotResolvedJavaMethod leaner
twisti
parents: 14607
diff changeset
37 * 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
38 *
9416
16c354398d09 intrinsify Reflection.getCallerClass
twisti
parents: 9380
diff changeset
39 * @return true if CallerSensitive annotation present, false otherwise
16c354398d09 intrinsify Reflection.getCallerClass
twisti
parents: 9380
diff changeset
40 */
18222
a8cff27ca2e1 converted HotSpotResolvedJavaMethod to an interface
Doug Simon <doug.simon@oracle.com>
parents: 18187
diff changeset
41 boolean isCallerSensitive();
a8cff27ca2e1 converted HotSpotResolvedJavaMethod to an interface
Doug Simon <doug.simon@oracle.com>
parents: 18187
diff changeset
42
18323
301c5e3d683a removed *Impl types in signatures of Remote interfaces
Doug Simon <doug.simon@oracle.com>
parents: 18223
diff changeset
43 HotSpotResolvedObjectType getDeclaringClass();
14717
aa1a43bfdf4e make HotSpotResolvedJavaMethod leaner
twisti
parents: 14607
diff changeset
44
aa1a43bfdf4e make HotSpotResolvedJavaMethod leaner
twisti
parents: 14607
diff changeset
45 /**
aa1a43bfdf4e make HotSpotResolvedJavaMethod leaner
twisti
parents: 14607
diff changeset
46 * 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
47 *
14717
aa1a43bfdf4e make HotSpotResolvedJavaMethod leaner
twisti
parents: 14607
diff changeset
48 * @return true if ForceInline annotation present, false otherwise
aa1a43bfdf4e make HotSpotResolvedJavaMethod leaner
twisti
parents: 14607
diff changeset
49 */
18222
a8cff27ca2e1 converted HotSpotResolvedJavaMethod to an interface
Doug Simon <doug.simon@oracle.com>
parents: 18187
diff changeset
50 boolean isForceInline();
14717
aa1a43bfdf4e make HotSpotResolvedJavaMethod leaner
twisti
parents: 14607
diff changeset
51
aa1a43bfdf4e make HotSpotResolvedJavaMethod leaner
twisti
parents: 14607
diff changeset
52 /**
aa1a43bfdf4e make HotSpotResolvedJavaMethod leaner
twisti
parents: 14607
diff changeset
53 * Returns true if this method has a {@code DontInline} annotation.
15018
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 14717
diff changeset
54 *
14717
aa1a43bfdf4e make HotSpotResolvedJavaMethod leaner
twisti
parents: 14607
diff changeset
55 * @return true if DontInline annotation present, false otherwise
aa1a43bfdf4e make HotSpotResolvedJavaMethod leaner
twisti
parents: 14607
diff changeset
56 */
18222
a8cff27ca2e1 converted HotSpotResolvedJavaMethod to an interface
Doug Simon <doug.simon@oracle.com>
parents: 18187
diff changeset
57 boolean isDontInline();
9416
16c354398d09 intrinsify Reflection.getCallerClass
twisti
parents: 9380
diff changeset
58
23393
1d4ce2d19e52 clean up and minimize JVMCI (JDK-8156835)
Doug Simon <doug.simon@oracle.com>
parents: 23312
diff changeset
59 /**
1d4ce2d19e52 clean up and minimize JVMCI (JDK-8156835)
Doug Simon <doug.simon@oracle.com>
parents: 23312
diff changeset
60 * Returns true if this method has a {@code ReservedStackAccess} annotation.
1d4ce2d19e52 clean up and minimize JVMCI (JDK-8156835)
Doug Simon <doug.simon@oracle.com>
parents: 23312
diff changeset
61 *
1d4ce2d19e52 clean up and minimize JVMCI (JDK-8156835)
Doug Simon <doug.simon@oracle.com>
parents: 23312
diff changeset
62 * @return true if ReservedStackAccess annotation present, false otherwise
1d4ce2d19e52 clean up and minimize JVMCI (JDK-8156835)
Doug Simon <doug.simon@oracle.com>
parents: 23312
diff changeset
63 */
23312
fb20e2d4f0bc Add dummy implementation of HotSpotResolvedJavaMethod.hasReservedAccess for compatibility with JDK9
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22758
diff changeset
64 boolean hasReservedStackAccess();
fb20e2d4f0bc Add dummy implementation of HotSpotResolvedJavaMethod.hasReservedAccess for compatibility with JDK9
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22758
diff changeset
65
9416
16c354398d09 intrinsify Reflection.getCallerClass
twisti
parents: 9380
diff changeset
66 /**
12532
9b1cc2628961 Extend the CompilerToVM interface to explicitly avoid compilation and inlining of methods
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 12464
diff changeset
67 * 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
68 */
18222
a8cff27ca2e1 converted HotSpotResolvedJavaMethod to an interface
Doug Simon <doug.simon@oracle.com>
parents: 18187
diff changeset
69 void setNotInlineable();
12532
9b1cc2628961 Extend the CompilerToVM interface to explicitly avoid compilation and inlining of methods
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 12464
diff changeset
70
9b1cc2628961 Extend the CompilerToVM interface to explicitly avoid compilation and inlining of methods
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 12464
diff changeset
71 /**
9416
16c354398d09 intrinsify Reflection.getCallerClass
twisti
parents: 9380
diff changeset
72 * Returns true if this method is one of the special methods that is ignored by security stack
16c354398d09 intrinsify Reflection.getCallerClass
twisti
parents: 9380
diff changeset
73 * walks.
15018
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 14717
diff changeset
74 *
9416
16c354398d09 intrinsify Reflection.getCallerClass
twisti
parents: 9380
diff changeset
75 * @return true if special method ignored by security stack walks, false otherwise
16c354398d09 intrinsify Reflection.getCallerClass
twisti
parents: 9380
diff changeset
76 */
18222
a8cff27ca2e1 converted HotSpotResolvedJavaMethod to an interface
Doug Simon <doug.simon@oracle.com>
parents: 18187
diff changeset
77 boolean ignoredBySecurityStackWalk();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
78
18323
301c5e3d683a removed *Impl types in signatures of Remote interfaces
Doug Simon <doug.simon@oracle.com>
parents: 18223
diff changeset
79 ResolvedJavaMethod uniqueConcreteMethod(HotSpotResolvedObjectType receiver);
14107
800057208a2c enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14105
diff changeset
80
800057208a2c enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14105
diff changeset
81 /**
800057208a2c enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14105
diff changeset
82 * 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
83 *
14107
800057208a2c enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14105
diff changeset
84 * @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
85 */
18222
a8cff27ca2e1 converted HotSpotResolvedJavaMethod to an interface
Doug Simon <doug.simon@oracle.com>
parents: 18187
diff changeset
86 boolean hasCompiledCode();
14107
800057208a2c enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14105
diff changeset
87
800057208a2c enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14105
diff changeset
88 /**
14607
7573ba6dfba2 fix comment
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14545
diff changeset
89 * @param level
7573ba6dfba2 fix comment
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14545
diff changeset
90 * @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
91 */
18222
a8cff27ca2e1 converted HotSpotResolvedJavaMethod to an interface
Doug Simon <doug.simon@oracle.com>
parents: 18187
diff changeset
92 boolean hasCompiledCodeAtLevel(int level);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
93
18222
a8cff27ca2e1 converted HotSpotResolvedJavaMethod to an interface
Doug Simon <doug.simon@oracle.com>
parents: 18187
diff changeset
94 default boolean isDefault() {
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
95 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
96 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
97 }
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
98 // 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
99 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
100 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
101 }
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
102
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
103 /**
12559
ae412befde21 read HotSpotVMConfig fields from HotSpot's vmStructs via annotations
twisti
parents: 12535
diff changeset
104 * 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
105 * 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
106 * thrown.
15018
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 14717
diff changeset
107 *
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
108 * @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
109 */
18222
a8cff27ca2e1 converted HotSpotResolvedJavaMethod to an interface
Doug Simon <doug.simon@oracle.com>
parents: 18187
diff changeset
110 int vtableEntryOffset(ResolvedJavaType 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
111
18222
a8cff27ca2e1 converted HotSpotResolvedJavaMethod to an interface
Doug Simon <doug.simon@oracle.com>
parents: 18187
diff changeset
112 int intrinsicId();
10056
a323a9e20f9d Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 10000
diff changeset
113
14104
a38a54030ea2 pass metaspace pointers instead of object to VM
twisti
parents: 14089
diff changeset
114 /**
a38a54030ea2 pass metaspace pointers instead of object to VM
twisti
parents: 14089
diff changeset
115 * 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
116 *
14104
a38a54030ea2 pass metaspace pointers instead of object to VM
twisti
parents: 14089
diff changeset
117 * @param entryBCI entry bci
a38a54030ea2 pass metaspace pointers instead of object to VM
twisti
parents: 14089
diff changeset
118 * @return compile id
a38a54030ea2 pass metaspace pointers instead of object to VM
twisti
parents: 14089
diff changeset
119 */
18222
a8cff27ca2e1 converted HotSpotResolvedJavaMethod to an interface
Doug Simon <doug.simon@oracle.com>
parents: 18187
diff changeset
120 int allocateCompileId(int entryBCI);
14104
a38a54030ea2 pass metaspace pointers instead of object to VM
twisti
parents: 14089
diff changeset
121
18222
a8cff27ca2e1 converted HotSpotResolvedJavaMethod to an interface
Doug Simon <doug.simon@oracle.com>
parents: 18187
diff changeset
122 boolean hasCodeAtLevel(int entryBCI, int level);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
123 }