# HG changeset patch # User Josef Eisl # Date 1411994439 -7200 # Node ID 6d85dfeb6981f15db53bb34eb74b0b47a6a0e691 # Parent 6855e4c325d0b1e1c1151f8750309a2a8ea4285c LSRA: replace anonymous ValueConsumers with Lambdas. diff -r 6855e4c325d0 -r 6d85dfeb6981 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java Mon Sep 29 14:37:21 2014 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java Mon Sep 29 14:40:39 2014 +0200 @@ -612,13 +612,9 @@ intervalsSize = operandSize(); intervals = new Interval[intervalsSize + (intervalsSize >> SPLIT_INTERVALS_CAPACITY_RIGHT_SHIFT)]; - ValueConsumer setVariableConsumer = new ValueConsumer() { - - @Override - public void visitValue(Value value, OperandMode mode, EnumSet flags) { - if (isVariable(value)) { - getOrCreateInterval(asVariable(value)); - } + ValueConsumer setVariableConsumer = (value, mode, flags) -> { + if (isVariable(value)) { + getOrCreateInterval(asVariable(value)); } }; @@ -678,56 +674,44 @@ List instructions = ir.getLIRforBlock(block); int numInst = instructions.size(); - ValueConsumer useConsumer = new ValueConsumer() { - - @Override - public void visitValue(Value operand, OperandMode mode, EnumSet flags) { - if (isVariable(operand)) { - int operandNum = operandNumber(operand); - if (!liveKill.get(operandNum)) { - liveGen.set(operandNum); - Debug.log("liveGen for operand %d", operandNum); - } - if (block.getLoop() != null) { - intervalInLoop.setBit(operandNum, block.getLoop().getIndex()); - } - } - - if (DetailedAsserts.getValue()) { - verifyInput(block, liveKill, operand); - } - } - }; - ValueConsumer stateConsumer = new ValueConsumer() { - - @Override - public void visitValue(Value operand, OperandMode mode, EnumSet flags) { + ValueConsumer useConsumer = (operand, mode, flags) -> { + if (isVariable(operand)) { int operandNum = operandNumber(operand); if (!liveKill.get(operandNum)) { liveGen.set(operandNum); - Debug.log("liveGen in state for operand %d", operandNum); + Debug.log("liveGen for operand %d", operandNum); + } + if (block.getLoop() != null) { + intervalInLoop.setBit(operandNum, block.getLoop().getIndex()); } } + + if (DetailedAsserts.getValue()) { + verifyInput(block, liveKill, operand); + } }; - ValueConsumer defConsumer = new ValueConsumer() { + ValueConsumer stateConsumer = (operand, mode, flags) -> { + int operandNum = operandNumber(operand); + if (!liveKill.get(operandNum)) { + liveGen.set(operandNum); + Debug.log("liveGen in state for operand %d", operandNum); + } + }; + ValueConsumer defConsumer = (operand, mode, flags) -> { + if (isVariable(operand)) { + int varNum = operandNumber(operand); + liveKill.set(varNum); + Debug.log("liveKill for operand %d", varNum); + if (block.getLoop() != null) { + intervalInLoop.setBit(varNum, block.getLoop().getIndex()); + } + } - @Override - public void visitValue(Value operand, OperandMode mode, EnumSet flags) { - if (isVariable(operand)) { - int varNum = operandNumber(operand); - liveKill.set(varNum); - Debug.log("liveKill for operand %d", varNum); - if (block.getLoop() != null) { - intervalInLoop.setBit(varNum, block.getLoop().getIndex()); - } - } - - if (DetailedAsserts.getValue()) { - // fixed intervals are never live at block boundaries, so - // they need not be processed in live sets - // process them only in debug mode so that this can be checked - verifyTemp(liveKill, operand); - } + if (DetailedAsserts.getValue()) { + // fixed intervals are never live at block boundaries, so + // they need not be processed in live sets + // process them only in debug mode so that this can be checked + verifyTemp(liveKill, operand); } };