changeset 4346:ee5fbfca6612

more work on debug project; removed CiStatistics
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Wed, 11 Jan 2012 15:02:48 +0100
parents 176d60b77d31
children c8e5635f2bdd
files graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiCompiler.java graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiResult.java graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiStatistics.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalCompilation.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalCompiler.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/LinearScan.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIR.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/Phase.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64Backend.java graal/com.oracle.max.graal.debug/src/com/oracle/max/graal/debug/Debug.java graal/com.oracle.max.graal.debug/src/com/oracle/max/graal/debug/DebugContext.java graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/bridge/VMToCompilerImpl.java graal/com.oracle.max.graal.java/src/com/oracle/max/graal/java/GraphBuilderPhase.java graal/com.oracle.max.graal.snippets/src/com/oracle/max/graal/snippets/Snippets.java graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/GraphTest.java
diffstat 15 files changed, 95 insertions(+), 179 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiCompiler.java	Tue Jan 10 23:00:17 2012 +0100
+++ b/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiCompiler.java	Wed Jan 11 15:02:48 2012 +0100
@@ -55,5 +55,5 @@
      *            on-stack-replacement compilation
      * @param debugInfoLevel TODO
      */
-    CiResult compileMethod(RiResolvedMethod method, int osrBCI, CiStatistics stats, DebugInfoLevel debugInfoLevel);
+    CiResult compileMethod(RiResolvedMethod method, int osrBCI, DebugInfoLevel debugInfoLevel);
 }
--- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiResult.java	Tue Jan 10 23:00:17 2012 +0100
+++ b/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiResult.java	Wed Jan 11 15:02:48 2012 +0100
@@ -30,7 +30,6 @@
 public class CiResult {
     private final CiTargetMethod targetMethod;
     private final CiBailout bailout;
-    private final CiStatistics stats;
 
     /**
      * Creates a new compilation result.
@@ -38,10 +37,9 @@
      * @param bailout the bailout condition that occurred
      * @param stats statistics about the compilation
      */
-    public CiResult(CiTargetMethod targetMethod, CiBailout bailout, CiStatistics stats) {
+    public CiResult(CiTargetMethod targetMethod, CiBailout bailout) {
         this.targetMethod = targetMethod;
         this.bailout = bailout;
-        this.stats = stats;
     }
 
     /**
@@ -58,14 +56,6 @@
     }
 
     /**
-     * Returns the statistics about the compilation that were produced, if any.
-     * @return the statistics
-     */
-    public CiStatistics statistics() {
-        return stats;
-    }
-
-    /**
      * Returns the bailout condition that occurred for this compilation, if any.
      * @return the bailout
      */
--- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiStatistics.java	Tue Jan 10 23:00:17 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.max.cri.ci;
-
-/**
- * Contains statistics gathered during the compilation of a method and reported back
- * from the compiler as the result of compilation.
- */
-public class CiStatistics {
-
-    /**
-     * The total number of bytes of bytecode parsed during this compilation, including any inlined methods.
-     */
-    public int bytecodeCount;
-
-    /**
-     * The number of internal graph nodes created during this compilation.
-     */
-    public int nodeCount;
-
-    /**
-     * The number of basic blocks created during this compilation.
-     */
-    public int blockCount;
-
-    /**
-     * The number of loops in the compiled method.
-     */
-    public int loopCount;
-
-    /**
-     * The number of methods inlined.
-     */
-    public int inlineCount;
-
-    /**
-     * The number of methods folded (i.e. evaluated).
-     */
-    public int foldCount;
-
-    /**
-     * The number of intrinsics inlined in this compilation.
-     */
-    public int intrinsicCount;
-
-}
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalCompilation.java	Tue Jan 10 23:00:17 2012 +0100
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalCompilation.java	Wed Jan 11 15:02:48 2012 +0100
@@ -54,7 +54,6 @@
     public final GraalCompiler compiler;
     public final RiResolvedMethod method;
     public final RiRegisterConfig registerConfig;
-    public final CiStatistics stats;
     public final FrameState placeholderState;
 
     public final StructuredGraph graph;
@@ -76,14 +75,13 @@
      * @param stats externally supplied statistics object to be used if not {@code null}
      * @param debugInfoLevel TODO
      */
-    public GraalCompilation(GraalContext context, GraalCompiler compiler, RiResolvedMethod method, StructuredGraph graph, int osrBCI, CiStatistics stats, DebugInfoLevel debugInfoLevel) {
+    public GraalCompilation(GraalContext context, GraalCompiler compiler, RiResolvedMethod method, StructuredGraph graph, int osrBCI, DebugInfoLevel debugInfoLevel) {
         if (osrBCI != -1) {
             throw new CiBailout("No OSR supported");
         }
         this.compiler = compiler;
         this.graph = graph;
         this.method = method;
-        this.stats = stats == null ? new CiStatistics() : stats;
         this.registerConfig = method == null ? compiler.compilerStubRegisterConfig : compiler.runtime.getRegisterConfig(method);
         this.placeholderState = debugInfoLevel == DebugInfoLevel.REF_MAPS ? new FrameState(method, 0, 0, 0, false) : null;
 
@@ -260,9 +258,6 @@
 
             IdentifyBlocksPhase schedule = new IdentifyBlocksPhase(true, LIRBlock.FACTORY);
             schedule.apply(graph, context());
-            if (stats != null) {
-                stats.loopCount = schedule.loopCount();
-            }
 
             if (context().isObserved()) {
                 context().observable.fireCompilationEvent("After IdentifyBlocksPhase", this, graph, schedule);
@@ -281,7 +276,7 @@
 
             context().timers.startScope("Compute Linear Scan Order");
             try {
-                ComputeLinearScanOrder clso = new ComputeLinearScanOrder(blocks.size(), stats.loopCount, startBlock);
+                ComputeLinearScanOrder clso = new ComputeLinearScanOrder(blocks.size(), schedule.loopCount(), startBlock);
                 List<LIRBlock> linearScanOrder = clso.linearScanOrder();
                 List<LIRBlock> codeEmittingOrder = clso.codeEmittingOrder();
 
@@ -290,7 +285,7 @@
                     b.setLinearScanNumber(z++);
                 }
 
-                lir = new LIR(startBlock, linearScanOrder, codeEmittingOrder, valueToBlock);
+                lir = new LIR(startBlock, linearScanOrder, codeEmittingOrder, valueToBlock, schedule.loopCount());
 
                 if (context().isObserved()) {
                     context().observable.fireCompilationEvent("After linear scan order", this, graph, lir);
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalCompiler.java	Tue Jan 10 23:00:17 2012 +0100
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalCompiler.java	Wed Jan 11 15:02:48 2012 +0100
@@ -75,26 +75,26 @@
         init();
     }
 
-    public CiTargetMethod compileMethod(RiResolvedMethod method, int osrBCI, CiStatistics stats, CiCompiler.DebugInfoLevel debugInfoLevel) {
-        return compileMethod(method, osrBCI, stats, debugInfoLevel, PhasePlan.DEFAULT);
+    public CiTargetMethod compileMethod(RiResolvedMethod method, int osrBCI, CiCompiler.DebugInfoLevel debugInfoLevel) {
+        return compileMethod(method, osrBCI, debugInfoLevel, PhasePlan.DEFAULT);
     }
 
-    public CiTargetMethod compileMethod(RiResolvedMethod method, int osrBCI, CiStatistics stats, CiCompiler.DebugInfoLevel debugInfoLevel, PhasePlan plan) {
-        return compileMethod(method, new StructuredGraph(method), osrBCI, stats, debugInfoLevel, plan);
+    public CiTargetMethod compileMethod(RiResolvedMethod method, int osrBCI, CiCompiler.DebugInfoLevel debugInfoLevel, PhasePlan plan) {
+        return compileMethod(method, new StructuredGraph(method), osrBCI, debugInfoLevel, plan);
     }
 
-    public CiTargetMethod compileMethod(RiResolvedMethod method, StructuredGraph graph, int osrBCI, CiStatistics stats, CiCompiler.DebugInfoLevel debugInfoLevel, PhasePlan plan) {
-        try (Scope scope = openScope("CompileMethod", method)) {
-            CiTargetMethod result = null;
+    public CiTargetMethod compileMethod(final RiResolvedMethod method, StructuredGraph graph, int osrBCI, CiCompiler.DebugInfoLevel debugInfoLevel, final PhasePlan plan) {
+        final GraalCompilation compilation = new GraalCompilation(context, GraalCompiler.this, method, graph, osrBCI, debugInfoLevel);
+        final CiTargetMethod[] result = new CiTargetMethod[1];
+        Debug.scope("CompileMethod", new Runnable() { public void run() {
             TTY.Filter filter = new TTY.Filter(GraalOptions.PrintFilter, method);
-            GraalCompilation compilation = new GraalCompilation(context, this, method, graph, osrBCI, stats, debugInfoLevel);
             try {
-                result = compilation.compile(plan);
+                result[0] = compilation.compile(plan);
             } finally {
                 filter.remove();
             }
-            return result;
-        }
+        }}, method);
+        return result[0];
     }
 
     private void init() {
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/LinearScan.java	Tue Jan 10 23:00:17 2012 +0100
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/LinearScan.java	Wed Jan 11 15:02:48 2012 +0100
@@ -280,7 +280,7 @@
     }
 
     int numLoops() {
-        return compilation.stats.loopCount;
+        return ir.numLoops();
     }
 
     boolean isIntervalInLoop(int interval, int loop) {
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIR.java	Tue Jan 10 23:00:17 2012 +0100
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIR.java	Wed Jan 11 15:02:48 2012 +0100
@@ -64,6 +64,7 @@
     public SlowPath methodEndMarker;
 
     private int numVariables;
+    private int numLoops;
 
 
     public interface SlowPath {
@@ -74,11 +75,12 @@
      * Creates a new LIR instance for the specified compilation.
      * @param compilation the compilation
      */
-    public LIR(LIRBlock startBlock, List<LIRBlock> linearScanOrder, List<LIRBlock> codeEmittingOrder, NodeMap<LIRBlock> valueToBlock) {
+    public LIR(LIRBlock startBlock, List<LIRBlock> linearScanOrder, List<LIRBlock> codeEmittingOrder, NodeMap<LIRBlock> valueToBlock, int numLoops) {
         this.codeEmittingOrder = codeEmittingOrder;
         this.linearScanOrder = linearScanOrder;
         this.startBlock = startBlock;
         this.valueToBlock = valueToBlock;
+        this.numLoops = numLoops;
 
         slowPaths = new ArrayList<>();
         deoptimizationStubs = new ArrayList<>();
@@ -245,4 +247,8 @@
             TTY.println();
         }
     }
+
+    public int numLoops() {
+        return numLoops;
+    }
 }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/Phase.java	Tue Jan 10 23:00:17 2012 +0100
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/Phase.java	Wed Jan 11 15:02:48 2012 +0100
@@ -22,9 +22,12 @@
  */
 package com.oracle.max.graal.compiler.phases;
 
+import static com.oracle.max.graal.debug.Debug.*;
+
 import com.oracle.max.cri.ci.*;
 import com.oracle.max.graal.compiler.*;
 import com.oracle.max.graal.compiler.schedule.*;
+import com.oracle.max.graal.debug.*;
 import com.oracle.max.graal.graph.*;
 import com.oracle.max.graal.nodes.*;
 
@@ -64,58 +67,61 @@
         apply(graph,  GraalContext.EMPTY_CONTEXT, plot);
     }
 
-    public final void apply(StructuredGraph graph, GraalContext context, boolean plot) {
+    public final void apply(final StructuredGraph graph, GraalContext context, boolean plot) {
 
         this.currentContext = context;
-        try {
-            assert graph != null && (!shouldVerify || graph.verify());
-        } catch (GraalInternalError e) {
-            throw e.addContext("start of phase", getDetailedName());
-        }
+
+        Debug.scope(name, new Runnable() { public void run() { Phase.this.run(graph); }});
 
-        int startDeletedNodeCount = graph.getDeletedNodeCount();
-        int startNodeCount = graph.getNodeCount();
-        if (context != null) {
-            context.timers.startScope(getName());
-        }
-        try {
-            try {
-                run(graph);
-            } catch (CiBailout bailout) {
-                throw bailout;
-            } catch (AssertionError e) {
-                throw new GraalInternalError(e);
-            } catch (RuntimeException e) {
-                throw new GraalInternalError(e);
-            } finally {
-                if (context != null) {
-                    context.timers.endScope();
-                }
-            }
-        } catch (GraalInternalError e) {
-            throw e.addContext(graph).addContext("phase", getDetailedName());
-        }
-
-        if (context != null) {
-            if (GraalOptions.Meter) {
-                int deletedNodeCount = graph.getDeletedNodeCount() - startDeletedNodeCount;
-                int createdNodeCount = graph.getNodeCount() - startNodeCount + deletedNodeCount;
-                context.metrics.get(getName().concat(".executed")).increment();
-                context.metrics.get(getName().concat(".deletedNodes")).increment(deletedNodeCount);
-                context.metrics.get(getName().concat(".createdNodes")).increment(createdNodeCount);
-            }
-
-            boolean shouldFireCompilationEvents = context.isObserved() && this.getClass() != IdentifyBlocksPhase.class && (plot || GraalOptions.PlotVerbose);
-            if (shouldFireCompilationEvents && context.timers.currentLevel() < GraalOptions.PlotLevel) {
-                context.observable.fireCompilationEvent("After " + getName(), graph);
-            }
-        }
-
-        try {
-            assert !shouldVerify || graph.verify();
-        } catch (GraalInternalError e) {
-            throw e.addContext("end of phase", getDetailedName());
-        }
+//        try {
+//            assert graph != null && (!shouldVerify || graph.verify());
+//        } catch (GraalInternalError e) {
+//            throw e.addContext("start of phase", getDetailedName());
+//        }
+//
+//        int startDeletedNodeCount = graph.getDeletedNodeCount();
+//        int startNodeCount = graph.getNodeCount();
+//        if (context != null) {
+//            context.timers.startScope(getName());
+//        }
+//        try {
+//            try {
+//                run(graph);
+//            } catch (CiBailout bailout) {
+//                throw bailout;
+//            } catch (AssertionError e) {
+//                throw new GraalInternalError(e);
+//            } catch (RuntimeException e) {
+//                throw new GraalInternalError(e);
+//            } finally {
+//                if (context != null) {
+//                    context.timers.endScope();
+//                }
+//            }
+//        } catch (GraalInternalError e) {
+//            throw e.addContext(graph).addContext("phase", getDetailedName());
+//        }
+//
+//        if (context != null) {
+//            if (GraalOptions.Meter) {
+//                int deletedNodeCount = graph.getDeletedNodeCount() - startDeletedNodeCount;
+//                int createdNodeCount = graph.getNodeCount() - startNodeCount + deletedNodeCount;
+//                context.metrics.get(getName().concat(".executed")).increment();
+//                context.metrics.get(getName().concat(".deletedNodes")).increment(deletedNodeCount);
+//                context.metrics.get(getName().concat(".createdNodes")).increment(createdNodeCount);
+//            }
+//
+//            boolean shouldFireCompilationEvents = context.isObserved() && this.getClass() != IdentifyBlocksPhase.class && (plot || GraalOptions.PlotVerbose);
+//            if (shouldFireCompilationEvents && context.timers.currentLevel() < GraalOptions.PlotLevel) {
+//                context.observable.fireCompilationEvent("After " + getName(), graph);
+//            }
+//        }
+//
+//        try {
+//            assert !shouldVerify || graph.verify();
+//        } catch (GraalInternalError e) {
+//            throw e.addContext("end of phase", getDetailedName());
+//        }
     }
 
     public final String getName() {
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64Backend.java	Tue Jan 10 23:00:17 2012 +0100
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64Backend.java	Wed Jan 11 15:02:48 2012 +0100
@@ -71,7 +71,7 @@
 
     @Override
     public CompilerStub emit(GraalContext context, Id stub) {
-        final GraalCompilation comp = new GraalCompilation(context, compiler, null, new StructuredGraph(), -1, null, DebugInfoLevel.FULL);
+        final GraalCompilation comp = new GraalCompilation(context, compiler, null, new StructuredGraph(), -1, DebugInfoLevel.FULL);
         try {
             return new AMD64CompilerStubEmitter(comp, stub.arguments, stub.resultKind).emit(stub);
         } finally {
@@ -81,7 +81,7 @@
 
     @Override
     public CompilerStub emit(GraalContext context, CiRuntimeCall rtCall) {
-        final GraalCompilation comp = new GraalCompilation(context, compiler, null, new StructuredGraph(), -1, null, DebugInfoLevel.FULL);
+        final GraalCompilation comp = new GraalCompilation(context, compiler, null, new StructuredGraph(), -1, DebugInfoLevel.FULL);
         try {
             return new AMD64CompilerStubEmitter(comp, rtCall.arguments, rtCall.resultKind).emit(rtCall);
         } finally {
@@ -101,7 +101,7 @@
 
     @Override
     public CompilerStub emit(GraalContext context, XirTemplate t) {
-        final GraalCompilation comp = new GraalCompilation(context, compiler, null, new StructuredGraph(), -1, null, DebugInfoLevel.FULL);
+        final GraalCompilation comp = new GraalCompilation(context, compiler, null, new StructuredGraph(), -1, DebugInfoLevel.FULL);
         try {
             return new AMD64CompilerStubEmitter(comp, getArgumentKinds(t), t.resultOperand.kind).emit(t);
         } finally {
--- a/graal/com.oracle.max.graal.debug/src/com/oracle/max/graal/debug/Debug.java	Tue Jan 10 23:00:17 2012 +0100
+++ b/graal/com.oracle.max.graal.debug/src/com/oracle/max/graal/debug/Debug.java	Wed Jan 11 15:02:48 2012 +0100
@@ -22,8 +22,6 @@
  */
 package com.oracle.max.graal.debug;
 
-import java.io.*;
-
 
 public class Debug {
     public static boolean ENABLED = false;
@@ -34,16 +32,17 @@
         }
     }
 
-    public static Scope openScope(String name, Object... context) {
+    public static void scope(String name, Runnable runnable, Object... context) {
         if (ENABLED) {
-            return new Scope(name, context);
+            DebugContext.getInstance().scope(name, runnable, context);
         } else {
-            return VOID_SCOPE;
+            runnable.run();
         }
     }
 
     private static final Scope VOID_SCOPE = new Scope(null);
 
+
     public static final class Scope implements AutoCloseable {
         private String name;
         private Object[] context;
--- a/graal/com.oracle.max.graal.debug/src/com/oracle/max/graal/debug/DebugContext.java	Tue Jan 10 23:00:17 2012 +0100
+++ b/graal/com.oracle.max.graal.debug/src/com/oracle/max/graal/debug/DebugContext.java	Wed Jan 11 15:02:48 2012 +0100
@@ -37,7 +37,7 @@
     void log(String msg, Object... args) {
     }
 
-    void scope(Runnable runnable, String name, Object... context) {
+    void scope(String name, Runnable runnable, Object... context) {
         runnable.run();
     }
 }
--- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/bridge/VMToCompilerImpl.java	Tue Jan 10 23:00:17 2012 +0100
+++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/bridge/VMToCompilerImpl.java	Wed Jan 11 15:02:48 2012 +0100
@@ -169,7 +169,7 @@
                 public void run() {
                     try {
                         PhasePlan plan = new PhasePlan();
-                        GraphBuilderPhase graphBuilderPhase = new GraphBuilderPhase(compiler.getRuntime(), null);
+                        GraphBuilderPhase graphBuilderPhase = new GraphBuilderPhase(compiler.getRuntime());
                         plan.addPhase(PhasePosition.AFTER_PARSING, graphBuilderPhase);
                         long startTime = 0;
                         int index = compiledMethodCount++;
@@ -186,7 +186,7 @@
                         CiTargetMethod result = null;
                         TTY.Filter filter = new TTY.Filter(GraalOptions.PrintFilter, method);
                         try {
-                            result = compiler.getCompiler().compileMethod(method, -1, null, DebugInfoLevel.FULL, plan);
+                            result = compiler.getCompiler().compileMethod(method, -1, DebugInfoLevel.FULL, plan);
                         } finally {
                             filter.remove();
                             if (printCompilation) {
--- a/graal/com.oracle.max.graal.java/src/com/oracle/max/graal/java/GraphBuilderPhase.java	Tue Jan 10 23:00:17 2012 +0100
+++ b/graal/com.oracle.max.graal.java/src/com/oracle/max/graal/java/GraphBuilderPhase.java	Wed Jan 11 15:02:48 2012 +0100
@@ -67,7 +67,6 @@
 
     private StructuredGraph currentGraph;
 
-    private final CiStatistics stats;
     private final RiRuntime runtime;
     private RiConstantPool constantPool;
     private RiExceptionHandler[] exceptionHandlers;
@@ -104,17 +103,13 @@
     private final GraphBuilderConfiguration config;
 
     public GraphBuilderPhase(RiRuntime runtime) {
-        this(runtime, null);
+        this(runtime, GraphBuilderConfiguration.getDefault());
     }
 
-    public GraphBuilderPhase(RiRuntime runtime, CiStatistics stats) {
-        this(runtime, stats, GraphBuilderConfiguration.getDefault());
-    }
-
-    public GraphBuilderPhase(RiRuntime runtime, CiStatistics stats, GraphBuilderConfiguration config) {
+    public GraphBuilderPhase(RiRuntime runtime, GraphBuilderConfiguration config) {
+        assert config != null && runtime != null;
         this.config = config;
         this.runtime = runtime;
-        this.stats = stats;
         this.log = GraalOptions.TraceBytecodeParserLevel > 0 ? new LogStream(TTY.out()) : null;
     }
 
@@ -143,9 +138,6 @@
     private BlockMap createBlockMap() {
         BlockMap map = new BlockMap(method, config.useBranchPrediction());
         map.build();
-        if (stats != null) {
-            stats.bytecodeCount += method.code().length;
-        }
 
         if (currentContext.isObserved()) {
             String label = CiUtil.format("BlockListBuilder %f %R %H.%n(%P)", method);
@@ -165,9 +157,6 @@
         this.canTrapBitSet = blockMap.canTrap;
 
         exceptionHandlers = blockMap.exceptionHandlers();
-        if (stats != null) {
-            stats.blockCount += blockMap.blocks.size();
-        }
         nextBlockNumber = blockMap.blocks.size();
 
         lastInstr = currentGraph.start();
@@ -208,9 +197,6 @@
     }
 
     private int nextBlockNumber() {
-        if (stats != null) {
-            stats.blockCount++;
-        }
         return nextBlockNumber++;
     }
 
--- a/graal/com.oracle.max.graal.snippets/src/com/oracle/max/graal/snippets/Snippets.java	Tue Jan 10 23:00:17 2012 +0100
+++ b/graal/com.oracle.max.graal.snippets/src/com/oracle/max/graal/snippets/Snippets.java	Wed Jan 11 15:02:48 2012 +0100
@@ -129,7 +129,7 @@
     private static StructuredGraph buildSnippetGraph(RiResolvedMethod snippetRiMethod, GraalRuntime runtime, CiTarget target, GraalContext context, BoxingMethodPool pool, PhasePlan plan, IdealGraphPrinterObserver observer) {
 
         GraphBuilderConfiguration config = GraphBuilderConfiguration.getDeoptFreeDefault();
-        GraphBuilderPhase graphBuilder = new GraphBuilderPhase(runtime, null, config);
+        GraphBuilderPhase graphBuilder = new GraphBuilderPhase(runtime, config);
         StructuredGraph graph = new StructuredGraph(snippetRiMethod);
         graphBuilder.apply(graph, context);
 
--- a/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/GraphTest.java	Tue Jan 10 23:00:17 2012 +0100
+++ b/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/GraphTest.java	Wed Jan 11 15:02:48 2012 +0100
@@ -103,13 +103,13 @@
     protected StructuredGraph parse(Method m) {
         RiResolvedMethod riMethod = runtime.getRiMethod(m);
         StructuredGraph graph = new StructuredGraph(riMethod);
-        new GraphBuilderPhase(runtime, null, GraphBuilderConfiguration.getDeoptFreeDefault()).apply(graph);
+        new GraphBuilderPhase(runtime, GraphBuilderConfiguration.getDeoptFreeDefault()).apply(graph);
         return graph;
     }
 
     protected PhasePlan getDefaultPhasePlan() {
         PhasePlan plan = new PhasePlan();
-        plan.addPhase(PhasePosition.AFTER_PARSING, new GraphBuilderPhase(runtime, null, GraphBuilderConfiguration.getDeoptFreeDefault()));
+        plan.addPhase(PhasePosition.AFTER_PARSING, new GraphBuilderPhase(runtime, GraphBuilderConfiguration.getDeoptFreeDefault()));
         return plan;
     }