changeset 19032:b646e37bc989

StackSlotAllocation: handle uninitialized stack slots.
author Josef Eisl <josef.eisl@jku.at>
date Wed, 28 Jan 2015 19:12:57 +0100
parents beb7c10b7747
children 74b144f7c54a
files graal/com.oracle.graal.lir/src/com/oracle/graal/lir/stackslotalloc/LSStackSlotAllocator.java
diffstat 1 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/stackslotalloc/LSStackSlotAllocator.java	Tue Jan 13 17:52:18 2015 +0100
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/stackslotalloc/LSStackSlotAllocator.java	Wed Jan 28 19:12:57 2015 +0100
@@ -247,7 +247,7 @@
                 private void useConsumer(LIRInstruction inst, Value operand, OperandMode mode, EnumSet<OperandFlag> flags) {
                     if (isVirtualStackSlot(operand)) {
                         VirtualStackSlot vslot = asVirtualStackSlot(operand);
-                        addUse(vslot, inst);
+                        addUse(vslot, inst, flags);
                         Debug.log("set operand: %s", operand);
                         currentSet.set(vslot.getId());
                     }
@@ -272,9 +272,16 @@
 
                 }
 
-                private void addUse(VirtualStackSlot stackSlot, LIRInstruction inst) {
+                private void addUse(VirtualStackSlot stackSlot, LIRInstruction inst, EnumSet<OperandFlag> flags) {
                     StackInterval interval = getOrCreateInterval(stackSlot);
-                    interval.addUse(inst.id());
+                    if (flags.contains(OperandFlag.UNINITIALIZED)) {
+                        // Stack slot is marked uninitialized so we have to assume it is live all
+                        // the time.
+                        interval.addDef(0);
+                        interval.addUse(maxOpId());
+                    } else {
+                        interval.addUse(inst.id());
+                    }
                 }
 
                 private void addDef(VirtualStackSlot stackSlot, LIRInstruction inst) {