changeset 20980:abc059cb0acf

Guard usages of Debug.log in LinearScan
author Tom Rodriguez <tom.rodriguez@oracle.com>
date Tue, 14 Apr 2015 11:37:24 -0700
parents 65d8d305f9c0
children 92fc95e8667d
files graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScan.java graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanWalker.java graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LocationMarker.java graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/MoveResolver.java
diffstat 4 files changed, 160 insertions(+), 54 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScan.java	Tue Apr 14 11:37:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScan.java	Tue Apr 14 11:37:24 2015 -0700
@@ -554,7 +554,9 @@
                             // move target is a stack slot that is always correct, so eliminate
                             // instruction
                             if (Debug.isLogEnabled()) {
-                                Debug.log("eliminating move from interval %d to %d", operandNumber(move.getInput()), operandNumber(move.getResult()));
+                                if (Debug.isLogEnabled()) {
+                                    Debug.log("eliminating move from interval %d to %d", operandNumber(move.getInput()), operandNumber(move.getResult()));
+                                }
                             }
                             // null-instructions are deleted by assignRegNum
                             instructions.set(j, null);
@@ -582,7 +584,9 @@
 
                                 insertionBuffer.append(j + 1, getSpillMoveFactory().createMove(toLocation, fromLocation));
 
-                                Debug.log("inserting move after definition of interval %d to stack slot %s at opId %d", interval.operandNumber, interval.spillSlot(), opId);
+                                if (Debug.isLogEnabled()) {
+                                    Debug.log("inserting move after definition of interval %d to stack slot %s at opId %d", interval.operandNumber, interval.spillSlot(), opId);
+                                }
                             }
                             interval = interval.next;
                         }
@@ -612,7 +616,9 @@
             assert temp.spillDefinitionPos() >= temp.from() : "invalid order";
             assert temp.spillDefinitionPos() <= temp.from() + 2 : "only intervals defined once at their start-pos can be optimized";
 
-            Debug.log("interval %d (from %d to %d) must be stored at %d", temp.operandNumber, temp.from(), temp.to(), temp.spillDefinitionPos());
+            if (Debug.isLogEnabled()) {
+                Debug.log("interval %d (from %d to %d) must be stored at %d", temp.operandNumber, temp.from(), temp.to(), temp.spillDefinitionPos());
+            }
 
             prev = temp;
             temp = temp.next;
@@ -695,7 +701,9 @@
                         int operandNum = operandNumber(operand);
                         if (!liveKill.get(operandNum)) {
                             liveGen.set(operandNum);
-                            Debug.log("liveGen for operand %d", operandNum);
+                            if (Debug.isLogEnabled()) {
+                                Debug.log("liveGen for operand %d", operandNum);
+                            }
                         }
                         if (block.getLoop() != null) {
                             intervalInLoop.setBit(operandNum, block.getLoop().getIndex());
@@ -711,7 +719,9 @@
                         int operandNum = operandNumber(operand);
                         if (!liveKill.get(operandNum)) {
                             liveGen.set(operandNum);
-                            Debug.log("liveGen in state for operand %d", operandNum);
+                            if (Debug.isLogEnabled()) {
+                                Debug.log("liveGen in state for operand %d", operandNum);
+                            }
                         }
                     }
                 };
@@ -719,7 +729,9 @@
                     if (isVariable(operand)) {
                         int varNum = operandNumber(operand);
                         liveKill.set(varNum);
-                        Debug.log("liveKill for operand %d", varNum);
+                        if (Debug.isLogEnabled()) {
+                            Debug.log("liveKill for operand %d", varNum);
+                        }
                         if (block.getLoop() != null) {
                             intervalInLoop.setBit(varNum, block.getLoop().getIndex());
                         }
@@ -754,8 +766,10 @@
                 blockSets.liveIn = new BitSet(liveSize);
                 blockSets.liveOut = new BitSet(liveSize);
 
-                Debug.log("liveGen  B%d %s", block.getId(), blockSets.liveGen);
-                Debug.log("liveKill B%d %s", block.getId(), blockSets.liveKill);
+                if (Debug.isLogEnabled()) {
+                    Debug.log("liveGen  B%d %s", block.getId(), blockSets.liveGen);
+                    Debug.log("liveKill B%d %s", block.getId(), blockSets.liveKill);
+                }
 
             }
         } // end of block iteration
@@ -845,7 +859,9 @@
                             liveIn.andNot(blockSets.liveKill);
                             liveIn.or(blockSets.liveGen);
 
-                            Debug.log("block %d: livein = %s,  liveout = %s", block.getId(), liveIn, blockSets.liveOut);
+                            if (Debug.isLogEnabled()) {
+                                Debug.log("block %d: livein = %s,  liveout = %s", block.getId(), liveIn, blockSets.liveOut);
+                            }
                         }
                     }
                     iterationCount++;
@@ -983,7 +999,9 @@
         // Register use position at even instruction id.
         interval.addUsePos(to & ~1, registerPriority);
 
-        Debug.log("add use: %s, from %d to %d (%s)", interval, from, to, registerPriority.name());
+        if (Debug.isLogEnabled()) {
+            Debug.log("add use: %s, from %d to %d (%s)", interval, from, to, registerPriority.name());
+        }
     }
 
     void addTemp(AllocatableValue operand, int tempPos, RegisterPriority registerPriority, LIRKind kind) {
@@ -1000,7 +1018,9 @@
         interval.addUsePos(tempPos, registerPriority);
         interval.addMaterializationValue(null);
 
-        Debug.log("add temp: %s tempPos %d (%s)", interval, tempPos, RegisterPriority.MustHaveRegister.name());
+        if (Debug.isLogEnabled()) {
+            Debug.log("add temp: %s tempPos %d (%s)", interval, tempPos, RegisterPriority.MustHaveRegister.name());
+        }
     }
 
     boolean isProcessed(Value operand) {
@@ -1030,7 +1050,9 @@
             // also add register priority for dead intervals
             interval.addRange(defPos, defPos + 1);
             interval.addUsePos(defPos, registerPriority);
-            Debug.log("Warning: def of operand %s at %d occurs without use", operand, defPos);
+            if (Debug.isLogEnabled()) {
+                Debug.log("Warning: def of operand %s at %d occurs without use", operand, defPos);
+            }
         }
 
         changeSpillDefinitionPos(interval, defPos);
@@ -1040,7 +1062,9 @@
         }
         interval.addMaterializationValue(LinearScan.getMaterializedValue(op, operand, interval));
 
-        Debug.log("add def: %s defPos %d (%s)", interval, defPos, registerPriority.name());
+        if (Debug.isLogEnabled()) {
+            Debug.log("add def: %s defPos %d (%s)", interval, defPos, registerPriority.name());
+        }
     }
 
     /**
@@ -1092,7 +1116,9 @@
                     assert blockForId(op.id()).getPredecessorCount() == 0 : "move from stack must be in first block";
                     assert isVariable(move.getResult()) : "result of move must be a variable";
 
-                    Debug.log("found move from stack slot %s to %s", slot, move.getResult());
+                    if (Debug.isLogEnabled()) {
+                        Debug.log("found move from stack slot %s to %s", slot, move.getResult());
+                    }
                 }
 
                 Interval interval = intervalFor(move.getResult());
@@ -1116,7 +1142,9 @@
                     } else {
                         from.setLocationHint(to);
                     }
-                    Debug.log("operation at opId %d: added hint from interval %d to %d", op.id(), from.operandNumber, to.operandNumber);
+                    if (Debug.isLogEnabled()) {
+                        Debug.log("operation at opId %d: added hint from interval %d to %d", op.id(), from.operandNumber, to.operandNumber);
+                    }
 
                     return registerHint;
                 }
@@ -1191,7 +1219,9 @@
                     for (int operandNum = live.nextSetBit(0); operandNum >= 0; operandNum = live.nextSetBit(operandNum + 1)) {
                         assert live.get(operandNum) : "should not stop here otherwise";
                         AllocatableValue operand = intervalFor(operandNum).operand;
-                        Debug.log("live in %d: %s", operandNum, operand);
+                        if (Debug.isLogEnabled()) {
+                            Debug.log("live in %d: %s", operandNum, operand);
+                        }
 
                         addUse(operand, blockFrom, blockTo + 2, RegisterPriority.None, LIRKind.Illegal);
 
@@ -1220,7 +1250,9 @@
                                         addTemp(r.asValue(), opId, RegisterPriority.None, LIRKind.Illegal);
                                     }
                                 }
-                                Debug.log("operation destroys all caller-save registers");
+                                if (Debug.isLogEnabled()) {
+                                    Debug.log("operation destroys all caller-save registers");
+                                }
                             }
 
                             op.visitEachOutput(outputConsumer);
@@ -1413,7 +1445,9 @@
         Interval result = interval.getSplitChildAtOpId(opId, mode, this);
 
         if (result != null) {
-            Debug.log("Split child at pos %d of interval %s is %s", opId, interval, result);
+            if (Debug.isLogEnabled()) {
+                Debug.log("Split child at pos %d of interval %s is %s", opId, interval, result);
+            }
             return result;
         }
 
@@ -1445,7 +1479,9 @@
 
     void resolveFindInsertPos(AbstractBlockBase<?> fromBlock, AbstractBlockBase<?> toBlock, MoveResolver moveResolver) {
         if (fromBlock.getSuccessorCount() <= 1) {
-            Debug.log("inserting moves at end of fromBlock B%d", fromBlock.getId());
+            if (Debug.isLogEnabled()) {
+                Debug.log("inserting moves at end of fromBlock B%d", fromBlock.getId());
+            }
 
             List<LIRInstruction> instructions = ir.getLIRforBlock(fromBlock);
             LIRInstruction instr = instructions.get(instructions.size() - 1);
@@ -1457,7 +1493,9 @@
             }
 
         } else {
-            Debug.log("inserting moves at beginning of toBlock B%d", toBlock.getId());
+            if (Debug.isLogEnabled()) {
+                Debug.log("inserting moves at beginning of toBlock B%d", toBlock.getId());
+            }
 
             if (DetailedAsserts.getValue()) {
                 assert ir.getLIRforBlock(fromBlock).get(0) instanceof StandardOp.LabelOp : "block does not start with a label";
@@ -1502,7 +1540,9 @@
 
                         // prevent optimization of two consecutive blocks
                         if (!blockCompleted.get(pred.getLinearScanNumber()) && !blockCompleted.get(sux.getLinearScanNumber())) {
-                            Debug.log(" optimizing empty block B%d (pred: B%d, sux: B%d)", block.getId(), pred.getId(), sux.getId());
+                            if (Debug.isLogEnabled()) {
+                                Debug.log(" optimizing empty block B%d (pred: B%d, sux: B%d)", block.getId(), pred.getId(), sux.getId());
+                            }
 
                             blockCompleted.set(block.getLinearScanNumber());
 
@@ -1529,7 +1569,9 @@
                         // check for duplicate edges between the same blocks (can happen with switch
                         // blocks)
                         if (!alreadyResolved.get(toBlock.getLinearScanNumber())) {
-                            Debug.log("processing edge between B%d and B%d", fromBlock.getId(), toBlock.getId());
+                            if (Debug.isLogEnabled()) {
+                                Debug.log("processing edge between B%d and B%d", fromBlock.getId(), toBlock.getId());
+                            }
 
                             alreadyResolved.set(toBlock.getLinearScanNumber());
 
@@ -1835,7 +1877,9 @@
                             // iterate all blocks where the interval has use positions
                             for (AbstractBlockBase<?> splitBlock : blocksForInterval(splitChild)) {
                                 if (dominates(defBlock, splitBlock)) {
-                                    Debug.log("Split interval %s, block %s", splitChild, splitBlock);
+                                    if (Debug.isLogEnabled()) {
+                                        Debug.log("Split interval %s, block %s", splitChild, splitBlock);
+                                    }
                                     if (spillBlock == null) {
                                         spillBlock = splitBlock;
                                     } else {
@@ -1862,14 +1906,18 @@
                         assert firstSpillChild != null;
                         if (!defBlock.equals(spillBlock) && spillBlock.equals(blockForId(firstSpillChild.from()))) {
                             AbstractBlockBase<?> dom = spillBlock.getDominator();
-                            Debug.log("Spill block (%s) is the beginning of a spill child -> use dominator (%s)", spillBlock, dom);
+                            if (Debug.isLogEnabled()) {
+                                Debug.log("Spill block (%s) is the beginning of a spill child -> use dominator (%s)", spillBlock, dom);
+                            }
                             spillBlock = dom;
                         }
 
                         if (!defBlock.equals(spillBlock)) {
                             assert dominates(defBlock, spillBlock);
                             betterSpillPos.increment();
-                            Debug.log("Better spill position found (Block %s)", spillBlock);
+                            if (Debug.isLogEnabled()) {
+                                Debug.log("Better spill position found (Block %s)", spillBlock);
+                            }
 
                             if (defBlock.probability() <= spillBlock.probability()) {
                                 // better spill block has the same probability -> do nothing
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanWalker.java	Tue Apr 14 11:37:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanWalker.java	Tue Apr 14 11:37:24 2015 -0700
@@ -297,7 +297,9 @@
         int optimalSplitPos = -1;
         if (minSplitPos == maxSplitPos) {
             // trivial case, no optimization of split position possible
-            Debug.log("min-pos and max-pos are equal, no optimization possible");
+            if (Debug.isLogEnabled()) {
+                Debug.log("min-pos and max-pos are equal, no optimization possible");
+            }
             optimalSplitPos = minSplitPos;
 
         } else {
@@ -319,7 +321,9 @@
             assert minBlock.getLinearScanNumber() <= maxBlock.getLinearScanNumber() : "invalid order";
             if (minBlock == maxBlock) {
                 // split position cannot be moved to block boundary : so split as late as possible
-                Debug.log("cannot move split pos to block boundary because minPos and maxPos are in same block");
+                if (Debug.isLogEnabled()) {
+                    Debug.log("cannot move split pos to block boundary because minPos and maxPos are in same block");
+                }
                 optimalSplitPos = maxSplitPos;
 
             } else {
@@ -329,19 +333,25 @@
                     // as mustHaveRegister) with a hole before each definition. When the register is
                     // needed
                     // for the second definition : an earlier reloading is unnecessary.
-                    Debug.log("interval has hole just before maxSplitPos, so splitting at maxSplitPos");
+                    if (Debug.isLogEnabled()) {
+                        Debug.log("interval has hole just before maxSplitPos, so splitting at maxSplitPos");
+                    }
                     optimalSplitPos = maxSplitPos;
 
                 } else {
                     // seach optimal block boundary between minSplitPos and maxSplitPos
-                    Debug.log("moving split pos to optimal block boundary between block B%d and B%d", minBlock.getId(), maxBlock.getId());
+                    if (Debug.isLogEnabled()) {
+                        Debug.log("moving split pos to optimal block boundary between block B%d and B%d", minBlock.getId(), maxBlock.getId());
+                    }
 
                     if (doLoopOptimization) {
                         // Loop optimization: if a loop-end marker is found between min- and
                         // max-position :
                         // then split before this loop
                         int loopEndPos = interval.nextUsageExact(RegisterPriority.LiveAtLoopEnd, allocator.getLastLirInstructionId(minBlock) + 2);
-                        Debug.log("loop optimization: loop end found at pos %d", loopEndPos);
+                        if (Debug.isLogEnabled()) {
+                            Debug.log("loop optimization: loop end found at pos %d", loopEndPos);
+                        }
 
                         assert loopEndPos > minSplitPos : "invalid order";
                         if (loopEndPos < maxSplitPos) {
@@ -354,16 +364,22 @@
                             // of the interval (normally, only mustHaveRegister causes a reloading)
                             AbstractBlockBase<?> loopBlock = allocator.blockForId(loopEndPos);
 
-                            Debug.log("interval is used in loop that ends in block B%d, so trying to move maxBlock back from B%d to B%d", loopBlock.getId(), maxBlock.getId(), loopBlock.getId());
+                            if (Debug.isLogEnabled()) {
+                                Debug.log("interval is used in loop that ends in block B%d, so trying to move maxBlock back from B%d to B%d", loopBlock.getId(), maxBlock.getId(), loopBlock.getId());
+                            }
                             assert loopBlock != minBlock : "loopBlock and minBlock must be different because block boundary is needed between";
 
                             int maxSpillPos = allocator.getLastLirInstructionId(loopBlock) + 2;
                             optimalSplitPos = findOptimalSplitPos(minBlock, loopBlock, maxSpillPos);
                             if (optimalSplitPos == maxSpillPos) {
                                 optimalSplitPos = -1;
-                                Debug.log("loop optimization not necessary");
+                                if (Debug.isLogEnabled()) {
+                                    Debug.log("loop optimization not necessary");
+                                }
                             } else {
-                                Debug.log("loop optimization successful");
+                                if (Debug.isLogEnabled()) {
+                                    Debug.log("loop optimization successful");
+                                }
                             }
                         }
                     }
@@ -375,7 +391,9 @@
                 }
             }
         }
-        Debug.log("optimal split position: %d", optimalSplitPos);
+        if (Debug.isLogEnabled()) {
+            Debug.log("optimal split position: %d", optimalSplitPos);
+        }
 
         return optimalSplitPos;
     }
@@ -402,7 +420,9 @@
             if (optimalSplitPos == interval.to() && interval.nextUsage(RegisterPriority.MustHaveRegister, minSplitPos) == Integer.MAX_VALUE) {
                 // the split position would be just before the end of the interval
                 // . no split at all necessary
-                Debug.log("no split necessary because optimal split position is at end of interval");
+                if (Debug.isLogEnabled()) {
+                    Debug.log("no split necessary because optimal split position is at end of interval");
+                }
                 return;
             }
 
@@ -415,7 +435,9 @@
                 optimalSplitPos = (optimalSplitPos - 1) | 1;
             }
 
-            Debug.log("splitting at position %d", optimalSplitPos);
+            if (Debug.isLogEnabled()) {
+                Debug.log("splitting at position %d", optimalSplitPos);
+            }
 
             assert allocator.isBlockBegin(optimalSplitPos) || ((optimalSplitPos & 1) == 1) : "split pos must be odd when not on block boundary";
             assert !allocator.isBlockBegin(optimalSplitPos) || ((optimalSplitPos & 1) == 0) : "split pos must be even on block boundary";
@@ -473,7 +495,9 @@
                         if (isRegister(parent.location())) {
                             if (parent.firstUsage(RegisterPriority.ShouldHaveRegister) == Integer.MAX_VALUE) {
                                 // parent is never used, so kick it out of its assigned register
-                                Debug.log("kicking out interval %d out of its register because it is never used", parent.operandNumber);
+                                if (Debug.isLogEnabled()) {
+                                    Debug.log("kicking out interval %d out of its register because it is never used", parent.operandNumber);
+                                }
                                 allocator.assignSpillSlot(parent);
                                 handleSpillSlot(parent);
                             } else {
@@ -508,7 +532,9 @@
                     allocator.changeSpillState(spilledPart, optimalSplitPos);
 
                     if (!allocator.isBlockBegin(optimalSplitPos)) {
-                        Debug.log("inserting move from interval %d to %d", interval.operandNumber, spilledPart.operandNumber);
+                        if (Debug.isLogEnabled()) {
+                            Debug.log("inserting move from interval %d to %d", interval.operandNumber, spilledPart.operandNumber);
+                        }
                         insertMove(optimalSplitPos, interval, spilledPart);
                     }
 
@@ -600,7 +626,9 @@
             Interval locationHint = interval.locationHint(true);
             if (locationHint != null && locationHint.location() != null && isRegister(locationHint.location())) {
                 hint = asRegister(locationHint.location());
-                Debug.log("hint register %d from interval %s", hint.number, locationHint);
+                if (Debug.isLogEnabled()) {
+                    Debug.log("hint register %d from interval %s", hint.number, locationHint);
+                }
             }
             assert interval.location() == null : "register already assigned to interval";
 
@@ -642,7 +670,9 @@
 
             splitPos = usePos[reg.number];
             interval.assignLocation(reg.asValue(interval.kind()));
-            Debug.log("selected register %d", reg.number);
+            if (Debug.isLogEnabled()) {
+                Debug.log("selected register %d", reg.number);
+            }
 
             assert splitPos > 0 : "invalid splitPos";
             if (needSplit) {
@@ -711,7 +741,9 @@
 
             int regUsePos = (reg == null ? 0 : usePos[reg.number]);
             if (regUsePos <= firstUsage) {
-                Debug.log("able to spill current interval. firstUsage(register): %d, usePos: %d", firstUsage, regUsePos);
+                if (Debug.isLogEnabled()) {
+                    Debug.log("able to spill current interval. firstUsage(register): %d, usePos: %d", firstUsage, regUsePos);
+                }
 
                 if (firstUsage <= interval.from() + 1) {
                     String description = "cannot spill interval that is used in first instruction (possible reason: no register found) firstUsage=" + firstUsage + ", interval.from()=" +
@@ -730,7 +762,9 @@
 
             int splitPos = blockPos[reg.number];
 
-            Debug.log("decided to use register %d", reg.number);
+            if (Debug.isLogEnabled()) {
+                Debug.log("decided to use register %d", reg.number);
+            }
             assert splitPos > 0 : "invalid splitPos";
             assert needSplit || splitPos > interval.from() : "splitting interval at from";
 
@@ -757,7 +791,9 @@
             if (isOdd(pos)) {
                 // the current instruction is a call that blocks all registers
                 if (pos < allocator.maxOpId() && allocator.hasCall(pos + 1) && interval.to() > pos + 1) {
-                    Debug.log("free register cannot be available because all registers blocked by following call");
+                    if (Debug.isLogEnabled()) {
+                        Debug.log("free register cannot be available because all registers blocked by following call");
+                    }
 
                     // safety check that there is really no register available
                     assert !allocFreeRegister(interval) : "found a register for this interval";
@@ -853,7 +889,9 @@
                 // activating an interval that has a stack slot assigned . split it at first use
                 // position
                 // used for method parameters
-                Debug.log("interval has spill slot assigned (method parameter) . split it before first use");
+                if (Debug.isLogEnabled()) {
+                    Debug.log("interval has spill slot assigned (method parameter) . split it before first use");
+                }
                 splitStackInterval(interval);
                 result = false;
 
@@ -861,7 +899,9 @@
                 if (interval.location() == null) {
                     // interval has not assigned register . normal allocation
                     // (this is the normal case for most intervals)
-                    Debug.log("normal allocation of register");
+                    if (Debug.isLogEnabled()) {
+                        Debug.log("normal allocation of register");
+                    }
 
                     // assign same spill slot to non-intersecting intervals
                     combineSpilledIntervals(interval);
@@ -885,7 +925,9 @@
                 assert interval.isSplitChild();
                 assert interval.currentSplitChild() != null;
                 assert !interval.currentSplitChild().operand.equals(operand) : "cannot insert move between same interval";
-                Debug.log("Inserting move from interval %d to %d because insertMoveWhenActivated is set", interval.currentSplitChild().operandNumber, interval.operandNumber);
+                if (Debug.isLogEnabled()) {
+                    Debug.log("Inserting move from interval %d to %d because insertMoveWhenActivated is set", interval.currentSplitChild().operandNumber, interval.operandNumber);
+                }
 
                 insertMove(interval.from(), interval.currentSplitChild(), interval);
             }
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LocationMarker.java	Tue Apr 14 11:37:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LocationMarker.java	Tue Apr 14 11:37:24 2015 -0700
@@ -213,7 +213,9 @@
                     LIRKind kind = operand.getLIRKind();
                     if (shouldProcessValue(operand) && !kind.isValue() && !kind.isDerivedReference()) {
                         // no need to insert values and derived reference
-                        Debug.log("set operand: %s", operand);
+                        if (Debug.isLogEnabled()) {
+                            Debug.log("set operand: %s", operand);
+                        }
                         frameMap.setReference(operand, currentSet);
                     }
                 }
@@ -222,7 +224,9 @@
             ValueConsumer defConsumer = new ValueConsumer() {
                 public void visitValue(Value operand, OperandMode mode, EnumSet<OperandFlag> flags) {
                     if (shouldProcessValue(operand)) {
-                        Debug.log("clear operand: %s", operand);
+                        if (Debug.isLogEnabled()) {
+                            Debug.log("clear operand: %s", operand);
+                        }
                         frameMap.clearReference(operand, currentSet);
                     } else {
                         assert isIllegal(operand) || operand.getPlatformKind() != Kind.Illegal || mode == OperandMode.TEMP : String.format(
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/MoveResolver.java	Tue Apr 14 11:37:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/MoveResolver.java	Tue Apr 14 11:37:24 2015 -0700
@@ -206,7 +206,9 @@
 
         insertionBuffer.append(insertIdx, allocator.getSpillMoveFactory().createMove(toOpr, fromOpr));
 
-        Debug.log("insert move from %s to %s at %d", fromInterval, toInterval, insertIdx);
+        if (Debug.isLogEnabled()) {
+            Debug.log("insert move from %s to %s at %d", fromInterval, toInterval, insertIdx);
+        }
     }
 
     private void insertMove(Value fromOpr, Interval toInterval) {
@@ -216,7 +218,9 @@
         AllocatableValue toOpr = toInterval.operand;
         insertionBuffer.append(insertIdx, allocator.getSpillMoveFactory().createMove(toOpr, fromOpr));
 
-        Debug.log("insert move from value %s to %s at %d", fromOpr, toInterval, insertIdx);
+        if (Debug.isLogEnabled()) {
+            Debug.log("insert move from value %s to %s at %d", fromOpr, toInterval, insertIdx);
+        }
     }
 
     private void resolveMappings() {
@@ -286,7 +290,9 @@
                 }
                 spillInterval.assignLocation(spillSlot);
 
-                Debug.log("created new Interval for spilling: %s", spillInterval);
+                if (Debug.isLogEnabled()) {
+                    Debug.log("created new Interval for spilling: %s", spillInterval);
+                }
 
                 // insert a move from register to stack and update the mapping
                 insertMove(fromInterval, spillInterval);
@@ -328,7 +334,9 @@
     void addMapping(Interval fromInterval, Interval toInterval) {
 
         if (isIllegal(toInterval.location()) && toInterval.canMaterialize()) {
-            Debug.log("no store to rematerializable interval %s needed", toInterval);
+            if (Debug.isLogEnabled()) {
+                Debug.log("no store to rematerializable interval %s needed", toInterval);
+            }
             return;
         }
         if (isIllegal(fromInterval.location()) && fromInterval.canMaterialize()) {
@@ -337,7 +345,9 @@
             addMapping(rematValue, toInterval);
             return;
         }
-        Debug.log("add move mapping from %s to %s", fromInterval, toInterval);
+        if (Debug.isLogEnabled()) {
+            Debug.log("add move mapping from %s to %s", fromInterval, toInterval);
+        }
 
         assert !fromInterval.operand.equals(toInterval.operand) : "from and to interval equal: " + fromInterval;
         assert fromInterval.kind().equals(toInterval.kind());
@@ -347,7 +357,9 @@
     }
 
     void addMapping(Value fromOpr, Interval toInterval) {
-        Debug.log("add move mapping from %s to %s", fromOpr, toInterval);
+        if (Debug.isLogEnabled()) {
+            Debug.log("add move mapping from %s to %s", fromOpr, toInterval);
+        }
 
         assert isConstant(fromOpr) : "only for constants";