Mercurial > hg > graal-compiler
changeset 19127:e0b4d14d1731
FixPointIntervalBuilder: do not record instruction ids but instructions.
author | Josef Eisl <josef.eisl@jku.at> |
---|---|
date | Wed, 04 Feb 2015 15:00:25 +0100 |
parents | 53c3e0c470b0 |
children | 04a07ceab00d |
files | graal/com.oracle.graal.lir/src/com/oracle/graal/lir/stackslotalloc/FixPointIntervalBuilder.java graal/com.oracle.graal.lir/src/com/oracle/graal/lir/stackslotalloc/LSStackSlotAllocator.java |
diffstat | 2 files changed, 10 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/stackslotalloc/FixPointIntervalBuilder.java Wed Feb 04 15:02:36 2015 +0100 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/stackslotalloc/FixPointIntervalBuilder.java Wed Feb 04 15:00:25 2015 +0100 @@ -43,7 +43,7 @@ private final LIR lir; private final int maxOpId; private final StackInterval[] stackSlotMap; - private final HashSet<Integer> usePos; + private final HashSet<LIRInstruction> usePos; /** * The number of allocated stack slots. @@ -61,10 +61,10 @@ /** * Builds the lifetime intervals for {@link VirtualStackSlot virtual stack slots}, sets up - * {@link #stackSlotMap} and returns a set of use positions, i.e. ids for instructions that - * contain virtual stack slots. + * {@link #stackSlotMap} and returns a set of use positions, i.e. instructions that contain + * virtual stack slots. */ - Set<Integer> build() { + Set<LIRInstruction> build() { Deque<AbstractBlock<?>> worklist = new ArrayDeque<>(); for (int i = lir.getControlFlowGraph().getBlocks().size() - 1; i >= 0; i--) { worklist.add(lir.getControlFlowGraph().getBlocks().get(i)); @@ -196,7 +196,7 @@ if (isVirtualStackSlot(operand)) { VirtualStackSlot vslot = asVirtualStackSlot(operand); addUse(vslot, inst, flags); - usePos.add(inst.id()); + usePos.add(inst); Debug.log("set operand: %s", operand); currentSet.set(vslot.getId()); } @@ -215,7 +215,7 @@ if (isVirtualStackSlot(operand)) { VirtualStackSlot vslot = asVirtualStackSlot(operand); addDef(vslot, inst); - usePos.add(inst.id()); + usePos.add(inst); Debug.log("clear operand: %s", operand); currentSet.clear(vslot.getId()); }
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/stackslotalloc/LSStackSlotAllocator.java Wed Feb 04 15:02:36 2015 +0100 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/stackslotalloc/LSStackSlotAllocator.java Wed Feb 04 15:00:25 2015 +0100 @@ -102,7 +102,7 @@ Debug.dump(lir, "After StackSlot numbering"); long currentFrameSize = Debug.isMeterEnabled() ? frameMapBuilder.getFrameMap().currentFrameSize() : 0; - Set<Integer> usePos; + Set<LIRInstruction> usePos; // step 2: build intervals try (Scope s = Debug.scope("StackSlotAllocationBuildIntervals"); Indent indent = Debug.logAndIndent("BuildIntervals"); TimerCloseable t = BuildIntervalsTimer.start()) { usePos = buildIntervals(); @@ -167,7 +167,7 @@ // step 2: build intervals // ==================== - private Set<Integer> buildIntervals() { + private Set<LIRInstruction> buildIntervals() { return new FixPointIntervalBuilder(lir, stackSlotMap, maxOpId()).build(); } @@ -354,9 +354,8 @@ // step 5: assign stack slots // ==================== - private void assignStackSlots(Set<Integer> usePos) { - for (int opId : usePos) { - LIRInstruction op = instructionForId(opId); + private void assignStackSlots(Set<LIRInstruction> usePos) { + for (LIRInstruction op : usePos) { op.forEachInput(this::assignSlot); op.forEachAlive(this::assignSlot); op.forEachState(this::assignSlot);