# HG changeset patch # User Doug Simon # Date 1370963010 -7200 # Node ID d9c14b1828fc795462f8d035e4181ca757de2d04 # Parent 828f342cb27591c0d8ce7e923418b3c8fd867679 unified toString() for HotSpot implementations of JavaMethod diff -r 828f342cb275 -r d9c14b1828fc graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethod.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethod.java Tue Jun 11 17:00:48 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethod.java Tue Jun 11 17:03:30 2013 +0200 @@ -22,6 +22,8 @@ */ package com.oracle.graal.hotspot.meta; +import static com.oracle.graal.api.meta.MetaUtil.*; + import com.oracle.graal.api.meta.*; import com.oracle.graal.hotspot.*; @@ -30,8 +32,22 @@ private static final long serialVersionUID = 7167491397941960839L; protected String name; + /** + * Controls whether {@link #toString()} includes the qualified or simple name of the class in + * which the method is declared. + */ + public static final boolean FULLY_QUALIFIED_METHOD_NAME = false; + @Override public final String getName() { return name; } + + @Override + public final String toString() { + char h = FULLY_QUALIFIED_METHOD_NAME ? 'H' : 'h'; + String suffix = this instanceof ResolvedJavaMethod ? "" : ", unresolved"; + String fmt = String.format("HotSpotMethod<%%%c.%%n(%%p)%s>", h, suffix); + return format(fmt, this); + } } diff -r 828f342cb275 -r d9c14b1828fc graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodUnresolved.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodUnresolved.java Tue Jun 11 17:00:48 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodUnresolved.java Tue Jun 11 17:03:30 2013 +0200 @@ -22,8 +22,6 @@ */ package com.oracle.graal.hotspot.meta; -import static com.oracle.graal.api.meta.MetaUtil.*; - import com.oracle.graal.api.meta.*; /** @@ -50,9 +48,4 @@ public JavaType getDeclaringClass() { return holder; } - - @Override - public String toString() { - return format("HotSpotMethod<%H.%n(%p), unresolved>", this); - } } diff -r 828f342cb275 -r d9c14b1828fc 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 Tue Jun 11 17:00:48 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java Tue Jun 11 17:03:30 2013 +0200 @@ -22,7 +22,6 @@ */ package com.oracle.graal.hotspot.meta; -import static com.oracle.graal.api.meta.MetaUtil.*; import static com.oracle.graal.graph.UnsafeAccess.*; import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*; import static com.oracle.graal.phases.GraalOptions.*; @@ -259,11 +258,6 @@ return signature; } - @Override - public String toString() { - return format("HotSpotMethod<%H.%n(%p)>", this); - } - public int getCompiledCodeSize() { return graalRuntime().getCompilerToVM().getCompiledCodeSize(metaspaceMethod); }