comparison graal/com.oracle.max.cri/src/com/sun/cri/ci/CiTargetMethod.java @ 4142:bc8527f3071c

Adjust code base to new level of warnings.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Sun, 18 Dec 2011 05:24:06 +0100
parents e233f5660da4
children
comparison
equal deleted inserted replaced
4141:04d21be7a24f 4142:bc8527f3071c
33 * {@linkplain CiStatistics compilation statistics} and {@linkplain CiBailout failure information}. 33 * {@linkplain CiStatistics compilation statistics} and {@linkplain CiBailout failure information}.
34 */ 34 */
35 public class CiTargetMethod implements Serializable { 35 public class CiTargetMethod implements Serializable {
36 36
37 /** 37 /**
38 *
39 */
40 private static final long serialVersionUID = -1319947729753702434L;
41
42 /**
38 * Represents a code position with associated additional information. 43 * Represents a code position with associated additional information.
39 */ 44 */
40 public abstract static class Site implements Serializable { 45 public abstract static class Site implements Serializable {
46 /**
47 *
48 */
49 private static final long serialVersionUID = -8214214947651979102L;
41 /** 50 /**
42 * The position (or offset) of this site with respect to the start of the target method. 51 * The position (or offset) of this site with respect to the start of the target method.
43 */ 52 */
44 public final int pcOffset; 53 public final int pcOffset;
45 54
50 59
51 /** 60 /**
52 * Represents a safepoint with associated debug info. 61 * Represents a safepoint with associated debug info.
53 */ 62 */
54 public static class Safepoint extends Site implements Comparable<Safepoint> { 63 public static class Safepoint extends Site implements Comparable<Safepoint> {
64 /**
65 *
66 */
67 private static final long serialVersionUID = 2479806696381720162L;
55 public final CiDebugInfo debugInfo; 68 public final CiDebugInfo debugInfo;
56 69
57 Safepoint(int pcOffset, CiDebugInfo debugInfo) { 70 Safepoint(int pcOffset, CiDebugInfo debugInfo) {
58 super(pcOffset); 71 super(pcOffset);
59 this.debugInfo = debugInfo; 72 this.debugInfo = debugInfo;
82 /** 95 /**
83 * Represents a call in the code. 96 * Represents a call in the code.
84 */ 97 */
85 public static final class Call extends Safepoint { 98 public static final class Call extends Safepoint {
86 /** 99 /**
100 *
101 */
102 private static final long serialVersionUID = 1440741241631046954L;
103
104 /**
87 * The target of the call. 105 * The target of the call.
88 */ 106 */
89 public final Object target; 107 public final Object target;
90 108
91 /** 109 /**
125 143
126 /** 144 /**
127 * Represents a reference to data from the code. The associated data can be any constant. 145 * Represents a reference to data from the code. The associated data can be any constant.
128 */ 146 */
129 public static final class DataPatch extends Site { 147 public static final class DataPatch extends Site {
148 /**
149 *
150 */
151 private static final long serialVersionUID = 5771730331604867476L;
130 public final CiConstant constant; 152 public final CiConstant constant;
131 public final int alignment; 153 public final int alignment;
132 154
133 DataPatch(int pcOffset, CiConstant data, int alignment) { 155 DataPatch(int pcOffset, CiConstant data, int alignment) {
134 super(pcOffset); 156 super(pcOffset);
145 /** 167 /**
146 * Provides extra information about instructions or data at specific positions in {@link CiTargetMethod#targetCode()}. 168 * Provides extra information about instructions or data at specific positions in {@link CiTargetMethod#targetCode()}.
147 * This is optional information that can be used to enhance a disassembly of the code. 169 * This is optional information that can be used to enhance a disassembly of the code.
148 */ 170 */
149 public abstract static class CodeAnnotation implements Serializable { 171 public abstract static class CodeAnnotation implements Serializable {
172 /**
173 *
174 */
175 private static final long serialVersionUID = -7903959680749520748L;
150 public final int position; 176 public final int position;
151 177
152 public CodeAnnotation(int position) { 178 public CodeAnnotation(int position) {
153 this.position = position; 179 this.position = position;
154 } 180 }
156 182
157 /** 183 /**
158 * A string comment about one or more instructions at a specific position in the code. 184 * A string comment about one or more instructions at a specific position in the code.
159 */ 185 */
160 public static final class CodeComment extends CodeAnnotation { 186 public static final class CodeComment extends CodeAnnotation {
187 /**
188 *
189 */
190 private static final long serialVersionUID = 6802287188701961401L;
161 public final String value; 191 public final String value;
162 public CodeComment(int position, String comment) { 192 public CodeComment(int position, String comment) {
163 super(position); 193 super(position);
164 this.value = comment; 194 this.value = comment;
165 } 195 }
172 202
173 /** 203 /**
174 * Labels some inline data in the code. 204 * Labels some inline data in the code.
175 */ 205 */
176 public static final class InlineData extends CodeAnnotation { 206 public static final class InlineData extends CodeAnnotation {
207 /**
208 *
209 */
210 private static final long serialVersionUID = 305997507263827108L;
177 public final int size; 211 public final int size;
178 public InlineData(int position, int size) { 212 public InlineData(int position, int size) {
179 super(position); 213 super(position);
180 this.size = size; 214 this.size = size;
181 } 215 }
192 * based on a key value from a dense value set (e.g. the {@code tableswitch} JVM instruction). 226 * based on a key value from a dense value set (e.g. the {@code tableswitch} JVM instruction).
193 * 227 *
194 * The table is indexed by the contiguous range of integers from {@link #low} to {@link #high} inclusive. 228 * The table is indexed by the contiguous range of integers from {@link #low} to {@link #high} inclusive.
195 */ 229 */
196 public static final class JumpTable extends CodeAnnotation { 230 public static final class JumpTable extends CodeAnnotation {
231 /**
232 *
233 */
234 private static final long serialVersionUID = 2222194398353801831L;
235
197 /** 236 /**
198 * The low value in the key range (inclusive). 237 * The low value in the key range (inclusive).
199 */ 238 */
200 public final int low; 239 public final int low;
201 240
227 * the table. This type of table maybe generated when translating a multi-way branch 266 * the table. This type of table maybe generated when translating a multi-way branch
228 * based on a key value from a sparse value set (e.g. the {@code lookupswitch} JVM instruction). 267 * based on a key value from a sparse value set (e.g. the {@code lookupswitch} JVM instruction).
229 */ 268 */
230 public static final class LookupTable extends CodeAnnotation { 269 public static final class LookupTable extends CodeAnnotation {
231 /** 270 /**
271 *
272 */
273 private static final long serialVersionUID = 8367952567559116160L;
274
275 /**
232 * The number of entries in the table. 276 * The number of entries in the table.
233 */ 277 */
234 public final int npairs; 278 public final int npairs;
235 279
236 /** 280 /**
259 /** 303 /**
260 * Represents exception handler information for a specific code position. It includes the catch code position as 304 * Represents exception handler information for a specific code position. It includes the catch code position as
261 * well as the caught exception type. 305 * well as the caught exception type.
262 */ 306 */
263 public static final class ExceptionHandler extends Site { 307 public static final class ExceptionHandler extends Site {
308 /**
309 *
310 */
311 private static final long serialVersionUID = 4897339464722665281L;
264 public final int bci; 312 public final int bci;
265 public final int scopeLevel; 313 public final int scopeLevel;
266 public final int handlerPos; 314 public final int handlerPos;
267 public final int handlerBci; 315 public final int handlerBci;
268 public final RiType exceptionType; 316 public final RiType exceptionType;
281 return String.format("%d[<exception edge to %d with type %s>]", pcOffset, handlerPos, (exceptionType == null) ? "null" : exceptionType); 329 return String.format("%d[<exception edge to %d with type %s>]", pcOffset, handlerPos, (exceptionType == null) ? "null" : exceptionType);
282 } 330 }
283 } 331 }
284 332
285 public static final class Mark extends Site { 333 public static final class Mark extends Site {
334 /**
335 *
336 */
337 private static final long serialVersionUID = 3612943150662354844L;
286 public final Object id; 338 public final Object id;
287 public final Mark[] references; 339 public final Mark[] references;
288 340
289 Mark(int pcOffset, Object id, Mark[] references) { 341 Mark(int pcOffset, Object id, Mark[] references) {
290 super(pcOffset); 342 super(pcOffset);
305 } 357 }
306 358
307 /** 359 /**
308 * List of safepoints, sorted by {@link Site#pcOffset}. 360 * List of safepoints, sorted by {@link Site#pcOffset}.
309 */ 361 */
310 public final List<Safepoint> safepoints = new ArrayList<Safepoint>(); 362 public final List<Safepoint> safepoints = new ArrayList<>();
311 363
312 /** 364 /**
313 * List of data references. 365 * List of data references.
314 */ 366 */
315 public final List<DataPatch> dataReferences = new ArrayList<DataPatch>(); 367 public final List<DataPatch> dataReferences = new ArrayList<>();
316 368
317 /** 369 /**
318 * List of exception handlers. 370 * List of exception handlers.
319 */ 371 */
320 public final List<ExceptionHandler> exceptionHandlers = new ArrayList<ExceptionHandler>(); 372 public final List<ExceptionHandler> exceptionHandlers = new ArrayList<>();
321 373
322 /** 374 /**
323 * List of marks. 375 * List of marks.
324 */ 376 */
325 public final List<Mark> marks = new ArrayList<Mark>(); 377 public final List<Mark> marks = new ArrayList<>();
326 378
327 private int frameSize = -1; 379 private int frameSize = -1;
328 private int customStackAreaOffset = -1; 380 private int customStackAreaOffset = -1;
329 private int registerRestoreEpilogueOffset = -1; 381 private int registerRestoreEpilogueOffset = -1;
330 private int deoptReturnAddressOffset;
331
332 /** 382 /**
333 * The buffer containing the emitted machine code. 383 * The buffer containing the emitted machine code.
334 */ 384 */
335 private byte[] targetCode; 385 private byte[] targetCode;
336 386
514 } 564 }
515 565
516 public void addAnnotation(CodeAnnotation annotation) { 566 public void addAnnotation(CodeAnnotation annotation) {
517 assert annotation != null; 567 assert annotation != null;
518 if (annotations == null) { 568 if (annotations == null) {
519 annotations = new ArrayList<CiTargetMethod.CodeAnnotation>(); 569 annotations = new ArrayList<>();
520 } 570 }
521 annotations.add(annotation); 571 annotations.add(annotation);
522 } 572 }
523 573
524 private static void appendDebugInfo(StringBuilder sb, CiDebugInfo info) { 574 private static void appendDebugInfo(StringBuilder sb, CiDebugInfo info) {
538 } 588 }
539 } 589 }
540 590
541 private static void appendRefMap(StringBuilder sb, String name, CiBitMap map) { 591 private static void appendRefMap(StringBuilder sb, String name, CiBitMap map) {
542 if (map != null) { 592 if (map != null) {
543 sb.append(' ').append(name).append('[').append(map.toBinaryString(-1)).append(']'); 593 sb.append(' ').append(name).append('[').append(map.toBinaryString()).append(']');
544 } 594 }
545 } 595 }
546 } 596 }