# HG changeset patch # User Josef Eisl # Date 1431425979 -7200 # Node ID de17f6676a4337abf780923699dd0d519e5920ca # Parent b8dcf353b822bd63c31f53515cdfae5df714df38 LinearScan: encapsulate opIdToBlockMap and opIdToInstructionMap. diff -r b8dcf353b822 -r de17f6676a43 graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LifetimeAnalysis.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LifetimeAnalysis.java Tue May 12 12:03:55 2015 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LifetimeAnalysis.java Tue May 12 12:19:39 2015 +0200 @@ -96,8 +96,7 @@ } // initialize with correct length - allocator.opIdToInstructionMap = new LIRInstruction[numInstructions]; - allocator.opIdToBlockMap = new AbstractBlockBase[numInstructions]; + allocator.initOpIdMaps(numInstructions); int opId = 0; int index = 0; @@ -111,8 +110,7 @@ LIRInstruction op = instructions.get(j); op.setId(opId); - allocator.opIdToInstructionMap[index] = op; - allocator.opIdToBlockMap[index] = block; + allocator.putOpIdMaps(index, op, block); assert allocator.instructionForId(opId) == op : "must match"; op.visitEachTemp(setVariableConsumer); @@ -310,7 +308,7 @@ /* * liveIn(block) is the union of liveGen(block) with (liveOut(block) & * !liveKill(block)). - * + * * Note: liveIn has to be computed only in first iteration or if liveOut * has changed! */ diff -r b8dcf353b822 -r de17f6676a43 graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScan.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScan.java Tue May 12 12:03:55 2015 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScan.java Tue May 12 12:19:39 2015 +0200 @@ -141,14 +141,14 @@ * be retrieved with {@link #instructionForId(int)} as the id is not simply an index into this * array. */ - LIRInstruction[] opIdToInstructionMap; + private LIRInstruction[] opIdToInstructionMap; /** * Map from an instruction {@linkplain LIRInstruction#id id} to the * {@linkplain AbstractBlockBase block} containing the instruction. Entries should be retrieved * with {@link #blockForId(int)} as the id is not simply an index into this array. */ - AbstractBlockBase[] opIdToBlockMap; + private AbstractBlockBase[] opIdToBlockMap; /** * The {@linkplain #operandNumber(Value) number} of the first variable operand allocated. @@ -377,6 +377,16 @@ } } + void initOpIdMaps(int numInstructions) { + opIdToInstructionMap = new LIRInstruction[numInstructions]; + opIdToBlockMap = new AbstractBlockBase[numInstructions]; + } + + void putOpIdMaps(int index, LIRInstruction op, AbstractBlockBase block) { + opIdToInstructionMap[index] = op; + opIdToBlockMap[index] = block; + } + /** * Gets the highest instruction id allocated by this object. */