# HG changeset patch # User Christian Wimmer # Date 1359988007 28800 # Node ID ca9061b6694c9bf79badb5db7417cbaf82f65435 # Parent 31d0b30b30a36cc51c31342ba87090b803c1addb getMethodDescriptor does not need to be in the Signature interface diff -r 31d0b30b30a3 -r ca9061b6694c graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaUtil.java --- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaUtil.java Mon Feb 04 05:59:06 2013 -0800 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaUtil.java Mon Feb 04 06:26:47 2013 -0800 @@ -212,7 +212,7 @@ return result; } case '[': - return classForNameCompatible ? name.replace('/', '.') : internalNameToJava(name.substring(1), qualified, classForNameCompatible) + "[]"; + return classForNameCompatible ? name.replace('/', '.') : internalNameToJava(name.substring(1), qualified, classForNameCompatible) + "[]"; default: if (name.length() != 1) { throw new IllegalArgumentException("Illegal internal name: " + name); @@ -221,7 +221,7 @@ } } - /** + /** * Turns an class name in internal format into a resolved Java type. */ public static ResolvedJavaType classForName(String internal, MetaAccessProvider metaAccess, ClassLoader cl) { @@ -515,6 +515,29 @@ } /** + * Gets the method + * descriptor corresponding to this signature. For example: + * + *
+     * (ILjava/lang/String;D)V
+     * 
+ * + * . + * + * @param sig the {@link Signature} to be converted. + * @return the signature as a string + */ + public static String signatureToMethodDescriptor(Signature sig) { + StringBuilder sb = new StringBuilder("("); + for (int i = 0; i < sig.getParameterCount(false); ++i) { + sb.append(sig.getParameterType(i, null).getName()); + } + sb.append(')').append(sig.getReturnType(null).getName()); + return sb.toString(); + } + + /** * Formats some profiling information associated as a string. * * @param info the profiling info to format diff -r 31d0b30b30a3 -r ca9061b6694c graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Signature.java --- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Signature.java Mon Feb 04 05:59:06 2013 -0800 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Signature.java Mon Feb 04 06:26:47 2013 -0800 @@ -86,19 +86,4 @@ * @return the size of the parameters in slots */ int getParameterSlots(boolean withReceiver); - - /** - * Gets the method - * descriptor corresponding to this signature. For example: - * - *
-     * (ILjava/lang/String;D)V
-     * 
- * - * . - * - * @return the signature as a string - */ - String getMethodDescriptor(); } diff -r 31d0b30b30a3 -r ca9061b6694c graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java Mon Feb 04 05:59:06 2013 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java Mon Feb 04 06:26:47 2013 -0800 @@ -52,7 +52,7 @@ private final HotSpotResolvedObjectType holder; private/* final */int codeSize; private/* final */int exceptionHandlerCount; - private Signature signature; + private HotSpotSignature signature; private Boolean hasBalancedMonitors; private Map compilerStorage; private HotSpotMethodData methodData; @@ -162,7 +162,7 @@ } @Override - public Signature getSignature() { + public HotSpotSignature getSignature() { if (signature == null) { signature = new HotSpotSignature(HotSpotGraalRuntime.getInstance().getCompilerToVM().getSignature(metaspaceMethod)); } diff -r 31d0b30b30a3 -r ca9061b6694c graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotSignature.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotSignature.java Mon Feb 04 05:59:06 2013 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotSignature.java Mon Feb 04 06:26:47 2013 -0800 @@ -124,8 +124,8 @@ return type; } - @Override public String getMethodDescriptor() { + assert originalString.equals(MetaUtil.signatureToMethodDescriptor(this)); return originalString; } diff -r 31d0b30b30a3 -r ca9061b6694c graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/ClassSubstitution.java --- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/ClassSubstitution.java Mon Feb 04 05:59:06 2013 -0800 +++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/ClassSubstitution.java Mon Feb 04 06:26:47 2013 -0800 @@ -77,7 +77,8 @@ boolean isStatic() default true; /** - * Gets the {@linkplain Signature#getMethodDescriptor() signature} of the original method. + * Gets the {@linkplain MetaUtil#signatureToMethodDescriptor signature} of the original + * method. *

* If the default value is specified for this element, then the signature of the original * method is the same as the substitute method. @@ -110,7 +111,7 @@ boolean isStatic() default true; /** - * Gets the {@linkplain Signature#getMethodDescriptor() signature} of the substituted + * Gets the {@linkplain MetaUtil#signatureToMethodDescriptor signature} of the substituted * method. *

* If the default value is specified for this element, then the signature of the substituted