use of org.jikesrvm.osr.VariableMapElement in project JikesRVM by JikesRVM.
the class UpdateOSRMaps method perform.
/**
* Iterate over the IR-based OSR map, and update symbolic registers
* with real reg number or spill locations.
* Verify there are only two types of operands:
* ConstantOperand
* RegisterOperand
* for integer constant, we save the value of the integer
*
* The LONG register has another half part.
*
* CodeSpill replaces any allocated symbolic register by
* physical registers.
*/
@Override
public void perform(IR ir) throws OptimizingCompilerException {
/* for each osr instruction */
for (VariableMapElement elm : ir.MIRInfo.osrVarMap.list) {
// MethodVariables mvar = mvarsList.get(numMvars);
for (MethodVariables mvar : elm.mvars) {
// LocalRegPair tuple = tupleList.get(numTuple);
for (LocalRegPair tuple : mvar.tupleList) {
Operand op = tuple.operand;
if (op.isRegister()) {
Register sym_reg = ((RegisterOperand) op).getRegister();
setRealPosition(ir, tuple, sym_reg);
// get another half part of long register
if (VM.BuildFor32Addr && (tuple.typeCode == LongTypeCode)) {
LocalRegPair other = tuple._otherHalf;
Operand other_op = other.operand;
if (VM.VerifyAssertions)
VM._assert(other_op.isRegister());
Register other_reg = ((RegisterOperand) other_op).getRegister();
setRealPosition(ir, other, other_reg);
}
/* According to ConvertToLowLevelIR, StringConstant, LongConstant,
* NullConstant, FloatConstant, and DoubleConstant are all materialized
* The only thing left is the integer constants which could encode
* non-moveable objects.
* POTENTIAL DRAWBACKS: since any long, float, and double are moved
* to register and treated as use, it may consume more registers and
* add unnecessary MOVEs.
*
* Perhaps, ConvertToLowLevelIR can skip OsrPoint instruction.
*/
} else if (op.isIntConstant()) {
setTupleValue(tuple, ICONST, ((IntConstantOperand) op).value);
if (VM.BuildFor32Addr && (tuple.typeCode == LongTypeCode)) {
LocalRegPair other = tuple._otherHalf;
Operand other_op = other.operand;
if (VM.VerifyAssertions)
VM._assert(other_op.isIntConstant());
setTupleValue(other, ICONST, ((IntConstantOperand) other_op).value);
}
} else if (op.isAddressConstant()) {
setTupleValue(tuple, ACONST, ((AddressConstantOperand) op).value.toWord());
} else if (VM.BuildFor64Addr && op.isLongConstant()) {
setTupleValue(tuple, LCONST, Word.fromLong(((LongConstantOperand) op).value));
} else {
throw new OptimizingCompilerException("LinearScan", "Unexpected operand type at ", op.toString());
}
// for the op type
}
// for each tuple
}
// for each inlined method
}
// for each osr instruction
}
Aggregations