# HG changeset patch # User Thomas Wuerthinger # Date 1339085521 -7200 # Node ID 56860d3f9f3945e946b21d607e740942e4037df5 # Parent 28af6dff047f4ebcb64e2cd445c61aa7f72ac50f More refactorings and renamings in preparation of ci/ri split. diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/simple/AssignRegisters.java --- a/graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/simple/AssignRegisters.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/simple/AssignRegisters.java Thu Jun 07 18:12:01 2012 +0200 @@ -25,6 +25,7 @@ import static com.oracle.graal.alloc.util.LocationUtil.*; import com.oracle.max.cri.ci.*; +import com.oracle.max.cri.ri.*; import com.oracle.graal.alloc.util.*; import com.oracle.graal.debug.*; import com.oracle.graal.lir.*; @@ -44,9 +45,9 @@ private CiBitMap curFrameRefMap; public void execute() { - ValueProcedure useProc = new ValueProcedure() { @Override public CiValue doValue(CiValue value) { return use(value); } }; - ValueProcedure defProc = new ValueProcedure() { @Override public CiValue doValue(CiValue value) { return def(value); } }; - ValueProcedure setReferenceProc = new ValueProcedure() { @Override public CiValue doValue(CiValue value) { return setReference(value); } }; + ValueProcedure useProc = new ValueProcedure() { @Override public RiValue doValue(RiValue value) { return use(value); } }; + ValueProcedure defProc = new ValueProcedure() { @Override public RiValue doValue(RiValue value) { return def(value); } }; + ValueProcedure setReferenceProc = new ValueProcedure() { @Override public RiValue doValue(RiValue value) { return setReference(value); } }; Debug.log("==== start assign registers ===="); for (int i = lir.linearScanOrder().size() - 1; i >= 0; i--) { @@ -89,10 +90,10 @@ Debug.log("==== end assign registers ===="); } - private CiValue use(CiValue value) { + private RiValue use(RiValue value) { Debug.log(" use %s", value); if (isLocation(value)) { - CiValue location = asLocation(value).location; + RiValue location = asLocation(value).location; frameMap.setReference(location, curRegisterRefMap, curFrameRefMap); return location; } else { @@ -101,10 +102,10 @@ } } - private CiValue def(CiValue value) { + private RiValue def(RiValue value) { Debug.log(" def %s", value); if (isLocation(value)) { - CiValue location = asLocation(value).location; + RiValue location = asLocation(value).location; frameMap.clearReference(location, curRegisterRefMap, curFrameRefMap); return location; } else { @@ -113,7 +114,7 @@ } } - private CiValue setReference(CiValue value) { + private RiValue setReference(RiValue value) { Debug.log(" setReference %s", value); frameMap.setReference(asLocation(value).location, curRegisterRefMap, curFrameRefMap); return value; diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/simple/DataFlowAnalysis.java --- a/graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/simple/DataFlowAnalysis.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/simple/DataFlowAnalysis.java Thu Jun 07 18:12:01 2012 +0200 @@ -36,9 +36,9 @@ public class DataFlowAnalysis { private final LIR lir; - private final RiRegisterConfig registerConfig; + private final CiRegisterConfig registerConfig; - public DataFlowAnalysis(LIR lir, RiRegisterConfig registerConfig) { + public DataFlowAnalysis(LIR lir, CiRegisterConfig registerConfig) { this.lir = lir; this.registerConfig = registerConfig; } @@ -57,7 +57,7 @@ return lir.numVariables(); } - private boolean isAllocatableRegister(CiValue value) { + private boolean isAllocatableRegister(RiValue value) { return isRegister(value) && registerConfig.getAttributesMap()[asRegister(value).number].isAllocatable; } @@ -93,14 +93,14 @@ Object entry = killedValues(op.id() + (end ? 1 : 0)); if (entry == null) { // Nothing to do - } else if (entry instanceof CiValue) { - CiValue newValue = proc.doValue((CiValue) entry, null, null); + } else if (entry instanceof RiValue) { + RiValue newValue = proc.doValue((RiValue) entry, null, null); assert newValue == entry : "procedure does not allow to change values"; } else { - CiValue[] values = (CiValue[]) entry; + RiValue[] values = (RiValue[]) entry; for (int i = 0; i < values.length; i++) { if (values[i] != null) { - CiValue newValue = proc.doValue(values[i], null, null); + RiValue newValue = proc.doValue(values[i], null, null); assert newValue == values[i] : "procedure does not allow to change values"; } } @@ -115,7 +115,7 @@ * Numbers all instructions in all blocks. The numbering follows the {@linkplain ComputeLinearScanOrder linear scan order}. */ private void numberInstructions() { - ValueProcedure defProc = new ValueProcedure() { @Override public CiValue doValue(CiValue value) { return setDef(value); } }; + ValueProcedure defProc = new ValueProcedure() { @Override public RiValue doValue(RiValue value) { return setDef(value); } }; int numInstructions = 0; for (Block block : blocks()) { @@ -140,7 +140,7 @@ assert curOpId == numInstructions << 1; } - private CiValue setDef(CiValue value) { + private RiValue setDef(RiValue value) { if (isVariable(value)) { assert definitions[asVariable(value).index] == 0 : "Variable defined twice"; definitions[asVariable(value).index] = curOpId; @@ -154,10 +154,10 @@ private int curOpId; private void backwardDataFlow() { - ValueProcedure inputProc = new ValueProcedure() { @Override public CiValue doValue(CiValue value) { return use(value, curOpId); } }; - ValueProcedure aliveProc = new ValueProcedure() { @Override public CiValue doValue(CiValue value) { return use(value, curOpId + 1); } }; - ValueProcedure tempProc = new ValueProcedure() { @Override public CiValue doValue(CiValue value) { return def(value, true); } }; - ValueProcedure outputProc = new ValueProcedure() { @Override public CiValue doValue(CiValue value) { return def(value, false); } }; + ValueProcedure inputProc = new ValueProcedure() { @Override public RiValue doValue(RiValue value) { return use(value, curOpId); } }; + ValueProcedure aliveProc = new ValueProcedure() { @Override public RiValue doValue(RiValue value) { return use(value, curOpId + 1); } }; + ValueProcedure tempProc = new ValueProcedure() { @Override public RiValue doValue(RiValue value) { return def(value, true); } }; + ValueProcedure outputProc = new ValueProcedure() { @Override public RiValue doValue(RiValue value) { return def(value, false); } }; blockLiveIn = new BitSet[blocks().size()]; registerLive = new BitSet(); @@ -211,7 +211,7 @@ Debug.log("==== end backward data flow analysis ===="); } - private CiValue use(CiValue value, int killOpId) { + private RiValue use(RiValue value, int killOpId) { Debug.log(" use %s", value); if (isVariable(value)) { int variableIdx = asVariable(value).index; @@ -233,7 +233,7 @@ return value; } - private CiValue def(CiValue value, boolean isTemp) { + private RiValue def(RiValue value, boolean isTemp) { Debug.log(" def %s", value); if (isVariable(value)) { int variableIdx = asVariable(value).index; @@ -261,7 +261,7 @@ return value; } - private void kill(CiValue value, int opId) { + private void kill(RiValue value, int opId) { if (opId < 0) { return; } @@ -284,10 +284,10 @@ Object entry = killedValues(opId); if (entry == null) { setKilledValues(opId, value); - } else if (entry instanceof CiValue) { - setKilledValues(opId, new CiValue[] {(CiValue) entry, value}); + } else if (entry instanceof RiValue) { + setKilledValues(opId, new RiValue[] {(RiValue) entry, value}); } else { - CiValue[] killed = (CiValue[]) entry; + RiValue[] killed = (RiValue[]) entry; for (int i = 0; i < killed.length; i++) { if (killed[i] == null) { killed[i] = value; diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/simple/LinearScanAllocator.java --- a/graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/simple/LinearScanAllocator.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/simple/LinearScanAllocator.java Thu Jun 07 18:12:01 2012 +0200 @@ -29,6 +29,7 @@ import com.oracle.max.cri.ci.*; import com.oracle.max.cri.ci.CiRegister.RegisterFlag; +import com.oracle.max.cri.ri.*; import com.oracle.graal.alloc.util.*; import com.oracle.graal.debug.*; import com.oracle.graal.graph.*; @@ -60,7 +61,7 @@ } @Override - protected CiValue scratchRegister(Variable spilled) { + protected RiValue scratchRegister(Variable spilled) { GraalInternalError.shouldNotReachHere("needs working implementation"); EnumMap categorizedRegs = frameMap.registerConfig.getCategorizedAllocatableRegisters(); @@ -106,7 +107,7 @@ return frameMap.target.arch.registers.length; } - private boolean isAllocatableRegister(CiValue value) { + private boolean isAllocatableRegister(RiValue value) { return isRegister(value) && frameMap.registerConfig.getAttributesMap()[asRegister(value).number].isAllocatable; } @@ -141,8 +142,8 @@ private MoveResolver moveResolver; private LocationMap curLocations; - private CiValue[] curInRegisterState; - private CiValue[] curOutRegisterState; + private RiValue[] curInRegisterState; + private RiValue[] curOutRegisterState; private BitSet curLiveIn; private LIRInstruction curOp; @@ -181,19 +182,19 @@ } private void allocate() { - ValueProcedure recordUseProc = new ValueProcedure() { @Override public CiValue doValue(CiValue value, OperandMode mode, EnumSet flags) { return recordUse(value); } }; - ValueProcedure killNonLiveProc = new ValueProcedure() { @Override public CiValue doValue(CiValue value) { return killNonLive(value); } }; - ValueProcedure unblockProc = new ValueProcedure() { @Override public CiValue doValue(CiValue value) { return unblock(value); } }; - ValueProcedure killProc = new ValueProcedure() { @Override public CiValue doValue(CiValue value) { return kill(value); } }; - ValueProcedure blockProc = new ValueProcedure() { @Override public CiValue doValue(CiValue value) { return block(value); } }; - ValueProcedure useProc = new ValueProcedure() { @Override public CiValue doValue(CiValue value, OperandMode mode, EnumSet flags) { return use(value, mode, flags); } }; - ValueProcedure defProc = new ValueProcedure() { @Override public CiValue doValue(CiValue value, OperandMode mode, EnumSet flags) { return def(value, mode, flags); } }; + ValueProcedure recordUseProc = new ValueProcedure() { @Override public RiValue doValue(RiValue value, OperandMode mode, EnumSet flags) { return recordUse(value); } }; + ValueProcedure killNonLiveProc = new ValueProcedure() { @Override public RiValue doValue(RiValue value) { return killNonLive(value); } }; + ValueProcedure unblockProc = new ValueProcedure() { @Override public RiValue doValue(RiValue value) { return unblock(value); } }; + ValueProcedure killProc = new ValueProcedure() { @Override public RiValue doValue(RiValue value) { return kill(value); } }; + ValueProcedure blockProc = new ValueProcedure() { @Override public RiValue doValue(RiValue value) { return block(value); } }; + ValueProcedure useProc = new ValueProcedure() { @Override public RiValue doValue(RiValue value, OperandMode mode, EnumSet flags) { return use(value, mode, flags); } }; + ValueProcedure defProc = new ValueProcedure() { @Override public RiValue doValue(RiValue value, OperandMode mode, EnumSet flags) { return def(value, mode, flags); } }; Debug.log("==== start linear scan allocation ===="); canonicalSpillLocations = new LocationMap(lir.numVariables()); hintRegisterLocations = new LocationMap(lir.numVariables()); - curInRegisterState = new CiValue[maxRegisterNum()]; - curOutRegisterState = new CiValue[maxRegisterNum()]; + curInRegisterState = new RiValue[maxRegisterNum()]; + curOutRegisterState = new RiValue[maxRegisterNum()]; for (Block block : lir.linearScanOrder()) { Debug.log("start block %s %s", block, block.getLoop()); @@ -273,7 +274,7 @@ Debug.log("==== end linear scan allocation ===="); } - private CiValue killNonLive(CiValue value) { + private RiValue killNonLive(RiValue value) { assert isLocation(value); if (!curLiveIn.get(asLocation(value).variable.index)) { return null; @@ -286,7 +287,7 @@ return value; } - private CiValue unblock(CiValue value) { + private RiValue unblock(RiValue value) { if (isAllocatableRegister(value)) { Debug.log(" unblock register %s", value); int regNum = asRegister(value).number; @@ -296,7 +297,7 @@ return value; } - private CiValue kill(CiValue value) { + private RiValue kill(RiValue value) { if (isVariable(value)) { Location location = curLocations.get(asVariable(value)); Debug.log(" kill location %s", location); @@ -312,7 +313,7 @@ } - private CiValue block(CiValue value) { + private RiValue block(RiValue value) { if (isAllocatableRegister(value)) { Debug.log(" block %s", value); int regNum = asRegister(value).number; @@ -325,14 +326,14 @@ private void spillCallerSaveRegisters() { Debug.log(" spill caller save registers in curInRegisterState %s", Arrays.toString(curInRegisterState)); for (CiRegister reg : frameMap.registerConfig.getCallerSaveRegisters()) { - CiValue in = curInRegisterState[reg.number]; + RiValue in = curInRegisterState[reg.number]; if (in != null && isLocation(in)) { spill(asLocation(in)); } } } - private CiValue recordUse(CiValue value) { + private RiValue recordUse(RiValue value) { if (isVariable(value)) { assert lastUseFor(asVariable(value)) <= curOp.id(); setLastUseFor(asVariable(value), curOp.id()); @@ -341,7 +342,7 @@ return value; } - private CiValue use(CiValue value, OperandMode mode, EnumSet flags) { + private RiValue use(RiValue value, OperandMode mode, EnumSet flags) { assert mode == OperandMode.Input || mode == OperandMode.Alive; if (isVariable(value)) { // State values are not recorded beforehand because it does not matter if they are spilled. Still, it is necessary to record them as used now. @@ -376,7 +377,7 @@ private static final EnumSet SPILL_FLAGS = EnumSet.of(OperandFlag.Register, OperandFlag.Stack); - private CiValue def(CiValue value, OperandMode mode, EnumSet flags) { + private RiValue def(RiValue value, OperandMode mode, EnumSet flags) { assert mode == OperandMode.Temp || mode == OperandMode.Output; if (isVariable(value)) { Debug.log(" def %s %s", mode, value); @@ -391,8 +392,8 @@ private void fixupEvicted() { for (int i = 0; i < curInRegisterState.length; i++) { - CiValue in = curInRegisterState[i]; - CiValue out = curOutRegisterState[i]; + RiValue in = curInRegisterState[i]; + RiValue out = curOutRegisterState[i]; if (in != null && in != out && isLocation(in) && curLocations.get(asLocation(in).variable) == in) { Debug.log(" %s was evicted by %s, need to allocate new location", in, out); @@ -409,13 +410,13 @@ private void phiRegisterHints(Block block) { Debug.log(" phi register hints for %s", block); - CiValue[] phiDefinitions = ((StandardOp.PhiLabelOp) block.lir.get(0)).getPhiDefinitions(); + RiValue[] phiDefinitions = ((StandardOp.PhiLabelOp) block.lir.get(0)).getPhiDefinitions(); for (Block pred : block.getPredecessors()) { - CiValue[] phiInputs = ((StandardOp.PhiJumpOp) pred.lir.get(pred.lir.size() - 1)).getPhiInputs(); + RiValue[] phiInputs = ((StandardOp.PhiJumpOp) pred.lir.get(pred.lir.size() - 1)).getPhiInputs(); for (int i = 0; i < phiDefinitions.length; i++) { - CiValue phiDefinition = phiDefinitions[i]; - CiValue phiInput = phiInputs[i]; + RiValue phiDefinition = phiDefinitions[i]; + RiValue phiInput = phiInputs[i]; if (isVariable(phiDefinition)) { Location hintResult = processRegisterHint(asVariable(phiDefinition), OperandMode.Output, phiInput); @@ -427,7 +428,7 @@ } } - private Location processRegisterHint(Variable variable, OperandMode mode, CiValue registerHint) { + private Location processRegisterHint(Variable variable, OperandMode mode, RiValue registerHint) { if (registerHint == null) { return null; } @@ -446,9 +447,9 @@ private Location allocateRegister(final Variable variable, final OperandMode mode, EnumSet flags) { if (flags.contains(OperandFlag.RegisterHint)) { - CiValue hintResult = curOp.forEachRegisterHint(variable, mode, new ValueProcedure() { + RiValue hintResult = curOp.forEachRegisterHint(variable, mode, new ValueProcedure() { @Override - public CiValue doValue(CiValue registerHint) { + public RiValue doValue(RiValue registerHint) { return processRegisterHint(variable, mode, registerHint); } }); @@ -457,7 +458,7 @@ } } - CiValue hintResult = processRegisterHint(variable, mode, hintRegisterLocations.get(variable)); + RiValue hintResult = processRegisterHint(variable, mode, hintRegisterLocations.get(variable)); if (hintResult != null) { return asLocation(hintResult); } @@ -519,8 +520,8 @@ } private Location spillCandidate(CiRegister reg) { - CiValue in = curInRegisterState[reg.number]; - CiValue out = curOutRegisterState[reg.number]; + RiValue in = curInRegisterState[reg.number]; + RiValue out = curOutRegisterState[reg.number]; if (in == out && in != null && isLocation(in) && lastUseFor(asLocation(in).variable) < curOp.id()) { return asLocation(in); } @@ -580,7 +581,7 @@ final BitSet liveState = new BitSet(); curLocations.forEachLocation(new ValueProcedure() { @Override - public CiValue doValue(CiValue value) { + public RiValue doValue(RiValue value) { liveState.set(asLocation(value).variable.index); for (Block pred : block.getPredecessors()) { @@ -604,7 +605,7 @@ sb.append(" current lcoations: "); curLocations.forEachLocation(new ValueProcedure() { @Override - public CiValue doValue(CiValue value) { + public RiValue doValue(RiValue value) { sb.append(value).append(" "); return value; } diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/simple/ResolveDataFlow.java --- a/graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/simple/ResolveDataFlow.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/simple/ResolveDataFlow.java Thu Jun 07 18:12:01 2012 +0200 @@ -26,7 +26,7 @@ import java.util.*; -import com.oracle.max.cri.ci.*; +import com.oracle.max.cri.ri.*; import com.oracle.graal.alloc.util.*; import com.oracle.graal.debug.*; import com.oracle.graal.graph.*; @@ -49,7 +49,7 @@ private LocationMap curFromLocations; public void execute() { - ValueProcedure locMappingProc = new ValueProcedure() { @Override public CiValue doValue(CiValue value) { return locMapping(value); } }; + ValueProcedure locMappingProc = new ValueProcedure() { @Override public RiValue doValue(RiValue value) { return locMapping(value); } }; Debug.log("==== start resolve data flow ===="); for (Block toBlock : lir.linearScanOrder()) { @@ -87,7 +87,7 @@ Debug.log("==== end resolve data flow ===="); } - private CiValue locMapping(CiValue value) { + private RiValue locMapping(RiValue value) { Location to = asLocation(value); Location from = curFromLocations.get(to.variable); if (value != from && from != null) { @@ -96,7 +96,7 @@ return value; } - private void phiMapping(CiValue[] inputs, CiValue[] outputs) { + private void phiMapping(RiValue[] inputs, RiValue[] outputs) { assert inputs.length == outputs.length; for (int i = 0; i < inputs.length; i++) { if (inputs[i] != outputs[i]) { diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/simple/SpillAllAllocator.java --- a/graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/simple/SpillAllAllocator.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/simple/SpillAllAllocator.java Thu Jun 07 18:12:01 2012 +0200 @@ -29,6 +29,7 @@ import com.oracle.max.cri.ci.*; import com.oracle.max.cri.ci.CiRegister.RegisterFlag; +import com.oracle.max.cri.ri.*; import com.oracle.graal.alloc.util.*; import com.oracle.graal.debug.*; import com.oracle.graal.graph.*; @@ -57,7 +58,7 @@ } @Override - protected CiValue scratchRegister(Variable spilled) { + protected RiValue scratchRegister(Variable spilled) { EnumMap categorizedRegs = frameMap.registerConfig.getCategorizedAllocatableRegisters(); CiRegister[] availableRegs = categorizedRegs.get(spilled.flag); for (CiRegister reg : availableRegs) { @@ -102,7 +103,7 @@ return frameMap.target.arch.registers.length; } - private boolean isAllocatableRegister(CiValue value) { + private boolean isAllocatableRegister(RiValue value) { return isRegister(value) && frameMap.registerConfig.getAttributesMap()[asRegister(value).number].isAllocatable; } @@ -149,14 +150,14 @@ } private void allocate() { - ValueProcedure killNonLiveProc = new ValueProcedure() { @Override public CiValue doValue(CiValue value) { return killNonLive(value); } }; - ValueProcedure killBeginProc = new ValueProcedure() { @Override public CiValue doValue(CiValue value) { return kill(value, false); } }; - ValueProcedure killEndProc = new ValueProcedure() { @Override public CiValue doValue(CiValue value) { return kill(value, true); } }; - ValueProcedure killLocationProc = new ValueProcedure() { @Override public CiValue doValue(CiValue value) { return killLocation(value); } }; - ValueProcedure blockProc = new ValueProcedure() { @Override public CiValue doValue(CiValue value) { return block(value); } }; - ValueProcedure loadProc = new ValueProcedure() { @Override public CiValue doValue(CiValue value, OperandMode mode, EnumSet flags) { return load(value, mode, flags); } }; - ValueProcedure spillProc = new ValueProcedure() { @Override public CiValue doValue(CiValue value, OperandMode mode, EnumSet flags) { return spill(value, mode, flags); } }; - ValueProcedure useSlotProc = new ValueProcedure() { @Override public CiValue doValue(CiValue value) { return useSlot(value); } }; + ValueProcedure killNonLiveProc = new ValueProcedure() { @Override public RiValue doValue(RiValue value) { return killNonLive(value); } }; + ValueProcedure killBeginProc = new ValueProcedure() { @Override public RiValue doValue(RiValue value) { return kill(value, false); } }; + ValueProcedure killEndProc = new ValueProcedure() { @Override public RiValue doValue(RiValue value) { return kill(value, true); } }; + ValueProcedure killLocationProc = new ValueProcedure() { @Override public RiValue doValue(RiValue value) { return killLocation(value); } }; + ValueProcedure blockProc = new ValueProcedure() { @Override public RiValue doValue(RiValue value) { return block(value); } }; + ValueProcedure loadProc = new ValueProcedure() { @Override public RiValue doValue(RiValue value, OperandMode mode, EnumSet flags) { return load(value, mode, flags); } }; + ValueProcedure spillProc = new ValueProcedure() { @Override public RiValue doValue(RiValue value, OperandMode mode, EnumSet flags) { return spill(value, mode, flags); } }; + ValueProcedure useSlotProc = new ValueProcedure() { @Override public RiValue doValue(RiValue value) { return useSlot(value); } }; Debug.log("==== start spill all allocation ===="); curInRegisterState = new Object[maxRegisterNum()]; @@ -224,7 +225,7 @@ Debug.log("==== end spill all allocation ===="); } - private CiValue killNonLive(CiValue value) { + private RiValue killNonLive(RiValue value) { assert isLocation(value); if (!curLiveIn.get(asLocation(value).variable.index)) { return null; @@ -232,7 +233,7 @@ return value; } - private CiValue kill(CiValue value, boolean end) { + private RiValue kill(RiValue value, boolean end) { if (isVariable(value)) { Debug.log(" kill variable %s", value); @@ -268,7 +269,7 @@ return value; } - private CiValue killLocation(CiValue value) { + private RiValue killLocation(RiValue value) { Debug.log(" kill location %s", value); assert isAllocatableRegister(asLocation(value).location); @@ -279,7 +280,7 @@ return null; } - private CiValue block(CiValue value) { + private RiValue block(RiValue value) { if (isAllocatableRegister(value)) { Debug.log(" block %s", value); int regNum = asRegister(value).number; @@ -290,7 +291,7 @@ return value; } - private CiValue load(CiValue value, OperandMode mode, EnumSet flags) { + private RiValue load(RiValue value, OperandMode mode, EnumSet flags) { assert mode == OperandMode.Input || mode == OperandMode.Alive; if (flags.contains(OperandFlag.Stack)) { return useSlot(value); @@ -314,7 +315,7 @@ } } - private CiValue spill(CiValue value, OperandMode mode, EnumSet flags) { + private RiValue spill(RiValue value, OperandMode mode, EnumSet flags) { assert mode == OperandMode.Temp || mode == OperandMode.Output; if (flags.contains(OperandFlag.Stack)) { return defSlot(value); @@ -335,7 +336,7 @@ } } - private CiValue useSlot(CiValue value) { + private RiValue useSlot(RiValue value) { if (isVariable(value)) { Debug.log(" useSlot %s", value); Location stackLoc = curStackLocations.get(asVariable(value)); @@ -347,7 +348,7 @@ } } - private CiValue defSlot(CiValue value) { + private RiValue defSlot(RiValue value) { if (isVariable(value)) { Debug.log(" assignSlot %s", value); Location stackLoc = new Location(asVariable(value), frameMap.allocateSpillSlot(value.kind)); @@ -362,9 +363,9 @@ private Location allocateRegister(final Variable variable, final Object[] inRegisterState, final Object[] outRegisterState, OperandMode mode, EnumSet flags) { if (flags.contains(OperandFlag.RegisterHint)) { - CiValue result = curInstruction.forEachRegisterHint(variable, mode, new ValueProcedure() { + RiValue result = curInstruction.forEachRegisterHint(variable, mode, new ValueProcedure() { @Override - public CiValue doValue(CiValue registerHint) { + public RiValue doValue(RiValue registerHint) { Debug.log(" registerHint %s", registerHint); CiRegister hint = null; if (isRegister(registerHint)) { @@ -418,7 +419,7 @@ final BitSet liveState = new BitSet(); curStackLocations.forEachLocation(new ValueProcedure() { @Override - public CiValue doValue(CiValue value) { + public RiValue doValue(RiValue value) { liveState.set(asLocation(value).variable.index); for (Block pred : block.getPredecessors()) { @@ -456,7 +457,7 @@ sb.append(" curVariableLocations: "); curStackLocations.forEachLocation(new ValueProcedure() { @Override - public CiValue doValue(CiValue value) { + public RiValue doValue(RiValue value) { sb.append(value).append(" "); return value; } diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/util/IntervalPrinter.java --- a/graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/util/IntervalPrinter.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/util/IntervalPrinter.java Thu Jun 07 18:12:01 2012 +0200 @@ -37,7 +37,7 @@ public final class IntervalPrinter { - public static void printBeforeAllocation(String label, LIR lir, RiRegisterConfig registerConfig, DataFlowAnalysis dataFlow) { + public static void printBeforeAllocation(String label, LIR lir, CiRegisterConfig registerConfig, DataFlowAnalysis dataFlow) { if (Debug.isDumpEnabled()) { IntervalPrinter printer = new IntervalPrinter(lir, registerConfig, dataFlow, null); Debug.dump(lir, label); @@ -45,7 +45,7 @@ } } - public static void printAfterAllocation(String label, LIR lir, RiRegisterConfig registerConfig, DataFlowAnalysis dataFlow, LocationMap[] blockEndLocations) { + public static void printAfterAllocation(String label, LIR lir, CiRegisterConfig registerConfig, DataFlowAnalysis dataFlow, LocationMap[] blockEndLocations) { if (Debug.isDumpEnabled()) { IntervalPrinter printer = new IntervalPrinter(lir, registerConfig, dataFlow, blockEndLocations); Debug.dump(lir, label); @@ -98,13 +98,13 @@ private final LIR lir; - private final RiRegisterConfig registerConfig; + private final CiRegisterConfig registerConfig; private final DataFlowAnalysis dataFlow; private final LocationMap[] blockEndLocations; private final Variable[] variables; private final Map intervals; - private IntervalPrinter(LIR lir, RiRegisterConfig registerConfig, DataFlowAnalysis dataFlow, LocationMap[] blockEndLocations) { + private IntervalPrinter(LIR lir, CiRegisterConfig registerConfig, DataFlowAnalysis dataFlow, LocationMap[] blockEndLocations) { this.lir = lir; this.registerConfig = registerConfig; this.dataFlow = dataFlow; @@ -113,7 +113,7 @@ this.intervals = new HashMap<>(); } - private boolean isAllocatableRegister(CiValue value) { + private boolean isAllocatableRegister(RiValue value) { return isRegister(value) && registerConfig.getAttributesMap()[asRegister(value).number].isAllocatable; } @@ -121,7 +121,7 @@ private String curUseKind; public Interval[] execute() { - ValueProcedure varProc = new ValueProcedure() { @Override public CiValue doValue(CiValue value) { return var(value); } }; + ValueProcedure varProc = new ValueProcedure() { @Override public RiValue doValue(RiValue value) { return var(value); } }; for (Block block : lir.linearScanOrder()) { for (LIRInstruction op : block.lir) { @@ -129,8 +129,8 @@ } } - ValueProcedure useProc = new ValueProcedure() { @Override public CiValue doValue(CiValue value, OperandMode mode, EnumSet flags) { return use(value, mode, flags); } }; - ValueProcedure defProc = new ValueProcedure() { @Override public CiValue doValue(CiValue value, OperandMode mode, EnumSet flags) { return def(value, flags); } }; + ValueProcedure useProc = new ValueProcedure() { @Override public RiValue doValue(RiValue value, OperandMode mode, EnumSet flags) { return use(value, mode, flags); } }; + ValueProcedure defProc = new ValueProcedure() { @Override public RiValue doValue(RiValue value, OperandMode mode, EnumSet flags) { return def(value, flags); } }; intervals.put("call", new Interval(-2, "call", "", "call", "hasCall")); intervals.put("st", new Interval(-1, "st", "", "st", "hasState")); @@ -192,7 +192,7 @@ return intervalsArray; } - public CiValue var(CiValue value) { + public RiValue var(RiValue value) { if (isLocation(value)) { variables[asLocation(value).variable.index] = asLocation(value).variable; } else if (isVariable(value)) { @@ -201,7 +201,7 @@ return value; } - private Interval findInterval(CiValue value) { + private Interval findInterval(RiValue value) { Interval interval; if (isLocation(value)) { Interval parent = findInterval(asLocation(value).variable); @@ -237,7 +237,7 @@ } } - private CiValue use(CiValue value, OperandMode mode, EnumSet flags) { + private RiValue use(RiValue value, OperandMode mode, EnumSet flags) { Interval interval = findInterval(value); if (interval != null) { if (interval.uses.size() == 0 || interval.uses.get(interval.uses.size() - 1).pos != curOpId) { @@ -250,7 +250,7 @@ return value; } - private CiValue def(CiValue value, EnumSet flags) { + private RiValue def(RiValue value, EnumSet flags) { Interval interval = findInterval(value); if (interval != null) { interval.uses.add(new UsePosition(curOpId, useKind(flags))); @@ -264,7 +264,7 @@ return value; } - private CiValue out(CiValue value) { + private RiValue out(RiValue value) { Interval interval = findInterval(value); if (interval != null) { interval.lastTo = curOpId; diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/util/Location.java --- a/graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/util/Location.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/util/Location.java Thu Jun 07 18:12:01 2012 +0200 @@ -22,16 +22,16 @@ */ package com.oracle.graal.alloc.util; -import com.oracle.max.cri.ci.*; +import com.oracle.max.cri.ri.*; import com.oracle.graal.lir.*; -public class Location extends CiValue { +public class Location extends RiValue { private static final long serialVersionUID = -1786677729152726126L; public final Variable variable; - public final CiValue location; + public final RiValue location; - public Location(Variable variable, CiValue location) { + public Location(Variable variable, RiValue location) { super(variable.kind); this.variable = variable; this.location = location; diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/util/LocationMap.java --- a/graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/util/LocationMap.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/util/LocationMap.java Thu Jun 07 18:12:01 2012 +0200 @@ -26,7 +26,7 @@ import java.util.*; -import com.oracle.max.cri.ci.*; +import com.oracle.max.cri.ri.*; import com.oracle.graal.lir.*; import com.oracle.graal.lir.LIRInstruction.*; @@ -57,7 +57,7 @@ public void forEachLocation(ValueProcedure proc) { for (int i = 0; i < locations.length; i++) { if (locations[i] != null) { - CiValue newValue = proc.doValue(locations[i], null, null); + RiValue newValue = proc.doValue(locations[i], null, null); assert newValue == null || asLocation(newValue).variable == locations[i].variable; locations[i] = (Location) newValue; } diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/util/LocationUtil.java --- a/graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/util/LocationUtil.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/util/LocationUtil.java Thu Jun 07 18:12:01 2012 +0200 @@ -22,17 +22,17 @@ */ package com.oracle.graal.alloc.util; -import com.oracle.max.cri.ci.*; +import com.oracle.max.cri.ri.*; import com.oracle.graal.lir.*; public class LocationUtil extends ValueUtil { - public static boolean isLocation(CiValue value) { + public static boolean isLocation(RiValue value) { assert value != null; return value instanceof Location; } - public static Location asLocation(CiValue value) { + public static Location asLocation(RiValue value) { assert value != null; return (Location) value; } diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/util/MoveResolver.java --- a/graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/util/MoveResolver.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/util/MoveResolver.java Thu Jun 07 18:12:01 2012 +0200 @@ -28,6 +28,7 @@ import java.util.*; import com.oracle.max.cri.ci.*; +import com.oracle.max.cri.ri.*; import com.oracle.graal.debug.*; import com.oracle.graal.graph.*; import com.oracle.graal.lir.*; @@ -36,8 +37,8 @@ private final LIR lir; private final FrameMap frameMap; private final int[] registersBlocked; - private final Map valuesBlocked; - private final List mappingFrom; + private final Map valuesBlocked; + private final List mappingFrom; private final List mappingTo; private final LIRInsertionBuffer insertionBuffer; private int insertPos; @@ -70,7 +71,7 @@ assert checkValid(); } - public void add(CiValue from, Location to) { + public void add(RiValue from, Location to) { assert checkValid(); assert isLocation(from) || isConstant(from); assert from != to; @@ -120,14 +121,14 @@ // Block all registers and stack slots that are used as inputs of a move. // When a register is blocked, no move to this register is emitted. // This is necessary for detecting cycles in moves. - for (CiValue from : mappingFrom) { + for (RiValue from : mappingFrom) { block(from); } while (mappingFrom.size() > 0) { boolean processed = false; for (int i = mappingFrom.size() - 1; i >= 0; i--) { - CiValue from = mappingFrom.get(i); + RiValue from = mappingFrom.get(i); Location to = mappingTo.get(i); if (safeToProcessMove(from, to)) { @@ -153,19 +154,19 @@ int exchangeOther = -1; for (int i = mappingFrom.size() - 1; i >= 0; i--) { - CiValue from = mappingFrom.get(i); + RiValue from = mappingFrom.get(i); Location to = mappingTo.get(i); assert !safeToProcessMove(from, to) : "would not be in this code otherwise"; if (isConstant(from)) { continue; } - CiValue fromLoc = asLocation(from).location; + RiValue fromLoc = asLocation(from).location; // Check if we can insert an exchange to save us from spilling. if (isRegister(fromLoc) && isRegister(to) && asRegister(fromLoc) != asRegister(to) && blockedCount(to) == 1) { for (int j = mappingFrom.size() - 1; j >= 0; j--) { - CiValue possibleOther = mappingFrom.get(j); + RiValue possibleOther = mappingFrom.get(j); if (isLocation(possibleOther)) { if (asLocation(possibleOther).location == to.location) { assert exchangeCandidate == -1 : "must not find twice because of blocked check above"; @@ -220,9 +221,9 @@ } } - private void block(CiValue value) { + private void block(RiValue value) { if (isLocation(value)) { - CiValue location = asLocation(value).location; + RiValue location = asLocation(value).location; if (isRegister(location)) { registersBlocked[asRegister(location).number]++; } else { @@ -232,10 +233,10 @@ } } - private void unblock(CiValue value) { + private void unblock(RiValue value) { if (isLocation(value)) { assert blockedCount(asLocation(value)) > 0; - CiValue location = asLocation(value).location; + RiValue location = asLocation(value).location; if (isRegister(location)) { registersBlocked[asRegister(location).number]--; } else { @@ -248,7 +249,7 @@ } private int blockedCount(Location value) { - CiValue location = asLocation(value).location; + RiValue location = asLocation(value).location; if (isRegister(location)) { return registersBlocked[asRegister(location).number]; } else { @@ -257,7 +258,7 @@ } } - private boolean safeToProcessMove(CiValue from, Location to) { + private boolean safeToProcessMove(RiValue from, Location to) { int count = blockedCount(to); return count == 0 || (count == 1 && isLocation(from) && asLocation(from).location == to.location); } @@ -269,17 +270,17 @@ throw GraalInternalError.unimplemented(); } - private void insertMove(CiValue src, Location dst) { + private void insertMove(RiValue src, Location dst) { if (isStackSlot(dst.location) && isLocation(src) && isStackSlot(asLocation(src).location)) { // Move between two stack slots. We need a temporary registers. If the allocator can give // us a free register, we need two moves: src->scratch, scratch->dst // If the allocator cannot give us a free register (it returns a Location in this case), // we need to spill the scratch register first, so we need four moves in total. - CiValue scratch = scratchRegister(dst.variable); + RiValue scratch = scratchRegister(dst.variable); Location scratchSaved = null; - CiValue scratchRegister = scratch; + RiValue scratchRegister = scratch; if (isLocation(scratch)) { scratchSaved = new Location(asLocation(scratch).variable, frameMap.allocateSpillSlot(scratch.kind)); insertMove(scratch, scratchSaved); @@ -306,7 +307,7 @@ * {@link CiRegisterValue}, the register can be overwritten without precautions. If the * returned value is a {@link Location}, it needs to be spilled and rescued itself. */ - protected abstract CiValue scratchRegister(Variable spilled); + protected abstract RiValue scratchRegister(Variable spilled); private boolean checkEmpty() { assert insertPos == -1; @@ -327,7 +328,7 @@ assert insertionBuffer.initialized() && insertPos != -1; for (int i = 0; i < mappingTo.size(); i++) { - CiValue from = mappingFrom.get(i); + RiValue from = mappingFrom.get(i); Location to = mappingTo.get(i); assert from.kind.stackKind() == to.kind; diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/util/RegisterVerifier.java --- a/graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/util/RegisterVerifier.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/util/RegisterVerifier.java Thu Jun 07 18:12:01 2012 +0200 @@ -28,6 +28,7 @@ import java.util.*; import com.oracle.max.cri.ci.*; +import com.oracle.max.cri.ri.*; import com.oracle.graal.debug.*; import com.oracle.graal.graph.*; import com.oracle.graal.lir.*; @@ -49,7 +50,7 @@ * value that is currently contained in there ({@link Location} for operands that were variables; {@link CiRegisterValue} or * {@link CiStackSlot} for operands that used fixed registers or stack slots). */ - private final Map[] blockStates; + private final Map[] blockStates; private void addToWorkList(Block block) { if (!workList.contains(block)) { @@ -57,15 +58,15 @@ } } - private Map stateFor(Block block) { + private Map stateFor(Block block) { return blockStates[block.getId()]; } - private void setStateFor(Block block, Map savedState) { + private void setStateFor(Block block, Map savedState) { blockStates[block.getId()] = savedState; } - private static Map copy(Map inputState) { + private static Map copy(Map inputState) { return new HashMap<>(inputState); } @@ -82,12 +83,12 @@ this.blockStates = new Map[lir.linearScanOrder().size()]; } - private Map curInputState; + private Map curInputState; private void verify(Block startBlock) { - ValueProcedure useProc = new ValueProcedure() { @Override public CiValue doValue(CiValue value, OperandMode mode, EnumSet flags) { return use(value, flags); } }; - ValueProcedure tempProc = new ValueProcedure() { @Override public CiValue doValue(CiValue value) { return temp(value); } }; - ValueProcedure outputProc = new ValueProcedure() { @Override public CiValue doValue(CiValue value) { return output(value); } }; + ValueProcedure useProc = new ValueProcedure() { @Override public RiValue doValue(RiValue value, OperandMode mode, EnumSet flags) { return use(value, flags); } }; + ValueProcedure tempProc = new ValueProcedure() { @Override public RiValue doValue(RiValue value) { return temp(value); } }; + ValueProcedure outputProc = new ValueProcedure() { @Override public RiValue doValue(RiValue value) { return output(value); } }; curInputState = new HashMap<>(); setStateFor(startBlock, curInputState); @@ -125,7 +126,7 @@ } private void processSuccessor(Block succ) { - Map savedState = stateFor(succ); + Map savedState = stateFor(succ); if (savedState == null) { // Block was not processed before, so set initial inputState. Debug.log(" successor %s: initial visit", succ); @@ -136,11 +137,11 @@ // This block was already processed before. // Check if new inputState is consistent with savedState. Debug.log(" successor %s: state present", succ); - Iterator> iter = savedState.entrySet().iterator(); + Iterator> iter = savedState.entrySet().iterator(); while (iter.hasNext()) { - Map.Entry entry = iter.next(); - CiValue savedValue = entry.getValue(); - CiValue inputValue = curInputState.get(entry.getKey()); + Map.Entry entry = iter.next(); + RiValue savedValue = entry.getValue(); + RiValue inputValue = curInputState.get(entry.getKey()); if (savedValue != inputValue) { // Current inputState and previous savedState assume a different value in this register. @@ -171,7 +172,7 @@ * include the kind of the value because we do not want to distinguish between the same register with * different kinds. */ - private Object key(CiValue value) { + private Object key(RiValue value) { if (isLocation(value)) { return key(asLocation(value).location); } else if (isRegister(value)) { @@ -183,13 +184,13 @@ } } - private boolean isIgnoredRegister(CiValue value) { + private boolean isIgnoredRegister(RiValue value) { return isRegister(value) && !frameMap.registerConfig.getAttributesMap()[asRegister(value).number].isAllocatable; } - private CiValue use(CiValue value, EnumSet flags) { - if (!isConstant(value) && value != CiValue.IllegalValue && !isIgnoredRegister(value)) { - CiValue actual = curInputState.get(key(value)); + private RiValue use(RiValue value, EnumSet flags) { + if (!isConstant(value) && value != RiValue.IllegalValue && !isIgnoredRegister(value)) { + RiValue actual = curInputState.get(key(value)); if (actual == null && flags.contains(OperandFlag.Uninitialized)) { // OK, since uninitialized values are allowed explicitly. } else if (value != actual) { @@ -201,16 +202,16 @@ return value; } - private CiValue temp(CiValue value) { - if (!isConstant(value) && value != CiValue.IllegalValue && !isIgnoredRegister(value)) { + private RiValue temp(RiValue value) { + if (!isConstant(value) && value != RiValue.IllegalValue && !isIgnoredRegister(value)) { Debug.log(" temp %s -> remove key %s", value, key(value)); curInputState.remove(key(value)); } return value; } - private CiValue output(CiValue value) { - if (value != CiValue.IllegalValue && !isIgnoredRegister(value)) { + private RiValue output(RiValue value) { + if (value != RiValue.IllegalValue && !isIgnoredRegister(value)) { Debug.log(" output %s -> set key %s", value, key(value)); curInputState.put(key(value), value); } diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.api/src/com/oracle/graal/api/GraalRuntime.java --- a/graal/com.oracle.graal.api/src/com/oracle/graal/api/GraalRuntime.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.api/src/com/oracle/graal/api/GraalRuntime.java Thu Jun 07 18:12:01 2012 +0200 @@ -25,4 +25,5 @@ public interface GraalRuntime { String getName(); + T getCapability(Class clazz); } diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/OptimisticOptimizations.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/OptimisticOptimizations.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/OptimisticOptimizations.java Thu Jun 07 18:12:01 2012 +0200 @@ -49,16 +49,16 @@ this.enabledOpts = EnumSet.noneOf(Optimization.class); RiProfilingInfo profilingInfo = method.profilingInfo(); - if (checkDeoptimizations(profilingInfo, RiDeoptReason.UnreachedCode)) { + if (checkDeoptimizations(profilingInfo, CiDeoptReason.UnreachedCode)) { enabledOpts.add(Optimization.RemoveNeverExecutedCode); } - if (checkDeoptimizations(profilingInfo, RiDeoptReason.TypeCheckedInliningViolated)) { + if (checkDeoptimizations(profilingInfo, CiDeoptReason.TypeCheckedInliningViolated)) { enabledOpts.add(Optimization.UseTypeCheckedInlining); } - if (checkDeoptimizations(profilingInfo, RiDeoptReason.OptimizedTypeCheckViolated)) { + if (checkDeoptimizations(profilingInfo, CiDeoptReason.OptimizedTypeCheckViolated)) { enabledOpts.add(Optimization.UseTypeCheckHints); } - if (checkDeoptimizations(profilingInfo, RiDeoptReason.NotCompiledExceptionHandler)) { + if (checkDeoptimizations(profilingInfo, CiDeoptReason.NotCompiledExceptionHandler)) { enabledOpts.add(Optimization.UseExceptionProbability); } } @@ -111,7 +111,7 @@ return false; } - private static boolean checkDeoptimizations(RiProfilingInfo profilingInfo, RiDeoptReason reason) { + private static boolean checkDeoptimizations(RiProfilingInfo profilingInfo, CiDeoptReason reason) { return profilingInfo.getDeoptimizationCount(reason) < GraalOptions.DeoptsToDisableOptimisticOptimization; } } diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/Interval.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/Interval.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/Interval.java Thu Jun 07 18:12:01 2012 +0200 @@ -402,17 +402,17 @@ /** * The {@linkplain CiRegisterValue register} or {@linkplain Variable variable} for this interval prior to register allocation. */ - public final CiValue operand; + public final RiValue operand; /** - * The {@linkplain OperandPool#operandNumber(CiValue) operand number} for this interval's {@linkplain #operand operand}. + * The {@linkplain OperandPool#operandNumber(RiValue) operand number} for this interval's {@linkplain #operand operand}. */ public final int operandNumber; /** * The {@linkplain CiRegisterValue register}, {@linkplain CiStackSlot spill slot} or {@linkplain CiAddress address} assigned to this interval. */ - private CiValue location; + private RiValue location; /** * The stack slot to which all splits of this interval are spilled if necessary. @@ -487,7 +487,7 @@ */ private Interval locationHint; - void assignLocation(CiValue newLocation) { + void assignLocation(RiValue newLocation) { if (isRegister(newLocation)) { assert this.location == null : "cannot re-assign location for " + this; if (newLocation.kind == RiKind.Illegal && kind != RiKind.Illegal) { @@ -506,7 +506,7 @@ /** * Gets the {@linkplain CiRegisterValue register}, {@linkplain CiStackSlot spill slot} or {@linkplain CiAddress address} assigned to this interval. */ - public CiValue location() { + public RiValue location() { return location; } @@ -659,9 +659,9 @@ /** * Sentinel interval to denote the end of an interval list. */ - static final Interval EndMarker = new Interval(CiValue.IllegalValue, -1); + static final Interval EndMarker = new Interval(RiValue.IllegalValue, -1); - Interval(CiValue operand, int operandNumber) { + Interval(RiValue operand, int operandNumber) { assert operand != null; this.operand = operand; this.operandNumber = operandNumber; diff -r 28af6dff047f -r 56860d3f9f39 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 Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java Thu Jun 07 18:12:01 2012 +0200 @@ -56,7 +56,7 @@ final LIR ir; final LIRGenerator gen; final FrameMap frameMap; - final RiRegisterAttributes[] registerAttributes; + final CiRegisterAttributes[] registerAttributes; final CiRegister[] registers; private static final int INITIAL_SPLIT_INTERVALS_CAPACITY = 32; @@ -66,7 +66,7 @@ * Bit map specifying which {@linkplain OperandPool operands} are live upon entry to this block. * These are values used in this block or any of its successors where such value are not defined * in this block. - * The bit index of an operand is its {@linkplain OperandPool#operandNumber(com.sun.cri.ci.CiValue) operand number}. + * The bit index of an operand is its {@linkplain OperandPool#operandNumber(com.oracle.max.cri.ri.RiValue.ci.CiValue) operand number}. */ public BitMap liveIn; @@ -74,20 +74,20 @@ * Bit map specifying which {@linkplain OperandPool operands} are live upon exit from this block. * These are values used in a successor block that are either defined in this block or were live * upon entry to this block. - * The bit index of an operand is its {@linkplain OperandPool#operandNumber(com.sun.cri.ci.CiValue) operand number}. + * The bit index of an operand is its {@linkplain OperandPool#operandNumber(com.oracle.max.cri.ri.RiValue.ci.CiValue) operand number}. */ public BitMap liveOut; /** * Bit map specifying which {@linkplain OperandPool operands} are used (before being defined) in this block. * That is, these are the values that are live upon entry to the block. - * The bit index of an operand is its {@linkplain OperandPool#operandNumber(com.sun.cri.ci.CiValue) operand number}. + * The bit index of an operand is its {@linkplain OperandPool#operandNumber(com.oracle.max.cri.ri.RiValue.ci.CiValue) operand number}. */ public BitMap liveGen; /** * Bit map specifying which {@linkplain OperandPool operands} are defined/overwritten in this block. - * The bit index of an operand is its {@linkplain OperandPool#operandNumber(com.sun.cri.ci.CiValue) operand number}. + * The bit index of an operand is its {@linkplain OperandPool#operandNumber(com.oracle.max.cri.ri.RiValue.ci.CiValue) operand number}. */ public BitMap liveKill; } @@ -100,7 +100,7 @@ final Block[] sortedBlocks; /** - * Map from {@linkplain #operandNumber(CiValue) operand numbers} to intervals. + * Map from {@linkplain #operandNumber(RiValue) operand numbers} to intervals. */ Interval[] intervals; @@ -139,14 +139,14 @@ BitMap2D intervalInLoop; /** - * The variable operands allocated from this pool. The {@linkplain #operandNumber(CiValue) number} + * The variable operands allocated from this pool. The {@linkplain #operandNumber(RiValue) number} * of the first variable operand in this pool is one greater than the number of the last * register operand in the pool. */ private final ArrayList variables; /** - * The {@linkplain #operandNumber(CiValue) number} of the first variable operand + * The {@linkplain #operandNumber(RiValue) number} of the first variable operand * {@linkplain #newVariable(RiKind) allocated} from this pool. */ private final int firstVariableNumber; @@ -167,7 +167,7 @@ this.blockData = new BlockMap<>(ir.cfg); } - public static boolean isVariableOrRegister(CiValue value) { + public static boolean isVariableOrRegister(RiValue value) { return isVariable(value) || isRegister(value); } @@ -177,7 +177,7 @@ * {@linkplain Variable variables} and {@linkplain CiRegisterValue registers} being processed by this * allocator. */ - private int operandNumber(CiValue operand) { + private int operandNumber(RiValue operand) { if (isRegister(operand)) { int number = asRegister(operand).number; assert number < firstVariableNumber; @@ -190,7 +190,7 @@ /** * Gets the operand denoted by a given operand number. */ - private CiValue operandFor(int operandNumber) { + private RiValue operandFor(int operandNumber) { if (operandNumber < firstVariableNumber) { assert operandNumber >= 0; return registers[operandNumber].asValue(); @@ -240,7 +240,7 @@ /** * Gets an object describing the attributes of a given register according to this register configuration. */ - RiRegisterAttributes attributes(CiRegister reg) { + CiRegisterAttributes attributes(CiRegister reg) { return registerAttributes[reg.number]; } @@ -262,7 +262,7 @@ * @param operand the operand for the interval * @return the created interval */ - Interval createInterval(CiValue operand) { + Interval createInterval(RiValue operand) { assert isProcessed(operand); assert isLegal(operand); int operandNumber = operandNumber(operand); @@ -324,7 +324,7 @@ return intervalInLoop.at(interval, loop); } - Interval intervalFor(CiValue operand) { + Interval intervalFor(RiValue operand) { int operandNumber = operandNumber(operand); assert operandNumber < intervalsSize; return intervals[operandNumber]; @@ -526,8 +526,8 @@ insertionBuffer.init(block.lir); } - CiValue fromLocation = interval.location(); - CiValue toLocation = canonicalSpillOpr(interval); + RiValue fromLocation = interval.location(); + RiValue toLocation = canonicalSpillOpr(interval); assert isRegister(fromLocation) : "from operand must be a register but is: " + fromLocation + " toLocation=" + toLocation + " spillState=" + interval.spillState(); assert isStackSlot(toLocation) : "to operand must be a stack slot"; @@ -582,7 +582,7 @@ void numberInstructions() { ValueProcedure setVariableProc = new ValueProcedure() { @Override - public CiValue doValue(CiValue value) { + public RiValue doValue(RiValue value) { if (isVariable(value)) { int variableIdx = asVariable(value).index; while (variables.size() <= variableIdx) { @@ -666,7 +666,7 @@ ValueProcedure useProc = new ValueProcedure() { @Override - protected CiValue doValue(CiValue operand) { + protected RiValue doValue(RiValue operand) { if (isVariable(operand)) { int operandNum = operandNumber(operand); if (!liveKill.get(operandNum)) { @@ -688,7 +688,7 @@ }; ValueProcedure stateProc = new ValueProcedure() { @Override - public CiValue doValue(CiValue operand) { + public RiValue doValue(RiValue operand) { int operandNum = operandNumber(operand); if (!liveKill.get(operandNum)) { liveGen.set(operandNum); @@ -701,7 +701,7 @@ }; ValueProcedure defProc = new ValueProcedure() { @Override - public CiValue doValue(CiValue operand) { + public RiValue doValue(RiValue operand) { if (isVariable(operand)) { int varNum = operandNumber(operand); liveKill.set(varNum); @@ -740,7 +740,7 @@ } // end of block iteration } - private void verifyTemp(BitMap liveKill, CiValue operand) { + private void verifyTemp(BitMap liveKill, RiValue operand) { // 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 @@ -751,7 +751,7 @@ } } - private void verifyInput(Block block, BitMap liveKill, CiValue operand) { + private void verifyInput(Block block, BitMap liveKill, RiValue operand) { // fixed intervals are never live at block boundaries, so // they need not be processed in live sets. // this is checked by these assertions to be sure about it. @@ -859,7 +859,7 @@ // print some additional information to simplify debugging for (int operandNum = 0; operandNum < blockData.get(ir.cfg.getStartBlock()).liveIn.size(); operandNum++) { if (blockData.get(ir.cfg.getStartBlock()).liveIn.get(operandNum)) { - CiValue operand = operandFor(operandNum); + RiValue operand = operandFor(operandNum); TTY.println(" var %d; operand=%s; node=%s", operandNum, operand.toString(), gen.valueForOperand(operand)); for (int j = 0; j < numBlocks; j++) { @@ -872,7 +872,7 @@ if (info != null) { info.forEachState(new ValueProcedure() { @Override - public CiValue doValue(CiValue liveStateOperand) { + public RiValue doValue(RiValue liveStateOperand) { TTY.println(" operand=" + liveStateOperand); return liveStateOperand; } @@ -912,7 +912,7 @@ TTY.println(blockData.get(block).liveOut.toString()); } - void addUse(CiValue operand, int from, int to, RegisterPriority registerPriority, RiKind kind) { + void addUse(RiValue operand, int from, int to, RegisterPriority registerPriority, RiKind kind) { if (!isProcessed(operand)) { return; } @@ -935,7 +935,7 @@ interval.addUsePos(to & ~1, registerPriority); } - void addTemp(CiValue operand, int tempPos, RegisterPriority registerPriority, RiKind kind) { + void addTemp(RiValue operand, int tempPos, RegisterPriority registerPriority, RiKind kind) { if (!isProcessed(operand)) { return; } @@ -955,11 +955,11 @@ interval.addUsePos(tempPos, registerPriority); } - boolean isProcessed(CiValue operand) { + boolean isProcessed(RiValue operand) { return !isRegister(operand) || attributes(asRegister(operand)).isAllocatable; } - void addDef(CiValue operand, int defPos, RegisterPriority registerPriority, RiKind kind) { + void addDef(RiValue operand, int defPos, RegisterPriority registerPriority, RiKind kind) { if (!isProcessed(operand)) { return; } @@ -1068,12 +1068,12 @@ } } - void addRegisterHint(final LIRInstruction op, final CiValue targetValue, OperandMode mode, EnumSet flags) { + void addRegisterHint(final LIRInstruction op, final RiValue targetValue, OperandMode mode, EnumSet flags) { if (flags.contains(OperandFlag.RegisterHint) && isVariableOrRegister(targetValue)) { op.forEachRegisterHint(targetValue, mode, new ValueProcedure() { @Override - protected CiValue doValue(CiValue registerHint) { + protected RiValue doValue(RiValue registerHint) { if (isVariableOrRegister(registerHint)) { Interval from = intervalFor(registerHint); Interval to = intervalFor(targetValue); @@ -1112,7 +1112,7 @@ BitMap live = blockData.get(block).liveOut; for (int operandNum = live.nextSetBit(0); operandNum >= 0; operandNum = live.nextSetBit(operandNum + 1)) { assert live.get(operandNum) : "should not stop here otherwise"; - CiValue operand = operandFor(operandNum); + RiValue operand = operandFor(operandNum); if (GraalOptions.TraceLinearScanLevel >= 2) { TTY.println("live in %s to %d", operand, blockTo + 2); } @@ -1150,7 +1150,7 @@ op.forEachOutput(new ValueProcedure() { @Override - public CiValue doValue(CiValue operand, OperandMode mode, EnumSet flags) { + public RiValue doValue(RiValue operand, OperandMode mode, EnumSet flags) { if (isVariableOrRegister(operand)) { addDef(operand, opId, registerPriorityOfOutputOperand(op), operand.kind.stackKind()); addRegisterHint(op, operand, mode, flags); @@ -1160,7 +1160,7 @@ }); op.forEachTemp(new ValueProcedure() { @Override - public CiValue doValue(CiValue operand, OperandMode mode, EnumSet flags) { + public RiValue doValue(RiValue operand, OperandMode mode, EnumSet flags) { if (isVariableOrRegister(operand)) { addTemp(operand, opId, RegisterPriority.MustHaveRegister, operand.kind.stackKind()); addRegisterHint(op, operand, mode, flags); @@ -1170,7 +1170,7 @@ }); op.forEachAlive(new ValueProcedure() { @Override - public CiValue doValue(CiValue operand, OperandMode mode, EnumSet flags) { + public RiValue doValue(RiValue operand, OperandMode mode, EnumSet flags) { if (isVariableOrRegister(operand)) { RegisterPriority p = registerPriorityOfInputOperand(flags); addUse(operand, blockFrom, opId + 1, p, operand.kind.stackKind()); @@ -1181,7 +1181,7 @@ }); op.forEachInput(new ValueProcedure() { @Override - public CiValue doValue(CiValue operand, OperandMode mode, EnumSet flags) { + public RiValue doValue(RiValue operand, OperandMode mode, EnumSet flags) { if (isVariableOrRegister(operand)) { RegisterPriority p = registerPriorityOfInputOperand(flags); addUse(operand, blockFrom, opId, p, operand.kind.stackKind()); @@ -1197,7 +1197,7 @@ // to a call site, the value would be in a register at the call otherwise) op.forEachState(new ValueProcedure() { @Override - public CiValue doValue(CiValue operand) { + public RiValue doValue(RiValue operand) { addUse(operand, blockFrom, opId + 1, RegisterPriority.None, operand.kind.stackKind()); return operand; } @@ -1398,21 +1398,21 @@ throw new CiBailout("LinearScan: interval is null"); } - Interval intervalAtBlockBegin(Block block, CiValue operand) { + Interval intervalAtBlockBegin(Block block, RiValue operand) { assert isVariable(operand) : "register number out of bounds"; assert intervalFor(operand) != null : "no interval found"; return splitChildAtOpId(intervalFor(operand), block.getFirstLirInstructionId(), LIRInstruction.OperandMode.Output); } - Interval intervalAtBlockEnd(Block block, CiValue operand) { + Interval intervalAtBlockEnd(Block block, RiValue operand) { assert isVariable(operand) : "register number out of bounds"; assert intervalFor(operand) != null : "no interval found"; return splitChildAtOpId(intervalFor(operand), block.getLastLirInstructionId() + 1, LIRInstruction.OperandMode.Output); } - Interval intervalAtOpId(CiValue operand, int opId) { + Interval intervalAtOpId(RiValue operand, int opId) { assert isVariable(operand) : "register number out of bounds"; assert intervalFor(operand) != null : "no interval found"; @@ -1430,7 +1430,7 @@ assert operandNum < numOperands : "live information set for not exisiting interval"; assert blockData.get(fromBlock).liveOut.get(operandNum) && blockData.get(toBlock).liveIn.get(operandNum) : "interval not live at this edge"; - CiValue liveOperand = operandFor(operandNum); + RiValue liveOperand = operandFor(operandNum); Interval fromInterval = intervalAtBlockEnd(fromBlock, liveOperand); Interval toInterval = intervalAtBlockBegin(toBlock, liveOperand); @@ -1551,7 +1551,7 @@ // * Phase 7: assign register numbers back to LIR // (includes computation of debug information and oop maps) - boolean verifyAssignedLocation(Interval interval, CiValue location) { + boolean verifyAssignedLocation(Interval interval, RiValue location) { RiKind kind = interval.kind(); assert isRegister(location) || isStackSlot(location); @@ -1607,7 +1607,7 @@ * @param mode the usage mode for {@code operand} by the instruction * @return the location assigned for the operand */ - private CiValue colorLirOperand(Variable operand, int opId, OperandMode mode) { + private RiValue colorLirOperand(Variable operand, int opId, OperandMode mode) { Interval interval = intervalFor(operand); assert interval != null : "interval must exist"; @@ -1645,7 +1645,7 @@ // intervals that have no oops inside need not to be processed. // to ensure a walking until the last instruction id, add a dummy interval // with a high operation id - nonOopIntervals = new Interval(CiValue.IllegalValue, -1); + nonOopIntervals = new Interval(RiValue.IllegalValue, -1); nonOopIntervals.addRange(Integer.MAX_VALUE - 2, Integer.MAX_VALUE - 1); return new IntervalWalker(this, oopIntervals, nonOopIntervals); @@ -1663,7 +1663,7 @@ // Iterate through active intervals for (Interval interval = iw.activeLists.get(RegisterBinding.Fixed); interval != Interval.EndMarker; interval = interval.next) { - CiValue operand = interval.operand; + RiValue operand = interval.operand; assert interval.currentFrom() <= op.id() && op.id() <= interval.currentTo() : "interval should not be active otherwise"; assert isVariable(interval.operand) : "fixed interval found"; @@ -1692,7 +1692,7 @@ } } - private boolean isCallerSave(CiValue operand) { + private boolean isCallerSave(RiValue operand) { return attributes(asRegister(operand)).isCallerSave; } @@ -1717,7 +1717,7 @@ info.forEachState(new ValueProcedure() { @Override - public CiValue doValue(CiValue operand) { + public RiValue doValue(RiValue operand) { int tempOpId = op.id(); OperandMode mode = OperandMode.Input; Block block = blockForId(tempOpId); @@ -1739,7 +1739,7 @@ // Get current location of operand // The operand must be live because debug information is considered when building the intervals // if the interval is not live, colorLirOperand will cause an assert on failure - CiValue result = colorLirOperand((Variable) operand, tempOpId, mode); + RiValue result = colorLirOperand((Variable) operand, tempOpId, mode); assert !hasCall(tempOpId) || isStackSlot(result) || !isCallerSave(result) : "cannot have caller-save register operands at calls"; return result; } @@ -1761,7 +1761,7 @@ ValueProcedure assignProc = new ValueProcedure() { @Override - public CiValue doValue(CiValue operand, OperandMode mode, EnumSet flags) { + public RiValue doValue(RiValue operand, OperandMode mode, EnumSet flags) { if (isVariable(operand)) { return colorLirOperand((Variable) operand, op.id(), mode); } @@ -2000,8 +2000,8 @@ if (i2.from() == 1 && i2.to() == 2) { continue; } - CiValue l1 = i1.location(); - CiValue l2 = i2.location(); + RiValue l1 = i1.location(); + RiValue l2 = i2.location(); if (i1.intersects(i2) && (l1.equals(l2))) { if (GraalOptions.DetailedAsserts) { TTY.println("Intervals %d and %d overlap and have the same register assigned", i1.operandNumber, i2.operandNumber); @@ -2019,7 +2019,7 @@ Interval curInterval; @Override - protected CiValue doValue(CiValue operand) { + protected RiValue doValue(RiValue operand) { if (isRegister(operand)) { if (intervalFor(operand) == curInterval) { ok = true; @@ -2037,7 +2037,7 @@ fixedIntervals = createUnhandledLists(IS_PRECOLORED_INTERVAL, null).first; // to ensure a walking until the last instruction id, add a dummy interval // with a high operation id - otherIntervals = new Interval(CiValue.IllegalValue, -1); + otherIntervals = new Interval(RiValue.IllegalValue, -1); otherIntervals.addRange(Integer.MAX_VALUE - 2, Integer.MAX_VALUE - 1); IntervalWalker iw = new IntervalWalker(this, fixedIntervals, otherIntervals); @@ -2090,7 +2090,7 @@ if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println("checking interval %d of block B%d", operandNum, block.getId()); } - CiValue operand = operandFor(operandNum); + RiValue operand = operandFor(operandNum); assert isVariable(operand) : "value must have variable operand"; // TKR assert value.asConstant() == null || value.isPinned() : // "only pinned constants can be alive accross block boundaries"; diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScanWalker.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScanWalker.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScanWalker.java Thu Jun 07 18:12:01 2012 +0200 @@ -29,6 +29,7 @@ import com.oracle.max.cri.ci.*; import com.oracle.max.cri.ci.CiRegister.RegisterFlag; +import com.oracle.max.cri.ri.*; import com.oracle.max.criutils.*; import com.oracle.graal.compiler.*; import com.oracle.graal.compiler.alloc.Interval.RegisterBinding; @@ -94,7 +95,7 @@ } void excludeFromUse(Interval i) { - CiValue location = i.location(); + RiValue location = i.location(); int i1 = asRegister(location).number; if (i1 >= availableRegs[0].number && i1 <= availableRegs[availableRegs.length - 1].number) { usePos[i1] = 0; @@ -674,7 +675,7 @@ return true; } - CiRegister findLockedRegister(int regNeededUntil, int intervalTo, CiValue ignoreReg, boolean[] needSplit) { + CiRegister findLockedRegister(int regNeededUntil, int intervalTo, RiValue ignoreReg, boolean[] needSplit) { int maxReg = -1; CiRegister ignore = isRegister(ignoreReg) ? asRegister(ignoreReg) : null; @@ -905,7 +906,7 @@ TTY.println(" splitParent: %s, insertMoveWhenActivated: %b", interval.splitParent().operandNumber, interval.insertMoveWhenActivated()); } - final CiValue operand = interval.operand; + final RiValue operand = interval.operand; if (interval.location() != null && isStackSlot(interval.location())) { // activating an interval that has a stack slot assigned . split it at first use position // used for method parameters diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/MoveResolver.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/MoveResolver.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/MoveResolver.java Thu Jun 07 18:12:01 2012 +0200 @@ -27,6 +27,7 @@ import java.util.*; import com.oracle.max.cri.ci.*; +import com.oracle.max.cri.ri.*; import com.oracle.max.criutils.*; import com.oracle.graal.compiler.*; import com.oracle.graal.lir.*; @@ -41,7 +42,7 @@ private LIRInsertionBuffer insertionBuffer; // buffer where moves are inserted private final List mappingFrom; - private final List mappingFromOpr; + private final List mappingFromOpr; private final List mappingTo; private boolean multipleReadsAllowed; private final int[] registerBlocked; @@ -106,7 +107,7 @@ } } - HashSet usedRegs = new HashSet<>(); + HashSet usedRegs = new HashSet<>(); if (!multipleReadsAllowed) { for (i = 0; i < mappingFrom.size(); i++) { Interval interval = mappingFrom.get(i); @@ -141,7 +142,7 @@ // mark assignedReg and assignedRegHi of the interval as blocked private void blockRegisters(Interval interval) { - CiValue location = interval.location(); + RiValue location = interval.location(); if (isRegister(location)) { int reg = asRegister(location).number; assert multipleReadsAllowed || registerBlocked(reg) == 0 : "register already marked as used"; @@ -151,7 +152,7 @@ // mark assignedReg and assignedRegHi of the interval as unblocked private void unblockRegisters(Interval interval) { - CiValue location = interval.location(); + RiValue location = interval.location(); if (isRegister(location)) { int reg = asRegister(location).number; assert registerBlocked(reg) > 0 : "register already marked as unused"; @@ -164,9 +165,9 @@ * or is only blocked by {@code from}. */ private boolean safeToProcessMove(Interval from, Interval to) { - CiValue fromReg = from != null ? from.location() : null; + RiValue fromReg = from != null ? from.location() : null; - CiValue reg = to.location(); + RiValue reg = to.location(); if (isRegister(reg)) { if (registerBlocked(asRegister(reg).number) > 1 || (registerBlocked(asRegister(reg).number) == 1 && reg != fromReg)) { return false; @@ -195,8 +196,8 @@ assert fromInterval.kind() == toInterval.kind() : "move between different types"; assert insertIdx != -1 : "must setup insert position first"; - CiValue fromOpr = fromInterval.operand; - CiValue toOpr = toInterval.operand; + RiValue fromOpr = fromInterval.operand; + RiValue toOpr = toInterval.operand; insertionBuffer.append(insertIdx, allocator.ir.spillMoveFactory.createMove(toOpr, fromOpr)); @@ -205,11 +206,11 @@ } } - private void insertMove(CiValue fromOpr, Interval toInterval) { + private void insertMove(RiValue fromOpr, Interval toInterval) { assert fromOpr.kind == toInterval.kind() : "move between different types"; assert insertIdx != -1 : "must setup insert position first"; - CiValue toOpr = toInterval.operand; + RiValue toOpr = toInterval.operand; insertionBuffer.append(insertIdx, allocator.ir.spillMoveFactory.createMove(toOpr, fromOpr)); if (GraalOptions.TraceLinearScanLevel >= 4) { @@ -332,11 +333,11 @@ assert fromInterval.operand != toInterval.operand : "from and to interval equal: " + fromInterval; assert fromInterval.kind() == toInterval.kind(); mappingFrom.add(fromInterval); - mappingFromOpr.add(CiValue.IllegalValue); + mappingFromOpr.add(RiValue.IllegalValue); mappingTo.add(toInterval); } - void addMapping(CiValue fromOpr, Interval toInterval) { + void addMapping(RiValue fromOpr, Interval toInterval) { if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println("MoveResolver: adding mapping from %s to %d (%s)", fromOpr, toInterval.operandNumber, toInterval.location()); } diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/RegisterVerifier.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/RegisterVerifier.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/RegisterVerifier.java Thu Jun 07 18:12:01 2012 +0200 @@ -27,6 +27,7 @@ import java.util.*; import com.oracle.max.cri.ci.*; +import com.oracle.max.cri.ri.*; import com.oracle.max.criutils.*; import com.oracle.graal.compiler.*; import com.oracle.graal.compiler.util.*; @@ -44,7 +45,7 @@ ArrayMap savedStates; // saved information of previous check // simplified access to methods of LinearScan - Interval intervalAt(CiValue operand) { + Interval intervalAt(RiValue operand) { return allocator.intervalFor(operand); } @@ -177,7 +178,7 @@ return inputState.clone(); } - static void statePut(Interval[] inputState, CiValue location, Interval interval) { + static void statePut(Interval[] inputState, RiValue location, Interval interval) { if (location != null && isRegister(location)) { CiRegister reg = asRegister(location); int regNum = reg.number; @@ -195,7 +196,7 @@ } } - static boolean checkState(Interval[] inputState, CiValue reg, Interval interval) { + static boolean checkState(Interval[] inputState, RiValue reg, Interval interval) { if (reg != null && isRegister(reg)) { if (inputState[asRegister(reg).number] != interval) { throw new GraalInternalError("!! Error in register allocation: register %s does not contain interval %s but interval %s", reg, interval.operand, inputState[asRegister(reg).number]); @@ -215,7 +216,7 @@ ValueProcedure useProc = new ValueProcedure() { @Override - public CiValue doValue(CiValue operand, OperandMode mode, EnumSet flags) { + public RiValue doValue(RiValue operand, OperandMode mode, EnumSet flags) { if (LinearScan.isVariableOrRegister(operand) && allocator.isProcessed(operand)) { Interval interval = intervalAt(operand); if (op.id() != -1) { @@ -230,7 +231,7 @@ ValueProcedure defProc = new ValueProcedure() { @Override - public CiValue doValue(CiValue operand, OperandMode mode, EnumSet flags) { + public RiValue doValue(RiValue operand, OperandMode mode, EnumSet flags) { if (LinearScan.isVariableOrRegister(operand) && allocator.isProcessed(operand)) { Interval interval = intervalAt(operand); if (op.id() != -1) { diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/DebugInfoBuilder.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/DebugInfoBuilder.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/DebugInfoBuilder.java Thu Jun 07 18:12:01 2012 +0200 @@ -36,9 +36,9 @@ import com.oracle.graal.nodes.virtual.*; public class DebugInfoBuilder { - private final NodeMap nodeOperands; + private final NodeMap nodeOperands; - public DebugInfoBuilder(NodeMap nodeOperands) { + public DebugInfoBuilder(NodeMap nodeOperands) { this.nodeOperands = nodeOperands; } @@ -81,9 +81,9 @@ VirtualObjectNode vobj = entry.getKey(); if (vobj instanceof BoxedVirtualObjectNode) { BoxedVirtualObjectNode boxedVirtualObjectNode = (BoxedVirtualObjectNode) vobj; - entry.getValue().setValues(new CiValue[]{toCiValue(boxedVirtualObjectNode.getUnboxedValue())}); + entry.getValue().setValues(new RiValue[]{toCiValue(boxedVirtualObjectNode.getUnboxedValue())}); } else { - CiValue[] values = new CiValue[vobj.fieldsCount()]; + RiValue[] values = new RiValue[vobj.fieldsCount()]; entry.getValue().setValues(values); if (values.length > 0) { changed = true; @@ -119,7 +119,7 @@ int numStack = state.stackSize(); int numLocks = (locks != null && locks.callerState == state.outerFrameState()) ? locks.stateDepth + 1 : 0; - CiValue[] values = new CiValue[numLocals + numStack + numLocks]; + RiValue[] values = new RiValue[numLocals + numStack + numLocks]; for (int i = 0; i < numLocals; i++) { values[i] = toCiValue(state.localAt(i)); } @@ -131,8 +131,8 @@ for (int i = numLocks - 1; i >= 0; i--) { assert locks != null && nextLock.callerState == state.outerFrameState() && nextLock.stateDepth == i; - CiValue owner = toCiValue(nextLock.monitor.object()); - CiValue lockData = nextLock.lockData; + RiValue owner = toCiValue(nextLock.monitor.object()); + RiValue lockData = nextLock.lockData; boolean eliminated = nextLock.monitor.eliminated(); values[numLocals + numStack + nextLock.stateDepth] = new CiMonitorValue(owner, lockData, eliminated); @@ -152,7 +152,7 @@ return frame; } - private CiValue toCiValue(ValueNode value) { + private RiValue toCiValue(ValueNode value) { if (value instanceof VirtualObjectNode) { VirtualObjectNode obj = (VirtualObjectNode) value; CiVirtualObject ciObj = virtualObjects.get(value); @@ -169,14 +169,14 @@ } else if (value != null) { Debug.metric("StateVariables").increment(); - CiValue operand = nodeOperands.get(value); + RiValue operand = nodeOperands.get(value); assert operand != null && (operand instanceof Variable || operand instanceof RiConstant); return operand; } else { // return a dummy value because real value not needed Debug.metric("StateIllegals").increment(); - return CiValue.IllegalValue; + return RiValue.IllegalValue; } } } diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java Thu Jun 07 18:12:01 2012 +0200 @@ -24,7 +24,7 @@ import static com.oracle.graal.lir.ValueUtil.*; import static com.oracle.max.cri.ci.CiCallingConvention.Type.*; -import static com.oracle.max.cri.ci.CiValue.*; +import static com.oracle.max.cri.ri.RiValue.*; import java.util.*; import java.util.Map.Entry; @@ -72,7 +72,7 @@ protected final CiTarget target; protected final RiResolvedMethod method; protected final FrameMap frameMap; - public final NodeMap nodeOperands; + public final NodeMap nodeOperands; protected final LIR lir; protected final XirSupport xirSupport; @@ -168,15 +168,15 @@ * @param node A node that produces a result value. */ @Override - public CiValue operand(ValueNode node) { + public RiValue operand(ValueNode node) { if (nodeOperands == null) { return null; } return nodeOperands.get(node); } - public ValueNode valueForOperand(CiValue value) { - for (Entry entry : nodeOperands.entries()) { + public ValueNode valueForOperand(RiValue value) { + for (Entry entry : nodeOperands.entries()) { if (entry.getValue() == value) { return (ValueNode) entry.getKey(); } @@ -207,7 +207,7 @@ } @Override - public CiValue setResult(ValueNode x, CiValue operand) { + public RiValue setResult(ValueNode x, RiValue operand) { assert (isVariable(operand) && x.kind() == operand.kind) || (isConstant(operand) && x.kind() == operand.kind.stackKind()) : operand.kind + " for node " + x; assert operand(x) == null : "operand cannot be set twice"; @@ -219,23 +219,23 @@ } @Override - public abstract Variable emitMove(CiValue input); + public abstract Variable emitMove(RiValue input); - public Variable load(CiValue value) { + public Variable load(RiValue value) { if (!isVariable(value)) { return emitMove(value); } return (Variable) value; } - public CiValue loadNonConst(CiValue value) { + public RiValue loadNonConst(RiValue value) { if (isConstant(value) && !canInlineConstant((RiConstant) value)) { return emitMove(value); } return value; } - public CiValue loadForStore(CiValue value, RiKind storeKind) { + public RiValue loadForStore(RiValue value, RiKind storeKind) { if (isConstant(value) && canStoreConstant((RiConstant) value)) { return value; } @@ -279,7 +279,7 @@ * @param kind the kind of value being returned * @return the operand representing the ABI defined location used return a value of kind {@code kind} */ - public CiValue resultOperandFor(RiKind kind) { + public RiValue resultOperandFor(RiKind kind) { if (kind == RiKind.Void) { return IllegalValue; } @@ -316,12 +316,12 @@ MergeNode merge = (MergeNode) block.getBeginNode(); for (PhiNode phi : merge.phis()) { if (phi.type() == PhiType.Value) { - CiValue phiValue = newVariable(phi.kind()); + RiValue phiValue = newVariable(phi.kind()); setResult(phi, phiValue); phiValues.add(phiValue); } } - append(new PhiLabelOp(new Label(), block.align, phiValues.toArray(new CiValue[phiValues.size()]))); + append(new PhiLabelOp(new Label(), block.align, phiValues.toArray(new RiValue[phiValues.size()]))); phiValues.clear(); } else { append(new LabelOp(new Label(), block.align)); @@ -505,7 +505,7 @@ protected void emitPrologue() { CiCallingConvention incomingArguments = frameMap.registerConfig.getCallingConvention(JavaCallee, CiUtil.signatureToKinds(method), target, false); - CiValue[] params = new CiValue[incomingArguments.locations.length]; + RiValue[] params = new RiValue[incomingArguments.locations.length]; for (int i = 0; i < params.length; i++) { params[i] = toStackKind(incomingArguments.locations[i]); if (CiValueUtil.isStackSlot(params[i])) { @@ -519,7 +519,7 @@ append(new ParametersOp(params)); for (LocalNode local : graph.getNodes(LocalNode.class)) { - CiValue param = params[local.index()]; + RiValue param = params[local.index()]; assert param.kind == local.kind().stackKind(); setResult(local, emitMove(param)); } @@ -609,7 +609,7 @@ @Override public void visitReturn(ReturnNode x) { - CiValue operand = CiValue.IllegalValue; + RiValue operand = RiValue.IllegalValue; if (!x.kind().isVoid()) { operand = resultOperandFor(x.kind()); emitMove(operand(x.result()), operand); @@ -617,7 +617,7 @@ emitReturn(operand); } - protected abstract void emitReturn(CiValue input); + protected abstract void emitReturn(RiValue input); @Override public void visitMerge(MergeNode x) { @@ -635,7 +635,7 @@ public void visitLoopEnd(LoopEndNode x) { } - private ArrayList phiValues = new ArrayList<>(); + private ArrayList phiValues = new ArrayList<>(); private void moveToPhi(MergeNode merge, EndNode pred) { if (GraalOptions.AllocSSA) { @@ -645,7 +645,7 @@ phiValues.add(operand(phi.valueAt(pred))); } } - append(new PhiJumpOp(getLIRBlock(merge), phiValues.toArray(new CiValue[phiValues.size()]))); + append(new PhiJumpOp(getLIRBlock(merge), phiValues.toArray(new RiValue[phiValues.size()]))); phiValues.clear(); return; } @@ -665,9 +665,9 @@ append(new JumpOp(getLIRBlock(merge), null)); } - private CiValue operandForPhi(PhiNode phi) { + private RiValue operandForPhi(PhiNode phi) { assert phi.type() == PhiType.Value : "wrong phi type: " + phi; - CiValue result = operand(phi); + RiValue result = operand(phi); if (result == null) { // allocate a variable for this phi Variable newOperand = newVariable(phi.kind()); @@ -685,7 +685,7 @@ } @Override - public void emitGuardCheck(BooleanNode comp, RiDeoptReason deoptReason, RiDeoptAction action, boolean negated, long leafGraphId) { + public void emitGuardCheck(BooleanNode comp, CiDeoptReason deoptReason, CiDeoptAction action, boolean negated, long leafGraphId) { if (comp instanceof IsNullNode && negated) { emitNullCheckGuard(((IsNullNode) comp).object(), leafGraphId); } else if (comp instanceof ConstantNode && (comp.asConstant().asBoolean() != negated)) { @@ -768,12 +768,12 @@ @Override public void emitConditional(ConditionalNode conditional) { - CiValue tVal = operand(conditional.trueValue()); - CiValue fVal = operand(conditional.falseValue()); + RiValue tVal = operand(conditional.trueValue()); + RiValue fVal = operand(conditional.falseValue()); setResult(conditional, emitConditional(conditional.condition(), tVal, fVal)); } - public Variable emitConditional(BooleanNode node, CiValue trueValue, CiValue falseValue) { + public Variable emitConditional(BooleanNode node, RiValue trueValue, RiValue falseValue) { if (node instanceof IsNullNode) { return emitNullCheckConditional((IsNullNode) node, trueValue, falseValue); } else if (node instanceof CompareNode) { @@ -787,11 +787,11 @@ } } - private Variable emitNullCheckConditional(IsNullNode node, CiValue trueValue, CiValue falseValue) { + private Variable emitNullCheckConditional(IsNullNode node, RiValue trueValue, RiValue falseValue) { return emitCMove(operand(node.object()), RiConstant.NULL_OBJECT, Condition.EQ, false, trueValue, falseValue); } - private Variable emitInstanceOfConditional(InstanceOfNode x, CiValue trueValue, CiValue falseValue) { + private Variable emitInstanceOfConditional(InstanceOfNode x, RiValue trueValue, RiValue falseValue) { XirArgument obj = toXirArgument(x.object()); XirArgument trueArg = toXirArgument(trueValue); XirArgument falseArg = toXirArgument(falseValue); @@ -799,19 +799,19 @@ return (Variable) emitXir(snippet, null, null, false); } - private Variable emitConstantConditional(boolean value, CiValue trueValue, CiValue falseValue) { + private Variable emitConstantConditional(boolean value, RiValue trueValue, RiValue falseValue) { return emitMove(value ? trueValue : falseValue); } - private Variable emitCompareConditional(CompareNode compare, CiValue trueValue, CiValue falseValue) { + private Variable emitCompareConditional(CompareNode compare, RiValue trueValue, RiValue falseValue) { return emitCMove(operand(compare.x()), operand(compare.y()), compare.condition(), compare.unorderedIsTrue(), trueValue, falseValue); } public abstract void emitLabel(Label label, boolean align); public abstract void emitJump(LabelRef label, LIRDebugInfo info); - public abstract void emitBranch(CiValue left, CiValue right, Condition cond, boolean unorderedIsTrue, LabelRef label, LIRDebugInfo info); - public abstract Variable emitCMove(CiValue leftVal, CiValue right, Condition cond, boolean unorderedIsTrue, CiValue trueValue, CiValue falseValue); + public abstract void emitBranch(RiValue left, RiValue right, Condition cond, boolean unorderedIsTrue, LabelRef label, LIRDebugInfo info); + public abstract Variable emitCMove(RiValue leftVal, RiValue right, Condition cond, boolean unorderedIsTrue, RiValue trueValue, RiValue falseValue); protected FrameState stateBeforeCallWithArguments(FrameState stateAfter, MethodCallTargetNode call, int bci) { return stateAfter.duplicateModified(bci, stateAfter.rethrowException(), call.returnKind(), toJVMArgumentStack(call.targetMethod().signature(), call.isStatic(), call.arguments())); @@ -873,7 +873,7 @@ break; } - CiValue destinationAddress = null; + RiValue destinationAddress = null; if (!target().invokeSnippetAfterArguments) { // This is the version currently necessary for Maxine: since the invokeinterface-snippet uses a division, it // destroys rdx, which is also used to pass a parameter. Therefore, the snippet must be before the parameters are assigned to their locations. @@ -881,12 +881,12 @@ destinationAddress = emitXir(snippet, x.node(), addrInfo, false); } - CiValue resultOperand = resultOperandFor(x.node().kind()); + RiValue resultOperand = resultOperandFor(x.node().kind()); RiKind[] signature = CiUtil.signatureToKinds(callTarget.targetMethod().signature(), callTarget.isStatic() ? null : callTarget.targetMethod().holder().kind(true)); CiCallingConvention cc = frameMap.registerConfig.getCallingConvention(JavaCall, signature, target(), false); frameMap.callsMethod(cc, JavaCall); - List argList = visitInvokeArguments(cc, callTarget.arguments()); + List argList = visitInvokeArguments(cc, callTarget.arguments()); if (target().invokeSnippetAfterArguments) { // This is the version currently active for HotSpot. @@ -902,10 +902,10 @@ } } - protected abstract void emitCall(Object targetMethod, CiValue result, List arguments, CiValue targetAddress, LIRDebugInfo info, Map marks); + protected abstract void emitCall(Object targetMethod, RiValue result, List arguments, RiValue targetAddress, LIRDebugInfo info, Map marks); - private static CiValue toStackKind(CiValue value) { + private static RiValue toStackKind(RiValue value) { if (value.kind.stackKind() != value.kind) { // We only have stack-kinds in the LIR, so convert the operand kind for values from the calling convention. if (isRegister(value)) { @@ -919,13 +919,13 @@ return value; } - public List visitInvokeArguments(CiCallingConvention cc, Iterable arguments) { + public List visitInvokeArguments(CiCallingConvention cc, Iterable arguments) { // for each argument, load it into the correct location - List argList = new ArrayList<>(); + List argList = new ArrayList<>(); int j = 0; for (ValueNode arg : arguments) { if (arg != null) { - CiValue operand = toStackKind(cc.locations[j++]); + RiValue operand = toStackKind(cc.locations[j++]); emitMove(operand(arg), operand); argList.add(operand); @@ -937,23 +937,23 @@ } - protected abstract LabelRef createDeoptStub(RiDeoptAction action, RiDeoptReason reason, LIRDebugInfo info, Object deoptInfo); + protected abstract LabelRef createDeoptStub(CiDeoptAction action, CiDeoptReason reason, LIRDebugInfo info, Object deoptInfo); @Override - public Variable emitCall(@SuppressWarnings("hiding") Object target, RiKind result, RiKind[] arguments, boolean canTrap, CiValue... args) { + public Variable emitCall(@SuppressWarnings("hiding") Object target, RiKind result, RiKind[] arguments, boolean canTrap, RiValue... args) { LIRDebugInfo info = canTrap ? state() : null; - CiValue physReg = resultOperandFor(result); + RiValue physReg = resultOperandFor(result); - List argumentList; + List argumentList; if (arguments.length > 0) { // move the arguments into the correct location CiCallingConvention cc = frameMap.registerConfig.getCallingConvention(RuntimeCall, arguments, target(), false); frameMap.callsMethod(cc, RuntimeCall); assert cc.locations.length == args.length : "argument count mismatch"; for (int i = 0; i < args.length; i++) { - CiValue arg = args[i]; - CiValue loc = cc.locations[i]; + RiValue arg = args[i]; + RiValue loc = cc.locations[i]; emitMove(arg, loc); } argumentList = Arrays.asList(cc.locations); @@ -976,10 +976,10 @@ public void emitRuntimeCall(RuntimeCallNode x) { // TODO Merge with emitCallToRuntime() method above. - CiValue resultOperand = resultOperandFor(x.kind()); + RiValue resultOperand = resultOperandFor(x.kind()); CiCallingConvention cc = frameMap.registerConfig.getCallingConvention(RuntimeCall, x.call().arguments, target(), false); frameMap.callsMethod(cc, RuntimeCall); - List argList = visitInvokeArguments(cc, x.arguments()); + List argList = visitInvokeArguments(cc, x.arguments()); LIRDebugInfo info = null; FrameState stateAfter = x.stateAfter(); @@ -1045,7 +1045,7 @@ } } - protected abstract void emitTableSwitch(int lowKey, LabelRef defaultTarget, LabelRef[] targets, CiValue index); + protected abstract void emitTableSwitch(int lowKey, LabelRef defaultTarget, LabelRef[] targets, RiValue index); // the range of values in a lookupswitch or tableswitch statement private static final class SwitchRange { @@ -1116,7 +1116,7 @@ } - protected XirArgument toXirArgument(CiValue v) { + protected XirArgument toXirArgument(RiValue v) { if (v == null) { return null; } @@ -1130,7 +1130,7 @@ return XirArgument.forInternalObject(loadNonConst(operand(i))); } - private CiValue allocateOperand(XirSnippet snippet, XirOperand op) { + private RiValue allocateOperand(XirSnippet snippet, XirOperand op) { if (op instanceof XirParameter) { XirParameter param = (XirParameter) op; return allocateOperand(snippet.arguments[param.parameterIndex], op, param.canBeConstant); @@ -1145,12 +1145,12 @@ } } - private CiValue allocateOperand(XirArgument arg, XirOperand var, boolean canBeConstant) { + private RiValue allocateOperand(XirArgument arg, XirOperand var, boolean canBeConstant) { if (arg.constant != null) { return arg.constant; } - CiValue value = (CiValue) arg.object; + RiValue value = (RiValue) arg.object; if (canBeConstant) { return value; } @@ -1163,23 +1163,23 @@ return variable; } - protected CiValue emitXir(XirSnippet snippet, ValueNode x, LIRDebugInfo info, boolean setInstructionResult) { + protected RiValue emitXir(XirSnippet snippet, ValueNode x, LIRDebugInfo info, boolean setInstructionResult) { return emitXir(snippet, x, info, null, setInstructionResult, null, null); } - protected CiValue emitXir(XirSnippet snippet, ValueNode instruction, LIRDebugInfo info, LIRDebugInfo infoAfter, boolean setInstructionResult, LabelRef trueSuccessor, LabelRef falseSuccessor) { + protected RiValue emitXir(XirSnippet snippet, ValueNode instruction, LIRDebugInfo info, LIRDebugInfo infoAfter, boolean setInstructionResult, LabelRef trueSuccessor, LabelRef falseSuccessor) { if (GraalOptions.PrintXirTemplates) { TTY.println("Emit XIR template " + snippet.template.name); } - final CiValue[] operandsArray = new CiValue[snippet.template.variableCount]; + final RiValue[] operandsArray = new RiValue[snippet.template.variableCount]; frameMap.reserveOutgoing(snippet.template.outgoingStackSize); XirOperand resultOperand = snippet.template.resultOperand; if (snippet.template.allocateResultOperand) { - CiValue outputOperand = IllegalValue; + RiValue outputOperand = IllegalValue; // This snippet has a result that must be separately allocated // Otherwise it is assumed that the result is part of the inputs if (resultOperand.kind != RiKind.Void && resultOperand.kind != RiKind.Illegal) { @@ -1214,13 +1214,13 @@ XirOperand[] inputTempOperands = snippet.template.inputTempOperands; XirOperand[] tempOperands = snippet.template.tempOperands; - CiValue[] inputOperandArray = new CiValue[inputOperands.length + inputTempOperands.length]; - CiValue[] tempOperandArray = new CiValue[tempOperands.length]; + RiValue[] inputOperandArray = new RiValue[inputOperands.length + inputTempOperands.length]; + RiValue[] tempOperandArray = new RiValue[tempOperands.length]; int[] inputOperandIndicesArray = new int[inputOperands.length + inputTempOperands.length]; int[] tempOperandIndicesArray = new int[tempOperands.length]; for (int i = 0; i < inputOperands.length; i++) { XirOperand x = inputOperands[i]; - CiValue op = allocateOperand(snippet, x); + RiValue op = allocateOperand(snippet, x); operandsArray[x.index] = op; inputOperandArray[i] = op; inputOperandIndicesArray[i] = x.index; @@ -1233,7 +1233,7 @@ for (int i = 0; i < tempOperands.length; i++) { XirOperand x = tempOperands[i]; - CiValue op = allocateOperand(snippet, x); + RiValue op = allocateOperand(snippet, x); operandsArray[x.index] = op; tempOperandArray[i] = op; tempOperandIndicesArray[i] = x.index; @@ -1242,17 +1242,17 @@ } } - for (CiValue operand : operandsArray) { + for (RiValue operand : operandsArray) { assert operand != null; } - CiValue allocatedResultOperand = operandsArray[resultOperand.index]; + RiValue allocatedResultOperand = operandsArray[resultOperand.index]; if (!isVariable(allocatedResultOperand) && !isRegister(allocatedResultOperand)) { allocatedResultOperand = IllegalValue; } if (setInstructionResult && isLegal(allocatedResultOperand)) { - CiValue operand = operand(instruction); + RiValue operand = operand(instruction); if (operand == null) { setResult(instruction, allocatedResultOperand); } else { @@ -1274,25 +1274,25 @@ return operandsArray[resultOperand.index]; } - protected abstract void emitXir(XirSnippet snippet, CiValue[] operands, CiValue outputOperand, CiValue[] inputs, CiValue[] temps, int[] inputOperandIndices, int[] tempOperandIndices, int outputOperandIndex, + protected abstract void emitXir(XirSnippet snippet, RiValue[] operands, RiValue outputOperand, RiValue[] inputs, RiValue[] temps, int[] inputOperandIndices, int[] tempOperandIndices, int outputOperandIndex, LIRDebugInfo info, LIRDebugInfo infoAfter, LabelRef trueSuccessor, LabelRef falseSuccessor); - protected final CiValue callRuntime(CiRuntimeCall runtimeCall, LIRDebugInfo info, CiValue... args) { + protected final RiValue callRuntime(CiRuntimeCall runtimeCall, LIRDebugInfo info, RiValue... args) { // get a result register RiKind result = runtimeCall.resultKind; RiKind[] arguments = runtimeCall.arguments; - CiValue physReg = result.isVoid() ? IllegalValue : resultOperandFor(result); + RiValue physReg = result.isVoid() ? IllegalValue : resultOperandFor(result); - List argumentList; + List argumentList; if (arguments.length > 0) { // move the arguments into the correct location CiCallingConvention cc = frameMap.registerConfig.getCallingConvention(RuntimeCall, arguments, target(), false); frameMap.callsMethod(cc, RuntimeCall); assert cc.locations.length == args.length : "argument count mismatch"; for (int i = 0; i < args.length; i++) { - CiValue arg = args[i]; - CiValue loc = cc.locations[i]; + RiValue arg = args[i]; + RiValue loc = cc.locations[i]; emitMove(arg, loc); } argumentList = Arrays.asList(cc.locations); @@ -1307,8 +1307,8 @@ return physReg; } - protected final Variable callRuntimeWithResult(CiRuntimeCall runtimeCall, LIRDebugInfo info, CiValue... args) { - CiValue location = callRuntime(runtimeCall, info, args); + protected final Variable callRuntimeWithResult(CiRuntimeCall runtimeCall, LIRDebugInfo info, RiValue... args) { + RiValue location = callRuntime(runtimeCall, info, args); return emitMove(location); } diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/PhiResolver.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/PhiResolver.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/PhiResolver.java Thu Jun 07 18:12:01 2012 +0200 @@ -22,12 +22,12 @@ */ package com.oracle.graal.compiler.gen; -import static com.oracle.max.cri.ci.CiValue.*; +import static com.oracle.max.cri.ri.RiValue.*; import static com.oracle.graal.lir.ValueUtil.*; import java.util.*; -import com.oracle.max.cri.ci.*; +import com.oracle.max.cri.ri.*; import com.oracle.graal.nodes.*; /** @@ -58,7 +58,7 @@ /** * A source operand whose value flows into the {@linkplain #destinations destination} operands. */ - final CiValue operand; + final RiValue operand; /** * The operands whose values are defined by the {@linkplain #operand source} operand. @@ -80,7 +80,7 @@ */ boolean startNode; - PhiResolverNode(CiValue operand) { + PhiResolverNode(RiValue operand) { this.operand = operand; destinations = new ArrayList<>(4); } @@ -105,7 +105,7 @@ */ private PhiResolverNode loop; - private CiValue temp; + private RiValue temp; private final ArrayList variableOperands = new ArrayList<>(3); private final ArrayList otherOperands = new ArrayList<>(3); @@ -113,7 +113,7 @@ /** * Maps operands to nodes. */ - private final HashMap operandToNodeMap = new HashMap<>(); + private final HashMap operandToNodeMap = new HashMap<>(); public PhiResolver(LIRGenerator gen) { this.gen = gen; @@ -141,7 +141,7 @@ } } - public void move(CiValue src, CiValue dest) { + public void move(RiValue src, RiValue dest) { assert isVariable(dest) : "destination must be virtual"; // tty.print("move "); src.print(); tty.print(" to "); dest.print(); tty.cr(); assert isLegal(src) : "source for phi move is illegal"; @@ -151,7 +151,7 @@ srcNode.destinations.add(destNode); } - private PhiResolverNode createNode(CiValue operand, boolean source) { + private PhiResolverNode createNode(RiValue operand, boolean source) { PhiResolverNode node; if (isVariable(operand)) { node = operandToNodeMap.get(operand); @@ -175,11 +175,11 @@ return node; } - private PhiResolverNode destinationNode(CiValue opr) { + private PhiResolverNode destinationNode(RiValue opr) { return createNode(opr, false); } - private void emitMove(CiValue src, CiValue dest) { + private void emitMove(RiValue src, RiValue dest) { assert isLegal(src); assert isLegal(dest); gen.emitMove(src, dest); @@ -217,19 +217,19 @@ } } - private void moveTempTo(CiValue dest) { + private void moveTempTo(RiValue dest) { assert isLegal(temp); emitMove(temp, dest); temp = IllegalValue; } - private void moveToTemp(CiValue src) { + private void moveToTemp(RiValue src) { assert isIllegal(temp); temp = gen.newVariable(src.kind); emitMove(src, temp); } - private PhiResolverNode sourceNode(CiValue opr) { + private PhiResolverNode sourceNode(RiValue opr) { return createNode(opr, true); } } diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/LoweringPhase.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/LoweringPhase.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/LoweringPhase.java Thu Jun 07 18:12:01 2012 +0200 @@ -31,7 +31,6 @@ import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.spi.*; import com.oracle.max.cri.ci.*; -import com.oracle.max.cri.ri.*; /** * Processes all {@link Lowerable} nodes to do their lowering. @@ -52,16 +51,16 @@ @Override public ValueNode createNullCheckGuard(ValueNode object, long leafGraphId) { - return createGuard(object.graph().unique(new IsNullNode(object)), RiDeoptReason.NullCheckException, RiDeoptAction.InvalidateReprofile, true, leafGraphId); + return createGuard(object.graph().unique(new IsNullNode(object)), CiDeoptReason.NullCheckException, CiDeoptAction.InvalidateReprofile, true, leafGraphId); } @Override - public ValueNode createGuard(BooleanNode condition, RiDeoptReason deoptReason, RiDeoptAction action, long leafGraphId) { + public ValueNode createGuard(BooleanNode condition, CiDeoptReason deoptReason, CiDeoptAction action, long leafGraphId) { return createGuard(condition, deoptReason, action, false, leafGraphId); } @Override - public ValueNode createGuard(BooleanNode condition, RiDeoptReason deoptReason, RiDeoptAction action, boolean negated, long leafGraphId) { + public ValueNode createGuard(BooleanNode condition, CiDeoptReason deoptReason, CiDeoptAction action, boolean negated, long leafGraphId) { // TODO (thomaswue): Document why this must not be called on floating nodes. throw new UnsupportedOperationException(); } @@ -150,7 +149,7 @@ } @Override - public ValueNode createGuard(BooleanNode condition, RiDeoptReason deoptReason, RiDeoptAction action, boolean negated, long leafGraphId) { + public ValueNode createGuard(BooleanNode condition, CiDeoptReason deoptReason, CiDeoptAction action, boolean negated, long leafGraphId) { FixedNode guardAnchor = (FixedNode) getGuardAnchor(); if (GraalOptions.OptEliminateGuards) { for (Node usage : condition.usages()) { diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/Backend.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/Backend.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/Backend.java Thu Jun 07 18:12:01 2012 +0200 @@ -68,7 +68,7 @@ } } - public FrameMap newFrameMap(RiRegisterConfig registerConfig) { + public FrameMap newFrameMap(CiRegisterConfig registerConfig) { return new FrameMap(runtime, target, registerConfig); } diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/amd64/AMD64DeoptimizationStub.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/amd64/AMD64DeoptimizationStub.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/amd64/AMD64DeoptimizationStub.java Thu Jun 07 18:12:01 2012 +0200 @@ -36,11 +36,11 @@ public class AMD64DeoptimizationStub extends AMD64Code { public final Label label = new Label(); public final LIRDebugInfo info; - public final RiDeoptAction action; - public final RiDeoptReason reason; + public final CiDeoptAction action; + public final CiDeoptReason reason; public final Object deoptInfo; - public AMD64DeoptimizationStub(RiDeoptAction action, RiDeoptReason reason, LIRDebugInfo info, Object deoptInfo) { + public AMD64DeoptimizationStub(CiDeoptAction action, CiDeoptReason reason, LIRDebugInfo info, Object deoptInfo) { this.action = action; this.reason = reason; this.info = info; diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/amd64/AMD64LIRGenerator.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/amd64/AMD64LIRGenerator.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/amd64/AMD64LIRGenerator.java Thu Jun 07 18:12:01 2012 +0200 @@ -87,12 +87,12 @@ public static class AMD64SpillMoveFactory implements LIR.SpillMoveFactory { @Override - public LIRInstruction createMove(CiValue result, CiValue input) { + public LIRInstruction createMove(RiValue result, RiValue input) { return new SpillMoveOp(result, input); } @Override - public LIRInstruction createExchange(CiValue input1, CiValue input2) { + public LIRInstruction createExchange(RiValue input1, RiValue input2) { // TODO (cwimmer) implement XCHG operation for LIR return null; } @@ -134,8 +134,8 @@ @Override public CiAddress makeAddress(LocationNode location, ValueNode object) { - CiValue base = operand(object); - CiValue index = CiValue.IllegalValue; + RiValue base = operand(object); + RiValue index = RiValue.IllegalValue; int scale = 1; long displacement = location.displacement(); @@ -143,7 +143,7 @@ if (!asConstant(base).isNull()) { displacement += asConstant(base).asLong(); } - base = CiValue.IllegalValue; + base = RiValue.IllegalValue; } if (location instanceof IndexedLocationNode) { @@ -158,10 +158,10 @@ // only use the constant index if the resulting displacement fits into a 32 bit offset if (NumUtil.isInt(newDisplacement)) { displacement = newDisplacement; - index = CiValue.IllegalValue; + index = RiValue.IllegalValue; } else { // create a temporary variable for the index, the pointer load cannot handle a constant index - CiValue newIndex = newVariable(RiKind.Long); + RiValue newIndex = newVariable(RiKind.Long); emitMove(index, newIndex); index = newIndex; } @@ -172,14 +172,14 @@ } @Override - public Variable emitMove(CiValue input) { + public Variable emitMove(RiValue input) { Variable result = newVariable(input.kind); emitMove(input, result); return result; } @Override - public void emitMove(CiValue src, CiValue dst) { + public void emitMove(RiValue src, RiValue dst) { if (isRegister(src) || isStackSlot(dst)) { append(new MoveFromRegOp(dst, src)); } else { @@ -188,20 +188,20 @@ } @Override - public Variable emitLoad(CiValue loadAddress, boolean canTrap) { + public Variable emitLoad(RiValue loadAddress, boolean canTrap) { Variable result = newVariable(loadAddress.kind); append(new LoadOp(result, loadAddress, canTrap ? state() : null)); return result; } @Override - public void emitStore(CiValue storeAddress, CiValue inputVal, boolean canTrap) { - CiValue input = loadForStore(inputVal, storeAddress.kind); + public void emitStore(RiValue storeAddress, RiValue inputVal, boolean canTrap) { + RiValue input = loadForStore(inputVal, storeAddress.kind); append(new StoreOp(storeAddress, input, canTrap ? state() : null)); } @Override - public Variable emitLea(CiValue address) { + public Variable emitLea(RiValue address) { Variable result = newVariable(target().wordKind); append(new LeaOp(result, address)); return result; @@ -218,7 +218,7 @@ } @Override - public void emitBranch(CiValue left, CiValue right, Condition cond, boolean unorderedIsTrue, LabelRef label, LIRDebugInfo info) { + public void emitBranch(RiValue left, RiValue right, Condition cond, boolean unorderedIsTrue, LabelRef label, LIRDebugInfo info) { boolean mirrored = emitCompare(left, right); Condition finalCondition = mirrored ? cond.mirror() : cond; switch (left.kind.stackKind()) { @@ -232,7 +232,7 @@ } @Override - public Variable emitCMove(CiValue left, CiValue right, Condition cond, boolean unorderedIsTrue, CiValue trueValue, CiValue falseValue) { + public Variable emitCMove(RiValue left, RiValue right, Condition cond, boolean unorderedIsTrue, RiValue trueValue, RiValue falseValue) { boolean mirrored = emitCompare(left, right); Condition finalCondition = mirrored ? cond.mirror() : cond; @@ -255,9 +255,9 @@ * @param b the right operand of the comparison * @return true if the left and right operands were switched, false otherwise */ - private boolean emitCompare(CiValue a, CiValue b) { + private boolean emitCompare(RiValue a, RiValue b) { Variable left; - CiValue right; + RiValue right; boolean mirrored; if (ValueUtil.isVariable(b)) { left = load(b); @@ -281,7 +281,7 @@ } @Override - public Variable emitNegate(CiValue input) { + public Variable emitNegate(RiValue input) { Variable result = newVariable(input.kind); switch (input.kind) { case Int: append(new Op1Stack(INEG, result, input)); break; @@ -294,7 +294,7 @@ } @Override - public Variable emitAdd(CiValue a, CiValue b) { + public Variable emitAdd(RiValue a, RiValue b) { Variable result = newVariable(a.kind); switch(a.kind) { case Int: append(new Op2Stack(IADD, result, a, loadNonConst(b))); break; @@ -307,7 +307,7 @@ } @Override - public Variable emitSub(CiValue a, CiValue b) { + public Variable emitSub(RiValue a, RiValue b) { Variable result = newVariable(a.kind); switch(a.kind) { case Int: append(new Op2Stack(ISUB, result, a, loadNonConst(b))); break; @@ -320,7 +320,7 @@ } @Override - public Variable emitMul(CiValue a, CiValue b) { + public Variable emitMul(RiValue a, RiValue b) { Variable result = newVariable(a.kind); switch(a.kind) { case Int: append(new Op2Reg(IMUL, result, a, loadNonConst(b))); break; @@ -333,7 +333,7 @@ } @Override - public Variable emitDiv(CiValue a, CiValue b) { + public Variable emitDiv(RiValue a, RiValue b) { switch(a.kind) { case Int: emitMove(a, RAX_I); @@ -359,7 +359,7 @@ } @Override - public CiValue emitRem(CiValue a, CiValue b) { + public RiValue emitRem(RiValue a, RiValue b) { switch(a.kind) { case Int: emitMove(a, RAX_I); @@ -379,7 +379,7 @@ } @Override - public Variable emitUDiv(CiValue a, CiValue b) { + public Variable emitUDiv(RiValue a, RiValue b) { switch(a.kind) { case Int: emitMove(a, RAX_I); @@ -395,7 +395,7 @@ } @Override - public Variable emitURem(CiValue a, CiValue b) { + public Variable emitURem(RiValue a, RiValue b) { switch(a.kind) { case Int: emitMove(a, RAX_I); @@ -412,7 +412,7 @@ @Override - public Variable emitAnd(CiValue a, CiValue b) { + public Variable emitAnd(RiValue a, RiValue b) { Variable result = newVariable(a.kind); switch(a.kind) { case Int: append(new Op2Stack(IAND, result, a, loadNonConst(b))); break; @@ -423,7 +423,7 @@ } @Override - public Variable emitOr(CiValue a, CiValue b) { + public Variable emitOr(RiValue a, RiValue b) { Variable result = newVariable(a.kind); switch(a.kind) { case Int: append(new Op2Stack(IOR, result, a, loadNonConst(b))); break; @@ -434,7 +434,7 @@ } @Override - public Variable emitXor(CiValue a, CiValue b) { + public Variable emitXor(RiValue a, RiValue b) { Variable result = newVariable(a.kind); switch(a.kind) { case Int: append(new Op2Stack(IXOR, result, a, loadNonConst(b))); break; @@ -446,7 +446,7 @@ @Override - public Variable emitShl(CiValue a, CiValue b) { + public Variable emitShl(RiValue a, RiValue b) { Variable result = newVariable(a.kind); switch (a.kind) { case Int: append(new ShiftOp(ISHL, result, a, loadShiftCount(b))); break; @@ -457,7 +457,7 @@ } @Override - public Variable emitShr(CiValue a, CiValue b) { + public Variable emitShr(RiValue a, RiValue b) { Variable result = newVariable(a.kind); switch (a.kind) { case Int: append(new ShiftOp(ISHR, result, a, loadShiftCount(b))); break; @@ -468,7 +468,7 @@ } @Override - public Variable emitUShr(CiValue a, CiValue b) { + public Variable emitUShr(RiValue a, RiValue b) { Variable result = newVariable(a.kind); switch (a.kind) { case Int: append(new ShiftOp(IUSHR, result, a, loadShiftCount(b))); break; @@ -478,7 +478,7 @@ return result; } - private CiValue loadShiftCount(CiValue value) { + private RiValue loadShiftCount(RiValue value) { if (isConstant(value)) { return value; } @@ -489,7 +489,7 @@ @Override - public Variable emitConvert(ConvertNode.Op opcode, CiValue inputVal) { + public Variable emitConvert(ConvertNode.Op opcode, RiValue inputVal) { Variable input = load(inputVal); Variable result = newVariable(opcode.to); switch (opcode) { @@ -519,7 +519,7 @@ @Override - public void emitDeoptimizeOnOverflow(RiDeoptAction action, RiDeoptReason reason, Object deoptInfo) { + public void emitDeoptimizeOnOverflow(CiDeoptAction action, CiDeoptReason reason, Object deoptInfo) { LIRDebugInfo info = state(); LabelRef stubEntry = createDeoptStub(action, reason, info, deoptInfo); append(new BranchOp(ConditionFlag.overflow, stubEntry, info)); @@ -527,7 +527,7 @@ @Override - public void emitDeoptimize(RiDeoptAction action, RiDeoptReason reason, Object deoptInfo, long leafGraphId) { + public void emitDeoptimize(CiDeoptAction action, CiDeoptReason reason, Object deoptInfo, long leafGraphId) { LIRDebugInfo info = state(leafGraphId); LabelRef stubEntry = createDeoptStub(action, reason, info, deoptInfo); append(new JumpOp(stubEntry, info)); @@ -542,35 +542,35 @@ } @Override - protected void emitCall(Object targetMethod, CiValue result, List arguments, CiValue targetAddress, LIRDebugInfo info, Map marks) { + protected void emitCall(Object targetMethod, RiValue result, List arguments, RiValue targetAddress, LIRDebugInfo info, Map marks) { if (isConstant(targetAddress)) { assert asConstant(targetAddress).isDefaultValue() : "destination address should be zero"; - append(new DirectCallOp(targetMethod, result, arguments.toArray(new CiValue[arguments.size()]), info, marks)); + append(new DirectCallOp(targetMethod, result, arguments.toArray(new RiValue[arguments.size()]), info, marks)); } else { - append(new IndirectCallOp(targetMethod, result, arguments.toArray(new CiValue[arguments.size()]), targetAddress, info, marks)); + append(new IndirectCallOp(targetMethod, result, arguments.toArray(new RiValue[arguments.size()]), targetAddress, info, marks)); } } @Override - protected void emitReturn(CiValue input) { + protected void emitReturn(RiValue input) { append(new ReturnOp(input)); } @Override - protected void emitXir(XirSnippet snippet, CiValue[] operands, CiValue outputOperand, CiValue[] inputs, CiValue[] temps, int[] inputOperandIndices, int[] tempOperandIndices, int outputOperandIndex, + protected void emitXir(XirSnippet snippet, RiValue[] operands, RiValue outputOperand, RiValue[] inputs, RiValue[] temps, int[] inputOperandIndices, int[] tempOperandIndices, int outputOperandIndex, LIRDebugInfo info, LIRDebugInfo infoAfter, LabelRef trueSuccessor, LabelRef falseSuccessor) { append(new AMD64XirOp(snippet, operands, outputOperand, inputs, temps, inputOperandIndices, tempOperandIndices, outputOperandIndex, info, infoAfter, trueSuccessor, falseSuccessor)); } @Override - protected void emitTableSwitch(int lowKey, LabelRef defaultTarget, LabelRef[] targets, CiValue index) { + protected void emitTableSwitch(int lowKey, LabelRef defaultTarget, LabelRef[] targets, RiValue index) { // Making a copy of the switch value is necessary because jump table destroys the input value Variable tmp = emitMove(index); append(new TableSwitchOp(lowKey, defaultTarget, targets, tmp, newVariable(target.wordKind))); } @Override - protected LabelRef createDeoptStub(RiDeoptAction action, RiDeoptReason reason, LIRDebugInfo info, Object deoptInfo) { + protected LabelRef createDeoptStub(CiDeoptAction action, CiDeoptReason reason, LIRDebugInfo info, Object deoptInfo) { assert info.topFrame.bci >= 0 : "invalid bci for deopt framestate"; AMD64DeoptimizationStub stub = new AMD64DeoptimizationStub(action, reason, info, deoptInfo); lir.stubs.add(stub); @@ -589,12 +589,12 @@ RiKind kind = node.newValue().kind(); assert kind == node.expected().kind(); - CiValue expected = loadNonConst(operand(node.expected())); + RiValue expected = loadNonConst(operand(node.expected())); Variable newValue = load(operand(node.newValue())); CiAddress address; int displacement = node.displacement(); - CiValue index = operand(node.offset()); + RiValue index = operand(node.offset()); if (isConstant(index) && NumUtil.isInt(asConstant(index).asLong())) { displacement += (int) asConstant(index).asLong(); address = new CiAddress(kind, load(operand(node.object())), displacement); diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/amd64/AMD64XirOp.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/amd64/AMD64XirOp.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/amd64/AMD64XirOp.java Thu Jun 07 18:12:01 2012 +0200 @@ -23,8 +23,8 @@ package com.oracle.graal.compiler.target.amd64; import static com.oracle.max.cri.ci.CiCallingConvention.Type.*; -import static com.oracle.max.cri.ci.CiValue.*; import static com.oracle.max.cri.ci.CiValueUtil.*; +import static com.oracle.max.cri.ri.RiValue.*; import java.util.*; @@ -45,7 +45,7 @@ import com.oracle.max.cri.xir.CiXirAssembler.XirMark; public class AMD64XirOp extends LIRXirInstruction { - public AMD64XirOp(XirSnippet snippet, CiValue[] operands, CiValue outputOperand, CiValue[] inputs, CiValue[] temps, int[] inputOperandIndices, int[] tempOperandIndices, int outputOperandIndex, + public AMD64XirOp(XirSnippet snippet, RiValue[] operands, RiValue outputOperand, RiValue[] inputs, RiValue[] temps, int[] inputOperandIndices, int[] tempOperandIndices, int outputOperandIndex, LIRDebugInfo info, LIRDebugInfo infoAfter, LabelRef trueSuccessor, LabelRef falseSuccessor) { super("XIR", snippet, operands, outputOperand, inputs, temps, inputOperandIndices, tempOperandIndices, outputOperandIndex, info, infoAfter, trueSuccessor, falseSuccessor); } @@ -106,7 +106,7 @@ } - protected void emitXirInstructions(TargetMethodAssembler tasm, AMD64MacroAssembler masm, XirInstruction[] instructions, Label[] labels, CiValue[] operands, Map marks) { + protected void emitXirInstructions(TargetMethodAssembler tasm, AMD64MacroAssembler masm, XirInstruction[] instructions, Label[] labels, RiValue[] operands, Map marks) { for (XirInstruction inst : instructions) { switch (inst.op) { case Add: @@ -154,15 +154,15 @@ break; case Mov: { - CiValue result = operands[inst.result.index]; - CiValue source = operands[inst.x().index]; + RiValue result = operands[inst.result.index]; + RiValue source = operands[inst.x().index]; AMD64Move.move(tasm, masm, result, source); break; } case PointerLoad: { - CiValue result = operands[inst.result.index]; - CiValue pointer = operands[inst.x().index]; + RiValue result = operands[inst.result.index]; + RiValue pointer = operands[inst.x().index]; CiRegisterValue register = assureInRegister(tasm, masm, pointer); AMD64Move.load(tasm, masm, result, new CiAddress(inst.kind, register), (Boolean) inst.extra ? info : null); @@ -170,8 +170,8 @@ } case PointerStore: { - CiValue value = assureNot64BitConstant(tasm, masm, operands[inst.y().index]); - CiValue pointer = operands[inst.x().index]; + RiValue value = assureNot64BitConstant(tasm, masm, operands[inst.y().index]); + RiValue pointer = operands[inst.x().index]; assert isRegister(pointer); AMD64Move.store(tasm, masm, new CiAddress(inst.kind, pointer), value, (Boolean) inst.extra ? info : null); @@ -185,9 +185,9 @@ CiAddress.Scale scale = addressInformation.scale; int displacement = addressInformation.disp; - CiValue result = operands[inst.result.index]; - CiValue pointer = operands[inst.x().index]; - CiValue index = operands[inst.y().index]; + RiValue result = operands[inst.result.index]; + RiValue pointer = operands[inst.x().index]; + RiValue index = operands[inst.y().index]; pointer = assureInRegister(tasm, masm, pointer); assert isRegister(pointer); @@ -211,9 +211,9 @@ CiAddress.Scale scale = addressInformation.scale; int displacement = addressInformation.disp; - CiValue result = operands[inst.result.index]; - CiValue pointer = operands[inst.x().index]; - CiValue index = operands[inst.y().index]; + RiValue result = operands[inst.result.index]; + RiValue pointer = operands[inst.x().index]; + RiValue index = operands[inst.y().index]; pointer = assureInRegister(tasm, masm, pointer); assert isRegister(pointer); @@ -229,9 +229,9 @@ CiAddress.Scale scale = addressInformation.scale; int displacement = addressInformation.disp; - CiValue value = assureNot64BitConstant(tasm, masm, operands[inst.z().index]); - CiValue pointer = operands[inst.x().index]; - CiValue index = operands[inst.y().index]; + RiValue value = assureNot64BitConstant(tasm, masm, operands[inst.z().index]); + RiValue pointer = operands[inst.x().index]; + RiValue index = operands[inst.y().index]; pointer = assureInRegister(tasm, masm, pointer); assert isRegister(pointer); @@ -266,8 +266,8 @@ case PointerCAS: assert asRegister(operands[inst.x().index]).equals(AMD64.rax) : "wrong input x: " + operands[inst.x().index]; - CiValue exchangedVal = operands[inst.y().index]; - CiValue exchangedAddress = operands[inst.x().index]; + RiValue exchangedVal = operands[inst.y().index]; + RiValue exchangedAddress = operands[inst.x().index]; CiRegisterValue pointerRegister = assureInRegister(tasm, masm, exchangedAddress); CiAddress addr = new CiAddress(tasm.target.wordKind, pointerRegister); @@ -286,8 +286,8 @@ CiCallingConvention cc = tasm.frameMap.registerConfig.getCallingConvention(RuntimeCall, signature, tasm.target, false); for (int i = 0; i < inst.arguments.length; i++) { - CiValue argumentLocation = cc.locations[i]; - CiValue argumentSourceLocation = operands[inst.arguments[i].index]; + RiValue argumentLocation = cc.locations[i]; + RiValue argumentSourceLocation = operands[inst.arguments[i].index]; if (argumentLocation != argumentSourceLocation) { AMD64Move.move(tasm, masm, argumentLocation, argumentSourceLocation); } @@ -298,7 +298,7 @@ if (inst.result != null && inst.result.kind != RiKind.Illegal && inst.result.kind != RiKind.Void) { CiRegister returnRegister = tasm.frameMap.registerConfig.getReturnRegister(inst.result.kind); - CiValue resultLocation = returnRegister.asValue(inst.result.kind.stackKind()); + RiValue resultLocation = returnRegister.asValue(inst.result.kind.stackKind()); AMD64Move.move(tasm, masm, operands[inst.result.index], resultLocation); } break; @@ -314,7 +314,7 @@ } case DecAndJumpNotZero: { Label label = labels[((XirLabel) inst.extra).index]; - CiValue value = operands[inst.x().index]; + RiValue value = operands[inst.x().index]; if (value.kind == RiKind.Long) { masm.decq(asRegister(value)); } else { @@ -367,9 +367,9 @@ case Jbset: { Label label = labels[((XirLabel) inst.extra).index]; - CiValue pointer = operands[inst.x().index]; - CiValue offset = operands[inst.y().index]; - CiValue bit = operands[inst.z().index]; + RiValue pointer = operands[inst.x().index]; + RiValue offset = operands[inst.y().index]; + RiValue bit = operands[inst.z().index]; assert isConstant(offset) && isConstant(bit); RiConstant constantOffset = (RiConstant) offset; RiConstant constantBit = (RiConstant) bit; @@ -392,7 +392,7 @@ } case NullCheck: { tasm.recordImplicitException(masm.codeBuffer.position(), info); - CiValue pointer = operands[inst.x().index]; + RiValue pointer = operands[inst.x().index]; masm.nullCheck(asRegister(pointer)); break; } @@ -402,7 +402,7 @@ break; } case Pop: { - CiValue result = operands[inst.result.index]; + RiValue result = operands[inst.result.index]; if (isRegister(result)) { masm.pop(asRegister(result)); } else { @@ -440,7 +440,7 @@ } private static void emitXirViaLir(TargetMethodAssembler tasm, AMD64MacroAssembler masm, AMD64Arithmetic intOp, AMD64Arithmetic longOp, AMD64Arithmetic floatOp, - AMD64Arithmetic doubleOp, CiValue left, CiValue right, CiValue result) { + AMD64Arithmetic doubleOp, RiValue left, RiValue right, RiValue result) { AMD64Arithmetic code; switch (result.kind) { case Int: code = intOp; break; @@ -458,9 +458,9 @@ } } - private static void emitXirCompare(TargetMethodAssembler tasm, AMD64MacroAssembler masm, XirInstruction inst, ConditionFlag cflag, CiValue[] ops, Label label) { - CiValue x = ops[inst.x().index]; - CiValue y = ops[inst.y().index]; + private static void emitXirCompare(TargetMethodAssembler tasm, AMD64MacroAssembler masm, XirInstruction inst, ConditionFlag cflag, RiValue[] ops, Label label) { + RiValue x = ops[inst.x().index]; + RiValue y = ops[inst.y().index]; AMD64Compare code; switch (x.kind) { case Int: code = AMD64Compare.ICMP; break; @@ -474,7 +474,7 @@ masm.jcc(cflag, label); } - private static CiValue assureNot64BitConstant(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue value) { + private static RiValue assureNot64BitConstant(TargetMethodAssembler tasm, AMD64MacroAssembler masm, RiValue value) { if (isConstant(value) && (value.kind == RiKind.Long || value.kind == RiKind.Object)) { CiRegisterValue register = tasm.frameMap.registerConfig.getScratchRegister().asValue(value.kind); AMD64Move.move(tasm, masm, register, value); @@ -483,7 +483,7 @@ return value; } - private static CiRegisterValue assureInRegister(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue pointer) { + private static CiRegisterValue assureInRegister(TargetMethodAssembler tasm, AMD64MacroAssembler masm, RiValue pointer) { if (isConstant(pointer)) { CiRegisterValue register = tasm.frameMap.registerConfig.getScratchRegister().asValue(pointer.kind); AMD64Move.move(tasm, masm, register, pointer); diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/util/InliningUtil.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/util/InliningUtil.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/util/InliningUtil.java Thu Jun 07 18:12:01 2012 +0200 @@ -189,7 +189,7 @@ ValueNode receiver = invoke.callTarget().receiver(); ReadHubNode objectClass = graph.add(new ReadHubNode(receiver)); IsTypeNode isTypeNode = graph.unique(new IsTypeNode(objectClass, type)); - FixedGuardNode guard = graph.add(new FixedGuardNode(isTypeNode, RiDeoptReason.TypeCheckedInliningViolated, RiDeoptAction.InvalidateReprofile, invoke.leafGraphId())); + FixedGuardNode guard = graph.add(new FixedGuardNode(isTypeNode, CiDeoptReason.TypeCheckedInliningViolated, CiDeoptAction.InvalidateReprofile, invoke.leafGraphId())); AnchorNode anchor = graph.add(new AnchorNode()); assert invoke.predecessor() != null; @@ -315,7 +315,7 @@ if (shouldFallbackToInvoke()) { unknownTypeNode = createInvocationBlock(graph, invoke, returnMerge, returnValuePhi, exceptionMerge, exceptionObjectPhi, 1, notRecordedTypeProbability, false); } else { - unknownTypeNode = graph.add(new DeoptimizeNode(RiDeoptAction.InvalidateReprofile, RiDeoptReason.TypeCheckedInliningViolated, invoke.leafGraphId())); + unknownTypeNode = graph.add(new DeoptimizeNode(CiDeoptAction.InvalidateReprofile, CiDeoptReason.TypeCheckedInliningViolated, invoke.leafGraphId())); } // replace the invoke exception edge @@ -380,7 +380,7 @@ ReadHubNode objectClassNode = graph.add(new ReadHubNode(invoke.callTarget().receiver())); graph.addBeforeFixed(invoke.node(), objectClassNode); - FixedNode unknownTypeNode = graph.add(new DeoptimizeNode(RiDeoptAction.InvalidateReprofile, RiDeoptReason.TypeCheckedInliningViolated, invoke.leafGraphId())); + FixedNode unknownTypeNode = graph.add(new DeoptimizeNode(CiDeoptAction.InvalidateReprofile, CiDeoptReason.TypeCheckedInliningViolated, invoke.leafGraphId())); FixedNode dispatchOnType = createDispatchOnType(graph, objectClassNode, new BeginNode[] {calleeEntryNode}, unknownTypeNode); FixedWithNextNode pred = (FixedWithNextNode) invoke.node().predecessor(); @@ -828,7 +828,7 @@ } else { if (unwindNode != null) { UnwindNode unwindDuplicate = (UnwindNode) duplicates.get(unwindNode); - DeoptimizeNode deoptimizeNode = new DeoptimizeNode(RiDeoptAction.InvalidateRecompile, RiDeoptReason.NotCompiledExceptionHandler, invoke.leafGraphId()); + DeoptimizeNode deoptimizeNode = new DeoptimizeNode(CiDeoptAction.InvalidateRecompile, CiDeoptReason.NotCompiledExceptionHandler, invoke.leafGraphId()); unwindDuplicate.replaceAndDelete(graph.add(deoptimizeNode)); // move the deopt upwards if there is a monitor exit that tries to use the "after exception" frame state // (because there is no "after exception" frame state!) @@ -908,7 +908,7 @@ NodeInputList parameters = callTarget.arguments(); ValueNode firstParam = parameters.size() <= 0 ? null : parameters.get(0); if (!callTarget.isStatic() && firstParam.kind() == RiKind.Object && !firstParam.objectStamp().nonNull()) { - graph.addBeforeFixed(invoke.node(), graph.add(new FixedGuardNode(graph.unique(new IsNullNode(firstParam)), RiDeoptReason.ClassCastException, RiDeoptAction.InvalidateReprofile, true, invoke.leafGraphId()))); + graph.addBeforeFixed(invoke.node(), graph.add(new FixedGuardNode(graph.unique(new IsNullNode(firstParam)), CiDeoptReason.ClassCastException, CiDeoptAction.InvalidateReprofile, true, invoke.leafGraphId()))); } } } diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/counters/MethodEntryCounters.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/counters/MethodEntryCounters.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/counters/MethodEntryCounters.java Thu Jun 07 18:12:01 2012 +0200 @@ -69,8 +69,8 @@ protected final Counter counter; - protected AMD64MethodEntryOp(Counter counter, CiValue counterArr, CiValue callerPc) { - super("ENTRY_COUNTER", LIRInstruction.NO_OPERANDS, null, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS, new CiValue[] {counterArr, callerPc}); + protected AMD64MethodEntryOp(Counter counter, RiValue counterArr, RiValue callerPc) { + super("ENTRY_COUNTER", LIRInstruction.NO_OPERANDS, null, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS, new RiValue[] {counterArr, callerPc}); this.counter = counter; } @@ -78,8 +78,8 @@ public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) { int start = masm.codeBuffer.position(); - CiValue counterArr = temp(0); - CiValue callerPc = temp(1); + RiValue counterArr = temp(0); + RiValue callerPc = temp(1); int off = Unsafe.getUnsafe().arrayBaseOffset(long[].class); int scale = Unsafe.getUnsafe().arrayIndexScale(long[].class); diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ArrayWriteBarrier.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ArrayWriteBarrier.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ArrayWriteBarrier.java Thu Jun 07 18:12:01 2012 +0200 @@ -22,7 +22,7 @@ */ package com.oracle.graal.hotspot.nodes; -import com.oracle.max.cri.ci.*; +import com.oracle.max.cri.ri.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.extended.*; import com.oracle.graal.nodes.spi.*; @@ -47,7 +47,7 @@ @Override public void generate(LIRGeneratorTool gen) { - CiValue addr = gen.emitLea(gen.makeAddress(location(), object())); + RiValue addr = gen.emitLea(gen.makeAddress(location(), object())); generateBarrier(addr, gen); } } diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/FieldWriteBarrier.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/FieldWriteBarrier.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/FieldWriteBarrier.java Thu Jun 07 18:12:01 2012 +0200 @@ -22,7 +22,7 @@ */ package com.oracle.graal.hotspot.nodes; -import com.oracle.max.cri.ci.*; +import com.oracle.max.cri.ri.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.spi.*; @@ -40,7 +40,7 @@ @Override public void generate(LIRGeneratorTool generator) { - CiValue obj = generator.newVariable(generator.target().wordKind); + RiValue obj = generator.newVariable(generator.target().wordKind); generator.emitMove(generator.operand(object()), obj); generateBarrier(obj, generator); } diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/TailcallNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/TailcallNode.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/TailcallNode.java Thu Jun 07 18:12:01 2012 +0200 @@ -68,9 +68,9 @@ for (int i = 0, slot = 0; i < cc.locations.length; i++, slot += FrameStateBuilder.stackSlots(frameState.localAt(slot).kind())) { parameters.add(frameState.localAt(slot)); } - List argList = gen.visitInvokeArguments(cc, parameters); + List argList = gen.visitInvokeArguments(cc, parameters); - CiValue entry = gen.emitLoad(new CiAddress(RiKind.Long, gen.operand(target), config.nmethodEntryOffset), false); + RiValue entry = gen.emitLoad(new CiAddress(RiKind.Long, gen.operand(target), config.nmethodEntryOffset), false); gen.append(new AMD64TailcallOp(argList, entry, cc.locations)); } diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/WriteBarrier.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/WriteBarrier.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/WriteBarrier.java Thu Jun 07 18:12:01 2012 +0200 @@ -35,9 +35,9 @@ super(StampFactory.forVoid()); } - protected void generateBarrier(CiValue adr, LIRGeneratorTool gen) { + protected void generateBarrier(RiValue adr, LIRGeneratorTool gen) { HotSpotVMConfig config = CompilerImpl.getInstance().getConfig(); - CiValue base = gen.emitUShr(adr, RiConstant.forInt(config.cardtableShift)); + RiValue base = gen.emitUShr(adr, RiConstant.forInt(config.cardtableShift)); long startAddress = config.cardtableStartAddress; int displacement = 0; diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotCodeInfo.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotCodeInfo.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotCodeInfo.java Thu Jun 07 18:12:01 2012 +0200 @@ -64,11 +64,6 @@ } @Override - public CiTargetMethod targetMethod() { - return targetMethod; - } - - @Override public RiResolvedMethod method() { return method; } diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotMethodData.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotMethodData.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotMethodData.java Thu Jun 07 18:12:01 2012 +0200 @@ -29,6 +29,7 @@ import com.oracle.graal.compiler.*; import com.oracle.graal.hotspot.*; import com.oracle.graal.hotspot.Compiler; +import com.oracle.max.cri.ci.*; import com.oracle.max.cri.ri.*; import com.oracle.max.cri.ri.RiTypeProfile.*; @@ -78,7 +79,7 @@ return position >= 0 && position < normalDataSize + extraDataSize; } - public int getDeoptimizationCount(RiDeoptReason reason) { + public int getDeoptimizationCount(CiDeoptReason reason) { int reasonIndex = compiler.getRuntime().convertDeoptReason(reason); return unsafe.getByte(hotspotMirror, (long) config.methodDataOopTrapHistoryOffset + reasonIndex) & 0xFF; } diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotProfilingInfo.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotProfilingInfo.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotProfilingInfo.java Thu Jun 07 18:12:01 2012 +0200 @@ -85,7 +85,7 @@ } @Override - public int getDeoptimizationCount(RiDeoptReason reason) { + public int getDeoptimizationCount(CiDeoptReason reason) { return methodData.getDeoptimizationCount(reason); } diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotRegisterConfig.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotRegisterConfig.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotRegisterConfig.java Thu Jun 07 18:12:01 2012 +0200 @@ -34,7 +34,7 @@ import com.oracle.graal.graph.*; import com.oracle.graal.hotspot.*; -public class HotSpotRegisterConfig implements RiRegisterConfig { +public class HotSpotRegisterConfig implements CiRegisterConfig { // be careful - the contents of this array are duplicated in graal_CodeInstaller.cpp private final CiRegister[] allocatable = { @@ -45,7 +45,7 @@ private final EnumMap categorized = CiRegister.categorize(allocatable); - private final RiRegisterAttributes[] attributesMap; + private final CiRegisterAttributes[] attributesMap; @Override public CiRegister[] getAllocatableRegisters() { @@ -58,7 +58,7 @@ } @Override - public RiRegisterAttributes[] getAttributesMap() { + public CiRegisterAttributes[] getAttributesMap() { return attributesMap; } @@ -92,7 +92,7 @@ csl = new CiCalleeSaveLayout(0, size, 8, regs); } - attributesMap = RiRegisterAttributes.createMap(this, AMD64.allRegisters); + attributesMap = CiRegisterAttributes.createMap(this, AMD64.allRegisters); allParameterRegisters = Arrays.copyOf(generalParameterRegisters, generalParameterRegisters.length + xmmParameterRegisters.length); System.arraycopy(xmmParameterRegisters, 0, allParameterRegisters, generalParameterRegisters.length, xmmParameterRegisters.length); } @@ -120,7 +120,7 @@ } private CiCallingConvention callingConvention(RiKind[] types, Type type, CiTarget target, boolean stackOnly) { - CiValue[] locations = new CiValue[types.length]; + RiValue[] locations = new RiValue[types.length]; int currentGeneral = 0; int currentXMM = 0; diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotRuntime.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotRuntime.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotRuntime.java Thu Jun 07 18:12:01 2012 +0200 @@ -85,11 +85,10 @@ } @Override - public String disassemble(RiCodeInfo info) { + public String disassemble(RiCodeInfo info, CiTargetMethod tm) { byte[] code = info.code(); CiTarget target = compiler.getTarget(); HexCodeFile hcf = new HexCodeFile(code, info.start(), target.arch.name, target.wordSize * 8); - CiTargetMethod tm = info.targetMethod(); if (tm != null) { HexCodeFile.addAnnotations(hcf, tm.annotations()); addExceptionHandlersComment(tm, hcf); @@ -205,7 +204,7 @@ } @Override - public RiRegisterConfig getRegisterConfig(RiMethod method) { + public CiRegisterConfig getRegisterConfig(RiMethod method) { return regConfig; } @@ -391,7 +390,7 @@ private static ValueNode createBoundsCheck(AccessIndexedNode n, CiLoweringTool tool) { StructuredGraph graph = (StructuredGraph) n.graph(); ArrayLengthNode arrayLength = graph.add(new ArrayLengthNode(n.array())); - ValueNode guard = tool.createGuard(graph.unique(new IntegerBelowThanNode(n.index(), arrayLength)), RiDeoptReason.BoundsCheckException, RiDeoptAction.InvalidateReprofile, n.leafGraphId()); + ValueNode guard = tool.createGuard(graph.unique(new IntegerBelowThanNode(n.index(), arrayLength)), CiDeoptReason.BoundsCheckException, CiDeoptAction.InvalidateReprofile, n.leafGraphId()); graph.addBeforeFixed(n, arrayLength); return guard; @@ -491,7 +490,7 @@ } @Override - public RiRegisterConfig getGlobalStubRegisterConfig() { + public CiRegisterConfig getGlobalStubRegisterConfig() { return globalStubRegConfig; } @@ -502,7 +501,7 @@ } @Override - public int encodeDeoptActionAndReason(RiDeoptAction action, RiDeoptReason reason) { + public int encodeDeoptActionAndReason(CiDeoptAction action, CiDeoptReason reason) { final int actionShift = 0; final int reasonShift = 3; @@ -512,7 +511,7 @@ } @Override - public int convertDeoptAction(RiDeoptAction action) { + public int convertDeoptAction(CiDeoptAction action) { switch(action) { case None: return 0; case RecompileIfTooManyDeopts: return 1; @@ -524,7 +523,7 @@ } @Override - public int convertDeoptReason(RiDeoptReason reason) { + public int convertDeoptReason(CiDeoptReason reason) { switch(reason) { case None: return 0; case NullCheckException: return 1; diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotXirGenerator.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotXirGenerator.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotXirGenerator.java Thu Jun 07 18:12:01 2012 +0200 @@ -75,13 +75,13 @@ private final HotSpotVMConfig config; private final CiTarget target; - private final RiRegisterConfig registerConfig; + private final CiRegisterConfig registerConfig; private final Compiler compiler; private CiXirAssembler globalAsm; - public HotSpotXirGenerator(HotSpotVMConfig config, CiTarget target, RiRegisterConfig registerConfig, Compiler compiler) { + public HotSpotXirGenerator(HotSpotVMConfig config, CiTarget target, CiRegisterConfig registerConfig, Compiler compiler) { this.config = config; this.target = target; this.registerConfig = registerConfig; @@ -580,9 +580,9 @@ if (counters != null) { incCounter(asm, counter, counters, CheckcastCounter.exception); } - RiDeoptReason deoptReason = exact ? RiDeoptReason.OptimizedTypeCheckViolated : RiDeoptReason.ClassCastException; + CiDeoptReason deoptReason = exact ? CiDeoptReason.OptimizedTypeCheckViolated : CiDeoptReason.ClassCastException; XirOperand scratch = asm.createRegisterTemp("scratch", target.wordKind, AMD64.r10); - asm.mov(scratch, wordConst(asm, compiler.getRuntime().encodeDeoptActionAndReason(RiDeoptAction.InvalidateReprofile, deoptReason))); + asm.mov(scratch, wordConst(asm, compiler.getRuntime().encodeDeoptActionAndReason(CiDeoptAction.InvalidateReprofile, deoptReason))); asm.callRuntime(CiRuntimeCall.Deoptimize, null); asm.shouldNotReachHere(); diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/server/ReplacingStreams.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/server/ReplacingStreams.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/server/ReplacingStreams.java Thu Jun 07 18:12:01 2012 +0200 @@ -26,7 +26,6 @@ import java.lang.reflect.*; import java.util.*; -import com.oracle.max.cri.ci.*; import com.oracle.max.cri.ri.*; import com.oracle.graal.hotspot.*; @@ -47,7 +46,7 @@ input = new ReplacingInputStream(new BufferedInputStream(inputStream)); invocation = new InvocationSocket(output, input); - addStaticObject(CiValue.IllegalValue); + addStaticObject(RiValue.IllegalValue); addStaticObject(HotSpotProxy.DUMMY_CONSTANT_OBJ); } diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/CheckCastSnippets.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/CheckCastSnippets.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/CheckCastSnippets.java Thu Jun 07 18:12:01 2012 +0200 @@ -49,6 +49,7 @@ import com.oracle.graal.snippets.SnippetTemplate.Cache; import com.oracle.graal.snippets.SnippetTemplate.Key; import com.oracle.graal.snippets.nodes.*; +import com.oracle.max.cri.ci.*; import com.oracle.max.cri.ri.*; import com.oracle.max.criutils.*; @@ -73,7 +74,7 @@ Object objectHub = UnsafeLoadNode.loadObject(object, 0, hubOffset(), true); if (objectHub != exactHub) { exactMiss.inc(); - DeoptimizeNode.deopt(RiDeoptAction.InvalidateReprofile, RiDeoptReason.ClassCastException); + DeoptimizeNode.deopt(CiDeoptAction.InvalidateReprofile, CiDeoptReason.ClassCastException); } exactHit.inc(); return object; @@ -95,7 +96,7 @@ Object objectHub = UnsafeLoadNode.loadObject(object, 0, hubOffset(), true); if (UnsafeLoadNode.loadObject(objectHub, 0, superCheckOffset, true) != hub) { displayMiss.inc(); - DeoptimizeNode.deopt(RiDeoptAction.InvalidateReprofile, RiDeoptReason.ClassCastException); + DeoptimizeNode.deopt(CiDeoptAction.InvalidateReprofile, CiDeoptReason.ClassCastException); } displayHit.inc(); return object; @@ -121,7 +122,7 @@ } } if (!checkSecondarySubType(hub, objectHub)) { - DeoptimizeNode.deopt(RiDeoptAction.InvalidateReprofile, RiDeoptReason.ClassCastException); + DeoptimizeNode.deopt(CiDeoptAction.InvalidateReprofile, CiDeoptReason.ClassCastException); } return object; } @@ -147,7 +148,7 @@ } } if (!checkUnknownSubType(hub, objectHub)) { - DeoptimizeNode.deopt(RiDeoptAction.InvalidateReprofile, RiDeoptReason.ClassCastException); + DeoptimizeNode.deopt(CiDeoptAction.InvalidateReprofile, CiDeoptReason.ClassCastException); } return object; } diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/DirectStoreNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/DirectStoreNode.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/DirectStoreNode.java Thu Jun 07 18:12:01 2012 +0200 @@ -27,6 +27,7 @@ import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.type.*; import com.oracle.max.cri.ci.*; +import com.oracle.max.cri.ri.*; /** * A special purpose store node that differs from {@link UnsafeStoreNode} in that @@ -56,7 +57,7 @@ @Override public void generate(LIRGeneratorTool gen) { - CiValue v = gen.operand(value); + RiValue v = gen.operand(value); gen.emitStore(new CiAddress(v.kind, gen.operand(address)), v, false); } } diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/GetObjectAddressNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/GetObjectAddressNode.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/GetObjectAddressNode.java Thu Jun 07 18:12:01 2012 +0200 @@ -25,7 +25,6 @@ import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.type.*; -import com.oracle.max.cri.ci.*; import com.oracle.max.cri.ri.*; /** @@ -50,7 +49,7 @@ @Override public void generate(LIRGeneratorTool gen) { - CiValue obj = gen.newVariable(gen.target().wordKind); + RiValue obj = gen.newVariable(gen.target().wordKind); gen.emitMove(gen.operand(object), obj); gen.setResult(this, obj); } diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/AMD64TailcallOp.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/AMD64TailcallOp.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/AMD64TailcallOp.java Thu Jun 07 18:12:01 2012 +0200 @@ -27,7 +27,7 @@ import java.util.*; import com.oracle.max.asm.target.amd64.*; -import com.oracle.max.cri.ci.*; +import com.oracle.max.cri.ri.*; import com.oracle.graal.graph.*; import com.oracle.graal.lir.*; import com.oracle.graal.lir.amd64.*; @@ -38,7 +38,7 @@ */ public class AMD64TailcallOp extends AMD64LIRInstruction { - public AMD64TailcallOp(List parameters, CiValue target, CiValue[] callingConvention) { + public AMD64TailcallOp(List parameters, RiValue target, RiValue[] callingConvention) { super("TAILCALL", LIRInstruction.NO_OPERANDS, null, toArray(parameters, target), LIRInstruction.NO_OPERANDS, callingConvention.clone()); assert inputs.length == temps.length + 1; @@ -48,8 +48,8 @@ } } - private static CiValue[] toArray(List parameters, CiValue target) { - CiValue[] result = new CiValue[parameters.size() + 1]; + private static RiValue[] toArray(List parameters, RiValue target) { + RiValue[] result = new RiValue[parameters.size() + 1]; parameters.toArray(result); result[parameters.size()] = target; return result; diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/HotSpotAMD64Backend.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/HotSpotAMD64Backend.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/HotSpotAMD64Backend.java Thu Jun 07 18:12:01 2012 +0200 @@ -71,7 +71,7 @@ CiRegisterValue thread = r15.asValue(); CiAddress exceptionAddress = new CiAddress(RiKind.Object, thread, config.threadExceptionOopOffset); CiAddress pcAddress = new CiAddress(RiKind.Long, thread, config.threadExceptionPcOffset); - CiValue exception = emitLoad(exceptionAddress, false); + RiValue exception = emitLoad(exceptionAddress, false); emitStore(exceptionAddress, RiConstant.NULL_OBJECT, false); emitStore(pcAddress, RiConstant.LONG_0, false); setResult(x, exception); @@ -121,7 +121,7 @@ int frameSize = tasm.frameMap.frameSize(); AMD64MacroAssembler asm = (AMD64MacroAssembler) tasm.asm; CiCalleeSaveLayout csl = tasm.frameMap.registerConfig.getCalleeSaveLayout(); - RiRegisterConfig regConfig = tasm.frameMap.registerConfig; + CiRegisterConfig regConfig = tasm.frameMap.registerConfig; if (csl != null && csl.size != 0) { tasm.targetMethod.setRegisterRestoreEpilogueOffset(asm.codeBuffer.position()); @@ -178,7 +178,7 @@ public void emitCode(TargetMethodAssembler tasm, RiResolvedMethod method, LIR lir) { AMD64MacroAssembler asm = (AMD64MacroAssembler) tasm.asm; FrameMap frameMap = tasm.frameMap; - RiRegisterConfig regConfig = frameMap.registerConfig; + CiRegisterConfig regConfig = frameMap.registerConfig; HotSpotVMConfig config = ((HotSpotRuntime) runtime).config; Label unverifiedStub = new Label(); diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java --- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java Thu Jun 07 18:12:01 2012 +0200 @@ -286,7 +286,7 @@ if (riType instanceof RiResolvedType) { frameState.push(RiKind.Object, append(ConstantNode.forCiConstant(((RiResolvedType) riType).getEncoding(Representation.JavaClass), runtime, currentGraph))); } else { - append(currentGraph.add(new DeoptimizeNode(RiDeoptAction.InvalidateRecompile, RiDeoptReason.Unresolved, graphId))); + append(currentGraph.add(new DeoptimizeNode(CiDeoptAction.InvalidateRecompile, CiDeoptReason.Unresolved, graphId))); frameState.push(RiKind.Object, append(ConstantNode.forObject(null, runtime, currentGraph))); } } else if (con instanceof RiConstant) { @@ -565,7 +565,7 @@ private void genThrow() { ValueNode exception = frameState.apop(); - FixedGuardNode node = currentGraph.add(new FixedGuardNode(currentGraph.unique(new IsNullNode(exception)), RiDeoptReason.NullCheckException, RiDeoptAction.InvalidateReprofile, true, graphId)); + FixedGuardNode node = currentGraph.add(new FixedGuardNode(currentGraph.unique(new IsNullNode(exception)), CiDeoptReason.NullCheckException, CiDeoptAction.InvalidateReprofile, true, graphId)); append(node); append(handleException(exception, bci())); } @@ -635,7 +635,7 @@ frameState.apush(checkCast); } else { ValueNode object = frameState.apop(); - append(currentGraph.add(new FixedGuardNode(currentGraph.unique(new IsNullNode(object)), RiDeoptReason.Unresolved, RiDeoptAction.InvalidateRecompile, graphId))); + append(currentGraph.add(new FixedGuardNode(currentGraph.unique(new IsNullNode(object)), CiDeoptReason.Unresolved, CiDeoptAction.InvalidateRecompile, graphId))); frameState.apush(appendConstant(RiConstant.NULL_OBJECT)); } } @@ -651,7 +651,7 @@ frameState.ipush(append(MaterializeNode.create(currentGraph.unique(instanceOfNode), currentGraph))); } else { BlockPlaceholderNode successor = currentGraph.add(new BlockPlaceholderNode()); - DeoptimizeNode deopt = currentGraph.add(new DeoptimizeNode(RiDeoptAction.InvalidateRecompile, RiDeoptReason.Unresolved, graphId)); + DeoptimizeNode deopt = currentGraph.add(new DeoptimizeNode(CiDeoptAction.InvalidateRecompile, CiDeoptReason.Unresolved, graphId)); IfNode ifNode = currentGraph.add(new IfNode(currentGraph.unique(new IsNullNode(object)), successor, deopt, 0)); append(ifNode); lastInstr = successor; @@ -665,7 +665,7 @@ NewInstanceNode n = currentGraph.add(new NewInstanceNode((RiResolvedType) type)); frameState.apush(append(n)); } else { - append(currentGraph.add(new DeoptimizeNode(RiDeoptAction.InvalidateRecompile, RiDeoptReason.Unresolved, graphId))); + append(currentGraph.add(new DeoptimizeNode(CiDeoptAction.InvalidateRecompile, CiDeoptReason.Unresolved, graphId))); frameState.apush(appendConstant(RiConstant.NULL_OBJECT)); } } @@ -706,7 +706,7 @@ NewArrayNode n = currentGraph.add(new NewObjectArrayNode((RiResolvedType) type, length)); frameState.apush(append(n)); } else { - append(currentGraph.add(new DeoptimizeNode(RiDeoptAction.InvalidateRecompile, RiDeoptReason.Unresolved, graphId))); + append(currentGraph.add(new DeoptimizeNode(CiDeoptAction.InvalidateRecompile, CiDeoptReason.Unresolved, graphId))); frameState.apush(appendConstant(RiConstant.NULL_OBJECT)); } @@ -723,7 +723,7 @@ FixedWithNextNode n = currentGraph.add(new NewMultiArrayNode((RiResolvedType) type, dims)); frameState.apush(append(n)); } else { - append(currentGraph.add(new DeoptimizeNode(RiDeoptAction.InvalidateRecompile, RiDeoptReason.Unresolved, graphId))); + append(currentGraph.add(new DeoptimizeNode(CiDeoptAction.InvalidateRecompile, CiDeoptReason.Unresolved, graphId))); frameState.apush(appendConstant(RiConstant.NULL_OBJECT)); } } @@ -737,7 +737,7 @@ LoadFieldNode load = currentGraph.add(new LoadFieldNode(receiver, (RiResolvedField) field, graphId)); appendOptimizedLoadField(kind, load); } else { - append(currentGraph.add(new DeoptimizeNode(RiDeoptAction.InvalidateRecompile, RiDeoptReason.Unresolved, graphId))); + append(currentGraph.add(new DeoptimizeNode(CiDeoptAction.InvalidateRecompile, CiDeoptReason.Unresolved, graphId))); frameState.push(kind.stackKind(), append(ConstantNode.defaultForKind(kind, currentGraph))); } } @@ -814,7 +814,7 @@ StoreFieldNode store = currentGraph.add(new StoreFieldNode(receiver, (RiResolvedField) field, value, graphId)); appendOptimizedStoreField(store); } else { - append(currentGraph.add(new DeoptimizeNode(RiDeoptAction.InvalidateRecompile, RiDeoptReason.Unresolved, graphId))); + append(currentGraph.add(new DeoptimizeNode(CiDeoptAction.InvalidateRecompile, CiDeoptReason.Unresolved, graphId))); } } @@ -856,7 +856,7 @@ if (initialized) { return appendConstant(((RiResolvedType) holder).getEncoding(representation)); } else { - append(currentGraph.add(new DeoptimizeNode(RiDeoptAction.InvalidateRecompile, RiDeoptReason.Unresolved, graphId))); + append(currentGraph.add(new DeoptimizeNode(CiDeoptAction.InvalidateRecompile, CiDeoptReason.Unresolved, graphId))); return null; } } @@ -917,7 +917,7 @@ } private void genInvokeDeopt(RiMethod unresolvedTarget, boolean withReceiver) { - append(currentGraph.add(new DeoptimizeNode(RiDeoptAction.InvalidateRecompile, RiDeoptReason.Unresolved, graphId))); + append(currentGraph.add(new DeoptimizeNode(CiDeoptAction.InvalidateRecompile, CiDeoptReason.Unresolved, graphId))); frameState.popArguments(unresolvedTarget.signature().argumentSlots(withReceiver), unresolvedTarget.signature().argumentCount(withReceiver)); RiKind kind = unresolvedTarget.signature().returnKind(false); if (kind != RiKind.Void) { @@ -957,7 +957,7 @@ private void appendInvoke(InvokeKind invokeKind, RiResolvedMethod targetMethod, ValueNode[] args) { RiKind resultType = targetMethod.signature().returnKind(false); if (GraalOptions.DeoptALot) { - DeoptimizeNode deoptimize = currentGraph.add(new DeoptimizeNode(RiDeoptAction.None, RiDeoptReason.RuntimeConstraint, graphId)); + DeoptimizeNode deoptimize = currentGraph.add(new DeoptimizeNode(CiDeoptAction.None, CiDeoptReason.RuntimeConstraint, graphId)); deoptimize.setMessage("invoke " + targetMethod.name()); append(deoptimize); frameState.pushReturn(resultType, ConstantNode.defaultForKind(resultType, currentGraph)); @@ -1029,7 +1029,7 @@ ValueNode local = frameState.loadLocal(localIndex); JsrScope scope = currentBlock.jsrScope; int retAddress = scope.nextReturnAddress(); - append(currentGraph.add(new FixedGuardNode(currentGraph.unique(new IntegerEqualsNode(local, ConstantNode.forJsr(retAddress, currentGraph))), RiDeoptReason.JavaSubroutineMismatch, RiDeoptAction.InvalidateReprofile, graphId))); + append(currentGraph.add(new FixedGuardNode(currentGraph.unique(new IntegerEqualsNode(local, ConstantNode.forJsr(retAddress, currentGraph))), CiDeoptReason.JavaSubroutineMismatch, CiDeoptAction.InvalidateReprofile, graphId))); if (!successor.jsrScope.equals(scope.pop())) { throw new JsrNotSupportedBailout("unstructured control flow (ret leaves more than one scope)"); } @@ -1186,7 +1186,7 @@ private FixedNode createTarget(double probability, Block block, FrameStateBuilder stateAfter) { assert probability >= 0 && probability <= 1; if (probability == 0 && optimisticOpts.removeNeverExecutedCode()) { - return currentGraph.add(new DeoptimizeNode(RiDeoptAction.InvalidateReprofile, RiDeoptReason.UnreachedCode, graphId)); + return currentGraph.add(new DeoptimizeNode(CiDeoptAction.InvalidateReprofile, CiDeoptReason.UnreachedCode, graphId)); } else { return createTarget(block, stateAfter); } diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Arithmetic.java --- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Arithmetic.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Arithmetic.java Thu Jun 07 18:12:01 2012 +0200 @@ -29,7 +29,6 @@ import com.oracle.max.asm.*; import com.oracle.max.asm.target.amd64.*; import com.oracle.max.asm.target.amd64.AMD64Assembler.ConditionFlag; -import com.oracle.max.cri.ci.*; import com.oracle.max.cri.ri.*; import com.oracle.graal.graph.*; import com.oracle.graal.lir.*; @@ -49,14 +48,14 @@ public static class Op1Reg extends AMD64LIRInstruction { - public Op1Reg(AMD64Arithmetic opcode, CiValue result, CiValue x) { - super(opcode, new CiValue[] {result}, null, new CiValue[] {x}, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS); + public Op1Reg(AMD64Arithmetic opcode, RiValue result, RiValue x) { + super(opcode, new RiValue[] {result}, null, new RiValue[] {x}, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS); } @Override public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) { - CiValue result = output(0); - CiValue x = input(0); + RiValue result = output(0); + RiValue x = input(0); emit(tasm, masm, (AMD64Arithmetic) code, result, x, null); } @@ -73,14 +72,14 @@ } public static class Op1Stack extends AMD64LIRInstruction { - public Op1Stack(AMD64Arithmetic opcode, CiValue result, CiValue x) { - super(opcode, new CiValue[] {result}, null, new CiValue[] {x}, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS); + public Op1Stack(AMD64Arithmetic opcode, RiValue result, RiValue x) { + super(opcode, new RiValue[] {result}, null, new RiValue[] {x}, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS); } @Override public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) { - CiValue result = output(0); - CiValue x = input(0); + RiValue result = output(0); + RiValue x = input(0); AMD64Move.move(tasm, masm, result, x); emit(tasm, masm, (AMD64Arithmetic) code, result); @@ -98,15 +97,15 @@ } public static class Op2Stack extends AMD64LIRInstruction { - public Op2Stack(AMD64Arithmetic opcode, CiValue result, CiValue x, CiValue y) { - super(opcode, new CiValue[] {result}, null, new CiValue[] {x}, new CiValue[] {y}, LIRInstruction.NO_OPERANDS); + public Op2Stack(AMD64Arithmetic opcode, RiValue result, RiValue x, RiValue y) { + super(opcode, new RiValue[] {result}, null, new RiValue[] {x}, new RiValue[] {y}, LIRInstruction.NO_OPERANDS); } @Override public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) { - CiValue result = output(0); - CiValue x = input(0); - CiValue y = alive(0); + RiValue result = output(0); + RiValue x = input(0); + RiValue y = alive(0); AMD64Move.move(tasm, masm, result, x); emit(tasm, masm, (AMD64Arithmetic) code, result, y, null); @@ -126,9 +125,9 @@ @Override public void verify() { - CiValue result = output(0); - CiValue x = input(0); - CiValue y = alive(0); + RiValue result = output(0); + RiValue x = input(0); + RiValue y = alive(0); super.verify(); assert differentRegisters(result, y) || sameRegister(x, y); @@ -137,15 +136,15 @@ } public static class Op2Reg extends AMD64LIRInstruction { - public Op2Reg(AMD64Arithmetic opcode, CiValue result, CiValue x, CiValue y) { - super(opcode, new CiValue[] {result}, null, new CiValue[] {x}, new CiValue[] {y}, LIRInstruction.NO_OPERANDS); + public Op2Reg(AMD64Arithmetic opcode, RiValue result, RiValue x, RiValue y) { + super(opcode, new RiValue[] {result}, null, new RiValue[] {x}, new RiValue[] {y}, LIRInstruction.NO_OPERANDS); } @Override public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) { - CiValue result = output(0); - CiValue x = input(0); - CiValue y = alive(0); + RiValue result = output(0); + RiValue x = input(0); + RiValue y = alive(0); AMD64Move.move(tasm, masm, result, x); emit(tasm, masm, (AMD64Arithmetic) code, result, y, null); @@ -165,9 +164,9 @@ @Override public void verify() { - CiValue result = output(0); - CiValue x = input(0); - CiValue y = alive(0); + RiValue result = output(0); + RiValue x = input(0); + RiValue y = alive(0); super.verify(); assert differentRegisters(result, y) || sameRegister(x, y); @@ -176,15 +175,15 @@ } public static class Op2RegCommutative extends AMD64LIRInstruction { - public Op2RegCommutative(AMD64Arithmetic opcode, CiValue result, CiValue x, CiValue y) { - super(opcode, new CiValue[] {result}, null, new CiValue[] {x, y}, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS); + public Op2RegCommutative(AMD64Arithmetic opcode, RiValue result, RiValue x, RiValue y) { + super(opcode, new RiValue[] {result}, null, new RiValue[] {x, y}, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS); } @Override public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) { - CiValue result = output(0); - CiValue x = input(0); - CiValue y = input(1); + RiValue result = output(0); + RiValue x = input(0); + RiValue y = input(1); if (sameRegister(result, y)) { emit(tasm, masm, (AMD64Arithmetic) code, result, x, null); @@ -208,9 +207,9 @@ @Override protected void verify() { - CiValue result = output(0); - CiValue x = input(0); - CiValue y = input(1); + RiValue result = output(0); + RiValue x = input(0); + RiValue y = input(1); super.verify(); verifyKind((AMD64Arithmetic) code, result, x, y); @@ -218,15 +217,15 @@ } public static class ShiftOp extends AMD64LIRInstruction { - public ShiftOp(AMD64Arithmetic opcode, CiValue result, CiValue x, CiValue y) { - super(opcode, new CiValue[] {result}, null, new CiValue[] {x}, new CiValue[] {y}, LIRInstruction.NO_OPERANDS); + public ShiftOp(AMD64Arithmetic opcode, RiValue result, RiValue x, RiValue y) { + super(opcode, new RiValue[] {result}, null, new RiValue[] {x}, new RiValue[] {y}, LIRInstruction.NO_OPERANDS); } @Override public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) { - CiValue result = output(0); - CiValue x = input(0); - CiValue y = alive(0); + RiValue result = output(0); + RiValue x = input(0); + RiValue y = alive(0); AMD64Move.move(tasm, masm, result, x); emit(tasm, masm, (AMD64Arithmetic) code, result, y, null); @@ -246,9 +245,9 @@ @Override public void verify() { - CiValue result = output(0); - CiValue x = input(0); - CiValue y = alive(0); + RiValue result = output(0); + RiValue x = input(0); + RiValue y = alive(0); super.verify(); assert isConstant(y) || asRegister(y) == AMD64.rcx; @@ -259,14 +258,14 @@ } public static class DivOp extends AMD64LIRInstruction { - public DivOp(AMD64Arithmetic opcode, CiValue result, CiValue x, CiValue y, LIRDebugInfo info) { - super(opcode, new CiValue[] {result}, info, new CiValue[] {x}, new CiValue[] {y}, new CiValue[] {asRegister(result) == AMD64.rax ? AMD64.rdx.asValue(result.kind) : AMD64.rax.asValue(result.kind)}); + public DivOp(AMD64Arithmetic opcode, RiValue result, RiValue x, RiValue y, LIRDebugInfo info) { + super(opcode, new RiValue[] {result}, info, new RiValue[] {x}, new RiValue[] {y}, new RiValue[] {asRegister(result) == AMD64.rax ? AMD64.rdx.asValue(result.kind) : AMD64.rax.asValue(result.kind)}); } @Override public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) { - CiValue result = output(0); - CiValue y = alive(0); + RiValue result = output(0); + RiValue y = alive(0); emit(tasm, masm, (AMD64Arithmetic) code, result, y, info); } @@ -287,9 +286,9 @@ @Override protected void verify() { - CiValue result = output(0); - CiValue x = input(0); - CiValue y = alive(0); + RiValue result = output(0); + RiValue x = input(0); + RiValue y = alive(0); super.verify(); // left input in rax, right input in any register but rax and rdx, result quotient in rax, result remainder in rdx @@ -302,7 +301,7 @@ @SuppressWarnings("unused") - protected static void emit(TargetMethodAssembler tasm, AMD64MacroAssembler masm, AMD64Arithmetic opcode, CiValue result) { + protected static void emit(TargetMethodAssembler tasm, AMD64MacroAssembler masm, AMD64Arithmetic opcode, RiValue result) { switch (opcode) { case INEG: masm.negl(asIntReg(result)); break; case LNEG: masm.negq(asLongReg(result)); break; @@ -314,7 +313,7 @@ } } - public static void emit(TargetMethodAssembler tasm, AMD64MacroAssembler masm, AMD64Arithmetic opcode, CiValue dst, CiValue src, LIRDebugInfo info) { + public static void emit(TargetMethodAssembler tasm, AMD64MacroAssembler masm, AMD64Arithmetic opcode, RiValue dst, RiValue src, LIRDebugInfo info) { int exceptionOffset = -1; if (isRegister(src)) { switch (opcode) { @@ -499,7 +498,7 @@ } } - private static void emitConvertFixup(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue result, CiValue x) { + private static void emitConvertFixup(TargetMethodAssembler tasm, AMD64MacroAssembler masm, RiValue result, RiValue x) { ConvertSlowPath slowPath = new ConvertSlowPath(result, x); tasm.stubs.add(slowPath); switch (result.kind) { @@ -514,10 +513,10 @@ private static class ConvertSlowPath extends AMD64Code { public final Label start = new Label(); public final Label continuation = new Label(); - private final CiValue result; - private final CiValue x; + private final RiValue result; + private final RiValue x; - public ConvertSlowPath(CiValue result, CiValue x) { + public ConvertSlowPath(RiValue result, RiValue x) { this.result = result; this.x = x; } @@ -556,7 +555,7 @@ } - private static void verifyKind(AMD64Arithmetic opcode, CiValue result, CiValue x, CiValue y) { + private static void verifyKind(AMD64Arithmetic opcode, RiValue result, RiValue x, RiValue y) { assert (opcode.name().startsWith("I") && result.kind == RiKind.Int && x.kind.stackKind() == RiKind.Int && y.kind.stackKind() == RiKind.Int) || (opcode.name().startsWith("L") && result.kind == RiKind.Long && x.kind == RiKind.Long && y.kind == RiKind.Long) || (opcode.name().startsWith("F") && result.kind == RiKind.Float && x.kind == RiKind.Float && y.kind == RiKind.Float) diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Call.java --- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Call.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Call.java Thu Jun 07 18:12:01 2012 +0200 @@ -29,6 +29,7 @@ import com.oracle.max.asm.target.amd64.*; import com.oracle.max.cri.ci.*; import com.oracle.max.cri.ci.CiTargetMethod.Mark; +import com.oracle.max.cri.ri.*; import com.oracle.max.cri.xir.CiXirAssembler.XirMark; import com.oracle.graal.graph.*; import com.oracle.graal.lir.*; @@ -40,8 +41,8 @@ private final Object targetMethod; private final Map marks; - public DirectCallOp(Object targetMethod, CiValue result, CiValue[] parameters, LIRDebugInfo info, Map marks) { - super("CALL_DIRECT", new CiValue[] {result}, info, parameters, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS); + public DirectCallOp(Object targetMethod, RiValue result, RiValue[] parameters, LIRDebugInfo info, Map marks) { + super("CALL_DIRECT", new RiValue[] {result}, info, parameters, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS); this.targetMethod = targetMethod; this.marks = marks; } @@ -70,19 +71,19 @@ private final Object targetMethod; private final Map marks; - private static CiValue[] concat(CiValue[] parameters, CiValue targetAddress) { - CiValue[] result = Arrays.copyOf(parameters, parameters.length + 1); + private static RiValue[] concat(RiValue[] parameters, RiValue targetAddress) { + RiValue[] result = Arrays.copyOf(parameters, parameters.length + 1); result[result.length - 1] = targetAddress; return result; } - public IndirectCallOp(Object targetMethod, CiValue result, CiValue[] parameters, CiValue targetAddress, LIRDebugInfo info, Map marks) { - super("CALL_INDIRECT", new CiValue[] {result}, info, concat(parameters, targetAddress), LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS); + public IndirectCallOp(Object targetMethod, RiValue result, RiValue[] parameters, RiValue targetAddress, LIRDebugInfo info, Map marks) { + super("CALL_INDIRECT", new RiValue[] {result}, info, concat(parameters, targetAddress), LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS); this.targetMethod = targetMethod; this.marks = marks; } - private CiValue targetAddress() { + private RiValue targetAddress() { return input(inputs.length - 1); } diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Compare.java --- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Compare.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Compare.java Thu Jun 07 18:12:01 2012 +0200 @@ -27,7 +27,6 @@ import java.util.*; import com.oracle.max.asm.target.amd64.*; -import com.oracle.max.cri.ci.*; import com.oracle.max.cri.ri.*; import com.oracle.graal.graph.*; import com.oracle.graal.lir.*; @@ -37,14 +36,14 @@ ICMP, LCMP, ACMP, FCMP, DCMP; public static class CompareOp extends AMD64LIRInstruction { - public CompareOp(AMD64Compare opcode, CiValue x, CiValue y) { - super(opcode, LIRInstruction.NO_OPERANDS, null, new CiValue[] {x, y}, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS); + public CompareOp(AMD64Compare opcode, RiValue x, RiValue y) { + super(opcode, LIRInstruction.NO_OPERANDS, null, new RiValue[] {x, y}, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS); } @Override public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) { - CiValue x = input(0); - CiValue y = input(1); + RiValue x = input(0); + RiValue y = input(1); emit(tasm, masm, (AMD64Compare) code, x, y); } @@ -60,8 +59,8 @@ @Override protected void verify() { - CiValue x = input(0); - CiValue y = input(1); + RiValue x = input(0); + RiValue y = input(1); super.verify(); assert (name().startsWith("I") && x.kind == RiKind.Int && y.kind.stackKind() == RiKind.Int) @@ -73,7 +72,7 @@ } } - public static void emit(TargetMethodAssembler tasm, AMD64MacroAssembler masm, AMD64Compare opcode, CiValue x, CiValue y) { + public static void emit(TargetMethodAssembler tasm, AMD64MacroAssembler masm, AMD64Compare opcode, RiValue x, RiValue y) { if (isRegister(y)) { switch (opcode) { case ICMP: masm.cmpl(asIntReg(x), asIntReg(y)); break; diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64ControlFlow.java --- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64ControlFlow.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64ControlFlow.java Thu Jun 07 18:12:01 2012 +0200 @@ -41,8 +41,8 @@ public class AMD64ControlFlow { public static class ReturnOp extends AMD64LIRInstruction { - public ReturnOp(CiValue input) { - super("RETURN", LIRInstruction.NO_OPERANDS, null, new CiValue[] {input}, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS); + public ReturnOp(RiValue input) { + super("RETURN", LIRInstruction.NO_OPERANDS, null, new RiValue[] {input}, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS); } @Override @@ -137,7 +137,7 @@ private final LabelRef[] targets; public TableSwitchOp(final int lowKey, final LabelRef defaultTarget, final LabelRef[] targets, Variable index, Variable scratch) { - super("TABLE_SWITCH", LIRInstruction.NO_OPERANDS, null, LIRInstruction.NO_OPERANDS, new CiValue[] {index}, new CiValue[] {scratch}); + super("TABLE_SWITCH", LIRInstruction.NO_OPERANDS, null, LIRInstruction.NO_OPERANDS, new RiValue[] {index}, new RiValue[] {scratch}); this.lowKey = lowKey; this.defaultTarget = defaultTarget; this.targets = targets; @@ -175,8 +175,8 @@ public static class CondMoveOp extends AMD64LIRInstruction { private final ConditionFlag condition; - public CondMoveOp(Variable result, Condition condition, Variable trueValue, CiValue falseValue) { - super("CMOVE", new CiValue[] {result}, null, new CiValue[] {falseValue}, new CiValue[] {trueValue}, LIRInstruction.NO_OPERANDS); + public CondMoveOp(Variable result, Condition condition, Variable trueValue, RiValue falseValue) { + super("CMOVE", new RiValue[] {result}, null, new RiValue[] {falseValue}, new RiValue[] {trueValue}, LIRInstruction.NO_OPERANDS); this.condition = intCond(condition); } @@ -209,7 +209,7 @@ private final boolean unorderedIsTrue; public FloatCondMoveOp(Variable result, Condition condition, boolean unorderedIsTrue, Variable trueValue, Variable falseValue) { - super("FLOAT_CMOVE", new CiValue[] {result}, null, LIRInstruction.NO_OPERANDS, new CiValue[] {trueValue, falseValue}, LIRInstruction.NO_OPERANDS); + super("FLOAT_CMOVE", new RiValue[] {result}, null, LIRInstruction.NO_OPERANDS, new RiValue[] {trueValue, falseValue}, LIRInstruction.NO_OPERANDS); this.condition = floatCond(condition); this.unorderedIsTrue = unorderedIsTrue; } @@ -305,7 +305,7 @@ masm.bind(endLabel); } - private static void cmove(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue result, boolean isFloat, ConditionFlag condition, boolean unorderedIsTrue, CiValue trueValue, CiValue falseValue) { + private static void cmove(TargetMethodAssembler tasm, AMD64MacroAssembler masm, RiValue result, boolean isFloat, ConditionFlag condition, boolean unorderedIsTrue, RiValue trueValue, RiValue falseValue) { // check that we don't overwrite an input operand before it is used. assert !result.equals(trueValue); @@ -321,7 +321,7 @@ } } - private static void cmove(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue result, ConditionFlag cond, CiValue other) { + private static void cmove(TargetMethodAssembler tasm, AMD64MacroAssembler masm, RiValue result, ConditionFlag cond, RiValue other) { if (isRegister(other)) { assert asRegister(other) != asRegister(result) : "other already overwritten by previous move"; switch (other.kind) { diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64LIRInstruction.java --- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64LIRInstruction.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64LIRInstruction.java Thu Jun 07 18:12:01 2012 +0200 @@ -23,7 +23,7 @@ package com.oracle.graal.lir.amd64; import com.oracle.max.asm.target.amd64.*; -import com.oracle.max.cri.ci.*; +import com.oracle.max.cri.ri.*; import com.oracle.graal.lir.*; import com.oracle.graal.lir.asm.*; @@ -32,7 +32,7 @@ */ public abstract class AMD64LIRInstruction extends LIRInstruction { - public AMD64LIRInstruction(Object opcode, CiValue[] outputs, LIRDebugInfo info, CiValue[] inputs, CiValue[] alives, CiValue[] temps) { + public AMD64LIRInstruction(Object opcode, RiValue[] outputs, LIRDebugInfo info, RiValue[] inputs, RiValue[] alives, RiValue[] temps) { super(opcode, outputs, info, inputs, alives, temps); } diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Move.java --- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Move.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Move.java Thu Jun 07 18:12:01 2012 +0200 @@ -40,8 +40,8 @@ public class AMD64Move { public static class SpillMoveOp extends AMD64LIRInstruction implements MoveOp { - public SpillMoveOp(CiValue result, CiValue input) { - super("MOVE", new CiValue[] {result}, null, new CiValue[] {input}, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS); + public SpillMoveOp(RiValue result, RiValue input) { + super("MOVE", new RiValue[] {result}, null, new RiValue[] {input}, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS); } @Override @@ -50,11 +50,11 @@ } @Override - public CiValue getInput() { + public RiValue getInput() { return input(0); } @Override - public CiValue getResult() { + public RiValue getResult() { return output(0); } @@ -71,8 +71,8 @@ public static class MoveToRegOp extends AMD64LIRInstruction implements MoveOp { - public MoveToRegOp(CiValue result, CiValue input) { - super("MOVE", new CiValue[] {result}, null, new CiValue[] {input}, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS); + public MoveToRegOp(RiValue result, RiValue input) { + super("MOVE", new RiValue[] {result}, null, new RiValue[] {input}, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS); } @Override @@ -81,11 +81,11 @@ } @Override - public CiValue getInput() { + public RiValue getInput() { return input(0); } @Override - public CiValue getResult() { + public RiValue getResult() { return output(0); } @@ -102,8 +102,8 @@ public static class MoveFromRegOp extends AMD64LIRInstruction implements MoveOp { - public MoveFromRegOp(CiValue result, CiValue input) { - super("MOVE", new CiValue[] {result}, null, new CiValue[] {input}, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS); + public MoveFromRegOp(RiValue result, RiValue input) { + super("MOVE", new RiValue[] {result}, null, new RiValue[] {input}, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS); } @Override @@ -112,11 +112,11 @@ } @Override - public CiValue getInput() { + public RiValue getInput() { return input(0); } @Override - public CiValue getResult() { + public RiValue getResult() { return output(0); } @@ -133,8 +133,8 @@ public static class LoadOp extends AMD64LIRInstruction { - public LoadOp(CiValue result, CiValue address, LIRDebugInfo info) { - super("LOAD", new CiValue[] {result}, info, new CiValue[] {address}, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS); + public LoadOp(RiValue result, RiValue address, LIRDebugInfo info) { + super("LOAD", new RiValue[] {result}, info, new RiValue[] {address}, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS); } @Override @@ -155,8 +155,8 @@ public static class StoreOp extends AMD64LIRInstruction { - public StoreOp(CiValue address, CiValue input, LIRDebugInfo info) { - super("STORE", LIRInstruction.NO_OPERANDS, info, new CiValue[] {address, input}, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS); + public StoreOp(RiValue address, RiValue input, LIRDebugInfo info) { + super("STORE", LIRInstruction.NO_OPERANDS, info, new RiValue[] {address, input}, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS); } @Override @@ -177,8 +177,8 @@ public static class LeaOp extends AMD64LIRInstruction { - public LeaOp(CiValue result, CiValue address) { - super("LEA", new CiValue[] {result}, null, new CiValue[] {address}, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS); + public LeaOp(RiValue result, RiValue address) { + super("LEA", new RiValue[] {result}, null, new RiValue[] {address}, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS); } @Override @@ -220,7 +220,7 @@ public static class NullCheckOp extends AMD64LIRInstruction { public NullCheckOp(Variable input, LIRDebugInfo info) { - super("NULL_CHECK", LIRInstruction.NO_OPERANDS, info, new CiValue[] {input}, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS); + super("NULL_CHECK", LIRInstruction.NO_OPERANDS, info, new RiValue[] {input}, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS); } @Override @@ -240,8 +240,8 @@ public static class CompareAndSwapOp extends AMD64LIRInstruction { - public CompareAndSwapOp(CiValue result, CiAddress address, CiValue cmpValue, CiValue newValue) { - super("CAS", new CiValue[] {result}, null, new CiValue[] {address, cmpValue, newValue}, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS); + public CompareAndSwapOp(RiValue result, CiAddress address, RiValue cmpValue, RiValue newValue) { + super("CAS", new RiValue[] {result}, null, new RiValue[] {address, cmpValue, newValue}, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS); } @Override @@ -265,7 +265,7 @@ } - public static void move(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue result, CiValue input) { + public static void move(TargetMethodAssembler tasm, AMD64MacroAssembler masm, RiValue result, RiValue input) { if (isRegister(input)) { if (isRegister(result)) { reg2reg(masm, result, input); @@ -293,7 +293,7 @@ } } - private static void reg2reg(AMD64MacroAssembler masm, CiValue result, CiValue input) { + private static void reg2reg(AMD64MacroAssembler masm, RiValue result, RiValue input) { if (input.equals(result)) { return; } @@ -308,7 +308,7 @@ } } - private static void reg2stack(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue result, CiValue input) { + private static void reg2stack(TargetMethodAssembler tasm, AMD64MacroAssembler masm, RiValue result, RiValue input) { switch (input.kind) { case Jsr: case Int: masm.movl(tasm.asAddress(result), asRegister(input)); break; @@ -320,7 +320,7 @@ } } - private static void stack2reg(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue result, CiValue input) { + private static void stack2reg(TargetMethodAssembler tasm, AMD64MacroAssembler masm, RiValue result, RiValue input) { switch (input.kind) { case Jsr: case Int: masm.movl(asRegister(result), tasm.asAddress(input)); break; @@ -332,7 +332,7 @@ } } - private static void const2reg(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue result, RiConstant input) { + private static void const2reg(TargetMethodAssembler tasm, AMD64MacroAssembler masm, RiValue result, RiConstant input) { // Note: we use the kind of the input operand (and not the kind of the result operand) because they don't match // in all cases. For example, an object constant can be loaded to a long register when unsafe casts occurred (e.g., // for a write barrier where arithmetic operations are then performed on the pointer). @@ -384,7 +384,7 @@ } } - private static void const2stack(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue result, RiConstant input) { + private static void const2stack(TargetMethodAssembler tasm, AMD64MacroAssembler masm, RiValue result, RiConstant input) { switch (input.kind.stackKind()) { case Jsr: case Int: masm.movl(tasm.asAddress(result), input.asInt()); break; @@ -404,7 +404,7 @@ } - public static void load(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue result, CiAddress loadAddr, LIRDebugInfo info) { + public static void load(TargetMethodAssembler tasm, AMD64MacroAssembler masm, RiValue result, CiAddress loadAddr, LIRDebugInfo info) { if (info != null) { tasm.recordImplicitException(masm.codeBuffer.position(), info); } @@ -422,7 +422,7 @@ } } - public static void store(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiAddress storeAddr, CiValue input, LIRDebugInfo info) { + public static void store(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiAddress storeAddr, RiValue input, LIRDebugInfo info) { if (info != null) { tasm.recordImplicitException(masm.codeBuffer.position(), info); } @@ -474,7 +474,7 @@ } } - protected static void compareAndSwap(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue result, CiAddress address, CiValue cmpValue, CiValue newValue) { + protected static void compareAndSwap(TargetMethodAssembler tasm, AMD64MacroAssembler masm, RiValue result, CiAddress address, RiValue cmpValue, RiValue newValue) { assert asRegister(cmpValue) == AMD64.rax && asRegister(result) == AMD64.rax; if (tasm.target.isMP) { diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.lir/src/com/oracle/graal/lir/FrameMap.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/FrameMap.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/FrameMap.java Thu Jun 07 18:12:01 2012 +0200 @@ -82,7 +82,7 @@ public final class FrameMap { public final RiRuntime runtime; public final CiTarget target; - public final RiRegisterConfig registerConfig; + public final CiRegisterConfig registerConfig; /** * The initial frame size, not including the size of the return address. @@ -125,7 +125,7 @@ /** * Creates a new frame map for the specified method. */ - public FrameMap(RiRuntime runtime, CiTarget target, RiRegisterConfig registerConfig) { + public FrameMap(RiRuntime runtime, CiTarget target, CiRegisterConfig registerConfig) { this.runtime = runtime; this.target = target; this.registerConfig = registerConfig; @@ -323,7 +323,7 @@ * @param registerRefMap A register reference map, as created by {@link #initRegisterRefMap()}. * @param frameRefMap A frame reference map, as created by {@link #initFrameRefMap()}. */ - public void setReference(CiValue location, CiBitMap registerRefMap, CiBitMap frameRefMap) { + public void setReference(RiValue location, CiBitMap registerRefMap, CiBitMap frameRefMap) { if (location.kind == RiKind.Object) { if (isRegister(location)) { assert registerRefMap.size() == target.arch.registerReferenceMapBitCount; @@ -347,7 +347,7 @@ * @param registerRefMap A register reference map, as created by {@link #initRegisterRefMap()}. * @param frameRefMap A frame reference map, as created by {@link #initFrameRefMap()}. */ - public void clearReference(CiValue location, CiBitMap registerRefMap, CiBitMap frameRefMap) { + public void clearReference(RiValue location, CiBitMap registerRefMap, CiBitMap frameRefMap) { if (location.kind == RiKind.Object) { if (location instanceof CiRegisterValue) { assert registerRefMap.size() == target.arch.registerReferenceMapBitCount; diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIR.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIR.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIR.java Thu Jun 07 18:12:01 2012 +0200 @@ -24,7 +24,7 @@ import java.util.*; -import com.oracle.max.cri.ci.*; +import com.oracle.max.cri.ri.*; import com.oracle.graal.debug.*; import com.oracle.graal.graph.*; import com.oracle.graal.lir.asm.*; @@ -65,8 +65,8 @@ public SpillMoveFactory spillMoveFactory; public interface SpillMoveFactory { - LIRInstruction createMove(CiValue result, CiValue input); - LIRInstruction createExchange(CiValue input1, CiValue input2); + LIRInstruction createMove(RiValue result, RiValue input); + LIRInstruction createExchange(RiValue input1, RiValue input2); } private boolean hasArgInCallerFrame; diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRDebugInfo.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRDebugInfo.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRDebugInfo.java Thu Jun 07 18:12:01 2012 +0200 @@ -27,6 +27,7 @@ import java.util.*; import com.oracle.max.cri.ci.*; +import com.oracle.max.cri.ri.*; import com.oracle.graal.lir.LIRInstruction.OperandFlag; import com.oracle.graal.lir.LIRInstruction.OperandMode; import com.oracle.graal.lir.LIRInstruction.ValueProcedure; @@ -78,9 +79,9 @@ */ private static final EnumSet STATE_FLAGS = EnumSet.of(OperandFlag.Register, OperandFlag.Stack); - private void processValues(CiValue[] values, ValueProcedure proc) { + private void processValues(RiValue[] values, ValueProcedure proc) { for (int i = 0; i < values.length; i++) { - CiValue value = values[i]; + RiValue value = values[i]; if (value instanceof CiMonitorValue) { CiMonitorValue monitor = (CiMonitorValue) value; if (processed(monitor.owner)) { @@ -93,7 +94,7 @@ } } - private boolean processed(CiValue value) { + private boolean processed(RiValue value) { if (isIllegal(value)) { // Ignore dead local variables. return false; diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRInstruction.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRInstruction.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRInstruction.java Thu Jun 07 18:12:01 2012 +0200 @@ -27,6 +27,7 @@ import java.util.*; import com.oracle.max.cri.ci.*; +import com.oracle.max.cri.ri.*; import com.oracle.graal.graph.*; import com.oracle.graal.lir.asm.*; @@ -35,7 +36,7 @@ */ public abstract class LIRInstruction { - public static final CiValue[] NO_OPERANDS = {}; + public static final RiValue[] NO_OPERANDS = {}; /** * Iterator for iterating over a list of values. Subclasses must overwrite one of the doValue methods. @@ -49,7 +50,7 @@ * @param value The value that is iterated. * @return The new value to replace the value that was passed in. */ - protected CiValue doValue(CiValue value) { + protected RiValue doValue(RiValue value) { throw GraalInternalError.shouldNotReachHere("One of the doValue() methods must be overwritten"); } @@ -62,7 +63,7 @@ * @param flags A set of flags for the value. * @return The new value to replace the value that was passed in. */ - public CiValue doValue(CiValue value, OperandMode mode, EnumSet flags) { + public RiValue doValue(RiValue value, OperandMode mode, EnumSet flags) { return doValue(value); } } @@ -163,22 +164,22 @@ /** * The output operands for this instruction (modified by the register allocator). */ - protected CiValue[] outputs; + protected RiValue[] outputs; /** * The input operands for this instruction (modified by the register allocator). */ - protected CiValue[] inputs; + protected RiValue[] inputs; /** * The alive operands for this instruction (modified by the register allocator). */ - protected CiValue[] alives; + protected RiValue[] alives; /** * The temp operands for this instruction (modified by the register allocator). */ - protected CiValue[] temps; + protected RiValue[] temps; /** * Used to emit debug information. @@ -199,7 +200,7 @@ * @param inputs the input operands for the instruction. * @param temps the temp operands for the instruction. */ - public LIRInstruction(Object opcode, CiValue[] outputs, LIRDebugInfo info, CiValue[] inputs, CiValue[] alives, CiValue[] temps) { + public LIRInstruction(Object opcode, RiValue[] outputs, LIRDebugInfo info, RiValue[] inputs, RiValue[] alives, RiValue[] temps) { this.code = opcode; this.outputs = outputs; this.inputs = inputs; @@ -226,7 +227,7 @@ * @param index the index of the operand requested. * @return the {@code index}'th input operand. */ - protected final CiValue input(int index) { + protected final RiValue input(int index) { return inputs[index]; } @@ -236,7 +237,7 @@ * @param index the index of the operand requested. * @return the {@code index}'th alive operand. */ - protected final CiValue alive(int index) { + protected final RiValue alive(int index) { return alives[index]; } @@ -246,7 +247,7 @@ * @param index the index of the operand requested. * @return the {@code index}'th temp operand. */ - protected final CiValue temp(int index) { + protected final RiValue temp(int index) { return temps[index]; } @@ -255,7 +256,7 @@ * * @return return the result operand */ - protected final CiValue output(int index) { + protected final RiValue output(int index) { return outputs[index]; } @@ -272,11 +273,11 @@ private static final EnumSet ADDRESS_FLAGS = EnumSet.of(OperandFlag.Register, OperandFlag.Illegal); - private void forEach(CiValue[] values, OperandMode mode, ValueProcedure proc) { + private void forEach(RiValue[] values, OperandMode mode, ValueProcedure proc) { for (int i = 0; i < values.length; i++) { assert ALLOWED_FLAGS.get(mode).containsAll(flagsFor(mode, i)); - CiValue value = values[i]; + RiValue value = values[i]; if (isAddress(value)) { assert flagsFor(mode, i).contains(OperandFlag.Address); CiAddress address = asAddress(value); @@ -337,8 +338,8 @@ * and the value is returned by this method, i.e., clients can stop the iteration once a suitable hint has been found. * @return The non-null value returned by the procedure, or null. */ - public CiValue forEachRegisterHint(CiValue value, OperandMode mode, ValueProcedure proc) { - CiValue[] hints; + public RiValue forEachRegisterHint(RiValue value, OperandMode mode, ValueProcedure proc) { + RiValue[] hints; if (mode == OperandMode.Input) { hints = outputs; } else if (mode == OperandMode.Output) { @@ -348,7 +349,7 @@ } for (int i = 0; i < hints.length; i++) { - CiValue result = proc.doValue(hints[i], null, null); + RiValue result = proc.doValue(hints[i], null, null); if (result != null) { return result; } @@ -385,7 +386,7 @@ if (outputs.length > 1) { buf.append("("); } - for (CiValue output : outputs) { + for (RiValue output : outputs) { buf.append(sep).append(output); sep = ", "; } @@ -400,11 +401,11 @@ buf.append("("); } sep = ""; - for (CiValue input : inputs) { + for (RiValue input : inputs) { buf.append(sep).append(input); sep = ", "; } - for (CiValue input : alives) { + for (RiValue input : alives) { buf.append(sep).append(input).append(" ~"); sep = ", "; } @@ -416,7 +417,7 @@ buf.append(" ["); } sep = ""; - for (CiValue temp : temps) { + for (RiValue temp : temps) { buf.append(sep).append(temp); sep = ", "; } diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRVerifier.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRVerifier.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRVerifier.java Thu Jun 07 18:12:01 2012 +0200 @@ -28,6 +28,7 @@ import java.util.*; import com.oracle.max.cri.ci.*; +import com.oracle.max.cri.ri.*; import com.oracle.max.criutils.*; import com.oracle.graal.graph.*; import com.oracle.graal.lir.LIRInstruction.*; @@ -53,12 +54,12 @@ return frameMap.target.arch.registers.length; } - private boolean isAllocatableRegister(CiValue value) { + private boolean isAllocatableRegister(RiValue value) { return isRegister(value) && frameMap.registerConfig.getAttributesMap()[asRegister(value).number].isAllocatable; } public static boolean verify(final LIRInstruction op) { - ValueProcedure allowedProc = new ValueProcedure() { @Override public CiValue doValue(CiValue value, OperandMode mode, EnumSet flags) { return allowed(op, value, mode, flags); } }; + ValueProcedure allowedProc = new ValueProcedure() { @Override public RiValue doValue(RiValue value, OperandMode mode, EnumSet flags) { return allowed(op, value, mode, flags); } }; op.forEachInput(allowedProc); op.forEachAlive(allowedProc); @@ -86,21 +87,21 @@ } private BitSet curVariablesLive; - private CiValue[] curRegistersLive; + private RiValue[] curRegistersLive; private Block curBlock; private Object curInstruction; private BitSet curRegistersDefined; private void verify() { - ValueProcedure useProc = new ValueProcedure() { @Override public CiValue doValue(CiValue value, OperandMode mode, EnumSet flags) { return use(value, mode, flags); } }; - ValueProcedure defProc = new ValueProcedure() { @Override public CiValue doValue(CiValue value, OperandMode mode, EnumSet flags) { return def(value, mode, flags); } }; + ValueProcedure useProc = new ValueProcedure() { @Override public RiValue doValue(RiValue value, OperandMode mode, EnumSet flags) { return use(value, mode, flags); } }; + ValueProcedure defProc = new ValueProcedure() { @Override public RiValue doValue(RiValue value, OperandMode mode, EnumSet flags) { return def(value, mode, flags); } }; curRegistersDefined = new BitSet(); for (Block block : lir.linearScanOrder()) { curBlock = block; curVariablesLive = new BitSet(); - curRegistersLive = new CiValue[maxRegisterNum()]; + curRegistersLive = new RiValue[maxRegisterNum()]; if (block.getDominator() != null) { curVariablesLive.or(liveOutFor(block.getDominator())); @@ -109,7 +110,7 @@ assert block.lir.get(0) instanceof StandardOp.LabelOp : "block must start with label"; if (block.numberOfPreds() > 1) { assert block.lir.get(0) instanceof StandardOp.PhiLabelOp : "phi mapping required for multiple predecessors"; - CiValue[] phiDefinitions = ((StandardOp.PhiLabelOp) block.lir.get(0)).getPhiDefinitions(); + RiValue[] phiDefinitions = ((StandardOp.PhiLabelOp) block.lir.get(0)).getPhiDefinitions(); if (!beforeRegisterAllocation) { assert phiDefinitions.length == 0; } @@ -117,7 +118,7 @@ assert pred.numberOfSux() == 1; LIRInstruction last = pred.lir.get(pred.lir.size() - 1); assert last instanceof StandardOp.PhiJumpOp : "phi mapping required for multiple successors"; - CiValue[] phiUses = ((StandardOp.PhiJumpOp) last).getPhiInputs(); + RiValue[] phiUses = ((StandardOp.PhiJumpOp) last).getPhiInputs(); if (!beforeRegisterAllocation) { assert phiUses.length == 0; } @@ -151,7 +152,7 @@ } } - private CiValue use(CiValue value, OperandMode mode, EnumSet flags) { + private RiValue use(RiValue value, OperandMode mode, EnumSet flags) { allowed(curInstruction, value, mode, flags); if (isVariable(value)) { @@ -184,7 +185,7 @@ return value; } - private CiValue def(CiValue value, OperandMode mode, EnumSet flags) { + private RiValue def(RiValue value, OperandMode mode, EnumSet flags) { allowed(curInstruction, value, mode, flags); if (isVariable(value)) { @@ -225,7 +226,7 @@ return value; } - private static CiValue allowed(Object op, CiValue value, OperandMode mode, EnumSet flags) { + private static RiValue allowed(Object op, RiValue value, OperandMode mode, EnumSet flags) { if ((isVariable(value) && flags.contains(OperandFlag.Register)) || (isRegister(value) && flags.contains(OperandFlag.Register)) || (isStackSlot(value) && flags.contains(OperandFlag.Stack)) || diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRXirInstruction.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRXirInstruction.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRXirInstruction.java Thu Jun 07 18:12:01 2012 +0200 @@ -26,13 +26,13 @@ import java.util.*; -import com.oracle.max.cri.ci.*; +import com.oracle.max.cri.ri.*; import com.oracle.max.cri.xir.*; import com.oracle.graal.graph.*; public abstract class LIRXirInstruction extends LIRInstruction { - public final CiValue[] originalOperands; + public final RiValue[] originalOperands; public final int outputOperandIndex; public final int[] inputOperandIndices; public final int[] tempOperandIndices; @@ -43,9 +43,9 @@ public LIRXirInstruction(Object opcode, XirSnippet snippet, - CiValue[] originalOperands, - CiValue outputOperand, - CiValue[] inputs, CiValue[] temps, + RiValue[] originalOperands, + RiValue outputOperand, + RiValue[] inputs, RiValue[] temps, int[] inputOperandIndices, int[] tempOperandIndices, int outputOperandIndex, LIRDebugInfo info, @@ -54,7 +54,7 @@ LabelRef falseSuccessor) { // Note that we register the XIR input operands as Alive, because the XIR specification allows that input operands // are used at any time, even when the temp operands and the actual output operands have already be assigned. - super(opcode, isLegal(outputOperand) ? new CiValue[] {outputOperand} : LIRInstruction.NO_OPERANDS, info, LIRInstruction.NO_OPERANDS, inputs, temps); + super(opcode, isLegal(outputOperand) ? new RiValue[] {outputOperand} : LIRInstruction.NO_OPERANDS, info, LIRInstruction.NO_OPERANDS, inputs, temps); this.infoAfter = infoAfter; this.snippet = snippet; this.inputOperandIndices = inputOperandIndices; @@ -76,7 +76,7 @@ throw GraalInternalError.shouldNotReachHere(); } - public CiValue[] getOperands() { + public RiValue[] getOperands() { for (int i = 0; i < inputOperandIndices.length; i++) { originalOperands[inputOperandIndices[i]] = alive(i); } diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.lir/src/com/oracle/graal/lir/StandardOp.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/StandardOp.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/StandardOp.java Thu Jun 07 18:12:01 2012 +0200 @@ -25,7 +25,7 @@ import java.util.*; import com.oracle.max.asm.*; -import com.oracle.max.cri.ci.*; +import com.oracle.max.cri.ri.*; import com.oracle.graal.graph.*; import com.oracle.graal.lir.asm.*; @@ -35,7 +35,7 @@ */ public class StandardOp { - private static CiValue[] EMPTY = new CiValue[0]; + private static RiValue[] EMPTY = new RiValue[0]; /** * LIR operation that defines the position of a label. @@ -45,7 +45,7 @@ private final Label label; private final boolean align; - protected LabelOp(Object opcode, CiValue[] outputs, LIRDebugInfo info, CiValue[] inputs, CiValue[] alives, CiValue[] temps, Label label, boolean align) { + protected LabelOp(Object opcode, RiValue[] outputs, LIRDebugInfo info, RiValue[] inputs, RiValue[] alives, RiValue[] temps, Label label, boolean align) { super(opcode, outputs, info, inputs, alives, temps); this.label = label; this.align = align; @@ -79,7 +79,7 @@ } public static class PhiLabelOp extends LabelOp { - public PhiLabelOp(Label label, boolean align, CiValue[] phiDefinitions) { + public PhiLabelOp(Label label, boolean align, RiValue[] phiDefinitions) { super("PHI_LABEL", phiDefinitions, null, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS, label, align); } @@ -95,7 +95,7 @@ outputs = EMPTY; } - public CiValue[] getPhiDefinitions() { + public RiValue[] getPhiDefinitions() { return outputs; } } @@ -110,7 +110,7 @@ public static class JumpOp extends LIRInstruction { private final LabelRef destination; - protected JumpOp(Object opcode, CiValue[] outputs, LIRDebugInfo info, CiValue[] inputs, CiValue[] alives, CiValue[] temps, LabelRef destination) { + protected JumpOp(Object opcode, RiValue[] outputs, LIRDebugInfo info, RiValue[] inputs, RiValue[] alives, RiValue[] temps, LabelRef destination) { super(opcode, outputs, info, inputs, alives, temps); this.destination = destination; } @@ -140,7 +140,7 @@ } public static class PhiJumpOp extends JumpOp { - public PhiJumpOp(LabelRef destination, CiValue[] phiInputs) { + public PhiJumpOp(LabelRef destination, RiValue[] phiInputs) { super("PHI_JUMP", LIRInstruction.NO_OPERANDS, null, LIRInstruction.NO_OPERANDS, phiInputs, LIRInstruction.NO_OPERANDS, destination); } @@ -156,7 +156,7 @@ alives = EMPTY; } - public CiValue[] getPhiInputs() { + public RiValue[] getPhiInputs() { return alives; } } @@ -174,8 +174,8 @@ * Marker interface for a LIR operation that moves a value from {@link #getInput()} to {@link #getResult()}. */ public interface MoveOp { - CiValue getInput(); - CiValue getResult(); + RiValue getInput(); + RiValue getResult(); } /** @@ -191,7 +191,7 @@ * In particular, it is not the actual method prologue. */ public static final class ParametersOp extends LIRInstruction { - public ParametersOp(CiValue[] params) { + public ParametersOp(RiValue[] params) { super("PARAMS", params, null, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS); } diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ValueUtil.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ValueUtil.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ValueUtil.java Thu Jun 07 18:12:01 2012 +0200 @@ -23,15 +23,16 @@ package com.oracle.graal.lir; import com.oracle.max.cri.ci.*; +import com.oracle.max.cri.ri.*; public class ValueUtil extends CiValueUtil { - public static boolean isVariable(CiValue value) { + public static boolean isVariable(RiValue value) { assert value != null; return value instanceof Variable; } - public static Variable asVariable(CiValue value) { + public static Variable asVariable(RiValue value) { assert value != null; return (Variable) value; } diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.lir/src/com/oracle/graal/lir/Variable.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/Variable.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/Variable.java Thu Jun 07 18:12:01 2012 +0200 @@ -29,7 +29,7 @@ * Represents a value that is yet to be bound to a machine location (such as * a {@link CiRegisterValue} or {@link CiStackSlot}) by a register allocator. */ -public final class Variable extends CiValue { +public final class Variable extends RiValue { private static final long serialVersionUID = 4507578431686109809L; /** diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.lir/src/com/oracle/graal/lir/asm/TargetMethodAssembler.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/asm/TargetMethodAssembler.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/asm/TargetMethodAssembler.java Thu Jun 07 18:12:01 2012 +0200 @@ -219,7 +219,7 @@ * Returns the integer value of any constants that can be represented by a 32-bit integer value, * including long constants that fit into the 32-bit range. */ - public int asIntConst(CiValue value) { + public int asIntConst(RiValue value) { assert (value.kind.stackKind() == RiKind.Int || value.kind == RiKind.Jsr || value.kind == RiKind.Long) && isConstant(value); long c = ((RiConstant) value).asLong(); if (!(NumUtil.isInt(c))) { @@ -231,11 +231,11 @@ /** * Returns the address of a float constant that is embedded as a data references into the code. */ - public CiAddress asFloatConstRef(CiValue value) { + public CiAddress asFloatConstRef(RiValue value) { return asFloatConstRef(value, 4); } - public CiAddress asFloatConstRef(CiValue value, int alignment) { + public CiAddress asFloatConstRef(RiValue value, int alignment) { assert value.kind == RiKind.Float && isConstant(value); return recordDataReferenceInCode((RiConstant) value, alignment); } @@ -243,11 +243,11 @@ /** * Returns the address of a double constant that is embedded as a data references into the code. */ - public CiAddress asDoubleConstRef(CiValue value) { + public CiAddress asDoubleConstRef(RiValue value) { return asDoubleConstRef(value, 8); } - public CiAddress asDoubleConstRef(CiValue value, int alignment) { + public CiAddress asDoubleConstRef(RiValue value, int alignment) { assert value.kind == RiKind.Double && isConstant(value); return recordDataReferenceInCode((RiConstant) value, alignment); } @@ -255,37 +255,37 @@ /** * Returns the address of a long constant that is embedded as a data references into the code. */ - public CiAddress asLongConstRef(CiValue value) { + public CiAddress asLongConstRef(RiValue value) { assert value.kind == RiKind.Long && isConstant(value); return recordDataReferenceInCode((RiConstant) value, 8); } - public CiAddress asIntAddr(CiValue value) { + public CiAddress asIntAddr(RiValue value) { assert value.kind == RiKind.Int; return asAddress(value); } - public CiAddress asLongAddr(CiValue value) { + public CiAddress asLongAddr(RiValue value) { assert value.kind == RiKind.Long; return asAddress(value); } - public CiAddress asObjectAddr(CiValue value) { + public CiAddress asObjectAddr(RiValue value) { assert value.kind == RiKind.Object; return asAddress(value); } - public CiAddress asFloatAddr(CiValue value) { + public CiAddress asFloatAddr(RiValue value) { assert value.kind == RiKind.Float; return asAddress(value); } - public CiAddress asDoubleAddr(CiValue value) { + public CiAddress asDoubleAddr(RiValue value) { assert value.kind == RiKind.Double; return asAddress(value); } - public CiAddress asAddress(CiValue value) { + public CiAddress asAddress(RiValue value) { if (isStackSlot(value)) { CiStackSlot slot = (CiStackSlot) value; return new CiAddress(slot.kind, frameMap.registerConfig.getFrameRegister().asValue(), frameMap.offsetForStackSlot(slot)); diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.nodes/src/com/oracle/graal/cri/CiLoweringTool.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/cri/CiLoweringTool.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/cri/CiLoweringTool.java Thu Jun 07 18:12:01 2012 +0200 @@ -24,14 +24,13 @@ import com.oracle.graal.nodes.*; import com.oracle.max.cri.ci.*; -import com.oracle.max.cri.ri.*; public interface CiLoweringTool { ExtendedRiRuntime getRuntime(); ValueNode getGuardAnchor(); ValueNode createNullCheckGuard(ValueNode object, long leafGraphId); - ValueNode createGuard(BooleanNode condition, RiDeoptReason deoptReason, RiDeoptAction action, long leafGraphId); - ValueNode createGuard(BooleanNode condition, RiDeoptReason deoptReason, RiDeoptAction action, boolean negated, long leafGraphId); + ValueNode createGuard(BooleanNode condition, CiDeoptReason deoptReason, CiDeoptAction action, long leafGraphId); + ValueNode createGuard(BooleanNode condition, CiDeoptReason deoptReason, CiDeoptAction action, boolean negated, long leafGraphId); CiAssumptions assumptions(); } diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DeoptimizeNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DeoptimizeNode.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DeoptimizeNode.java Thu Jun 07 18:12:01 2012 +0200 @@ -25,22 +25,22 @@ import com.oracle.graal.graph.*; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.type.*; -import com.oracle.max.cri.ri.*; +import com.oracle.max.cri.ci.*; @NodeInfo(shortName = "Deopt") public class DeoptimizeNode extends FixedNode implements Node.IterableNodeType, LIRLowerable { private String message; - private final RiDeoptAction action; - private final RiDeoptReason reason; + private final CiDeoptAction action; + private final CiDeoptReason reason; private final long leafGraphId; - public DeoptimizeNode(RiDeoptAction action, RiDeoptReason reason) { + public DeoptimizeNode(CiDeoptAction action, CiDeoptReason reason) { this(action, reason, -1); } - public DeoptimizeNode(RiDeoptAction action, RiDeoptReason reason, long leafGraphId) { + public DeoptimizeNode(CiDeoptAction action, CiDeoptReason reason, long leafGraphId) { super(StampFactory.forVoid()); this.action = action; this.reason = reason; @@ -55,11 +55,11 @@ return message; } - public RiDeoptAction action() { + public CiDeoptAction action() { return action; } - public RiDeoptReason reason() { + public CiDeoptReason reason() { return reason; } @@ -74,7 +74,7 @@ @SuppressWarnings("unused") @NodeIntrinsic - public static void deopt(@ConstantNodeParameter RiDeoptAction action, @ConstantNodeParameter RiDeoptReason reason) { + public static void deopt(@ConstantNodeParameter CiDeoptAction action, @ConstantNodeParameter CiDeoptReason reason) { throw new UnsupportedOperationException(); } } diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FixedGuardNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FixedGuardNode.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FixedGuardNode.java Thu Jun 07 18:12:01 2012 +0200 @@ -26,13 +26,13 @@ import com.oracle.graal.graph.*; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.type.*; -import com.oracle.max.cri.ri.*; +import com.oracle.max.cri.ci.*; public final class FixedGuardNode extends FixedWithNextNode implements Simplifiable, Lowerable, LIRLowerable, Node.IterableNodeType, Negatable { @Input private BooleanNode condition; - private final RiDeoptReason deoptReason; - private final RiDeoptAction action; + private final CiDeoptReason deoptReason; + private final CiDeoptAction action; private boolean negated; private final long leafGraphId; @@ -45,11 +45,11 @@ condition = x; } - public FixedGuardNode(BooleanNode condition, RiDeoptReason deoptReason, RiDeoptAction action, long leafGraphId) { + public FixedGuardNode(BooleanNode condition, CiDeoptReason deoptReason, CiDeoptAction action, long leafGraphId) { this(condition, deoptReason, action, false, leafGraphId); } - public FixedGuardNode(BooleanNode condition, RiDeoptReason deoptReason, RiDeoptAction action, boolean negated, long leafGraphId) { + public FixedGuardNode(BooleanNode condition, CiDeoptReason deoptReason, CiDeoptAction action, boolean negated, long leafGraphId) { super(StampFactory.forVoid()); this.action = action; this.negated = negated; @@ -83,7 +83,7 @@ if (next != null) { tool.deleteBranch(next); } - setNext(graph().add(new DeoptimizeNode(RiDeoptAction.InvalidateRecompile, deoptReason, leafGraphId))); + setNext(graph().add(new DeoptimizeNode(CiDeoptAction.InvalidateRecompile, deoptReason, leafGraphId))); return; } } diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardNode.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardNode.java Thu Jun 07 18:12:01 2012 +0200 @@ -27,7 +27,7 @@ import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.spi.types.*; import com.oracle.graal.nodes.type.*; -import com.oracle.max.cri.ri.*; +import com.oracle.max.cri.ci.*; /** * A guard is a node that deoptimizes based on a conditional expression. Guards are not attached to a certain frame @@ -44,8 +44,8 @@ @Input private BooleanNode condition; @Input(notDataflow = true) private FixedNode anchor; - private final RiDeoptReason reason; - private final RiDeoptAction action; + private final CiDeoptReason reason; + private final CiDeoptAction action; private boolean negated; private final long leafGraphId; @@ -74,15 +74,15 @@ return negated; } - public RiDeoptReason reason() { + public CiDeoptReason reason() { return reason; } - public RiDeoptAction action() { + public CiDeoptAction action() { return action; } - public GuardNode(BooleanNode condition, FixedNode anchor, RiDeoptReason reason, RiDeoptAction action, boolean negated, long leafGraphId) { + public GuardNode(BooleanNode condition, FixedNode anchor, CiDeoptReason reason, CiDeoptAction action, boolean negated, long leafGraphId) { super(StampFactory.dependency()); this.condition = condition; this.anchor = anchor; diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatAddNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatAddNode.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatAddNode.java Thu Jun 07 18:12:01 2012 +0200 @@ -22,7 +22,6 @@ */ package com.oracle.graal.nodes.calc; -import com.oracle.max.cri.ci.*; import com.oracle.max.cri.ri.*; import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; @@ -66,10 +65,10 @@ @Override public void generate(LIRGeneratorTool gen) { - CiValue op1 = gen.operand(x()); - CiValue op2 = gen.operand(y()); + RiValue op1 = gen.operand(x()); + RiValue op2 = gen.operand(y()); if (!y().isConstant() && !livesLonger(this, y(), gen)) { - CiValue op = op1; + RiValue op = op1; op1 = op2; op2 = op; } diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatMulNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatMulNode.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatMulNode.java Thu Jun 07 18:12:01 2012 +0200 @@ -22,7 +22,6 @@ */ package com.oracle.graal.nodes.calc; -import com.oracle.max.cri.ci.*; import com.oracle.max.cri.ri.*; import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; @@ -53,10 +52,10 @@ @Override public void generate(LIRGeneratorTool gen) { - CiValue op1 = gen.operand(x()); - CiValue op2 = gen.operand(y()); + RiValue op1 = gen.operand(x()); + RiValue op2 = gen.operand(y()); if (!y().isConstant() && !FloatAddNode.livesLonger(this, y(), gen)) { - CiValue op = op1; + RiValue op = op1; op1 = op2; op2 = op; } diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerAddNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerAddNode.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerAddNode.java Thu Jun 07 18:12:01 2012 +0200 @@ -22,7 +22,6 @@ */ package com.oracle.graal.nodes.calc; -import com.oracle.max.cri.ci.*; import com.oracle.max.cri.ri.*; import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; @@ -99,11 +98,11 @@ @Override public void generate(LIRGeneratorTool gen) { - CiValue op1 = gen.operand(x()); + RiValue op1 = gen.operand(x()); assert op1 != null : x() + ", this=" + this; - CiValue op2 = gen.operand(y()); + RiValue op2 = gen.operand(y()); if (!y().isConstant() && !FloatAddNode.livesLonger(this, y(), gen)) { - CiValue op = op1; + RiValue op = op1; op1 = op2; op2 = op; } diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerMulNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerMulNode.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerMulNode.java Thu Jun 07 18:12:01 2012 +0200 @@ -78,10 +78,10 @@ @Override public void generate(LIRGeneratorTool gen) { - CiValue op1 = gen.operand(x()); - CiValue op2 = gen.operand(y()); + RiValue op1 = gen.operand(x()); + RiValue op2 = gen.operand(y()); if (!y().isConstant() && !FloatAddNode.livesLonger(this, y(), gen)) { - CiValue op = op1; + RiValue op = op1; op1 = op2; op2 = op; } diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/LIRGeneratorTool.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/LIRGeneratorTool.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/LIRGeneratorTool.java Thu Jun 07 18:12:01 2012 +0200 @@ -48,47 +48,47 @@ */ public abstract boolean canStoreConstant(RiConstant c); - public abstract CiValue operand(ValueNode object); - public abstract CiValue newVariable(RiKind kind); - public abstract CiValue setResult(ValueNode x, CiValue operand); + public abstract RiValue operand(ValueNode object); + public abstract RiValue newVariable(RiKind kind); + public abstract RiValue setResult(ValueNode x, RiValue operand); public abstract CiAddress makeAddress(LocationNode location, ValueNode object); - public abstract CiValue emitMove(CiValue input); - public abstract void emitMove(CiValue src, CiValue dst); - public abstract CiValue emitLoad(CiValue loadAddress, boolean canTrap); - public abstract void emitStore(CiValue storeAddress, CiValue input, boolean canTrap); - public abstract CiValue emitLea(CiValue address); + public abstract RiValue emitMove(RiValue input); + public abstract void emitMove(RiValue src, RiValue dst); + public abstract RiValue emitLoad(RiValue loadAddress, boolean canTrap); + public abstract void emitStore(RiValue storeAddress, RiValue input, boolean canTrap); + public abstract RiValue emitLea(RiValue address); - public abstract CiValue emitNegate(CiValue input); - public abstract CiValue emitAdd(CiValue a, CiValue b); - public abstract CiValue emitSub(CiValue a, CiValue b); - public abstract CiValue emitMul(CiValue a, CiValue b); - public abstract CiValue emitDiv(CiValue a, CiValue b); - public abstract CiValue emitRem(CiValue a, CiValue b); - public abstract CiValue emitUDiv(CiValue a, CiValue b); - public abstract CiValue emitURem(CiValue a, CiValue b); + public abstract RiValue emitNegate(RiValue input); + public abstract RiValue emitAdd(RiValue a, RiValue b); + public abstract RiValue emitSub(RiValue a, RiValue b); + public abstract RiValue emitMul(RiValue a, RiValue b); + public abstract RiValue emitDiv(RiValue a, RiValue b); + public abstract RiValue emitRem(RiValue a, RiValue b); + public abstract RiValue emitUDiv(RiValue a, RiValue b); + public abstract RiValue emitURem(RiValue a, RiValue b); - public abstract CiValue emitAnd(CiValue a, CiValue b); - public abstract CiValue emitOr(CiValue a, CiValue b); - public abstract CiValue emitXor(CiValue a, CiValue b); + public abstract RiValue emitAnd(RiValue a, RiValue b); + public abstract RiValue emitOr(RiValue a, RiValue b); + public abstract RiValue emitXor(RiValue a, RiValue b); - public abstract CiValue emitShl(CiValue a, CiValue b); - public abstract CiValue emitShr(CiValue a, CiValue b); - public abstract CiValue emitUShr(CiValue a, CiValue b); + public abstract RiValue emitShl(RiValue a, RiValue b); + public abstract RiValue emitShr(RiValue a, RiValue b); + public abstract RiValue emitUShr(RiValue a, RiValue b); - public abstract CiValue emitConvert(ConvertNode.Op opcode, CiValue inputVal); + public abstract RiValue emitConvert(ConvertNode.Op opcode, RiValue inputVal); public abstract void emitMembar(int barriers); - public abstract void emitDeoptimizeOnOverflow(RiDeoptAction action, RiDeoptReason reason, Object deoptInfo); - public abstract void emitDeoptimize(RiDeoptAction action, RiDeoptReason reason, Object deoptInfo, long leafGraphId); - public abstract CiValue emitCall(Object target, RiKind result, RiKind[] arguments, boolean canTrap, CiValue... args); - public final CiValue emitCall(CiRuntimeCall runtimeCall, boolean canTrap, CiValue... args) { + public abstract void emitDeoptimizeOnOverflow(CiDeoptAction action, CiDeoptReason reason, Object deoptInfo); + public abstract void emitDeoptimize(CiDeoptAction action, CiDeoptReason reason, Object deoptInfo, long leafGraphId); + public abstract RiValue emitCall(Object target, RiKind result, RiKind[] arguments, boolean canTrap, RiValue... args); + public final RiValue emitCall(CiRuntimeCall runtimeCall, boolean canTrap, RiValue... args) { return emitCall(runtimeCall, runtimeCall.resultKind, runtimeCall.arguments, canTrap, args); } public abstract void emitIf(IfNode i); public abstract void emitConditional(ConditionalNode i); - public abstract void emitGuardCheck(BooleanNode comp, RiDeoptReason deoptReason, RiDeoptAction deoptAction, boolean negated, long leafGraphId); + public abstract void emitGuardCheck(BooleanNode comp, CiDeoptReason deoptReason, CiDeoptAction deoptAction, boolean negated, long leafGraphId); public abstract void emitLookupSwitch(LookupSwitchNode i); public abstract void emitTableSwitch(TableSwitchNode i); diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinter.java --- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinter.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinter.java Thu Jun 07 18:12:01 2012 +0200 @@ -308,7 +308,7 @@ out.print("tid ").print(nodeToString(node)).println(COLUMN_END); if (lirGenerator != null) { - CiValue operand = lirGenerator.nodeOperands.get(node); + RiValue operand = lirGenerator.nodeOperands.get(node); if (operand != null) { out.print("result ").print(operand.toString()).println(COLUMN_END); } @@ -407,7 +407,7 @@ private String stateValueToString(ValueNode value) { String result = nodeToString(value); if (lirGenerator != null && lirGenerator.nodeOperands != null && value != null) { - CiValue operand = lirGenerator.nodeOperands.get(value); + RiValue operand = lirGenerator.nodeOperands.get(value); if (operand != null) { result += ": " + operand; } diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinterObserver.java --- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinterObserver.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinterObserver.java Thu Jun 07 18:12:01 2012 +0200 @@ -141,22 +141,19 @@ final CiTargetMethod tm = (CiTargetMethod) object; final byte[] code = Arrays.copyOf(tm.targetCode(), tm.targetCodeSize()); RiCodeInfo info = new RiCodeInfo() { - public CiTargetMethod targetMethod() { - return tm; + public RiResolvedMethod method() { + return null; } public long start() { return 0L; } - public RiResolvedMethod method() { - return null; - } public byte[] code() { return code; } }; - cfgPrinter.printMachineCode(runtime.disassemble(info), message); + cfgPrinter.printMachineCode(runtime.disassemble(info, tm), message); } else if (object instanceof RiCodeInfo) { - cfgPrinter.printMachineCode(runtime.disassemble((RiCodeInfo) object), message); + cfgPrinter.printMachineCode(runtime.disassemble((RiCodeInfo) object, null), message); } else if (object instanceof Interval[]) { cfgPrinter.printIntervals(message, (Interval[]) object); diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/target/amd64/AMD64MathIntrinsicOp.java --- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/target/amd64/AMD64MathIntrinsicOp.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/target/amd64/AMD64MathIntrinsicOp.java Thu Jun 07 18:12:01 2012 +0200 @@ -27,7 +27,7 @@ import java.util.*; import com.oracle.max.asm.target.amd64.*; -import com.oracle.max.cri.ci.*; +import com.oracle.max.cri.ri.*; import com.oracle.graal.graph.*; import com.oracle.graal.lir.*; import com.oracle.graal.lir.amd64.*; @@ -40,15 +40,15 @@ LOG, LOG10; } - public AMD64MathIntrinsicOp(Opcode opcode, CiValue result, CiValue input) { - super(opcode, new CiValue[] {result}, null, new CiValue[] {input}, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS); + public AMD64MathIntrinsicOp(Opcode opcode, RiValue result, RiValue input) { + super(opcode, new RiValue[] {result}, null, new RiValue[] {input}, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS); } @Override public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) { Opcode opcode = (Opcode) code; - CiValue result = output(0); - CiValue input = input(0); + RiValue result = output(0); + RiValue input = input(0); switch (opcode) { case SQRT: masm.sqrtsd(asDoubleReg(result), asDoubleReg(input)); break; diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.max.asm/src/com/oracle/max/asm/target/amd64/AMD64Assembler.java --- a/graal/com.oracle.max.asm/src/com/oracle/max/asm/target/amd64/AMD64Assembler.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.max.asm/src/com/oracle/max/asm/target/amd64/AMD64Assembler.java Thu Jun 07 18:12:01 2012 +0200 @@ -136,7 +136,7 @@ * {@link CiRegister#CallerFrame} to physical registers. This value can be null if this assembler * instance will not be used to assemble instructions using these logical registers. */ - public AMD64Assembler(CiTarget target, RiRegisterConfig registerConfig) { + public AMD64Assembler(CiTarget target, CiRegisterConfig registerConfig) { super(target); this.frameRegister = registerConfig == null ? null : registerConfig.getFrameRegister(); } @@ -2217,7 +2217,7 @@ } } - private static boolean needsRex(CiValue value) { + private static boolean needsRex(RiValue value) { return isRegister(value) && asRegister(value).encoding >= MinEncodingNeedsRex; } diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.max.asm/src/com/oracle/max/asm/target/amd64/AMD64MacroAssembler.java --- a/graal/com.oracle.max.asm/src/com/oracle/max/asm/target/amd64/AMD64MacroAssembler.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.max.asm/src/com/oracle/max/asm/target/amd64/AMD64MacroAssembler.java Thu Jun 07 18:12:01 2012 +0200 @@ -31,7 +31,7 @@ */ public class AMD64MacroAssembler extends AMD64Assembler { - public AMD64MacroAssembler(CiTarget target, RiRegisterConfig registerConfig) { + public AMD64MacroAssembler(CiTarget target, CiRegisterConfig registerConfig) { super(target, registerConfig); } diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiAddress.java --- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiAddress.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiAddress.java Thu Jun 07 18:12:01 2012 +0200 @@ -31,25 +31,25 @@ * a displacement and a scale. Note that the base and index registers may be a variable that will get a register assigned * later by the register allocator. */ -public final class CiAddress extends CiValue { +public final class CiAddress extends RiValue { private static final long serialVersionUID = -1003772042519945089L; /** * A sentinel value used as a place holder in an instruction stream for an address that will be patched. */ - public static final CiAddress Placeholder = new CiAddress(RiKind.Illegal, CiValue.IllegalValue); + public static final CiAddress Placeholder = new CiAddress(RiKind.Illegal, RiValue.IllegalValue); /** * Base register that defines the start of the address computation. - * If not present, is denoted by {@link CiValue#IllegalValue}. + * If not present, is denoted by {@link RiValue#IllegalValue}. */ - public CiValue base; + public RiValue base; /** * Index register, the value of which (possibly scaled by {@link #scale}) is added to {@link #base}. - * If not present, is denoted by {@link CiValue#IllegalValue}. + * If not present, is denoted by {@link RiValue#IllegalValue}. */ - public CiValue index; + public RiValue index; /** * Scaling factor for indexing, dependent on target operand size. @@ -66,7 +66,7 @@ * @param kind the kind of the value being addressed * @param base the base register */ - public CiAddress(RiKind kind, CiValue base) { + public CiAddress(RiKind kind, RiValue base) { this(kind, base, IllegalValue, Scale.Times1, 0); } @@ -76,7 +76,7 @@ * @param base the base register * @param displacement the displacement */ - public CiAddress(RiKind kind, CiValue base, int displacement) { + public CiAddress(RiKind kind, RiValue base, int displacement) { this(kind, base, IllegalValue, Scale.Times1, displacement); } @@ -89,7 +89,7 @@ * @param scale the scaling factor * @param displacement the displacement */ - public CiAddress(RiKind kind, CiValue base, CiValue index, Scale scale, int displacement) { + public CiAddress(RiKind kind, RiValue base, RiValue index, Scale scale, int displacement) { super(kind); this.base = base; this.index = index; diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiCallingConvention.java --- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiCallingConvention.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiCallingConvention.java Thu Jun 07 18:12:01 2012 +0200 @@ -34,7 +34,7 @@ /** * Constants denoting the type of a call for which a calling convention is - * {@linkplain RiRegisterConfig#getCallingConvention(Type, CiKind[], CiTarget, boolean) requested}. + * {@linkplain CiRegisterConfig#getCallingConvention(Type, CiKind[], CiTarget, boolean) requested}. */ public enum Type { /** @@ -78,9 +78,9 @@ /** * The locations in which the arguments are placed. This array ordered by argument index. */ - public final CiValue[] locations; + public final RiValue[] locations; - public CiCallingConvention(CiValue[] locations, int stackSize) { + public CiCallingConvention(RiValue[] locations, int stackSize) { this.locations = locations; this.stackSize = stackSize; assert verify(); @@ -90,7 +90,7 @@ public String toString() { StringBuilder result = new StringBuilder(); result.append("CallingConvention["); - for (CiValue op : locations) { + for (RiValue op : locations) { result.append(op.toString()).append(" "); } result.append("]"); @@ -99,7 +99,7 @@ private boolean verify() { for (int i = 0; i < locations.length; i++) { - CiValue location = locations[i]; + RiValue location = locations[i]; assert isStackSlot(location) || isRegister(location); } return true; diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiDeoptAction.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiDeoptAction.java Thu Jun 07 18:12:01 2012 +0200 @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.cri.ci; + + +public enum CiDeoptAction { + None, // just interpret, do not invalidate nmethod + RecompileIfTooManyDeopts, // recompile the nmethod; need not invalidate + InvalidateReprofile, // invalidate the nmethod, reset IC, maybe recompile + InvalidateRecompile, // invalidate the nmethod, recompile (probably) + InvalidateStopCompiling; // invalidate the nmethod and do not compile +} diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiDeoptReason.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiDeoptReason.java Thu Jun 07 18:12:01 2012 +0200 @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.cri.ci; + + +public enum CiDeoptReason { + None, + NullCheckException, + BoundsCheckException, + ClassCastException, + ArrayStoreException, + UnreachedCode, + TypeCheckedInliningViolated, + OptimizedTypeCheckViolated, + NotCompiledExceptionHandler, + Unresolved, + JavaSubroutineMismatch, + ArithmeticException, + RuntimeConstraint; +} diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiFrame.java --- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiFrame.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiFrame.java Thu Jun 07 18:12:01 2012 +0200 @@ -28,7 +28,7 @@ /** * Represents the Java bytecode frame state(s) at a given position - * including {@link CiValue locations} where to find the local variables, + * including {@link RiValue locations} where to find the local variables, * operand stack values and locked objects of the bytecode frame(s). */ public class CiFrame extends CiCodePos implements Serializable { @@ -48,7 +48,7 @@ * Note that the number of locals and the number of stack slots may be smaller than the * maximum number of locals and stack slots as specified in the compiled method. */ - public final CiValue[] values; + public final RiValue[] values; /** * The number of locals in the values array. @@ -87,7 +87,7 @@ * @param numStack the depth of the stack * @param numLocks the number of locked objects */ - public CiFrame(CiFrame caller, RiResolvedMethod method, int bci, boolean rethrowException, boolean duringCall, CiValue[] values, int numLocals, int numStack, int numLocks, long leafGraphId) { + public CiFrame(CiFrame caller, RiResolvedMethod method, int bci, boolean rethrowException, boolean duringCall, RiValue[] values, int numLocals, int numStack, int numLocks, long leafGraphId) { super(caller, method, bci); assert values != null; this.rethrowException = rethrowException; @@ -105,7 +105,7 @@ * @param i the local variable index * @return the value that can be used to reconstruct the local's current value */ - public CiValue getLocalValue(int i) { + public RiValue getLocalValue(int i) { return values[i]; } @@ -114,7 +114,7 @@ * @param i the stack index * @return the value that can be used to reconstruct the stack slot's current value */ - public CiValue getStackValue(int i) { + public RiValue getStackValue(int i) { return values[i + numLocals]; } @@ -123,7 +123,7 @@ * @param i the lock index * @return the value that can be used to reconstruct the lock's current value */ - public CiValue getLockValue(int i) { + public RiValue getLockValue(int i) { return values[i + numLocals + numStack]; } diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiMonitorValue.java --- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiMonitorValue.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiMonitorValue.java Thu Jun 07 18:12:01 2012 +0200 @@ -24,14 +24,14 @@ import com.oracle.max.cri.ri.*; -public final class CiMonitorValue extends CiValue { +public final class CiMonitorValue extends RiValue { private static final long serialVersionUID = 8241681800464483691L; - public CiValue owner; - public final CiValue lockData; + public RiValue owner; + public final RiValue lockData; public final boolean eliminated; - public CiMonitorValue(CiValue owner, CiValue lockData, boolean eliminated) { + public CiMonitorValue(RiValue owner, RiValue lockData, boolean eliminated) { super(RiKind.Illegal); this.owner = owner; this.lockData = lockData; diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiRegisterAttributes.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiRegisterAttributes.java Thu Jun 07 18:12:01 2012 +0200 @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.cri.ci; + +import java.util.*; + +/** + * A collection of register attributes. The specific attribute values for a register may be + * local to a compilation context. For example, a {@link CiRegisterConfig} in use during + * a compilation will determine which registers are callee saved. + */ +public class CiRegisterAttributes { + + /** + * Denotes a register whose value preservation (if required) across a call is the responsibility of the caller. + */ + public final boolean isCallerSave; + + /** + * Denotes a register whose value preservation (if required) across a call is the responsibility of the callee. + */ + public final boolean isCalleeSave; + + /** + * Denotes a register that is available for use by a register allocator. + */ + public final boolean isAllocatable; + + /** + * Denotes a register guaranteed to be non-zero if read in compiled Java code. + * For example, a register dedicated to holding the current thread. + */ + public boolean isNonZero; + + public CiRegisterAttributes(boolean isCallerSave, boolean isCalleeSave, boolean isAllocatable) { + this.isCallerSave = isCallerSave; + this.isCalleeSave = isCalleeSave; + this.isAllocatable = isAllocatable; + } + + public static final CiRegisterAttributes NONE = new CiRegisterAttributes(false, false, false); + + /** + * Creates a map from register {@linkplain CiRegister#number numbers} to register + * {@linkplain CiRegisterAttributes attributes} for a given register configuration and set of + * registers. + * + * @param registerConfig a register configuration + * @param registers a set of registers + * @return an array whose length is the max register number in {@code registers} plus 1. An element at index i holds + * the attributes of the register whose number is i. + */ + public static CiRegisterAttributes[] createMap(CiRegisterConfig registerConfig, CiRegister[] registers) { + CiRegisterAttributes[] map = new CiRegisterAttributes[registers.length]; + for (CiRegister reg : registers) { + if (reg != null) { + CiCalleeSaveLayout csl = registerConfig.getCalleeSaveLayout(); + CiRegisterAttributes attr = new CiRegisterAttributes( + Arrays.asList(registerConfig.getCallerSaveRegisters()).contains(reg), + csl == null ? false : Arrays.asList(csl.registers).contains(reg), + Arrays.asList(registerConfig.getAllocatableRegisters()).contains(reg)); + if (map.length <= reg.number) { + map = Arrays.copyOf(map, reg.number + 1); + } + map[reg.number] = attr; + } + } + for (int i = 0; i < map.length; i++) { + if (map[i] == null) { + map[i] = NONE; + } + } + return map; + } +} diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiRegisterConfig.java --- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiRegisterConfig.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiRegisterConfig.java Thu Jun 07 18:12:01 2012 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,270 +29,85 @@ import com.oracle.max.cri.ri.*; /** - * A default implementation of {@link RiRegisterConfig}. + * A register configuration binds roles and {@linkplain CiRegisterAttributes attributes} + * to physical registers. */ -public class CiRegisterConfig implements RiRegisterConfig { - - /** - * The object describing the callee save area of this register configuration. - */ - public CiCalleeSaveLayout csl; - - /** - * The minimum register role identifier. - */ - public final int minRole; +public interface CiRegisterConfig { /** - * The map from register role IDs to registers. + * Gets the register to be used for returning a value of a given kind. */ - public final CiRegister[] registersRoleMap; + CiRegister getReturnRegister(RiKind kind); /** - * The set of registers that can be used by the register allocator. + * Gets the register to which {@link CiRegister#Frame} and {@link CiRegister#CallerFrame} are bound. */ - public final CiRegister[] allocatable; + CiRegister getFrameRegister(); - /** - * The set of registers that can be used by the register allocator, - * {@linkplain CiRegister#categorize(CiRegister[]) categorized} by register - * {@linkplain RegisterFlag flags}. - */ - public final EnumMap categorized; + CiRegister getScratchRegister(); /** - * The ordered set of registers used to pass integral arguments. - */ - public final CiRegister[] cpuParameters; - - /** - * The ordered set of registers used to pass floating point arguments. + * Gets the calling convention describing how arguments are passed. + * + * @param type the type of calling convention being requested + * @param parameters the types of the arguments of the call + * @param target the target platform + * @param stackOnly ignore registers */ - public final CiRegister[] fpuParameters; - - /** - * The caller saved registers. - */ - public final CiRegister[] callerSave; - - /** - * The register to which {@link CiRegister#Frame} and {@link CiRegister#CallerFrame} are bound. - */ - public final CiRegister frame; + CiCallingConvention getCallingConvention(Type type, RiKind[] parameters, CiTarget target, boolean stackOnly); /** - * Register for returning an integral value. - */ - public final CiRegister integralReturn; - - /** - * Register for returning a floating point value. + * Gets the ordered set of registers that are can be used to pass parameters + * according to a given calling convention. + * + * @param type the type of calling convention + * @param flag specifies whether registers for {@linkplain RegisterFlag#CPU integral} or + * {@linkplain} RegisterFlag#FPU floating point} parameters are being requested + * @return the ordered set of registers that may be used to pass parameters in a call conforming to {@code type} */ - public final CiRegister floatingPointReturn; - - /** - * The map from register {@linkplain CiRegister#number numbers} to register - * {@linkplain RiRegisterAttributes attributes} for this register configuration. - */ - public final RiRegisterAttributes[] attributesMap; - - /** - * The scratch register. - */ - public final CiRegister scratch; + CiRegister[] getCallingConventionRegisters(Type type, RegisterFlag flag); /** - * The frame offset of the first stack argument for each calling convention {@link CiCallingConvention.Type}. + * Gets the set of registers that can be used by the register allocator. */ - public final int[] stackArg0Offsets = new int[CiCallingConvention.Type.VALUES.length]; + CiRegister[] getAllocatableRegisters(); - public CiRegisterConfig( - CiRegister frame, - CiRegister integralReturn, - CiRegister floatingPointReturn, - CiRegister scratch, - CiRegister[] allocatable, - CiRegister[] callerSave, - CiRegister[] parameters, - CiCalleeSaveLayout csl, - CiRegister[] allRegisters, - Map roles) { - this.frame = frame; - this.csl = csl; - this.allocatable = allocatable; - this.callerSave = callerSave; - assert !Arrays.asList(allocatable).contains(scratch); - this.scratch = scratch; - EnumMap categorizedParameters = CiRegister.categorize(parameters); - this.cpuParameters = categorizedParameters.get(RegisterFlag.CPU); - this.fpuParameters = categorizedParameters.get(RegisterFlag.FPU); - categorized = CiRegister.categorize(allocatable); - attributesMap = RiRegisterAttributes.createMap(this, allRegisters); - this.floatingPointReturn = floatingPointReturn; - this.integralReturn = integralReturn; - int minRoleId = Integer.MAX_VALUE; - int maxRoleId = Integer.MIN_VALUE; - for (Map.Entry e : roles.entrySet()) { - int id = e.getKey(); - assert id >= 0; - if (minRoleId > id) { - minRoleId = id; - } - if (maxRoleId < id) { - maxRoleId = id; - } - } - registersRoleMap = new CiRegister[(maxRoleId - minRoleId) + 1]; - for (Map.Entry e : roles.entrySet()) { - int id = e.getKey(); - registersRoleMap[id] = e.getValue(); - } - minRole = minRoleId; - } + /** + * Gets the set of registers that can be used by the register allocator, + * {@linkplain CiRegister#categorize(CiRegister[]) categorized} by register {@linkplain RegisterFlag flags}. + * + * @return a map from each {@link RegisterFlag} constant to the list of {@linkplain #getAllocatableRegisters() + * allocatable} registers for which the flag is {@linkplain #isSet(RegisterFlag) set} + * + */ + EnumMap getCategorizedAllocatableRegisters(); - public CiRegisterConfig(CiRegisterConfig src, CiCalleeSaveLayout csl) { - this.frame = src.frame; - this.csl = csl; - this.allocatable = src.allocatable; - this.callerSave = src.callerSave; - this.scratch = src.scratch; - this.cpuParameters = src.cpuParameters; - this.fpuParameters = src.fpuParameters; - this.categorized = src.categorized; - this.attributesMap = src.attributesMap; - this.floatingPointReturn = src.floatingPointReturn; - this.integralReturn = src.integralReturn; - this.registersRoleMap = src.registersRoleMap; - this.minRole = src.minRole; - System.arraycopy(src.stackArg0Offsets, 0, stackArg0Offsets, 0, stackArg0Offsets.length); - } - - public CiRegister getReturnRegister(RiKind kind) { - if (kind.isDouble() || kind.isFloat()) { - return floatingPointReturn; - } - return integralReturn; - } - - public CiRegister getFrameRegister() { - return frame; - } - - public CiRegister getScratchRegister() { - return scratch; - } + /** + * Gets the registers whose values must be preserved by a method across any call it makes. + */ + CiRegister[] getCallerSaveRegisters(); /** - * {@inheritDoc} + * Gets the layout of the callee save area of this register configuration. * - * This implementation assigns all available registers to parameters before assigning - * any stack slots to parameters. + * @return {@code null} if there is no callee save area */ - public CiCallingConvention getCallingConvention(Type type, RiKind[] parameters, CiTarget target, boolean stackOnly) { - CiValue[] locations = new CiValue[parameters.length]; - - int currentGeneral = 0; - int currentXMM = 0; - int currentStackOffset = stackArg0Offsets[type.ordinal()]; - - for (int i = 0; i < parameters.length; i++) { - final RiKind kind = parameters[i]; - - switch (kind) { - case Byte: - case Boolean: - case Short: - case Char: - case Int: - case Long: - case Object: - if (!stackOnly && currentGeneral < cpuParameters.length) { - CiRegister register = cpuParameters[currentGeneral++]; - locations[i] = register.asValue(kind); - } - break; - - case Float: - case Double: - if (!stackOnly && currentXMM < fpuParameters.length) { - CiRegister register = fpuParameters[currentXMM++]; - locations[i] = register.asValue(kind); - } - break; - - default: - throw new InternalError("Unexpected parameter kind: " + kind); - } - - if (locations[i] == null) { - locations[i] = CiStackSlot.get(kind.stackKind(), currentStackOffset, !type.out); - currentStackOffset += Math.max(target.sizeInBytes(kind), target.wordSize); - } - } - - return new CiCallingConvention(locations, currentStackOffset); - } + CiCalleeSaveLayout getCalleeSaveLayout(); - public CiRegister[] getCallingConventionRegisters(Type type, RegisterFlag flag) { - if (flag == RegisterFlag.CPU) { - return cpuParameters; - } - assert flag == RegisterFlag.FPU; - return fpuParameters; - } - - public CiRegister[] getAllocatableRegisters() { - return allocatable; - } - - public EnumMap getCategorizedAllocatableRegisters() { - return categorized; - } - - public CiRegister[] getCallerSaveRegisters() { - return callerSave; - } - - public CiCalleeSaveLayout getCalleeSaveLayout() { - return csl; - } - - public RiRegisterAttributes[] getAttributesMap() { - return attributesMap; - } - - public CiRegister getRegisterForRole(int id) { - return registersRoleMap[id - minRole]; - } + /** + * Gets a map from register {@linkplain CiRegister#number numbers} to register + * {@linkplain CiRegisterAttributes attributes} for this register configuration. + * + * @return an array where an element at index i holds the attributes of the register whose number is i + * @see CiRegister#categorize(CiRegister[]) + */ + CiRegisterAttributes[] getAttributesMap(); - @Override - public String toString() { - StringBuilder roleMap = new StringBuilder(); - for (int i = 0; i < registersRoleMap.length; ++i) { - CiRegister reg = registersRoleMap[i]; - if (reg != null) { - if (roleMap.length() != 0) { - roleMap.append(", "); - } - roleMap.append(i + minRole).append(" -> ").append(reg); - } - } - StringBuilder stackArg0OffsetsMap = new StringBuilder(); - for (Type t : Type.VALUES) { - if (stackArg0OffsetsMap.length() != 0) { - stackArg0OffsetsMap.append(", "); - } - stackArg0OffsetsMap.append(t).append(" -> ").append(stackArg0Offsets[t.ordinal()]); - } - String res = String.format( - "Allocatable: " + Arrays.toString(getAllocatableRegisters()) + "%n" + - "CallerSave: " + Arrays.toString(getCallerSaveRegisters()) + "%n" + - "CalleeSave: " + getCalleeSaveLayout() + "%n" + - "CPU Params: " + Arrays.toString(cpuParameters) + "%n" + - "FPU Params: " + Arrays.toString(fpuParameters) + "%n" + - "VMRoles: " + roleMap + "%n" + - "stackArg0: " + stackArg0OffsetsMap + "%n" + - "Scratch: " + getScratchRegister() + "%n"); - return res; - } + /** + * Gets the register corresponding to a runtime-defined role. + * + * @param id the identifier of a runtime-defined register role + * @return the register playing the role specified by {@code id} + */ + CiRegister getRegisterForRole(int id); } diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiRegisterConfigImpl.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiRegisterConfigImpl.java Thu Jun 07 18:12:01 2012 +0200 @@ -0,0 +1,298 @@ +/* + * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.cri.ci; + +import java.util.*; + +import com.oracle.max.cri.ci.CiCallingConvention.*; +import com.oracle.max.cri.ci.CiRegister.*; +import com.oracle.max.cri.ri.*; + +/** + * A default implementation of {@link CiRegisterConfig}. + */ +public class CiRegisterConfigImpl implements CiRegisterConfig { + + /** + * The object describing the callee save area of this register configuration. + */ + public CiCalleeSaveLayout csl; + + /** + * The minimum register role identifier. + */ + public final int minRole; + + /** + * The map from register role IDs to registers. + */ + public final CiRegister[] registersRoleMap; + + /** + * The set of registers that can be used by the register allocator. + */ + public final CiRegister[] allocatable; + + /** + * The set of registers that can be used by the register allocator, + * {@linkplain CiRegister#categorize(CiRegister[]) categorized} by register + * {@linkplain RegisterFlag flags}. + */ + public final EnumMap categorized; + + /** + * The ordered set of registers used to pass integral arguments. + */ + public final CiRegister[] cpuParameters; + + /** + * The ordered set of registers used to pass floating point arguments. + */ + public final CiRegister[] fpuParameters; + + /** + * The caller saved registers. + */ + public final CiRegister[] callerSave; + + /** + * The register to which {@link CiRegister#Frame} and {@link CiRegister#CallerFrame} are bound. + */ + public final CiRegister frame; + + /** + * Register for returning an integral value. + */ + public final CiRegister integralReturn; + + /** + * Register for returning a floating point value. + */ + public final CiRegister floatingPointReturn; + + /** + * The map from register {@linkplain CiRegister#number numbers} to register + * {@linkplain CiRegisterAttributes attributes} for this register configuration. + */ + public final CiRegisterAttributes[] attributesMap; + + /** + * The scratch register. + */ + public final CiRegister scratch; + + /** + * The frame offset of the first stack argument for each calling convention {@link CiCallingConvention.Type}. + */ + public final int[] stackArg0Offsets = new int[CiCallingConvention.Type.VALUES.length]; + + public CiRegisterConfigImpl( + CiRegister frame, + CiRegister integralReturn, + CiRegister floatingPointReturn, + CiRegister scratch, + CiRegister[] allocatable, + CiRegister[] callerSave, + CiRegister[] parameters, + CiCalleeSaveLayout csl, + CiRegister[] allRegisters, + Map roles) { + this.frame = frame; + this.csl = csl; + this.allocatable = allocatable; + this.callerSave = callerSave; + assert !Arrays.asList(allocatable).contains(scratch); + this.scratch = scratch; + EnumMap categorizedParameters = CiRegister.categorize(parameters); + this.cpuParameters = categorizedParameters.get(RegisterFlag.CPU); + this.fpuParameters = categorizedParameters.get(RegisterFlag.FPU); + categorized = CiRegister.categorize(allocatable); + attributesMap = CiRegisterAttributes.createMap(this, allRegisters); + this.floatingPointReturn = floatingPointReturn; + this.integralReturn = integralReturn; + int minRoleId = Integer.MAX_VALUE; + int maxRoleId = Integer.MIN_VALUE; + for (Map.Entry e : roles.entrySet()) { + int id = e.getKey(); + assert id >= 0; + if (minRoleId > id) { + minRoleId = id; + } + if (maxRoleId < id) { + maxRoleId = id; + } + } + registersRoleMap = new CiRegister[(maxRoleId - minRoleId) + 1]; + for (Map.Entry e : roles.entrySet()) { + int id = e.getKey(); + registersRoleMap[id] = e.getValue(); + } + minRole = minRoleId; + } + + public CiRegisterConfigImpl(CiRegisterConfigImpl src, CiCalleeSaveLayout csl) { + this.frame = src.frame; + this.csl = csl; + this.allocatable = src.allocatable; + this.callerSave = src.callerSave; + this.scratch = src.scratch; + this.cpuParameters = src.cpuParameters; + this.fpuParameters = src.fpuParameters; + this.categorized = src.categorized; + this.attributesMap = src.attributesMap; + this.floatingPointReturn = src.floatingPointReturn; + this.integralReturn = src.integralReturn; + this.registersRoleMap = src.registersRoleMap; + this.minRole = src.minRole; + System.arraycopy(src.stackArg0Offsets, 0, stackArg0Offsets, 0, stackArg0Offsets.length); + } + + public CiRegister getReturnRegister(RiKind kind) { + if (kind.isDouble() || kind.isFloat()) { + return floatingPointReturn; + } + return integralReturn; + } + + public CiRegister getFrameRegister() { + return frame; + } + + public CiRegister getScratchRegister() { + return scratch; + } + + /** + * {@inheritDoc} + * + * This implementation assigns all available registers to parameters before assigning + * any stack slots to parameters. + */ + public CiCallingConvention getCallingConvention(Type type, RiKind[] parameters, CiTarget target, boolean stackOnly) { + RiValue[] locations = new RiValue[parameters.length]; + + int currentGeneral = 0; + int currentXMM = 0; + int currentStackOffset = stackArg0Offsets[type.ordinal()]; + + for (int i = 0; i < parameters.length; i++) { + final RiKind kind = parameters[i]; + + switch (kind) { + case Byte: + case Boolean: + case Short: + case Char: + case Int: + case Long: + case Object: + if (!stackOnly && currentGeneral < cpuParameters.length) { + CiRegister register = cpuParameters[currentGeneral++]; + locations[i] = register.asValue(kind); + } + break; + + case Float: + case Double: + if (!stackOnly && currentXMM < fpuParameters.length) { + CiRegister register = fpuParameters[currentXMM++]; + locations[i] = register.asValue(kind); + } + break; + + default: + throw new InternalError("Unexpected parameter kind: " + kind); + } + + if (locations[i] == null) { + locations[i] = CiStackSlot.get(kind.stackKind(), currentStackOffset, !type.out); + currentStackOffset += Math.max(target.sizeInBytes(kind), target.wordSize); + } + } + + return new CiCallingConvention(locations, currentStackOffset); + } + + public CiRegister[] getCallingConventionRegisters(Type type, RegisterFlag flag) { + if (flag == RegisterFlag.CPU) { + return cpuParameters; + } + assert flag == RegisterFlag.FPU; + return fpuParameters; + } + + public CiRegister[] getAllocatableRegisters() { + return allocatable; + } + + public EnumMap getCategorizedAllocatableRegisters() { + return categorized; + } + + public CiRegister[] getCallerSaveRegisters() { + return callerSave; + } + + public CiCalleeSaveLayout getCalleeSaveLayout() { + return csl; + } + + public CiRegisterAttributes[] getAttributesMap() { + return attributesMap; + } + + public CiRegister getRegisterForRole(int id) { + return registersRoleMap[id - minRole]; + } + + @Override + public String toString() { + StringBuilder roleMap = new StringBuilder(); + for (int i = 0; i < registersRoleMap.length; ++i) { + CiRegister reg = registersRoleMap[i]; + if (reg != null) { + if (roleMap.length() != 0) { + roleMap.append(", "); + } + roleMap.append(i + minRole).append(" -> ").append(reg); + } + } + StringBuilder stackArg0OffsetsMap = new StringBuilder(); + for (Type t : Type.VALUES) { + if (stackArg0OffsetsMap.length() != 0) { + stackArg0OffsetsMap.append(", "); + } + stackArg0OffsetsMap.append(t).append(" -> ").append(stackArg0Offsets[t.ordinal()]); + } + String res = String.format( + "Allocatable: " + Arrays.toString(getAllocatableRegisters()) + "%n" + + "CallerSave: " + Arrays.toString(getCallerSaveRegisters()) + "%n" + + "CalleeSave: " + getCalleeSaveLayout() + "%n" + + "CPU Params: " + Arrays.toString(cpuParameters) + "%n" + + "FPU Params: " + Arrays.toString(fpuParameters) + "%n" + + "VMRoles: " + roleMap + "%n" + + "stackArg0: " + stackArg0OffsetsMap + "%n" + + "Scratch: " + getScratchRegister() + "%n"); + return res; + } +} diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiRegisterValue.java --- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiRegisterValue.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiRegisterValue.java Thu Jun 07 18:12:01 2012 +0200 @@ -29,7 +29,7 @@ * CiRegisterValue} for each ({@link CiRegister}, {@link RiKind}) pair. Use {@link CiRegister#asValue(RiKind)} to * retrieve the canonical {@link CiRegisterValue} instance for a given (register,kind) pair. */ -public final class CiRegisterValue extends CiValue { +public final class CiRegisterValue extends RiValue { private static final long serialVersionUID = 7999341472196897163L; /** diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiStackSlot.java --- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiStackSlot.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiStackSlot.java Thu Jun 07 18:12:01 2012 +0200 @@ -30,7 +30,7 @@ * Represents a compiler spill slot or an outgoing stack-based argument in a method's frame * or an incoming stack-based argument in a method's {@linkplain #inCallerFrame() caller's frame}. */ -public final class CiStackSlot extends CiValue { +public final class CiStackSlot extends RiValue { private static final long serialVersionUID = -7725071921307318433L; private final int offset; diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiUtil.java --- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiUtil.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiUtil.java Thu Jun 07 18:12:01 2012 +0200 @@ -788,7 +788,7 @@ } boolean firstDeoptReason = true; - for (RiDeoptReason reason: RiDeoptReason.values()) { + for (CiDeoptReason reason: CiDeoptReason.values()) { int count = info.getDeoptimizationCount(reason); if (count > 0) { if (firstDeoptReason) { diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiValue.java --- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiValue.java Thu Jun 07 17:25:52 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.max.cri.ci; - -import java.io.*; - -import com.oracle.max.cri.ri.*; - -/** - * Abstract base class for values manipulated by the compiler. All values have a {@linkplain RiKind kind} and are immutable. - */ -public abstract class CiValue implements Serializable { - private static final long serialVersionUID = -6909397188697766469L; - - @SuppressWarnings("serial") - public static CiValue IllegalValue = new CiValue(RiKind.Illegal) { - @Override - public String toString() { - return "-"; - } - }; - - /** - * The kind of this value. - */ - public final RiKind kind; - - /** - * Initializes a new value of the specified kind. - * @param kind the kind - */ - protected CiValue(RiKind kind) { - this.kind = kind; - } - - /** - * String representation of the kind, which should be the end of all {@link #toString()} implementation of subclasses. - */ - protected final String kindSuffix() { - return "|" + kind.typeChar; - } -} diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiValueUtil.java --- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiValueUtil.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiValueUtil.java Thu Jun 07 18:12:01 2012 +0200 @@ -25,106 +25,106 @@ import com.oracle.max.cri.ri.*; public class CiValueUtil { - public static boolean isIllegal(CiValue value) { + public static boolean isIllegal(RiValue value) { assert value != null; - return value == CiValue.IllegalValue; + return value == RiValue.IllegalValue; } - public static boolean isLegal(CiValue value) { + public static boolean isLegal(RiValue value) { return !isIllegal(value); } - public static boolean isVirtualObject(CiValue value) { + public static boolean isVirtualObject(RiValue value) { assert value != null; return value instanceof CiVirtualObject; } - public static CiVirtualObject asVirtualObject(CiValue value) { + public static CiVirtualObject asVirtualObject(RiValue value) { assert value != null; return (CiVirtualObject) value; } - public static boolean isConstant(CiValue value) { + public static boolean isConstant(RiValue value) { assert value != null; return value instanceof RiConstant; } - public static RiConstant asConstant(CiValue value) { + public static RiConstant asConstant(RiValue value) { assert value != null; return (RiConstant) value; } - public static boolean isStackSlot(CiValue value) { + public static boolean isStackSlot(RiValue value) { assert value != null; return value instanceof CiStackSlot; } - public static CiStackSlot asStackSlot(CiValue value) { + public static CiStackSlot asStackSlot(RiValue value) { assert value != null; return (CiStackSlot) value; } - public static boolean isAddress(CiValue value) { + public static boolean isAddress(RiValue value) { assert value != null; return value instanceof CiAddress; } - public static CiAddress asAddress(CiValue value) { + public static CiAddress asAddress(RiValue value) { assert value != null; return (CiAddress) value; } - public static boolean isRegister(CiValue value) { + public static boolean isRegister(RiValue value) { assert value != null; return value instanceof CiRegisterValue; } - public static CiRegister asRegister(CiValue value) { + public static CiRegister asRegister(RiValue value) { assert value != null; return ((CiRegisterValue) value).reg; } - public static CiRegister asIntReg(CiValue value) { + public static CiRegister asIntReg(RiValue value) { assert value.kind == RiKind.Int || value.kind == RiKind.Jsr; return asRegister(value); } - public static CiRegister asLongReg(CiValue value) { + public static CiRegister asLongReg(RiValue value) { assert value.kind == RiKind.Long : value.kind; return asRegister(value); } - public static CiRegister asObjectReg(CiValue value) { + public static CiRegister asObjectReg(RiValue value) { assert value.kind == RiKind.Object; return asRegister(value); } - public static CiRegister asFloatReg(CiValue value) { + public static CiRegister asFloatReg(RiValue value) { assert value.kind == RiKind.Float; return asRegister(value); } - public static CiRegister asDoubleReg(CiValue value) { + public static CiRegister asDoubleReg(RiValue value) { assert value.kind == RiKind.Double; return asRegister(value); } - public static boolean sameRegister(CiValue v1, CiValue v2) { + public static boolean sameRegister(RiValue v1, RiValue v2) { return isRegister(v1) && isRegister(v2) && asRegister(v1) == asRegister(v2); } - public static boolean sameRegister(CiValue v1, CiValue v2, CiValue v3) { + public static boolean sameRegister(RiValue v1, RiValue v2, RiValue v3) { return sameRegister(v1, v2) && sameRegister(v1, v3); } - public static boolean differentRegisters(CiValue v1, CiValue v2) { + public static boolean differentRegisters(RiValue v1, RiValue v2) { return !isRegister(v1) || !isRegister(v2) || asRegister(v1) != asRegister(v2); } - public static boolean differentRegisters(CiValue v1, CiValue v2, CiValue v3) { + public static boolean differentRegisters(RiValue v1, RiValue v2, RiValue v3) { return differentRegisters(v1, v2) && differentRegisters(v1, v3) && differentRegisters(v2, v3); } } diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiVirtualObject.java --- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiVirtualObject.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiVirtualObject.java Thu Jun 07 18:12:01 2012 +0200 @@ -28,11 +28,11 @@ * An instance of this class represents an object whose allocation was removed by escape analysis. The information stored in the {@link CiVirtualObject} is used during * deoptimization to recreate the object. */ -public final class CiVirtualObject extends CiValue { +public final class CiVirtualObject extends RiValue { private static final long serialVersionUID = -2907197776426346021L; private final RiType type; - private CiValue[] values; + private RiValue[] values; private final int id; /** @@ -43,11 +43,11 @@ * @param id a unique id that identifies the object within the debug information for one position in the compiled code. * @return a new CiVirtualObject instance. */ - public static CiVirtualObject get(RiType type, CiValue[] values, int id) { + public static CiVirtualObject get(RiType type, RiValue[] values, int id) { return new CiVirtualObject(type, values, id); } - private CiVirtualObject(RiType type, CiValue[] values, int id) { + private CiVirtualObject(RiType type, RiValue[] values, int id) { super(RiKind.Object); this.type = type; this.values = values; @@ -69,7 +69,7 @@ /** * @return an array containing all the values to be stored into the object when it is recreated. */ - public CiValue[] values() { + public RiValue[] values() { return values; } @@ -84,7 +84,7 @@ * Overwrites the current set of values with a new one. * @param values an array containing all the values to be stored into the object when it is recreated. */ - public void setValues(CiValue[] values) { + public void setValues(RiValue[] values) { this.values = values; } @@ -124,39 +124,39 @@ this.runtime = runtime; } - public CiVirtualObject constantProxy(RiKind kind, CiValue objectValue, CiValue primitiveValue) { + public CiVirtualObject constantProxy(RiKind kind, RiValue objectValue, RiValue primitiveValue) { RiConstant cKind = RiConstant.forObject(kind); // TODO: here the ordering is hard coded... we should query RiType.fields() and act accordingly - return new CiVirtualObject(runtime.getType(RiConstant.class), new CiValue[] {cKind, primitiveValue, CiValue.IllegalValue, objectValue}, nextId++); + return new CiVirtualObject(runtime.getType(RiConstant.class), new RiValue[] {cKind, primitiveValue, RiValue.IllegalValue, objectValue}, nextId++); } - public CiValue proxy(CiValue ciValue) { + public RiValue proxy(RiValue ciValue) { switch (ciValue.kind) { case Boolean: - return new CiVirtualObject(runtime.getType(Boolean.class), new CiValue[] {ciValue}, nextId++); + return new CiVirtualObject(runtime.getType(Boolean.class), new RiValue[] {ciValue}, nextId++); case Byte: - return new CiVirtualObject(runtime.getType(Byte.class), new CiValue[] {ciValue}, nextId++); + return new CiVirtualObject(runtime.getType(Byte.class), new RiValue[] {ciValue}, nextId++); case Char: - return new CiVirtualObject(runtime.getType(Character.class), new CiValue[] {ciValue}, nextId++); + return new CiVirtualObject(runtime.getType(Character.class), new RiValue[] {ciValue}, nextId++); case Double: - return new CiVirtualObject(runtime.getType(Double.class), new CiValue[] {ciValue, CiValue.IllegalValue}, nextId++); + return new CiVirtualObject(runtime.getType(Double.class), new RiValue[] {ciValue, RiValue.IllegalValue}, nextId++); case Float: - return new CiVirtualObject(runtime.getType(Float.class), new CiValue[] {ciValue}, nextId++); + return new CiVirtualObject(runtime.getType(Float.class), new RiValue[] {ciValue}, nextId++); case Int: - return new CiVirtualObject(runtime.getType(Integer.class), new CiValue[] {ciValue}, nextId++); + return new CiVirtualObject(runtime.getType(Integer.class), new RiValue[] {ciValue}, nextId++); case Long: - return new CiVirtualObject(runtime.getType(Long.class), new CiValue[] {ciValue, CiValue.IllegalValue}, nextId++); + return new CiVirtualObject(runtime.getType(Long.class), new RiValue[] {ciValue, RiValue.IllegalValue}, nextId++); case Object: return ciValue; case Short: - return new CiVirtualObject(runtime.getType(Short.class), new CiValue[] {ciValue}, nextId++); + return new CiVirtualObject(runtime.getType(Short.class), new RiValue[] {ciValue}, nextId++); default: assert false : ciValue.kind; return null; } } - public CiVirtualObject arrayProxy(RiType arrayType, CiValue[] values) { + public CiVirtualObject arrayProxy(RiType arrayType, RiValue[] values) { return new CiVirtualObject(arrayType, values, nextId++); } diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/package-info.java --- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/package-info.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/package-info.java Thu Jun 07 18:12:01 2012 +0200 @@ -33,8 +33,8 @@ * {@link com.oracle.max.cri.ci.CiCodePos} and {@link com.oracle.max.cri.ci.CiDebugInfo} provide detailed information to the * runtime to support debugging and deoptimization of the compiled code. *

- * The compiler manipulates {@link com.oracle.max.cri.ci.CiValue} instances that have a {@link com.oracle.max.cri.ri.RiKind}, and are - * immutable. A concrete {@link com.oracle.max.cri.ci.CiValue value} is one of the following subclasses: + * The compiler manipulates {@link com.oracle.max.cri.ri.RiValue} instances that have a {@link com.oracle.max.cri.ri.RiKind}, and are + * immutable. A concrete {@link com.oracle.max.cri.ri.RiValue value} is one of the following subclasses: *

    *
  • {@link com.oracle.max.cri.ri.RiConstant}: a constant value. *
  • {@link com.oracle.max.cri.ci.CiRegisterValue}: a value stored in a {@linkplain com.oracle.max.cri.ci.CiRegister target machine register}. diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.max.cri/src/com/oracle/max/cri/ri/RiCodeInfo.java --- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ri/RiCodeInfo.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.max.cri/src/com/oracle/max/cri/ri/RiCodeInfo.java Thu Jun 07 18:12:01 2012 +0200 @@ -22,9 +22,6 @@ */ package com.oracle.max.cri.ri; -import com.oracle.max.cri.ci.*; - - /** * Represents some code installed in the code cache of the runtime. * This encapsulated details are only for informational purposes. @@ -43,11 +40,6 @@ byte[] code(); /** - * Gets the target method (if any) from which this installed code was produced. - */ - CiTargetMethod targetMethod(); - - /** * Gets the method (if any) from which this installed code was compiled. */ RiResolvedMethod method(); diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.max.cri/src/com/oracle/max/cri/ri/RiConstant.java --- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ri/RiConstant.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.max.cri/src/com/oracle/max/cri/ri/RiConstant.java Thu Jun 07 18:12:01 2012 +0200 @@ -22,14 +22,12 @@ */ package com.oracle.max.cri.ri; -import com.oracle.max.cri.ci.*; - /** * Represents a constant (boxed) value, such as an integer, floating point number, or object reference, * within the compiler and across the compiler/runtime interface. Exports a set of {@code CiConstant} * instances that represent frequently used constant values, such as {@link #ZERO}. */ -public final class RiConstant extends CiValue { +public final class RiConstant extends RiValue { private static final long serialVersionUID = -6355452536852663986L; private static final RiConstant[] INT_CONSTANT_CACHE = new RiConstant[100]; diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.max.cri/src/com/oracle/max/cri/ri/RiDeoptAction.java --- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ri/RiDeoptAction.java Thu Jun 07 17:25:52 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.max.cri.ri; - - -public enum RiDeoptAction { - None, // just interpret, do not invalidate nmethod - RecompileIfTooManyDeopts, // recompile the nmethod; need not invalidate - InvalidateReprofile, // invalidate the nmethod, reset IC, maybe recompile - InvalidateRecompile, // invalidate the nmethod, recompile (probably) - InvalidateStopCompiling; // invalidate the nmethod and do not compile -} diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.max.cri/src/com/oracle/max/cri/ri/RiDeoptReason.java --- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ri/RiDeoptReason.java Thu Jun 07 17:25:52 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.max.cri.ri; - - -public enum RiDeoptReason { - None, - NullCheckException, - BoundsCheckException, - ClassCastException, - ArrayStoreException, - UnreachedCode, - TypeCheckedInliningViolated, - OptimizedTypeCheckViolated, - NotCompiledExceptionHandler, - Unresolved, - JavaSubroutineMismatch, - ArithmeticException, - RuntimeConstraint; -} diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.max.cri/src/com/oracle/max/cri/ri/RiProfilingInfo.java --- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ri/RiProfilingInfo.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.max.cri/src/com/oracle/max/cri/ri/RiProfilingInfo.java Thu Jun 07 18:12:01 2012 +0200 @@ -22,6 +22,8 @@ */ package com.oracle.max.cri.ri; +import com.oracle.max.cri.ci.*; + /** * Provides access to the profiling information of one specific method. @@ -77,5 +79,5 @@ * @param reason the reason for which the number of deoptimizations should be queried * @return the number of times the compiled method deoptimized for the given reason. */ - int getDeoptimizationCount(RiDeoptReason reason); + int getDeoptimizationCount(CiDeoptReason reason); } diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.max.cri/src/com/oracle/max/cri/ri/RiRegisterAttributes.java --- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ri/RiRegisterAttributes.java Thu Jun 07 17:25:52 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.max.cri.ri; - -import java.util.*; - -import com.oracle.max.cri.ci.*; - -/** - * A collection of register attributes. The specific attribute values for a register may be - * local to a compilation context. For example, a {@link RiRegisterConfig} in use during - * a compilation will determine which registers are callee saved. - */ -public class RiRegisterAttributes { - - /** - * Denotes a register whose value preservation (if required) across a call is the responsibility of the caller. - */ - public final boolean isCallerSave; - - /** - * Denotes a register whose value preservation (if required) across a call is the responsibility of the callee. - */ - public final boolean isCalleeSave; - - /** - * Denotes a register that is available for use by a register allocator. - */ - public final boolean isAllocatable; - - /** - * Denotes a register guaranteed to be non-zero if read in compiled Java code. - * For example, a register dedicated to holding the current thread. - */ - public boolean isNonZero; - - public RiRegisterAttributes(boolean isCallerSave, boolean isCalleeSave, boolean isAllocatable) { - this.isCallerSave = isCallerSave; - this.isCalleeSave = isCalleeSave; - this.isAllocatable = isAllocatable; - } - - public static final RiRegisterAttributes NONE = new RiRegisterAttributes(false, false, false); - - /** - * Creates a map from register {@linkplain CiRegister#number numbers} to register - * {@linkplain RiRegisterAttributes attributes} for a given register configuration and set of - * registers. - * - * @param registerConfig a register configuration - * @param registers a set of registers - * @return an array whose length is the max register number in {@code registers} plus 1. An element at index i holds - * the attributes of the register whose number is i. - */ - public static RiRegisterAttributes[] createMap(RiRegisterConfig registerConfig, CiRegister[] registers) { - RiRegisterAttributes[] map = new RiRegisterAttributes[registers.length]; - for (CiRegister reg : registers) { - if (reg != null) { - CiCalleeSaveLayout csl = registerConfig.getCalleeSaveLayout(); - RiRegisterAttributes attr = new RiRegisterAttributes( - Arrays.asList(registerConfig.getCallerSaveRegisters()).contains(reg), - csl == null ? false : Arrays.asList(csl.registers).contains(reg), - Arrays.asList(registerConfig.getAllocatableRegisters()).contains(reg)); - if (map.length <= reg.number) { - map = Arrays.copyOf(map, reg.number + 1); - } - map[reg.number] = attr; - } - } - for (int i = 0; i < map.length; i++) { - if (map[i] == null) { - map[i] = NONE; - } - } - return map; - } -} diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.max.cri/src/com/oracle/max/cri/ri/RiRegisterConfig.java --- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ri/RiRegisterConfig.java Thu Jun 07 17:25:52 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,113 +0,0 @@ -/* - * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.max.cri.ri; - -import java.util.*; - -import com.oracle.max.cri.ci.*; -import com.oracle.max.cri.ci.CiCallingConvention.*; -import com.oracle.max.cri.ci.CiRegister.*; - -/** - * A register configuration binds roles and {@linkplain RiRegisterAttributes attributes} - * to physical registers. - */ -public interface RiRegisterConfig { - - /** - * Gets the register to be used for returning a value of a given kind. - */ - CiRegister getReturnRegister(RiKind kind); - - /** - * Gets the register to which {@link CiRegister#Frame} and {@link CiRegister#CallerFrame} are bound. - */ - CiRegister getFrameRegister(); - - CiRegister getScratchRegister(); - - /** - * Gets the calling convention describing how arguments are passed. - * - * @param type the type of calling convention being requested - * @param parameters the types of the arguments of the call - * @param target the target platform - * @param stackOnly ignore registers - */ - CiCallingConvention getCallingConvention(Type type, RiKind[] parameters, CiTarget target, boolean stackOnly); - - /** - * Gets the ordered set of registers that are can be used to pass parameters - * according to a given calling convention. - * - * @param type the type of calling convention - * @param flag specifies whether registers for {@linkplain RegisterFlag#CPU integral} or - * {@linkplain} RegisterFlag#FPU floating point} parameters are being requested - * @return the ordered set of registers that may be used to pass parameters in a call conforming to {@code type} - */ - CiRegister[] getCallingConventionRegisters(Type type, RegisterFlag flag); - - /** - * Gets the set of registers that can be used by the register allocator. - */ - CiRegister[] getAllocatableRegisters(); - - /** - * Gets the set of registers that can be used by the register allocator, - * {@linkplain CiRegister#categorize(CiRegister[]) categorized} by register {@linkplain RegisterFlag flags}. - * - * @return a map from each {@link RegisterFlag} constant to the list of {@linkplain #getAllocatableRegisters() - * allocatable} registers for which the flag is {@linkplain #isSet(RegisterFlag) set} - * - */ - EnumMap getCategorizedAllocatableRegisters(); - - /** - * Gets the registers whose values must be preserved by a method across any call it makes. - */ - CiRegister[] getCallerSaveRegisters(); - - /** - * Gets the layout of the callee save area of this register configuration. - * - * @return {@code null} if there is no callee save area - */ - CiCalleeSaveLayout getCalleeSaveLayout(); - - /** - * Gets a map from register {@linkplain CiRegister#number numbers} to register - * {@linkplain RiRegisterAttributes attributes} for this register configuration. - * - * @return an array where an element at index i holds the attributes of the register whose number is i - * @see CiRegister#categorize(CiRegister[]) - */ - RiRegisterAttributes[] getAttributesMap(); - - /** - * Gets the register corresponding to a runtime-defined role. - * - * @param id the identifier of a runtime-defined register role - * @return the register playing the role specified by {@code id} - */ - CiRegister getRegisterForRole(int id); -} diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.max.cri/src/com/oracle/max/cri/ri/RiRuntime.java --- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ri/RiRuntime.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.max.cri/src/com/oracle/max/cri/ri/RiRuntime.java Thu Jun 07 18:12:01 2012 +0200 @@ -43,7 +43,7 @@ * @param code the code that should be disassembled * @return a disassembly. This will be of length 0 if the runtime does not support disassembling. */ - String disassemble(RiCodeInfo code); + String disassemble(RiCodeInfo code, CiTargetMethod tm); /** * Returns the disassembly of the given method in a {@code javap}-like format. @@ -80,9 +80,9 @@ * * @param method the top level method of a compilation */ - RiRegisterConfig getRegisterConfig(RiMethod method); + CiRegisterConfig getRegisterConfig(RiMethod method); - RiRegisterConfig getGlobalStubRegisterConfig(); + CiRegisterConfig getGlobalStubRegisterConfig(); /** * Custom area on the stack of each compiled method that the VM can use for its own purposes. @@ -132,17 +132,17 @@ * Encodes a deoptimization action and a deoptimization reason in an integer value. * @return the encoded value as an integer */ - int encodeDeoptActionAndReason(RiDeoptAction action, RiDeoptReason reason); + int encodeDeoptActionAndReason(CiDeoptAction action, CiDeoptReason reason); /** * Converts a RiDeoptReason into an integer value. * @return An integer value representing the given RiDeoptReason. */ - int convertDeoptReason(RiDeoptReason reason); + int convertDeoptReason(CiDeoptReason reason); /** * Converts a RiDeoptAction into an integer value. * @return An integer value representing the given RiDeoptAction. */ - int convertDeoptAction(RiDeoptAction action); + int convertDeoptAction(CiDeoptAction action); } diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.max.cri/src/com/oracle/max/cri/ri/RiValue.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.cri/src/com/oracle/max/cri/ri/RiValue.java Thu Jun 07 18:12:01 2012 +0200 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.max.cri.ri; + +import java.io.*; + +/** + * Abstract base class for values manipulated by the compiler. All values have a {@linkplain RiKind kind} and are immutable. + */ +public abstract class RiValue implements Serializable { + private static final long serialVersionUID = -6909397188697766469L; + + @SuppressWarnings("serial") + public static RiValue IllegalValue = new RiValue(RiKind.Illegal) { + @Override + public String toString() { + return "-"; + } + }; + + /** + * The kind of this value. + */ + public final RiKind kind; + + /** + * Initializes a new value of the specified kind. + * @param kind the kind + */ + protected RiValue(RiKind kind) { + this.kind = kind; + } + + /** + * String representation of the kind, which should be the end of all {@link #toString()} implementation of subclasses. + */ + protected final String kindSuffix() { + return "|" + kind.typeChar; + } +} diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.max.cri/src/com/oracle/max/cri/xir/CiXirAssembler.java --- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/xir/CiXirAssembler.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.max.cri/src/com/oracle/max/cri/xir/CiXirAssembler.java Thu Jun 07 18:12:01 2012 +0200 @@ -246,7 +246,7 @@ } public static class XirRegister extends XirTemp { - public final CiValue register; + public final RiValue register; XirRegister(CiXirAssembler asm, String name, CiRegisterValue register, boolean reserve) { super(asm, name, register.kind, reserve); diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.max.criutils/src/com/oracle/max/criutils/BaseProfilingInfo.java --- a/graal/com.oracle.max.criutils/src/com/oracle/max/criutils/BaseProfilingInfo.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.max.criutils/src/com/oracle/max/criutils/BaseProfilingInfo.java Thu Jun 07 18:12:01 2012 +0200 @@ -78,7 +78,7 @@ } @Override - public int getDeoptimizationCount(RiDeoptReason reason) { + public int getDeoptimizationCount(CiDeoptReason reason) { return 0; } diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.max.criutils/src/com/oracle/max/criutils/CompilationPrinter.java --- a/graal/com.oracle.max.criutils/src/com/oracle/max/criutils/CompilationPrinter.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.max.criutils/src/com/oracle/max/criutils/CompilationPrinter.java Thu Jun 07 18:12:01 2012 +0200 @@ -170,7 +170,7 @@ return sb.toString(); } - protected String valueToString(CiValue value, List virtualObjects) { + protected String valueToString(RiValue value, List virtualObjects) { if (value == null) { return "-"; } diff -r 28af6dff047f -r 56860d3f9f39 graal/com.oracle.max.criutils/src/com/oracle/max/criutils/SnapshotProfilingInfo.java --- a/graal/com.oracle.max.criutils/src/com/oracle/max/criutils/SnapshotProfilingInfo.java Thu Jun 07 17:25:52 2012 +0200 +++ b/graal/com.oracle.max.criutils/src/com/oracle/max/criutils/SnapshotProfilingInfo.java Thu Jun 07 18:12:01 2012 +0200 @@ -48,7 +48,7 @@ typeProfiles = new RiTypeProfile[codeSize]; exceptions = new RiExceptionSeen[codeSize]; executions = new int[codeSize]; - deopts = new int[RiDeoptReason.values().length]; + deopts = new int[CiDeoptReason.values().length]; for (int bci = 0; bci < codeSize; bci++) { executions[bci] = other.getExecutionCount(bci); @@ -57,7 +57,7 @@ switches[bci] = other.getSwitchProbabilities(bci); typeProfiles[bci] = other.getTypeProfile(bci); } - for (RiDeoptReason reason: RiDeoptReason.values()) { + for (CiDeoptReason reason: CiDeoptReason.values()) { deopts[reason.ordinal()] = other.getDeoptimizationCount(reason); } } @@ -82,7 +82,7 @@ public int getExecutionCount(int bci) { return bci < executions.length ? executions[bci] : -1; } - public int getDeoptimizationCount(RiDeoptReason reason) { + public int getDeoptimizationCount(CiDeoptReason reason) { return deopts[reason.ordinal()]; }