comparison graal/com.oracle.max.cri/src/com/sun/cri/ci/CiUtil.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
234 } 234 }
235 return CiKind.fromPrimitiveOrVoidTypeChar(name.charAt(0)).javaName; 235 return CiKind.fromPrimitiveOrVoidTypeChar(name.charAt(0)).javaName;
236 } 236 }
237 } 237 }
238 238
239 // Stub so that there are fewer merging-related changes
240 // TODO remove
241 public static String format(String format, RiMethod method, boolean arg) throws IllegalFormatException {
242 return format(format, method);
243 }
244 public static String format(String format, RiField field, boolean arg) throws IllegalFormatException {
245 return format(format, field);
246 }
247
248 /** 239 /**
249 * Gets a string for a given method formatted according to a given format specification. A format specification is 240 * Gets a string for a given method formatted according to a given format specification. A format specification is
250 * composed of characters that are to be copied verbatim to the result and specifiers that denote an attribute of 241 * composed of characters that are to be copied verbatim to the result and specifiers that denote an attribute of
251 * the method that is to be copied to the result. A specifier is a single character preceded by a '%' character. The 242 * the method that is to be copied to the result. A specifier is a single character preceded by a '%' character. The
252 * accepted specifiers and the method attributes they denote are described below: 243 * accepted specifiers and the method attributes they denote are described below:
415 } 406 }
416 407
417 /** 408 /**
418 * Gets a stack trace element for a given method and bytecode index. 409 * Gets a stack trace element for a given method and bytecode index.
419 */ 410 */
420 public static StackTraceElement toStackTraceElement(RiMethod method, int bci) { 411 public static StackTraceElement toStackTraceElement(RiMethod method, @SuppressWarnings("unused") int bci) {
412 // TODO(tw): Look if we can use bci to get the line number.
421 return new StackTraceElement(CiUtil.toJavaName(method.holder()), method.name(), null, -1); 413 return new StackTraceElement(CiUtil.toJavaName(method.holder()), method.name(), null, -1);
422 } 414 }
423 415
424 /** 416 /**
425 * Converts a Java source-language class name into the internal form. 417 * Converts a Java source-language class name into the internal form.
428 * @return the internal name form of the class name 420 * @return the internal name form of the class name
429 */ 421 */
430 public static String toInternalName(String className) { 422 public static String toInternalName(String className) {
431 return "L" + className.replace('.', '/') + ";"; 423 return "L" + className.replace('.', '/') + ";";
432 } 424 }
433
434 private static final Object[] NO_ARGUMENTS = {};
435 425
436 /** 426 /**
437 * Creates a set that uses reference-equality instead of {@link Object#equals(Object)} 427 * Creates a set that uses reference-equality instead of {@link Object#equals(Object)}
438 * when comparing values. 428 * when comparing values.
439 * 429 *
466 * @return the values in {@code frame} as a tabulated string 456 * @return the values in {@code frame} as a tabulated string
467 */ 457 */
468 public static String tabulateValues(CiFrame frame) { 458 public static String tabulateValues(CiFrame frame) {
469 int cols = Math.max(frame.numLocals, Math.max(frame.numStack, frame.numLocks)); 459 int cols = Math.max(frame.numLocals, Math.max(frame.numStack, frame.numLocks));
470 assert cols > 0; 460 assert cols > 0;
471 ArrayList<Object> cells = new ArrayList<Object>(); 461 ArrayList<Object> cells = new ArrayList<>();
472 cells.add(""); 462 cells.add("");
473 for (int i = 0; i < cols; i++) { 463 for (int i = 0; i < cols; i++) {
474 cells.add(i); 464 cells.add(i);
475 } 465 }
476 cols++; 466 cols++;