changeset 3477:ce737132129b

Lazy calculation of detailed name in GraphBuilderPhase
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Wed, 03 Aug 2011 11:50:44 -0700
parents 65981c23c1d6
children bdeb4ba46a30
files graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/GraphBuilderPhase.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/Phase.java
diffstat 2 files changed, 10 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/GraphBuilderPhase.java	Wed Aug 03 11:35:30 2011 -0700
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/GraphBuilderPhase.java	Wed Aug 03 11:50:44 2011 -0700
@@ -119,8 +119,6 @@
         super(inline ? "BuildInlineGraph" : "BuildGraph");
         this.compilation = compilation;
 
-        setDetailedName(getName() + " " + method.holder().name() + "." + method.name() + method.signature().asString());
-
         this.runtime = compilation.runtime;
         this.method = method;
         this.stats = compilation.stats;
@@ -139,6 +137,11 @@
         build();
     }
 
+    @Override
+    protected String getDetailedName() {
+        return getName() + " " + method.holder().name() + "." + method.name() + method.signature().asString();
+    }
+
     /**
      * Builds the graph for a the specified {@code IRScope}.
      *
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/Phase.java	Wed Aug 03 11:35:30 2011 -0700
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/Phase.java	Wed Aug 03 11:50:44 2011 -0700
@@ -30,14 +30,12 @@
 public abstract class Phase {
 
     private final String name;
-    private String detailedName;
     private static final ThreadLocal<Phase> currentPhase = new ThreadLocal<Phase>();
     private final boolean shouldVerify;
 
     protected Phase() {
         this.name = this.getClass().getSimpleName();
         this.shouldVerify = GraalOptions.Verify;
-        this.detailedName = name;
     }
 
     protected Phase(String name) {
@@ -47,11 +45,10 @@
     protected Phase(String name, boolean shouldVerify) {
         this.name = name;
         this.shouldVerify = shouldVerify;
-        this.detailedName = name;
     }
 
-    protected void setDetailedName(String detailedName) {
-        this.detailedName = detailedName;
+    protected String getDetailedName() {
+        return getName();
     }
 
     public final void apply(Graph graph) {
@@ -78,13 +75,13 @@
         } catch (AssertionError t) {
             GraalCompilation compilation = GraalCompilation.compilation();
             if (compilation.compiler.isObserved() && plotOnError) {
-                compilation.compiler.fireCompilationEvent(new CompilationEvent(compilation, "AssertionError in " + detailedName, graph, true, false, true));
+                compilation.compiler.fireCompilationEvent(new CompilationEvent(compilation, "AssertionError in " + getDetailedName(), graph, true, false, true));
             }
             throw t;
         } catch (RuntimeException t) {
             GraalCompilation compilation = GraalCompilation.compilation();
             if (compilation.compiler.isObserved() && plotOnError) {
-                compilation.compiler.fireCompilationEvent(new CompilationEvent(compilation, "RuntimeException in " + detailedName, graph, true, false, true));
+                compilation.compiler.fireCompilationEvent(new CompilationEvent(compilation, "RuntimeException in " + getDetailedName(), graph, true, false, true));
             }
             throw t;
         }
@@ -105,7 +102,7 @@
         }
         GraalCompilation compilation = GraalCompilation.compilation();
         if (compilation.compiler.isObserved() && this.getClass() != IdentifyBlocksPhase.class && (plot || GraalOptions.PlotVerbose)) {
-            compilation.compiler.fireCompilationEvent(new CompilationEvent(compilation, "After " + detailedName, graph, true, false));
+            compilation.compiler.fireCompilationEvent(new CompilationEvent(compilation, "After " + getDetailedName(), graph, true, false));
         }
 
         assert !shouldVerify || graph.verify();