comparison graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiUtil.java @ 5503:438ab53efdd0

Renaming CiKind => RiKind.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Thu, 07 Jun 2012 17:08:33 +0200
parents 4c3d953f8131
children 56860d3f9f39
comparison
equal deleted inserted replaced
5502:13aee5aba8cc 5503:438ab53efdd0
191 * @param riType the type to be converted to a Java name 191 * @param riType the type to be converted to a Java name
192 * @param qualified specifies if the package prefix of the type should be included in the returned name 192 * @param qualified specifies if the package prefix of the type should be included in the returned name
193 * @return the Java name corresponding to {@code riType} 193 * @return the Java name corresponding to {@code riType}
194 */ 194 */
195 public static String toJavaName(RiType riType, boolean qualified) { 195 public static String toJavaName(RiType riType, boolean qualified) {
196 CiKind kind = riType.kind(false); 196 RiKind kind = riType.kind(false);
197 if (kind.isPrimitive() || kind == CiKind.Void) { 197 if (kind.isPrimitive() || kind == RiKind.Void) {
198 return kind.javaName; 198 return kind.javaName;
199 } 199 }
200 return internalNameToJava(riType.name(), qualified); 200 return internalNameToJava(riType.name(), qualified);
201 } 201 }
202 202
234 return internalNameToJava(name.substring(1), qualified) + "[]"; 234 return internalNameToJava(name.substring(1), qualified) + "[]";
235 default: 235 default:
236 if (name.length() != 1) { 236 if (name.length() != 1) {
237 throw new IllegalArgumentException("Illegal internal name: " + name); 237 throw new IllegalArgumentException("Illegal internal name: " + name);
238 } 238 }
239 return CiKind.fromPrimitiveOrVoidTypeChar(name.charAt(0)).javaName; 239 return RiKind.fromPrimitiveOrVoidTypeChar(name.charAt(0)).javaName;
240 } 240 }
241 } 241 }
242 242
243 /** 243 /**
244 * Gets a string for a given method formatted according to a given format specification. A format specification is 244 * Gets a string for a given method formatted according to a given format specification. A format specification is
261 * </pre> 261 * </pre>
262 * 262 *
263 * @param format a format specification 263 * @param format a format specification
264 * @param method the method to be formatted 264 * @param method the method to be formatted
265 * @param kinds if {@code true} then the types in {@code method}'s signature are printed in the 265 * @param kinds if {@code true} then the types in {@code method}'s signature are printed in the
266 * {@linkplain CiKind#jniName JNI} form of their {@linkplain CiKind kind} 266 * {@linkplain RiKind#jniName JNI} form of their {@linkplain RiKind kind}
267 * @return the result of formatting this method according to {@code format} 267 * @return the result of formatting this method according to {@code format}
268 * @throws IllegalFormatException if an illegal specifier is encountered in {@code format} 268 * @throws IllegalFormatException if an illegal specifier is encountered in {@code format}
269 */ 269 */
270 public static String format(String format, RiMethod method) throws IllegalFormatException { 270 public static String format(String format, RiMethod method) throws IllegalFormatException {
271 final StringBuilder sb = new StringBuilder(); 271 final StringBuilder sb = new StringBuilder();
353 * '%' | A '%' character | "%" 353 * '%' | A '%' character | "%"
354 * </pre> 354 * </pre>
355 * 355 *
356 * @param format a format specification 356 * @param format a format specification
357 * @param field the field to be formatted 357 * @param field the field to be formatted
358 * @param kinds if {@code true} then {@code field}'s type is printed in the {@linkplain CiKind#jniName JNI} form of 358 * @param kinds if {@code true} then {@code field}'s type is printed in the {@linkplain RiKind#jniName JNI} form of
359 * its {@linkplain CiKind kind} 359 * its {@linkplain RiKind kind}
360 * @return the result of formatting this field according to {@code format} 360 * @return the result of formatting this field according to {@code format}
361 * @throws IllegalFormatException if an illegal specifier is encountered in {@code format} 361 * @throws IllegalFormatException if an illegal specifier is encountered in {@code format}
362 */ 362 */
363 public static String format(String format, RiField field) throws IllegalFormatException { 363 public static String format(String format, RiField field) throws IllegalFormatException {
364 final StringBuilder sb = new StringBuilder(); 364 final StringBuilder sb = new StringBuilder();
705 append(sb, info.codePos); 705 append(sb, info.codePos);
706 } 706 }
707 return sb; 707 return sb;
708 } 708 }
709 709
710 public static CiKind[] signatureToKinds(RiResolvedMethod method) { 710 public static RiKind[] signatureToKinds(RiResolvedMethod method) {
711 CiKind receiver = isStatic(method.accessFlags()) ? null : method.holder().kind(true); 711 RiKind receiver = isStatic(method.accessFlags()) ? null : method.holder().kind(true);
712 return signatureToKinds(method.signature(), receiver); 712 return signatureToKinds(method.signature(), receiver);
713 } 713 }
714 714
715 public static CiKind[] signatureToKinds(RiSignature signature, CiKind receiverKind) { 715 public static RiKind[] signatureToKinds(RiSignature signature, RiKind receiverKind) {
716 int args = signature.argumentCount(false); 716 int args = signature.argumentCount(false);
717 CiKind[] result; 717 RiKind[] result;
718 int i = 0; 718 int i = 0;
719 if (receiverKind != null) { 719 if (receiverKind != null) {
720 result = new CiKind[args + 1]; 720 result = new RiKind[args + 1];
721 result[0] = receiverKind; 721 result[0] = receiverKind;
722 i = 1; 722 i = 1;
723 } else { 723 } else {
724 result = new CiKind[args]; 724 result = new RiKind[args];
725 } 725 }
726 for (int j = 0; j < args; j++) { 726 for (int j = 0; j < args; j++) {
727 result[i + j] = signature.argumentKindAt(j, true); 727 result[i + j] = signature.argumentKindAt(j, true);
728 } 728 }
729 return result; 729 return result;