comparison graal/com.oracle.max.cri/src/com/oracle/max/cri/ri/RiResolvedMethod.java @ 4199:aaac4894175c

Renamed cri packages from sun to oracle.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Tue, 03 Jan 2012 16:29:28 +0100
parents graal/com.oracle.max.cri/src/com/sun/cri/ri/RiResolvedMethod.java@e233f5660da4
children d089b71a5237 f7251c729b31
comparison
equal deleted inserted replaced
4198:8c9c0e1eaab1 4199:aaac4894175c
1 /*
2 * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23 package com.oracle.max.cri.ri;
24
25 import java.lang.annotation.*;
26 import java.lang.reflect.*;
27 import java.util.*;
28
29 import com.oracle.max.cri.ci.*;
30
31
32 /**
33 * Represents resolved methods. Methods, like fields and types, are resolved through
34 * {@link RiConstantPool constant pools}, and their actual implementation is provided by the {@link RiRuntime runtime}
35 * to the compiler.
36 */
37 public interface RiResolvedMethod extends RiMethod {
38
39 /**
40 * Gets the bytecode of the method, if the method {@linkplain #isResolved()} and has code.
41 * @return the bytecode of the method or {@code null} if none is available
42 */
43 byte[] code();
44
45 /**
46 * Gets the size of the bytecode of the method, if the method {@linkplain #isResolved()} and has code.
47 * @return the size of the bytecode in bytes, or 0 if no bytecode is available
48 */
49 int codeSize();
50
51 /**
52 * Gets the symbol used to link this method if it is native, otherwise {@code null}.
53 */
54 String jniSymbol();
55
56 /**
57 * Gets the type in which this method is declared.
58 * @return the type in which this method is declared
59 */
60 RiResolvedType holder();
61
62 /**
63 * Gets the maximum number of locals used in this method's bytecode.
64 * @return the maximum number of locals
65 */
66 int maxLocals();
67
68 /**
69 * Gets the maximum number of stack slots used in this method's bytecode.
70 * @return the maximum number of stack slots
71 */
72 int maxStackSize();
73
74 /**
75 * Checks whether this method has balanced monitor operations.
76 * @return {@code true} if the method has balanced monitor operations
77 */
78 boolean hasBalancedMonitors();
79
80 /**
81 * Gets the access flags for this method. Only the flags specified in the JVM specification
82 * will be included in the returned mask. The utility methods in the {@link Modifier} class
83 * should be used to query the returned mask for the presence/absence of individual flags.
84 * @return the mask of JVM defined method access flags defined for this method
85 */
86 int accessFlags();
87
88 /**
89 * Checks whether this method is a leaf method.
90 * @return {@code true} if the method is a leaf method (that is, is final or private)
91 */
92 boolean isLeafMethod();
93
94 /**
95 * Checks whether this method is a class initializer.
96 * @return {@code true} if the method is a class initializer
97 */
98 boolean isClassInitializer();
99
100 /**
101 * Checks whether this method is a constructor.
102 * @return {@code true} if the method is a constructor
103 */
104 boolean isConstructor();
105
106 /**
107 * Checks whether this method has been overridden. Decisions made based
108 * on a method being overridden must be registered as dependencies.
109 * @return {@code true} if the method has been overridden
110 */
111 boolean isOverridden();
112
113 /**
114 * Checks whether the compiler can insert safepoint polls in this method.
115 * @return {@code true} if the method cannot have safepoint polls inserted
116 */
117 boolean noSafepointPolls();
118
119 /**
120 * Gets a map from bytecode indexes to bit maps denoting the live locals at that position.
121 * If a non-null array is return, its length is guaranteed to be equal to {@code code().length}.
122 *
123 * @return the liveness map if it is available; {@code null} otherwise
124 */
125 CiBitMap[] livenessMap();
126
127 /**
128 * Checks whether this method can be statically bound (that is, it is final or private or static).
129 * @return {@code true} if this method can be statically bound
130 */
131 boolean canBeStaticallyBound();
132
133 /**
134 * Gets the list of exception handlers for this method.
135 * @return the list of exception handlers
136 */
137 RiExceptionHandler[] exceptionHandlers();
138
139 /**
140 * Gets a stack trace element for this method and a given bytecode index.
141 */
142 StackTraceElement toStackTraceElement(int bci);
143
144 /**
145 * Temporary work-around to support the @ACCESSOR Maxine annotation.
146 * Non-Maxine VMs should just return {@code null}.
147 */
148 RiResolvedType accessor();
149
150 /**
151 * Gets the intrinsic id of this method.
152 */
153 String intrinsic();
154
155 /**
156 * Provides an estimate of how often this method has been executed.
157 * @return The number of invocations, or -1 if this information isn't available.
158 */
159 int invocationCount();
160
161 /**
162 * Returns an estimate of hot often an exception was seen at the given bytecode.
163 * @return The estimate in percent (0-100), with 0 meaning never and 100 meaning always, or -1 if this information isn't available.
164 */
165 int exceptionProbability(int bci);
166
167 /**
168 * Returns the type profile of the instruction at the given byte code index.
169 * @return The RiTypeProfile information, or null if it isn't available.
170 */
171 RiTypeProfile typeProfile(int bci);
172
173 /**
174 * Returns an estimate of how often the branch at the given byte code was taken.
175 * @return The estimated probability, with 0.0 meaning never and 1.0 meaning always, or -1 if this information isn't available.
176 */
177 double branchProbability(int bci);
178
179 /**
180 * Returns an estimate of how often the branches of the switch at the given byte code were taken.
181 * @return The estimated probability, with 0.0 meaning never and 1.0 meaning always, or NULL if this information isn't available.
182 * The default case is specified at the last index.
183 */
184 double[] switchProbability(int bci);
185
186 /**
187 * Returns a map that the compiler can use to store objects that should survive the current compilation.
188 */
189 Map<Object, Object> compilerStorage();
190
191 /**
192 * Returns a pointer to the method's constant pool.
193 * @return the constant pool
194 */
195 RiConstantPool getConstantPool();
196
197 /**
198 * Returns this method's annotation of a specified type.
199 *
200 * @param annotationClass the Class object corresponding to the annotation type
201 * @return the annotation of type {@code annotationClass} for this method if present, else null
202 */
203 <T extends Annotation> T getAnnotation(Class<T> annotationClass);
204
205 /**
206 * Returns an array of arrays that represent the annotations on the formal
207 * parameters, in declaration order, of this method.
208 *
209 * @see Method#getParameterAnnotations()
210 * @see CiUtil#getParameterAnnotation(int, RiResolvedMethod)
211 */
212 Annotation[][] getParameterAnnotations();
213
214 /**
215 * Returns an array of {@link Type} objects that represent the formal
216 * parameter types, in declaration order, of this method.
217 *
218 * @see Method#getGenericParameterTypes()
219 */
220 Type[] getGenericParameterTypes();
221
222 /**
223 * Returns a {@link Type} object that represents the formal return type of this method.
224 *
225 * @see Method#getGenericReturnType()
226 */
227 Type getGenericReturnType();
228 }