From: <eri...@us...> - 2010-07-08 15:23:39
|
Revision: 15883 http://jikesrvm.svn.sourceforge.net/jikesrvm/?rev=15883&view=rev Author: eris2006 Date: 2010-07-08 15:23:32 +0000 (Thu, 08 Jul 2010) Log Message: ----------- First commit Modified Paths: -------------- rvmroot/branches/RVM-RegAlloc-ELS/trunk/rvm/src/org/jikesrvm/compilers/opt/regalloc/ia32/RegisterRestrictions.java Modified: rvmroot/branches/RVM-RegAlloc-ELS/trunk/rvm/src/org/jikesrvm/compilers/opt/regalloc/ia32/RegisterRestrictions.java =================================================================== --- rvmroot/branches/RVM-RegAlloc-ELS/trunk/rvm/src/org/jikesrvm/compilers/opt/regalloc/ia32/RegisterRestrictions.java 2010-07-06 21:03:41 UTC (rev 15882) +++ rvmroot/branches/RVM-RegAlloc-ELS/trunk/rvm/src/org/jikesrvm/compilers/opt/regalloc/ia32/RegisterRestrictions.java 2010-07-08 15:23:32 UTC (rev 15883) @@ -39,6 +39,8 @@ import org.jikesrvm.compilers.opt.ir.operand.ia32.BURSManagedFPROperand; import org.jikesrvm.compilers.opt.regalloc.GenericRegisterRestrictions; import org.jikesrvm.compilers.opt.regalloc.LiveIntervalElement; +import org.jikesrvm.compilers.opt.regalloc.LinearScan.CompoundInterval; +import org.jikesrvm.compilers.opt.regalloc.LinearScan.Interval; /** * An instance of this class encapsulates restrictions on register @@ -51,7 +53,8 @@ * Allow scratch registers in PEIs? */ public static final boolean SCRATCH_IN_PEI = true; - + /* present for testing purpose and must be removed before final commint*/ + private boolean forceitfornow= true; /** * Default Constructor */ @@ -68,25 +71,31 @@ * block */ public void addArchRestrictions(BasicBlock bb, ArrayList<LiveIntervalElement> symbolics) { - // If there are any registers used in catch blocks, we want to ensure - // that these registers are not used or evicted from scratch registers - // at a relevant PEI, so that the assumptions of register homes in the - // catch block remain valid. For now, we do this by forcing any - // register used in such a PEI as not spilled. TODO: relax this - // restriction for better code. - for (InstructionEnumeration ie = bb.forwardInstrEnumerator(); ie.hasMoreElements();) { - Instruction s = ie.next(); - if (s.isPEI() && s.operator != IR_PROLOGUE) { - if (bb.hasApplicableExceptionalOut(s) || !SCRATCH_IN_PEI) { - for (Enumeration<Operand> e = s.getOperands(); e.hasMoreElements();) { - Operand op = e.nextElement(); - if (op != null && op.isRegister()) { - noteMustNotSpill(op.asRegister().getRegister()); - handle8BitRestrictions(s); - } - } - } - } + // If there are any registers used in catch blocks, we want to ensure + // that these registers are not used or evicted from scratch registers + // at a relevant PEI, so that the assumptions of register homes in the + // catch block remain valid. For now, we do this by forcing any + // register used in such a PEI as not spilled. TODO: relax this + // restriction for better code. + for(InstructionEnumeration ie = bb.forwardInstrEnumerator(); ie.hasMoreElements();) { + Instruction s = ie.next(); + if (s.isPEI() && s.operator != IR_PROLOGUE) { + if (bb.hasApplicableExceptionalOut(s) || !SCRATCH_IN_PEI) { + for (Enumeration<Operand> e = s.getOperands(); e.hasMoreElements();) { + Operand op = e.nextElement(); + if (op != null && op.isRegister()) { + Register reg = op.asRegister().getRegister(); + Interval i = reg.getInterval(s); + VM._assert(i != null); + if(i instanceof CompoundInterval) + noteMustNotSpill(reg); + else + noteMustNotSpill(i); + handle8BitRestrictions(s); + } + } + } + } // handle special cases switch (s.getOpcode()) { @@ -94,21 +103,39 @@ RegisterOperand op = MIR_LowTableSwitch.getMethodStart(s); noteMustNotSpill(op.getRegister()); op = MIR_LowTableSwitch.getIndex(s); - noteMustNotSpill(op.getRegister()); + Register reg = op.getRegister(); + Interval i = reg.getInterval(s); + VM._assert(i != null); + if(i instanceof CompoundInterval) + noteMustNotSpill(reg); + else + noteMustNotSpill(i); } break; case IA32_MOVZX__B_opcode: case IA32_MOVSX__B_opcode: { if (MIR_Unary.getVal(s).isRegister()) { RegisterOperand val = MIR_Unary.getVal(s).asRegister(); - restrictTo8Bits(val.getRegister()); + Register reg = val.getRegister(); + Interval i = reg.getInterval(s); + VM._assert(i != null); + if(i instanceof CompoundInterval) + restrictTo8Bits(reg); + else + restrictTo8Bits(i); } } break; case IA32_SET__B_opcode: { if (MIR_Set.getResult(s).isRegister()) { RegisterOperand op = MIR_Set.getResult(s).asRegister(); - restrictTo8Bits(op.getRegister()); + Register reg = op.getRegister(); + Interval i = reg.getInterval(s); + VM._assert(i != null); + if(i instanceof CompoundInterval) + restrictTo8Bits(reg); + else + restrictTo8Bits(i); } } break; @@ -125,7 +152,12 @@ for (LiveIntervalElement symb : symbolics) { if (symb.getRegister().isFloatingPoint()) { if (contains(symb, s.scratch)) { - addRestrictions(symb.getRegister(), phys.getFPRs()); + Interval i = symb.getInterval(); + VM._assert(i != null); + if(i instanceof CompoundInterval) + addRestrictions(symb.getRegister(), phys.getFPRs()); + else + addRestrictions(i, phys.getFPRs()); } } } @@ -134,9 +166,17 @@ for (LiveIntervalElement symb : symbolics) { if (symb.getRegister().isFloatingPoint()) { if (contains(symb, s.scratch)) { + Interval interval = symb.getInterval(); + VM._assert(interval != null); + boolean basic = true; + if( interval instanceof CompoundInterval) + basic = false; int nSave = MIR_UnaryNoRes.getVal(s).asIntConstant().value; for (int i = nSave; i < NUM_FPRS; i++) { - addRestriction(symb.getRegister(), phys.getFPR(i)); + if(!basic) + addRestriction(symb.getRegister(), phys.getFPR(i)); + else + addRestriction(interval, phys.getFPR(i)); } } } @@ -170,7 +210,13 @@ for (OperandEnumeration e2 = s.getRootOperands(); e2.hasMoreElements();) { Operand rootOp = e2.next(); if (rootOp.isRegister()) { - restrictTo8Bits(rootOp.asRegister().getRegister()); + Register reg= rootOp.asRegister().getRegister(); + Interval i = reg.getInterval(s); + VM._assert(i != null); + if(i instanceof CompoundInterval) + restrictTo8Bits(reg); + else + restrictTo8Bits(i); } } } @@ -191,11 +237,24 @@ addRestriction(r, ESI); addRestriction(r, EDI); } - - /** + final void restrictTo8Bits(Interval i) { + Register ESP = phys.getESP(); + Register EBP = phys.getEBP(); + Register ESI = phys.getESI(); + Register EDI = phys.getEDI(); + addRestriction(i, ESP); + addRestriction(i, EBP); + addRestriction(i, ESI); + addRestriction(i, EDI); + } + /* * Given symbolic register r that appears in instruction s, does the * architecture demand that r be assigned to a physical register in s? */ + /* + * Following does not update any GenericRegisterRestriction data structure so leave it for now + * check back during scratch register assignment + */ public static boolean mustBeInRegister(Register r, Instruction s) { switch (s.getOpcode()) { case IA32_PREFETCHNTA_opcode: { @@ -380,6 +439,10 @@ * Is it forbidden to assign symbolic register symb to physical register r * in instruction s? */ + /* + * Following does not update any GenericRegisterRestriction data structure so leave it for now + * check back during scratch register assignment + */ public boolean isForbidden(Register symb, Register r, Instruction s) { // Look at 8-bit restrictions. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <eri...@us...> - 2010-07-10 09:20:54
|
Revision: 15896 http://jikesrvm.svn.sourceforge.net/jikesrvm/?rev=15896&view=rev Author: eris2006 Date: 2010-07-10 09:20:46 +0000 (Sat, 10 Jul 2010) Log Message: ----------- commit for IntervalAnalysis and RegisterRestrictions phase of Extended LinearScanphase Modified Paths: -------------- rvmroot/branches/RVM-RegAlloc-ELS/trunk/rvm/src/org/jikesrvm/compilers/opt/regalloc/ia32/RegisterRestrictions.java Modified: rvmroot/branches/RVM-RegAlloc-ELS/trunk/rvm/src/org/jikesrvm/compilers/opt/regalloc/ia32/RegisterRestrictions.java =================================================================== --- rvmroot/branches/RVM-RegAlloc-ELS/trunk/rvm/src/org/jikesrvm/compilers/opt/regalloc/ia32/RegisterRestrictions.java 2010-07-10 09:19:32 UTC (rev 15895) +++ rvmroot/branches/RVM-RegAlloc-ELS/trunk/rvm/src/org/jikesrvm/compilers/opt/regalloc/ia32/RegisterRestrictions.java 2010-07-10 09:20:46 UTC (rev 15896) @@ -39,7 +39,6 @@ import org.jikesrvm.compilers.opt.ir.operand.ia32.BURSManagedFPROperand; import org.jikesrvm.compilers.opt.regalloc.GenericRegisterRestrictions; import org.jikesrvm.compilers.opt.regalloc.LiveIntervalElement; -import org.jikesrvm.compilers.opt.regalloc.LinearScan.CompoundInterval; import org.jikesrvm.compilers.opt.regalloc.LinearScan.Interval; /** @@ -87,12 +86,12 @@ Register reg = op.asRegister().getRegister(); Interval i = reg.getInterval(s); VM._assert(i != null); - if(i instanceof CompoundInterval) + if(i.getContainer().equals(i.getInterval())) noteMustNotSpill(reg); - else + else noteMustNotSpill(i); handle8BitRestrictions(s); - } + } } } } @@ -106,7 +105,7 @@ Register reg = op.getRegister(); Interval i = reg.getInterval(s); VM._assert(i != null); - if(i instanceof CompoundInterval) + if(i.getContainer().equals(i.getInterval())) noteMustNotSpill(reg); else noteMustNotSpill(i); @@ -119,9 +118,9 @@ Register reg = val.getRegister(); Interval i = reg.getInterval(s); VM._assert(i != null); - if(i instanceof CompoundInterval) + if(i.getContainer().equals(i.getInterval())) restrictTo8Bits(reg); - else + else restrictTo8Bits(i); } } @@ -132,7 +131,7 @@ Register reg = op.getRegister(); Interval i = reg.getInterval(s); VM._assert(i != null); - if(i instanceof CompoundInterval) + if(i.getContainer().equals(i.getInterval())) restrictTo8Bits(reg); else restrictTo8Bits(i); @@ -154,10 +153,10 @@ if (contains(symb, s.scratch)) { Interval i = symb.getInterval(); VM._assert(i != null); - if(i instanceof CompoundInterval) + if(i.getContainer().equals(i.getInterval())) addRestrictions(symb.getRegister(), phys.getFPRs()); else - addRestrictions(i, phys.getFPRs()); + addRestrictions(i, phys.getFPRs()); } } } @@ -169,7 +168,7 @@ Interval interval = symb.getInterval(); VM._assert(interval != null); boolean basic = true; - if( interval instanceof CompoundInterval) + if( interval.getContainer().equals(interval.getInterval())) basic = false; int nSave = MIR_UnaryNoRes.getVal(s).asIntConstant().value; for (int i = nSave; i < NUM_FPRS; i++) { @@ -213,7 +212,7 @@ Register reg= rootOp.asRegister().getRegister(); Interval i = reg.getInterval(s); VM._assert(i != null); - if(i instanceof CompoundInterval) + if(i.getContainer().equals(i.getInterval())) restrictTo8Bits(reg); else restrictTo8Bits(i); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <eri...@us...> - 2010-07-15 10:58:12
|
Revision: 15908 http://jikesrvm.svn.sourceforge.net/jikesrvm/?rev=15908&view=rev Author: eris2006 Date: 2010-07-15 10:58:05 +0000 (Thu, 15 Jul 2010) Log Message: ----------- removed assertion check due to change in getInterval call in Register.java and LiveIntervalElement.java which required special handling for physical registers Modified Paths: -------------- rvmroot/branches/RVM-RegAlloc-ELS/trunk/rvm/src/org/jikesrvm/compilers/opt/regalloc/ia32/RegisterRestrictions.java Modified: rvmroot/branches/RVM-RegAlloc-ELS/trunk/rvm/src/org/jikesrvm/compilers/opt/regalloc/ia32/RegisterRestrictions.java =================================================================== --- rvmroot/branches/RVM-RegAlloc-ELS/trunk/rvm/src/org/jikesrvm/compilers/opt/regalloc/ia32/RegisterRestrictions.java 2010-07-15 10:48:39 UTC (rev 15907) +++ rvmroot/branches/RVM-RegAlloc-ELS/trunk/rvm/src/org/jikesrvm/compilers/opt/regalloc/ia32/RegisterRestrictions.java 2010-07-15 10:58:05 UTC (rev 15908) @@ -52,7 +52,7 @@ * Allow scratch registers in PEIs? */ public static final boolean SCRATCH_IN_PEI = true; - /* present for testing purpose and must be removed before final commint*/ + /* present for testing purpose and must be removed before final commit*/ private boolean forceitfornow= true; /** * Default Constructor @@ -84,13 +84,18 @@ Operand op = e.nextElement(); if (op != null && op.isRegister()) { Register reg = op.asRegister().getRegister(); + /* + * Interval i will be null for phyical registers. + * Previously physical register were also added through noteMustNotSpill call + * Spill at BasciInterval concept makes this obsolete because we are never going to + * spill a physical register. + */ Interval i = reg.getInterval(s); - VM._assert(i != null); - if(i.getContainer().equals(i.getInterval())) + if(i.getContainer().equals(i.getInterval()) ) noteMustNotSpill(reg); else noteMustNotSpill(i); - handle8BitRestrictions(s); + handle8BitRestrictions(s); } } } @@ -104,8 +109,7 @@ op = MIR_LowTableSwitch.getIndex(s); Register reg = op.getRegister(); Interval i = reg.getInterval(s); - VM._assert(i != null); - if(i.getContainer().equals(i.getInterval())) + if(i.getContainer().equals(i.getInterval()) ) noteMustNotSpill(reg); else noteMustNotSpill(i); @@ -117,8 +121,7 @@ RegisterOperand val = MIR_Unary.getVal(s).asRegister(); Register reg = val.getRegister(); Interval i = reg.getInterval(s); - VM._assert(i != null); - if(i.getContainer().equals(i.getInterval())) + if(i.getContainer().equals(i.getInterval()) ) restrictTo8Bits(reg); else restrictTo8Bits(i); @@ -130,8 +133,7 @@ RegisterOperand op = MIR_Set.getResult(s).asRegister(); Register reg = op.getRegister(); Interval i = reg.getInterval(s); - VM._assert(i != null); - if(i.getContainer().equals(i.getInterval())) + if(i.getContainer().equals(i.getInterval()) ) restrictTo8Bits(reg); else restrictTo8Bits(i); @@ -152,8 +154,7 @@ if (symb.getRegister().isFloatingPoint()) { if (contains(symb, s.scratch)) { Interval i = symb.getInterval(); - VM._assert(i != null); - if(i.getContainer().equals(i.getInterval())) + if(i.getContainer().equals(i.getInterval()) ) addRestrictions(symb.getRegister(), phys.getFPRs()); else addRestrictions(i, phys.getFPRs()); @@ -166,9 +167,8 @@ if (symb.getRegister().isFloatingPoint()) { if (contains(symb, s.scratch)) { Interval interval = symb.getInterval(); - VM._assert(interval != null); - boolean basic = true; - if( interval.getContainer().equals(interval.getInterval())) + boolean basic = true; + if( interval.getContainer().equals(interval.getInterval()) ) basic = false; int nSave = MIR_UnaryNoRes.getVal(s).asIntConstant().value; for (int i = nSave; i < NUM_FPRS; i++) { @@ -211,9 +211,8 @@ if (rootOp.isRegister()) { Register reg= rootOp.asRegister().getRegister(); Interval i = reg.getInterval(s); - VM._assert(i != null); - if(i.getContainer().equals(i.getInterval())) - restrictTo8Bits(reg); + if(i.getContainer().equals(i.getInterval()) ) + restrictTo8Bits(reg); else restrictTo8Bits(i); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <eri...@us...> - 2010-07-15 11:41:08
|
Revision: 15910 http://jikesrvm.svn.sourceforge.net/jikesrvm/?rev=15910&view=rev Author: eris2006 Date: 2010-07-15 11:41:01 +0000 (Thu, 15 Jul 2010) Log Message: ----------- null checking Modified Paths: -------------- rvmroot/branches/RVM-RegAlloc-ELS/trunk/rvm/src/org/jikesrvm/compilers/opt/regalloc/ia32/RegisterRestrictions.java Modified: rvmroot/branches/RVM-RegAlloc-ELS/trunk/rvm/src/org/jikesrvm/compilers/opt/regalloc/ia32/RegisterRestrictions.java =================================================================== --- rvmroot/branches/RVM-RegAlloc-ELS/trunk/rvm/src/org/jikesrvm/compilers/opt/regalloc/ia32/RegisterRestrictions.java 2010-07-15 11:01:05 UTC (rev 15909) +++ rvmroot/branches/RVM-RegAlloc-ELS/trunk/rvm/src/org/jikesrvm/compilers/opt/regalloc/ia32/RegisterRestrictions.java 2010-07-15 11:41:01 UTC (rev 15910) @@ -91,7 +91,7 @@ * spill a physical register. */ Interval i = reg.getInterval(s); - if(i.getContainer().equals(i.getInterval()) ) + if(i != null || i.getContainer().equals(i.getInterval()) ) noteMustNotSpill(reg); else noteMustNotSpill(i); @@ -109,7 +109,7 @@ op = MIR_LowTableSwitch.getIndex(s); Register reg = op.getRegister(); Interval i = reg.getInterval(s); - if(i.getContainer().equals(i.getInterval()) ) + if( i != null || i.getContainer().equals(i.getInterval()) ) noteMustNotSpill(reg); else noteMustNotSpill(i); @@ -121,7 +121,7 @@ RegisterOperand val = MIR_Unary.getVal(s).asRegister(); Register reg = val.getRegister(); Interval i = reg.getInterval(s); - if(i.getContainer().equals(i.getInterval()) ) + if(i != null || i.getContainer().equals(i.getInterval()) ) restrictTo8Bits(reg); else restrictTo8Bits(i); @@ -133,7 +133,7 @@ RegisterOperand op = MIR_Set.getResult(s).asRegister(); Register reg = op.getRegister(); Interval i = reg.getInterval(s); - if(i.getContainer().equals(i.getInterval()) ) + if( i != null || i.getContainer().equals(i.getInterval()) ) restrictTo8Bits(reg); else restrictTo8Bits(i); @@ -154,7 +154,7 @@ if (symb.getRegister().isFloatingPoint()) { if (contains(symb, s.scratch)) { Interval i = symb.getInterval(); - if(i.getContainer().equals(i.getInterval()) ) + if( i.getContainer().equals(i.getInterval()) ) addRestrictions(symb.getRegister(), phys.getFPRs()); else addRestrictions(i, phys.getFPRs()); @@ -211,7 +211,7 @@ if (rootOp.isRegister()) { Register reg= rootOp.asRegister().getRegister(); Interval i = reg.getInterval(s); - if(i.getContainer().equals(i.getInterval()) ) + if(i != null || i.getContainer().equals(i.getInterval()) ) restrictTo8Bits(reg); else restrictTo8Bits(i); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <eri...@us...> - 2010-07-15 11:51:23
|
Revision: 15911 http://jikesrvm.svn.sourceforge.net/jikesrvm/?rev=15911&view=rev Author: eris2006 Date: 2010-07-15 11:51:16 +0000 (Thu, 15 Jul 2010) Log Message: ----------- last commit error. It should have been other way round Modified Paths: -------------- rvmroot/branches/RVM-RegAlloc-ELS/trunk/rvm/src/org/jikesrvm/compilers/opt/regalloc/ia32/RegisterRestrictions.java Modified: rvmroot/branches/RVM-RegAlloc-ELS/trunk/rvm/src/org/jikesrvm/compilers/opt/regalloc/ia32/RegisterRestrictions.java =================================================================== --- rvmroot/branches/RVM-RegAlloc-ELS/trunk/rvm/src/org/jikesrvm/compilers/opt/regalloc/ia32/RegisterRestrictions.java 2010-07-15 11:41:01 UTC (rev 15910) +++ rvmroot/branches/RVM-RegAlloc-ELS/trunk/rvm/src/org/jikesrvm/compilers/opt/regalloc/ia32/RegisterRestrictions.java 2010-07-15 11:51:16 UTC (rev 15911) @@ -91,7 +91,7 @@ * spill a physical register. */ Interval i = reg.getInterval(s); - if(i != null || i.getContainer().equals(i.getInterval()) ) + if(i == null || i.getContainer().equals(i.getInterval()) ) noteMustNotSpill(reg); else noteMustNotSpill(i); @@ -109,7 +109,7 @@ op = MIR_LowTableSwitch.getIndex(s); Register reg = op.getRegister(); Interval i = reg.getInterval(s); - if( i != null || i.getContainer().equals(i.getInterval()) ) + if( i == null || i.getContainer().equals(i.getInterval()) ) noteMustNotSpill(reg); else noteMustNotSpill(i); @@ -121,7 +121,7 @@ RegisterOperand val = MIR_Unary.getVal(s).asRegister(); Register reg = val.getRegister(); Interval i = reg.getInterval(s); - if(i != null || i.getContainer().equals(i.getInterval()) ) + if(i == null || i.getContainer().equals(i.getInterval()) ) restrictTo8Bits(reg); else restrictTo8Bits(i); @@ -133,7 +133,7 @@ RegisterOperand op = MIR_Set.getResult(s).asRegister(); Register reg = op.getRegister(); Interval i = reg.getInterval(s); - if( i != null || i.getContainer().equals(i.getInterval()) ) + if( i == null || i.getContainer().equals(i.getInterval()) ) restrictTo8Bits(reg); else restrictTo8Bits(i); @@ -211,7 +211,7 @@ if (rootOp.isRegister()) { Register reg= rootOp.asRegister().getRegister(); Interval i = reg.getInterval(s); - if(i != null || i.getContainer().equals(i.getInterval()) ) + if(i == null || i.getContainer().equals(i.getInterval()) ) restrictTo8Bits(reg); else restrictTo8Bits(i); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <eri...@us...> - 2010-07-20 05:44:38
|
Revision: 15924 http://jikesrvm.svn.sourceforge.net/jikesrvm/?rev=15924&view=rev Author: eris2006 Date: 2010-07-20 05:44:32 +0000 (Tue, 20 Jul 2010) Log Message: ----------- Scrapped the idea of associating Restricted Physical Register set to symbolic registers. Instead now use Interval data structure Modified Paths: -------------- rvmroot/branches/RVM-RegAlloc-ELS/trunk/rvm/src/org/jikesrvm/compilers/opt/regalloc/ia32/RegisterRestrictions.java Modified: rvmroot/branches/RVM-RegAlloc-ELS/trunk/rvm/src/org/jikesrvm/compilers/opt/regalloc/ia32/RegisterRestrictions.java =================================================================== --- rvmroot/branches/RVM-RegAlloc-ELS/trunk/rvm/src/org/jikesrvm/compilers/opt/regalloc/ia32/RegisterRestrictions.java 2010-07-20 05:40:51 UTC (rev 15923) +++ rvmroot/branches/RVM-RegAlloc-ELS/trunk/rvm/src/org/jikesrvm/compilers/opt/regalloc/ia32/RegisterRestrictions.java 2010-07-20 05:44:32 UTC (rev 15924) @@ -79,40 +79,37 @@ for(InstructionEnumeration ie = bb.forwardInstrEnumerator(); ie.hasMoreElements();) { Instruction s = ie.next(); if (s.isPEI() && s.operator != IR_PROLOGUE) { - if (bb.hasApplicableExceptionalOut(s) || !SCRATCH_IN_PEI) { - for (Enumeration<Operand> e = s.getOperands(); e.hasMoreElements();) { - Operand op = e.nextElement(); - if (op != null && op.isRegister()) { - Register reg = op.asRegister().getRegister(); - /* - * Interval i will be null for phyical registers. - * Previously physical register were also added through noteMustNotSpill call - * Spill at BasciInterval concept makes this obsolete because we are never going to - * spill a physical register. - */ - Interval i = reg.getInterval(s); - if(i == null || i.getContainer().equals(i.getInterval()) ) - noteMustNotSpill(reg); - else - noteMustNotSpill(i); - handle8BitRestrictions(s); - } - } - } - } + if (bb.hasApplicableExceptionalOut(s) || !SCRATCH_IN_PEI) { + for (Enumeration<Operand> e = s.getOperands(); e.hasMoreElements();) { + Operand op = e.nextElement(); + if (op != null && op.isRegister()) { + Register reg = op.asRegister().getRegister(); + /* + * Interval i will be null for phyical registers. + * Previously physical register were also added through noteMustNotSpill call + * Spill at BasciInterval concept makes this obsolete because we are never going to + * spill a physical register. + */ + Interval i = reg.getInterval(s); + // i will be null for physical registers + noteMustNotSpill(i); + handle8BitRestrictions(s); + } + } + } + } // handle special cases switch (s.getOpcode()) { case MIR_LOWTABLESWITCH_opcode: { RegisterOperand op = MIR_LowTableSwitch.getMethodStart(s); - noteMustNotSpill(op.getRegister()); - op = MIR_LowTableSwitch.getIndex(s); Register reg = op.getRegister(); Interval i = reg.getInterval(s); - if( i == null || i.getContainer().equals(i.getInterval()) ) - noteMustNotSpill(reg); - else - noteMustNotSpill(i); + noteMustNotSpill(i); + op = MIR_LowTableSwitch.getIndex(s); + reg = op.getRegister(); + i = reg.getInterval(s); + noteMustNotSpill(i); } break; case IA32_MOVZX__B_opcode: @@ -121,10 +118,7 @@ RegisterOperand val = MIR_Unary.getVal(s).asRegister(); Register reg = val.getRegister(); Interval i = reg.getInterval(s); - if(i == null || i.getContainer().equals(i.getInterval()) ) - restrictTo8Bits(reg); - else - restrictTo8Bits(i); + restrictTo8Bits(i); } } break; @@ -133,10 +127,7 @@ RegisterOperand op = MIR_Set.getResult(s).asRegister(); Register reg = op.getRegister(); Interval i = reg.getInterval(s); - if( i == null || i.getContainer().equals(i.getInterval()) ) - restrictTo8Bits(reg); - else - restrictTo8Bits(i); + restrictTo8Bits(i); } } break; @@ -154,10 +145,7 @@ if (symb.getRegister().isFloatingPoint()) { if (contains(symb, s.scratch)) { Interval i = symb.getInterval(); - if( i.getContainer().equals(i.getInterval()) ) - addRestrictions(symb.getRegister(), phys.getFPRs()); - else - addRestrictions(i, phys.getFPRs()); + addRestrictions(i, phys.getFPRs()); } } } @@ -166,16 +154,10 @@ for (LiveIntervalElement symb : symbolics) { if (symb.getRegister().isFloatingPoint()) { if (contains(symb, s.scratch)) { - Interval interval = symb.getInterval(); - boolean basic = true; - if( interval.getContainer().equals(interval.getInterval()) ) - basic = false; + Interval interval = symb.getInterval(); int nSave = MIR_UnaryNoRes.getVal(s).asIntConstant().value; for (int i = nSave; i < NUM_FPRS; i++) { - if(!basic) - addRestriction(symb.getRegister(), phys.getFPR(i)); - else - addRestriction(interval, phys.getFPR(i)); + addRestriction(interval, phys.getFPR(i)); } } } @@ -209,12 +191,9 @@ for (OperandEnumeration e2 = s.getRootOperands(); e2.hasMoreElements();) { Operand rootOp = e2.next(); if (rootOp.isRegister()) { - Register reg= rootOp.asRegister().getRegister(); - Interval i = reg.getInterval(s); - if(i == null || i.getContainer().equals(i.getInterval()) ) - restrictTo8Bits(reg); - else - restrictTo8Bits(i); + Register reg= rootOp.asRegister().getRegister(); + Interval i = reg.getInterval(s); + restrictTo8Bits(i); } } } @@ -222,20 +201,12 @@ } /** - * Ensure that a particular register is only assigned to AL, BL, CL, or + * Ensure that a particular Interval is only assigned to AL, BL, CL, or * DL, since these are the only 8-bit registers we normally address. */ - final void restrictTo8Bits(Register r) { - Register ESP = phys.getESP(); - Register EBP = phys.getEBP(); - Register ESI = phys.getESI(); - Register EDI = phys.getEDI(); - addRestriction(r, ESP); - addRestriction(r, EBP); - addRestriction(r, ESI); - addRestriction(r, EDI); - } final void restrictTo8Bits(Interval i) { + // following must be removed, presnethere for testing purpose. i will be null for physical registers. So check this condition + VM._assert(i != null); Register ESP = phys.getESP(); Register EBP = phys.getEBP(); Register ESI = phys.getESI(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <eri...@us...> - 2010-07-23 11:46:04
|
Revision: 15943 http://jikesrvm.svn.sourceforge.net/jikesrvm/?rev=15943&view=rev Author: eris2006 Date: 2010-07-23 11:45:58 +0000 (Fri, 23 Jul 2010) Log Message: ----------- fix for null pointer exception Modified Paths: -------------- rvmroot/branches/RVM-RegAlloc-ELS/trunk/rvm/src/org/jikesrvm/compilers/opt/regalloc/ia32/RegisterRestrictions.java Modified: rvmroot/branches/RVM-RegAlloc-ELS/trunk/rvm/src/org/jikesrvm/compilers/opt/regalloc/ia32/RegisterRestrictions.java =================================================================== --- rvmroot/branches/RVM-RegAlloc-ELS/trunk/rvm/src/org/jikesrvm/compilers/opt/regalloc/ia32/RegisterRestrictions.java 2010-07-23 11:45:25 UTC (rev 15942) +++ rvmroot/branches/RVM-RegAlloc-ELS/trunk/rvm/src/org/jikesrvm/compilers/opt/regalloc/ia32/RegisterRestrictions.java 2010-07-23 11:45:58 UTC (rev 15943) @@ -118,7 +118,7 @@ RegisterOperand val = MIR_Unary.getVal(s).asRegister(); Register reg = val.getRegister(); Interval i = reg.getInterval(s); - restrictTo8Bits(i); + if (i != null) restrictTo8Bits(i); } } break; @@ -127,7 +127,7 @@ RegisterOperand op = MIR_Set.getResult(s).asRegister(); Register reg = op.getRegister(); Interval i = reg.getInterval(s); - restrictTo8Bits(i); + if (i != null) restrictTo8Bits(i); } } break; @@ -193,7 +193,7 @@ if (rootOp.isRegister()) { Register reg= rootOp.asRegister().getRegister(); Interval i = reg.getInterval(s); - restrictTo8Bits(i); + if (i != null) restrictTo8Bits(i); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |