# HG changeset patch # User Doug Simon # Date 1358108080 -3600 # Node ID 6a16788a29a650900a5ca217a54dc7a7f8f5b6ee # Parent f965b7a96f16059e453cd9f2f773600e27d83adb added API method for parsing a valid Method Descriptor string (JVMS 4.3.3) into a Signature object diff -r f965b7a96f16 -r 6a16788a29a6 graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaAccessProvider.java --- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaAccessProvider.java Sat Jan 12 22:05:07 2013 +0100 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaAccessProvider.java Sun Jan 13 21:14:40 2013 +0100 @@ -60,6 +60,13 @@ ResolvedJavaType lookupJavaType(Constant constant); /** + * Parses a method + * descriptor into a {@link Signature}. The behavior of this method is undefined if + * the method descriptor is not well formed. + */ + Signature parseMethodDescriptor(String methodDescriptor); + + /** * Compares two constants for equality. * This is used instead of {@link Constant#equals(Object)} in case the runtime * has an interpretation for object equality other than {@code x.asObject() == y.asObject()}. diff -r f965b7a96f16 -r 6a16788a29a6 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 22:05:07 2013 +0100 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Signature.java Sun Jan 13 21:14:40 2013 +0100 @@ -25,7 +25,7 @@ /** * Represents a method signature provided by the runtime. * - * @see Method Descriptors + * @see Method Descriptors */ public interface Signature { @@ -85,12 +85,13 @@ int getParameterSlots(boolean withReceiver); /** - * Gets this string representation of this signature in the format specified in the JVMS. + * Gets the method + * descriptor corresponding to this signature. * For example: * *
(ILjava/lang/String;D)V
. * * @return the signature as a string */ - String getString(); + String getMethodDescriptor(); } diff -r f965b7a96f16 -r 6a16788a29a6 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 22:05:07 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedObjectType.java Sun Jan 13 21:14:40 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()).getString()); + return (ResolvedJavaMethod) HotSpotGraalRuntime.getInstance().getCompilerToVM().resolveMethod(this, method.getName(), ((HotSpotSignature) method.getSignature()).getMethodDescriptor()); } @Override diff -r f965b7a96f16 -r 6a16788a29a6 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Sat Jan 12 22:05:07 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Sun Jan 13 21:14:40 2013 +0100 @@ -458,6 +458,11 @@ } @Override + public Signature parseMethodDescriptor(String signature) { + return new HotSpotSignature(signature); + } + + @Override public int getSizeOfLockData() { return config.basicLockSize; } diff -r f965b7a96f16 -r 6a16788a29a6 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 22:05:07 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotSignature.java Sun Jan 13 21:14:40 2013 +0100 @@ -25,6 +25,7 @@ import java.util.*; import com.oracle.graal.api.meta.*; +import com.oracle.graal.graph.*; import com.oracle.graal.hotspot.*; import com.oracle.graal.java.*; @@ -86,7 +87,7 @@ case 'Z': break; default: - assert false; + throw new GraalInternalError("Invalid character at index " + cur + " in signature: " + signature); } return cur; } @@ -124,7 +125,7 @@ } @Override - public String getString() { + public String getMethodDescriptor() { return originalString; } diff -r f965b7a96f16 -r 6a16788a29a6 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 Sat Jan 12 22:05:07 2013 +0100 +++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/ClassSubstitution.java Sun Jan 13 21:14:40 2013 +0100 @@ -73,7 +73,7 @@ boolean isStatic() default true; /** - * Gets the {@linkplain Signature#getString() signature} of the substituted method. + * Gets the {@linkplain Signature#getMethodDescriptor() signature} of the substituted method. *

* If the default value is specified for this element, then the * signature of the substituted method is the same as the substitute method.