changeset 20151:bdd5ad8ce088

DebugTimers should be static final when possible
author Tom Rodriguez <tom.rodriguez@oracle.com>
date Thu, 02 Apr 2015 17:42:25 -0700
parents 7bf5292dd7ad
children cfd1c99206b9
files graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScan.java
diffstat 1 files changed, 13 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScan.java	Thu Apr 02 21:27:25 2015 +0200
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScan.java	Thu Apr 02 17:42:25 2015 -0700
@@ -1738,6 +1738,13 @@
         }
     }
 
+    private static final DebugTimer lifetimeTimer = Debug.timer("LinearScan_LifetimeAnalysis");
+    private static final DebugTimer registerAllocationTimer = Debug.timer("LinearScan_RegisterAllocation");
+    private static final DebugTimer optimizedSpillPositionTimer = Debug.timer("LinearScan_OptimizeSpillPosition");
+    private static final DebugTimer resolveDataFlowTimer = Debug.timer("LinearScan_ResolveDataFlow");
+    private static final DebugTimer eliminateSpillMoveTimer = Debug.timer("LinearScan_EliminateSpillMove");
+    private static final DebugTimer assignLocationsTimer = Debug.timer("LinearScan_AssignLocations");
+
     void allocate() {
 
         /*
@@ -1745,7 +1752,7 @@
          */
         try (Indent indent = Debug.logAndIndent("LinearScan allocate")) {
 
-            try (Scope s = Debug.scope("LifetimeAnalysis"); DebugCloseable a = Debug.timer("LinearScan_LifetimeAnalysis").start()) {
+            try (Scope s = Debug.scope("LifetimeAnalysis"); DebugCloseable a = lifetimeTimer.start()) {
                 numberInstructions();
                 printLir("Before register allocation", true);
                 computeLocalLiveSets();
@@ -1756,7 +1763,7 @@
                 throw Debug.handle(e);
             }
 
-            try (Scope s = Debug.scope("RegisterAllocation"); DebugCloseable a = Debug.timer("LinearScan_RegisterAllocation").start()) {
+            try (Scope s = Debug.scope("RegisterAllocation"); DebugCloseable a = registerAllocationTimer.start()) {
                 printIntervals("Before register allocation");
                 allocateRegisters();
             } catch (Throwable e) {
@@ -1764,14 +1771,14 @@
             }
 
             if (Options.LSRAOptimizeSpillPosition.getValue()) {
-                try (Scope s = Debug.scope("OptimizeSpillPosition"); DebugCloseable a = Debug.timer("LinearScan_OptimizeSpillPosition").start()) {
+                try (Scope s = Debug.scope("OptimizeSpillPosition"); DebugCloseable a = optimizedSpillPositionTimer.start()) {
                     optimizeSpillPosition();
                 } catch (Throwable e) {
                     throw Debug.handle(e);
                 }
             }
 
-            try (Scope s = Debug.scope("ResolveDataFlow"); DebugCloseable a = Debug.timer("LinearScan_ResolveDataFlow").start()) {
+            try (Scope s = Debug.scope("ResolveDataFlow"); DebugCloseable a = resolveDataFlowTimer.start()) {
                 resolveDataFlow();
             } catch (Throwable e) {
                 throw Debug.handle(e);
@@ -1787,14 +1794,14 @@
                     verify();
                 }
 
-                try (Scope s1 = Debug.scope("EliminateSpillMove"); DebugCloseable a = Debug.timer("LinearScan_EliminateSpillMove").start()) {
+                try (Scope s1 = Debug.scope("EliminateSpillMove"); DebugCloseable a = eliminateSpillMoveTimer.start()) {
                     eliminateSpillMoves();
                 } catch (Throwable e) {
                     throw Debug.handle(e);
                 }
                 printLir("After spill move elimination", true);
 
-                try (Scope s1 = Debug.scope("AssignLocations"); DebugCloseable a = Debug.timer("LinearScan_AssignLocations").start()) {
+                try (Scope s1 = Debug.scope("AssignLocations"); DebugCloseable a = assignLocationsTimer.start()) {
                     assignLocations();
                 } catch (Throwable e) {
                     throw Debug.handle(e);