# HG changeset patch # User Christian Wimmer # Date 1326215276 28800 # Node ID 1e62f742f0b3d12e047c6de0b881c79888aedf8c # Parent 1cf920630944d86a732d6311272b65358cd83050 Test how trace-code wrapped into an assert looks like. diff -r 1cf920630944 -r 1e62f742f0b3 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/simple/AssignRegisters.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/simple/AssignRegisters.java Tue Jan 10 08:50:07 2012 -0800 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/simple/AssignRegisters.java Tue Jan 10 09:07:56 2012 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2012, 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 @@ -48,10 +48,10 @@ ValueProcedure defProc = new ValueProcedure() { @Override public CiValue doValue(CiValue value) { return def(value); } }; ValueProcedure setReferenceProc = new ValueProcedure() { @Override public CiValue doValue(CiValue value) { return setReference(value); } }; - trace(1, "==== start assign registers ===="); + assert trace("==== start assign registers ===="); for (int i = lir.linearScanOrder().size() - 1; i >= 0; i--) { LIRBlock block = lir.linearScanOrder().get(i); - trace(1, "start block %s", block); + assert trace("start block %s", block); assert block.phis == null : "Register assignment must run after phi functions have been replaced by moves"; curRegisterRefMap = frameMap.initRegisterRefMap(); @@ -62,7 +62,7 @@ for (int j = block.lir().size() - 1; j >= 0; j--) { LIRInstruction op = block.lir().get(j); - trace(1, " op %d %s", op.id(), op); + assert trace(" op %d %s", op.id(), op); op.forEachOutput(defProc); op.forEachTemp(defProc); @@ -70,7 +70,7 @@ op.forEachAlive(useProc); if (op.info != null) { - trace(3, " registerRefMap: %s frameRefMap: %s", curRegisterRefMap, curFrameRefMap); + assert trace(" registerRefMap: %s frameRefMap: %s", curRegisterRefMap, curFrameRefMap); op.info.finish(new CiBitMap(curRegisterRefMap), new CiBitMap(curFrameRefMap), frameMap); if (op instanceof LIRXirInstruction) { @@ -85,13 +85,13 @@ // for the last time at this instruction are not part of the reference map. op.forEachInput(useProc); } - trace(1, "end block %s", block); + assert trace("end block %s", block); } - trace(1, "==== end assign registers ===="); + assert trace("==== end assign registers ===="); } private CiValue use(CiValue value) { - trace(3, " use %s", value); + assert trace(" use %s", value); if (isLocation(value)) { CiValue location = asLocation(value).location; frameMap.setReference(location, curRegisterRefMap, curFrameRefMap); @@ -103,7 +103,7 @@ } private CiValue def(CiValue value) { - trace(3, " def %s", value); + assert trace(" def %s", value); if (isLocation(value)) { CiValue location = asLocation(value).location; frameMap.clearReference(location, curRegisterRefMap, curFrameRefMap); @@ -115,16 +115,17 @@ } private CiValue setReference(CiValue value) { - trace(3, " setReference %s", value); + assert trace(" setReference %s", value); frameMap.setReference(asLocation(value).location, curRegisterRefMap, curFrameRefMap); return value; } protected abstract LocationMap locationsForBlockEnd(LIRBlock block); - private static void trace(int level, String format, Object...args) { - if (GraalOptions.TraceRegisterAllocationLevel >= level) { + private static boolean trace(String format, Object...args) { + if (GraalOptions.TraceRegisterAllocation) { TTY.println(format, args); } + return true; } } diff -r 1cf920630944 -r 1e62f742f0b3 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/simple/DataFlowAnalysis.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/simple/DataFlowAnalysis.java Tue Jan 10 08:50:07 2012 -0800 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/simple/DataFlowAnalysis.java Tue Jan 10 09:07:56 2012 -0800 @@ -171,22 +171,22 @@ blockLiveIn = new BitSet[blocks().size()]; registerLive = new BitSet(); - trace(1, "==== start backward data flow analysis ===="); + assert trace("==== start backward data flow analysis ===="); for (int i = blocks().size() - 1; i >= 0; i--) { LIRBlock block = blocks().get(i); - trace(1, "start block %s loop %d depth %d", block, block.loopIndex(), block.loopDepth()); + assert trace("start block %s loop %d depth %d", block, block.loopIndex(), block.loopDepth()); variableLive = new BitSet(); for (LIRBlock sux : block.getLIRSuccessors()) { BitSet suxLive = liveIn(sux); if (suxLive != null) { - trace(1, " sux %s suxLive: %s", sux, suxLive); + assert trace(" sux %s suxLive: %s", sux, suxLive); variableLive.or(suxLive); } if (sux.phis != null) { curOpId = block.lastLirInstructionId(); - trace(1, " phis %d variableLive: %s", curOpId, variableLive); + assert trace(" phis %d variableLive: %s", curOpId, variableLive); sux.phis.forEachInput(block, phiInputProc); } } @@ -196,7 +196,7 @@ for (int j = block.lir().size() - 1; j >= 0; j--) { LIRInstruction op = block.lir().get(j); curOpId = op.id(); - trace(1, " op %d %s variableLive: %s registerLive: %s", curOpId, op, variableLive, registerLive); + assert trace(" op %d %s variableLive: %s registerLive: %s", curOpId, op, variableLive, registerLive); op.forEachOutput(outputProc); op.forEachTemp(tempProc); @@ -207,7 +207,7 @@ if (block.phis != null) { curOpId = block.firstLirInstructionId(); - trace(1, " phis %d variableLive: %s registerLive: %s", curOpId, variableLive, registerLive); + assert trace(" phis %d variableLive: %s registerLive: %s", curOpId, variableLive, registerLive); block.phis.forEachOutput(outputProc); } @@ -216,29 +216,29 @@ setLiveIn(block, variableLive); if (block.isLoopHeader()) { - trace(1, " loop header, propagating live set to loop blocks variableLive: %s", variableLive); + assert trace(" loop header, propagating live set to loop blocks variableLive: %s", variableLive); // All variables that are live at the beginning of a loop are also live the whole loop. // This is guaranteed by the SSA form. for (Block loop : block.loopBlocks) { BitSet loopLiveIn = liveIn(loop); assert loopLiveIn != null : "All loop blocks must have been processed before the loop header"; loopLiveIn.or(variableLive); - trace(3, " block %s loopLiveIn %s", loop, loopLiveIn); + assert trace(" block %s loopLiveIn %s", loop, loopLiveIn); } } - trace(1, "end block %s variableLive: %s", block, variableLive); + assert trace("end block %s variableLive: %s", block, variableLive); } - trace(1, "==== end backward data flow analysis ===="); + assert trace("==== end backward data flow analysis ===="); } private CiValue use(CiValue value, int killOpId) { - trace(3, " use %s", value); + assert trace(" use %s", value); if (isVariable(value)) { int variableIdx = asVariable(value).index; assert definitions[variableIdx] < curOpId; if (!variableLive.get(variableIdx)) { - trace(3, " set live variable %d", variableIdx); + assert trace(" set live variable %d", variableIdx); variableLive.set(variableIdx); kill(value, killOpId); } @@ -246,7 +246,7 @@ } else if (isAllocatableRegister(value)) { int regNum = asRegister(value).number; if (!registerLive.get(regNum)) { - trace(3, " set live register %d", regNum); + assert trace(" set live register %d", regNum); registerLive.set(regNum); kill(value, killOpId); } @@ -255,12 +255,12 @@ } private CiValue def(CiValue value, boolean isTemp) { - trace(3, " def %s", value); + assert trace(" def %s", value); if (isVariable(value)) { int variableIdx = asVariable(value).index; assert definitions[variableIdx] == curOpId; if (variableLive.get(variableIdx)) { - trace(3, " clear live variable %d", variableIdx); + assert trace(" clear live variable %d", variableIdx); assert !isTemp : "temp variable cannot be used after the operation"; variableLive.clear(variableIdx); } else { @@ -271,7 +271,7 @@ } else if (isAllocatableRegister(value)) { int regNum = asRegister(value).number; if (registerLive.get(regNum)) { - trace(3, " clear live register %d", regNum); + assert trace(" clear live register %d", regNum); assert !isTemp : "temp variable cannot be used after the operation"; registerLive.clear(regNum); } else { @@ -296,11 +296,11 @@ if (useBlock.loopDepth() > 0 && useBlock.loopIndex() != defBlock.loopIndex()) { // This is a value defined outside of the loop it is currently used in. Therefore, it is live the whole loop // and is not killed by the current instruction. - trace(3, " no kill because use in loop %d, definition in loop %d", useBlock.loopIndex(), defBlock.loopIndex()); + assert trace(" no kill because use in loop %d, definition in loop %d", useBlock.loopIndex(), defBlock.loopIndex()); return; } } - trace(3, " kill %s at %d", value, opId); + assert trace(" kill %s at %d", value, opId); Object entry = killedValues(opId); if (entry == null) { @@ -322,9 +322,10 @@ } } - private static void trace(int level, String format, Object...args) { - if (GraalOptions.TraceRegisterAllocationLevel >= level) { + private static boolean trace(String format, Object...args) { + if (GraalOptions.TraceRegisterAllocation) { TTY.println(format, args); } + return true; } } diff -r 1cf920630944 -r 1e62f742f0b3 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/simple/ResolveDataFlow.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/simple/ResolveDataFlow.java Tue Jan 10 08:50:07 2012 -0800 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/simple/ResolveDataFlow.java Tue Jan 10 09:07:56 2012 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2012, 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 @@ -50,11 +50,11 @@ ValueProcedure locMappingProc = new ValueProcedure() { @Override public CiValue doValue(CiValue value) { return locMapping(value); } }; PhiValueProcedure phiMappingProc = new PhiValueProcedure() { @Override public CiValue doValue(CiValue input, CiValue output) { return phiMapping(input, output); } }; - trace(1, "==== start resolve data flow ===="); + assert trace("==== start resolve data flow ===="); for (LIRBlock toBlock : lir.linearScanOrder()) { for (LIRBlock fromBlock : toBlock.getLIRPredecessors()) { - trace(1, "start edge %s -> %s", fromBlock, toBlock); + assert trace("start edge %s -> %s", fromBlock, toBlock); findInsertPos(fromBlock, toBlock); LocationMap toLocations = locationsForBlockBegin(toBlock); @@ -68,14 +68,14 @@ } moveResolver.resolve(); - trace(1, "end edge %s -> %s", fromBlock, toBlock); + assert trace("end edge %s -> %s", fromBlock, toBlock); } // Phi functions are resolved with moves now, so delete them. toBlock.phis = null; } moveResolver.finish(); - trace(1, "==== end resolve data flow ===="); + assert trace("==== end resolve data flow ===="); } private CiValue locMapping(CiValue value) { @@ -102,11 +102,11 @@ LIRInstruction instr = instructions.get(instructions.size() - 1); assert instr instanceof LIRBranch && instr.code == StandardOpcode.JUMP : "block does not end with an unconditional jump"; moveResolver.init(instructions, instructions.size() - 1); - trace(1, " insert at end of %s before %d", fromBlock, instructions.size() - 1); + assert trace(" insert at end of %s before %d", fromBlock, instructions.size() - 1); } else if (toBlock.numberOfPreds() == 1) { moveResolver.init(toBlock.lir(), 1); - trace(1, " insert at beginning of %s before %d", toBlock, 1); + assert trace(" insert at beginning of %s before %d", toBlock, 1); } else { Util.shouldNotReachHere("Critical edge not split"); @@ -117,9 +117,10 @@ protected abstract LocationMap locationsForBlockEnd(LIRBlock block); - private static void trace(int level, String format, Object...args) { - if (GraalOptions.TraceRegisterAllocationLevel >= level) { + private static boolean trace(String format, Object...args) { + if (GraalOptions.TraceRegisterAllocation) { TTY.println(format, args); } + return true; } } diff -r 1cf920630944 -r 1e62f742f0b3 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/simple/SpillAllAllocator.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/simple/SpillAllAllocator.java Tue Jan 10 08:50:07 2012 -0800 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/simple/SpillAllAllocator.java Tue Jan 10 09:07:56 2012 -0800 @@ -164,12 +164,12 @@ PhiValueProcedure useSlotProc = new PhiValueProcedure() { @Override public CiValue doValue(CiValue value) { return useSlot(value); } }; ValueProcedure defSlotProc = new ValueProcedure() { @Override public CiValue doValue(CiValue value) { return defSlot(value); } }; - trace(1, "==== start spill all allocation ===="); + assert trace("==== start spill all allocation ===="); curInRegisterState = new Object[maxRegisterNum()]; curOutRegisterState = new Object[maxRegisterNum()]; curRegisterLocations = new LocationMap(lir.numVariables()); for (LIRBlock block : lir.linearScanOrder()) { - trace(1, "start block %s loop %d depth %d", block, block.loopIndex(), block.loopDepth()); + assert trace("start block %s loop %d depth %d", block, block.loopIndex(), block.loopDepth()); assert checkEmpty(curOutRegisterState); if (block.dominator() != null) { @@ -182,17 +182,17 @@ } else { curStackLocations = new LocationMap(lir.numVariables()); } - traceState(); + assert traceState(); if (block.phis != null) { - trace(1, " phis"); + assert trace(" phis"); block.phis.forEachOutput(defSlotProc); } for (int opIdx = 0; opIdx < block.lir().size(); opIdx++) { LIRInstruction op = block.lir().get(opIdx); curInstruction = op; - trace(1, " op %d %s", op.id(), op); + assert trace(" op %d %s", op.id(), op); assert curRegisterLocations.checkEmpty(); @@ -227,7 +227,7 @@ for (LIRBlock sux : block.getLIRSuccessors()) { if (sux.phis != null) { - trace(1, " phis of successor %s", sux); + assert trace(" phis of successor %s", sux); sux.phis.forEachInput(block, useSlotProc); } } @@ -237,11 +237,11 @@ setLocationsFor(block, curStackLocations); traceState(); - trace(1, "end block %s", block); + assert trace("end block %s", block); } moveResolver.finish(); - trace(1, "==== end spill all allocation ===="); + assert trace("==== end spill all allocation ===="); } private CiValue killNonLive(CiValue value) { @@ -254,7 +254,7 @@ private CiValue kill(CiValue value, boolean end) { if (isVariable(value)) { - trace(3, " kill variable %s", value); + assert trace(" kill variable %s", value); Variable variable = asVariable(value); curStackLocations.clear(variable); @@ -264,7 +264,7 @@ killLocation(loc); curRegisterLocations.clear(variable); - trace(3, " location %s", loc); + assert trace(" location %s", loc); assert isAllocatableRegister(loc.location); int regNum = asRegister(loc.location).number; @@ -274,7 +274,7 @@ } } else if (isAllocatableRegister(value)) { - trace(3, " kill register %s", value); + assert trace(" kill register %s", value); int regNum = asRegister(value).number; assert curOutRegisterState[regNum] == null || curOutRegisterState[regNum] instanceof LIRInstruction && curInstruction != null; @@ -289,7 +289,7 @@ } private CiValue killLocation(CiValue value) { - trace(3, " kill location %s", value); + assert trace(" kill location %s", value); assert isAllocatableRegister(asLocation(value).location); int regNum = asRegister(asLocation(value).location).number; @@ -301,7 +301,7 @@ private CiValue block(CiValue value) { if (isAllocatableRegister(value)) { - trace(3, " block %s", value); + assert trace(" block %s", value); int regNum = asRegister(value).number; assert curInstruction != null; assert curOutRegisterState[regNum] == null || curOutRegisterState[regNum] instanceof LIRInstruction; @@ -316,11 +316,11 @@ return useSlot(value); } if (isVariable(value)) { - trace(3, " load %s", value); + assert trace(" load %s", value); Location regLoc = curRegisterLocations.get(asVariable(value)); if (regLoc != null) { // This variable has already been processed before. - trace(3, " found location %s", regLoc); + assert trace(" found location %s", regLoc); } else { regLoc = allocateRegister(asVariable(value), curInRegisterState, mode == OperandMode.Alive ? curOutRegisterState : null, mode, flags); Location stackLoc = curStackLocations.get(asVariable(value)); @@ -340,7 +340,7 @@ return defSlot(value); } if (isVariable(value)) { - trace(3, " spill %s", value); + assert trace(" spill %s", value); assert curStackLocations.get(asVariable(value)) == null; Location regLoc = allocateRegister(asVariable(value), null, curOutRegisterState, mode, flags); if (mode == OperandMode.Output) { @@ -357,10 +357,10 @@ private CiValue useSlot(CiValue value) { if (isVariable(value)) { - trace(3, " useSlot %s", value); + assert trace(" useSlot %s", value); Location stackLoc = curStackLocations.get(asVariable(value)); assert stackLoc != null; - trace(3, " slot %s", stackLoc); + assert trace(" slot %s", stackLoc); return stackLoc; } else { return value; @@ -369,11 +369,11 @@ private CiValue defSlot(CiValue value) { if (isVariable(value)) { - trace(3, " assignSlot %s", value); + assert trace(" assignSlot %s", value); Location stackLoc = new Location(asVariable(value), frameMap.allocateSpillSlot(value.kind)); assert curStackLocations.get(asVariable(value)) == null; curStackLocations.put(stackLoc); - trace(3, " slot %s", stackLoc); + assert trace(" slot %s", stackLoc); return stackLoc; } else { return value; @@ -385,7 +385,7 @@ CiValue result = curInstruction.forEachRegisterHint(variable, mode, new ValueProcedure() { @Override public CiValue doValue(CiValue registerHint) { - trace(3, " registerHint %s", registerHint); + assert trace(" registerHint %s", registerHint); CiRegister hint = null; if (isRegister(registerHint)) { hint = asRegister(registerHint); @@ -430,7 +430,7 @@ } assert curRegisterLocations.get(variable) == null; curRegisterLocations.put(loc); - trace(3, " selected register %s", loc); + assert trace(" selected register %s", loc); return loc; } @@ -471,8 +471,8 @@ } - private void traceState() { - if (GraalOptions.TraceRegisterAllocationLevel >= 3) { + private boolean traceState() { + if (GraalOptions.TraceRegisterAllocation) { TTY.print(" curVariableLocations: "); curStackLocations.forEachLocation(new ValueProcedure() { @Override @@ -483,11 +483,13 @@ }); TTY.println(); } + return true; } - private static void trace(int level, String format, Object...args) { - if (GraalOptions.TraceRegisterAllocationLevel >= level) { + private static boolean trace(String format, Object...args) { + if (GraalOptions.TraceRegisterAllocation) { TTY.println(format, args); } + return true; } } diff -r 1cf920630944 -r 1e62f742f0b3 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/util/MoveResolver.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/util/MoveResolver.java Tue Jan 10 08:50:07 2012 -0800 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/util/MoveResolver.java Tue Jan 10 09:07:56 2012 -0800 @@ -74,7 +74,7 @@ assert isLocation(from) || isConstant(from); assert from != to; - trace(3, "mr add mapping from %s to %s", from, to); + assert trace("mr add mapping from %s to %s", from, to); mappingFrom.add(from); mappingTo.add(to); @@ -86,12 +86,12 @@ if (mappingFrom.size() == 1) { // If there is only one mapping, it is trivial that this mapping is safe to resolve. - trace(3, "mr resolve mappings: %d", mappingFrom.size()); + assert trace("mr resolve mappings: %d", mappingFrom.size()); insertMove(mappingFrom.get(0), mappingTo.get(0)); mappingFrom.remove(0); mappingTo.remove(0); } else if (mappingFrom.size() > 1) { - trace(3, "mr resolve mappings: %d", mappingFrom.size()); + assert trace("mr resolve mappings: %d", mappingFrom.size()); doResolve(); } insertPos = -1; @@ -258,7 +258,7 @@ } private void insertExchange(Location from, Location to) { - trace(3, "mr XCHG %s, %s", from, to); + assert trace("mr XCHG %s, %s", from, to); // TODO create XCHG instruction and use it here insertionBuffer.append(insertPos, null); throw Util.unimplemented(); @@ -291,7 +291,7 @@ } } else { - trace(3, "mr MOV %s -> %s", src, dst); + assert trace("mr MOV %s -> %s", src, dst); insertionBuffer.append(insertPos, StandardOpcode.SPILL_MOVE.create(dst, src)); } } @@ -337,9 +337,10 @@ } - private static void trace(int level, String format, Object...args) { - if (GraalOptions.TraceRegisterAllocationLevel >= level) { + private static boolean trace(String format, Object...args) { + if (GraalOptions.TraceRegisterAllocation) { TTY.println(format, args); } + return true; } } diff -r 1cf920630944 -r 1e62f742f0b3 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/util/RegisterVerifier.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/util/RegisterVerifier.java Tue Jan 10 08:50:07 2012 -0800 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/util/RegisterVerifier.java Tue Jan 10 09:07:56 2012 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2012, 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 @@ -95,18 +95,18 @@ setStateFor(startBlock, curInputState); addToWorkList(startBlock); - trace(1, "==== start verify register allocation ===="); + assert trace("==== start verify register allocation ===="); do { LIRBlock block = workList.remove(0); assert block.phis == null : "phi functions must have been resolved with moves"; // Must copy state because it is modified. curInputState = copy(stateFor(block)); - trace(1, "start block %s loop %d depth %d", block, block.loopIndex(), block.loopDepth()); - traceState(); + assert trace("start block %s loop %d depth %d", block, block.loopIndex(), block.loopDepth()); + assert traceState(); for (LIRInstruction op : block.lir()) { - trace(2, " op %d %s", op.id(), op); + assert trace(" op %d %s", op.id(), op); op.forEachInput(useProc); if (op.hasCall()) { @@ -122,23 +122,23 @@ processSuccessor(succ); } - trace(1, "end block %s", block); + assert trace("end block %s", block); } while (!workList.isEmpty()); - trace(1, "==== end verify register allocation ===="); + assert trace("==== end verify register allocation ===="); } private void processSuccessor(LIRBlock succ) { Map savedState = stateFor(succ); if (savedState == null) { // Block was not processed before, so set initial inputState. - trace(2, " successor %s: initial visit", succ); + assert trace(" successor %s: initial visit", succ); setStateFor(succ, copy(curInputState)); addToWorkList(succ); } else { // This block was already processed before. // Check if new inputState is consistent with savedState. - trace(2, " successor %s: state present", succ); + assert trace(" successor %s: state present", succ); Iterator> iter = savedState.entrySet().iterator(); while (iter.hasNext()) { Map.Entry entry = iter.next(); @@ -148,7 +148,7 @@ if (savedValue != inputValue) { // Current inputState and previous savedState assume a different value in this register. // Assume that this register is invalid and remove it from the saved state. - trace(2, " invalididating %s because it is inconsistent with %s", savedValue, inputValue); + assert trace(" invalididating %s because it is inconsistent with %s", savedValue, inputValue); iter.remove(); // Must re-visit this block. addToWorkList(succ); @@ -163,7 +163,7 @@ while (iter.hasNext()) { Object value1 = iter.next(); if (value1 instanceof CiRegister && registerConfig.getAttributesMap()[((CiRegister) value1).number].isCallerSave) { - trace(2, " remove caller save register %s", value1); + assert trace(" remove caller save register %s", value1); iter.remove(); } } @@ -203,20 +203,20 @@ } private CiValue temp(CiValue value) { - trace(2, " temp %s -> remove key %s", value, key(value)); + assert trace(" temp %s -> remove key %s", value, key(value)); curInputState.remove(key(value)); return value; } private CiValue output(CiValue value) { - trace(2, " output %s -> set key %s", value, key(value)); + assert trace(" output %s -> set key %s", value, key(value)); curInputState.put(key(value), value); return value; } - private void traceState() { - if (GraalOptions.TraceRegisterAllocationLevel >= 2) { + private boolean traceState() { + if (GraalOptions.TraceRegisterAllocation) { ArrayList keys = new ArrayList<>(curInputState.keySet()); Collections.sort(keys, new Comparator() { @Override @@ -243,11 +243,13 @@ } TTY.println(); } + return true; } - private static void trace(int level, String format, Object...args) { - if (GraalOptions.TraceRegisterAllocationLevel >= level) { + private static boolean trace(String format, Object...args) { + if (GraalOptions.TraceRegisterAllocation) { TTY.println(format, args); } + return true; } } diff -r 1cf920630944 -r 1e62f742f0b3 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalOptions.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalOptions.java Tue Jan 10 08:50:07 2012 -0800 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalOptions.java Tue Jan 10 09:07:56 2012 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2012, 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 @@ -105,7 +105,7 @@ public static boolean PrintCodeBytes = ____; public static int PrintAssemblyBytesPerLine = 16; public static int TraceLinearScanLevel = 0; - public static int TraceRegisterAllocationLevel = 0; + public static boolean TraceRegisterAllocation = false; public static int TraceLIRGeneratorLevel = 0; public static boolean TraceRelocation = ____; public static boolean TraceLIRVisit = ____;