# HG changeset patch # User Doug Simon # Date 1358024002 -3600 # Node ID c07a49b27b89f2aaf07ff258b7aee3b8ccc5d017 # Parent fe9f252f0d058d9ce183d9a581d8f63cf1a2ed8f added Signature.getString() to get a signature string in JVMS format diff -r fe9f252f0d05 -r c07a49b27b89 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 Sat Jan 12 21:43:12 2013 +0100 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaUtil.java Sat Jan 12 21:53:22 2013 +0100 @@ -494,23 +494,6 @@ } /** - * Converts a {@link Signature} to internal representation, i.e., the signature - *
(int, String, double)void
is converted to
(ILjava/lang/String;D)V
. - * - * @param sig the {@link Signature} to be converted. - * - * @return the signature's internal representation as a string. - */ - public static String signatureToInternal(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 fe9f252f0d05 -r c07a49b27b89 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 Sat Jan 12 21:43:12 2013 +0100 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Signature.java Sat Jan 12 21:53:22 2013 +0100 @@ -24,14 +24,14 @@ /** * Represents a method signature provided by the runtime. - * + * * @see Method Descriptors */ public interface Signature { /** * Returns the number of parameters in this signature, adding 1 for a receiver if requested. - * + * * @param receiver true if 1 is to be added to the result for a receiver * @return the number of parameters; + 1 iff {@code receiver == true} */ @@ -40,7 +40,7 @@ /** * Gets the parameter type at the specified position. This method returns a {@linkplain ResolvedJavaType resolved} * type if possible but without triggering any class loading or resolution. - * + * * @param index the index into the parameters, with {@code 0} indicating the first parameter * @param accessingClass the context of the type lookup. If accessing class is provided, its class loader is used to * retrieve an existing resolved type. This value can be {@code null} if the caller does not care for a @@ -52,7 +52,7 @@ /** * Gets the parameter kind at the specified position. This is the same as calling {@link #getParameterType}. * {@link JavaType#getKind getKind}. - * + * * @param index the index into the parameters, with {@code 0} indicating the first parameter * @return the kind of the parameter at the specified position */ @@ -61,7 +61,7 @@ /** * Gets the return type of this signature. This method will return a {@linkplain ResolvedJavaType resolved} type if * possible but without triggering any class loading or resolution. - * + * * @param accessingClass the context of the type lookup. If accessing class is provided, its class loader is used to * retrieve an existing resolved type. This value can be {@code null} if the caller does not care for a * resolved type. @@ -77,10 +77,20 @@ /** * Gets the size, in Java slots, of the parameters to this signature. - * + * * @param withReceiver {@code true} if to add a slot for a receiver object; {@code false} not to include the * receiver * @return the size of the parameters in slots */ int getParameterSlots(boolean withReceiver); + + /** + * Gets this string representation of this signature in the format specified in the JVMS. + * For example: + * + *
(ILjava/lang/String;D)V
. + * + * @return the signature as a string + */ + String getString(); } diff -r fe9f252f0d05 -r c07a49b27b89 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedObjectType.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedObjectType.java Sat Jan 12 21:43:12 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedObjectType.java Sat Jan 12 21:53:22 2013 +0100 @@ -330,7 +330,7 @@ @Override public ResolvedJavaMethod resolveMethod(ResolvedJavaMethod method) { assert method instanceof HotSpotMethod; - return (ResolvedJavaMethod) HotSpotGraalRuntime.getInstance().getCompilerToVM().resolveMethod(this, method.getName(), ((HotSpotSignature) method.getSignature()).asString()); + return (ResolvedJavaMethod) HotSpotGraalRuntime.getInstance().getCompilerToVM().resolveMethod(this, method.getName(), ((HotSpotSignature) method.getSignature()).getString()); } @Override diff -r fe9f252f0d05 -r c07a49b27b89 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 Sat Jan 12 21:43:12 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotSignature.java Sat Jan 12 21:53:22 2013 +0100 @@ -123,7 +123,8 @@ return type; } - public String asString() { + @Override + public String getString() { return originalString; }