# HG changeset patch # User Roland Schatz # Date 1436445548 -7200 # Node ID 488d54275360de8e9e88a92f0f5a3eec2f97fcc6 # Parent 3c32af2369d2bcc1a6a2a8abc56d7947f715b8c1 Rename LIRKind.derivedReference to LIRKind.unknownReference. diff -r 3c32af2369d2 -r 488d54275360 graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java --- a/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java Thu Jul 09 14:29:51 2015 +0200 +++ b/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java Thu Jul 09 14:39:08 2015 +0200 @@ -625,7 +625,7 @@ @Override public Variable emitNegate(Value inputVal) { AllocatableValue input = asAllocatable(inputVal); - Variable result = newVariable(LIRKind.derive(input)); + Variable result = newVariable(LIRKind.combine(input)); switch (input.getKind()) { case Int: append(new AMD64Unary.MOp(NEG, DWORD, result, input)); @@ -648,7 +648,7 @@ @Override public Variable emitNot(Value inputVal) { AllocatableValue input = asAllocatable(inputVal); - Variable result = newVariable(LIRKind.derive(input)); + Variable result = newVariable(LIRKind.combine(input)); switch (input.getKind()) { case Int: append(new AMD64Unary.MOp(NOT, DWORD, result, input)); @@ -684,7 +684,7 @@ private Variable emitBinaryConst(AMD64BinaryArithmetic op, OperandSize size, boolean commutative, AllocatableValue a, JavaConstant b, boolean setFlags) { if (NumUtil.isInt(b.asLong())) { - Variable result = newVariable(LIRKind.derive(a, b)); + Variable result = newVariable(LIRKind.combine(a, b)); int constant = (int) b.asLong(); if (!setFlags) { @@ -722,13 +722,13 @@ } private Variable emitBinaryConst(AMD64RMOp op, OperandSize size, AllocatableValue a, JavaConstant b) { - Variable result = newVariable(LIRKind.derive(a, b)); + Variable result = newVariable(LIRKind.combine(a, b)); append(new AMD64Binary.DataOp(op, size, result, a, b)); return result; } private Variable emitBinaryVar(AMD64RMOp op, OperandSize size, boolean commutative, AllocatableValue a, AllocatableValue b) { - Variable result = newVariable(LIRKind.derive(a, b)); + Variable result = newVariable(LIRKind.combine(a, b)); if (commutative) { append(new AMD64Binary.CommutativeOp(op, size, result, a, b)); } else { @@ -779,7 +779,7 @@ op = AMD64RMIOp.IMUL; } - Variable ret = newVariable(LIRKind.derive(a, b)); + Variable ret = newVariable(LIRKind.combine(a, b)); append(new AMD64Binary.RMIOp(op, size, ret, a, imm)); return ret; } else { @@ -820,7 +820,7 @@ } private Value emitMulHigh(AMD64MOp opcode, OperandSize size, Value a, Value b) { - AMD64MulDivOp mulHigh = append(new AMD64MulDivOp(opcode, size, LIRKind.derive(a, b), moveToReg(AMD64.rax, a), asAllocatable(b))); + AMD64MulDivOp mulHigh = append(new AMD64MulDivOp(opcode, size, LIRKind.combine(a, b), moveToReg(AMD64.rax, a), asAllocatable(b))); return emitMove(mulHigh.getHighResult()); } @@ -849,7 +849,7 @@ } public Value emitBinaryMemory(AMD64RMOp op, OperandSize size, AllocatableValue a, AMD64AddressValue location, LIRFrameState state) { - Variable result = newVariable(LIRKind.derive(a)); + Variable result = newVariable(LIRKind.combine(a)); append(new AMD64Binary.MemoryOp(op, size, result, a, location, state)); return result; } @@ -886,14 +886,14 @@ } private AMD64MulDivOp emitIDIV(OperandSize size, Value a, Value b, LIRFrameState state) { - LIRKind kind = LIRKind.derive(a, b); + LIRKind kind = LIRKind.combine(a, b); AMD64SignExtendOp sx = append(new AMD64SignExtendOp(size, kind, moveToReg(AMD64.rax, a))); return append(new AMD64MulDivOp(AMD64MOp.IDIV, size, kind, sx.getHighResult(), sx.getLowResult(), asAllocatable(b), state)); } private AMD64MulDivOp emitDIV(OperandSize size, Value a, Value b, LIRFrameState state) { - LIRKind kind = LIRKind.derive(a, b); + LIRKind kind = LIRKind.combine(a, b); RegisterValue rax = moveToReg(AMD64.rax, a); RegisterValue rdx = AMD64.rdx.asValue(kind); @@ -944,12 +944,12 @@ AMD64MulDivOp lop = emitIDIV(QWORD, a, b, state); return emitMove(lop.getRemainder()); case Float: { - Variable result = newVariable(LIRKind.derive(a, b)); + Variable result = newVariable(LIRKind.combine(a, b)); append(new FPDivRemOp(FREM, result, load(a), load(b))); return result; } case Double: { - Variable result = newVariable(LIRKind.derive(a, b)); + Variable result = newVariable(LIRKind.combine(a, b)); append(new FPDivRemOp(DREM, result, load(a), load(b))); return result; } @@ -1039,7 +1039,7 @@ } private Variable emitShift(AMD64Shift op, OperandSize size, Value a, Value b) { - Variable result = newVariable(LIRKind.derive(a, b).changeType(a.getPlatformKind())); + Variable result = newVariable(LIRKind.combine(a, b).changeType(a.getPlatformKind())); AllocatableValue input = asAllocatable(a); if (isConstant(b)) { JavaConstant c = asConstant(b); @@ -1174,25 +1174,25 @@ public Value emitFloatConvert(FloatConvert op, Value input) { switch (op) { case D2F: - return emitConvertOp(LIRKind.derive(input).changeType(Kind.Float), SSEOp.CVTSD2SS, SD, input); + return emitConvertOp(LIRKind.combine(input).changeType(Kind.Float), SSEOp.CVTSD2SS, SD, input); case D2I: - return emitConvertOp(LIRKind.derive(input).changeType(Kind.Int), SSEOp.CVTTSD2SI, DWORD, input); + return emitConvertOp(LIRKind.combine(input).changeType(Kind.Int), SSEOp.CVTTSD2SI, DWORD, input); case D2L: - return emitConvertOp(LIRKind.derive(input).changeType(Kind.Long), SSEOp.CVTTSD2SI, QWORD, input); + return emitConvertOp(LIRKind.combine(input).changeType(Kind.Long), SSEOp.CVTTSD2SI, QWORD, input); case F2D: - return emitConvertOp(LIRKind.derive(input).changeType(Kind.Double), SSEOp.CVTSS2SD, SS, input); + return emitConvertOp(LIRKind.combine(input).changeType(Kind.Double), SSEOp.CVTSS2SD, SS, input); case F2I: - return emitConvertOp(LIRKind.derive(input).changeType(Kind.Int), SSEOp.CVTTSS2SI, DWORD, input); + return emitConvertOp(LIRKind.combine(input).changeType(Kind.Int), SSEOp.CVTTSS2SI, DWORD, input); case F2L: - return emitConvertOp(LIRKind.derive(input).changeType(Kind.Long), SSEOp.CVTTSS2SI, QWORD, input); + return emitConvertOp(LIRKind.combine(input).changeType(Kind.Long), SSEOp.CVTTSS2SI, QWORD, input); case I2D: - return emitConvertOp(LIRKind.derive(input).changeType(Kind.Double), SSEOp.CVTSI2SD, DWORD, input); + return emitConvertOp(LIRKind.combine(input).changeType(Kind.Double), SSEOp.CVTSI2SD, DWORD, input); case I2F: - return emitConvertOp(LIRKind.derive(input).changeType(Kind.Float), SSEOp.CVTSI2SS, DWORD, input); + return emitConvertOp(LIRKind.combine(input).changeType(Kind.Float), SSEOp.CVTSI2SS, DWORD, input); case L2D: - return emitConvertOp(LIRKind.derive(input).changeType(Kind.Double), SSEOp.CVTSI2SD, QWORD, input); + return emitConvertOp(LIRKind.combine(input).changeType(Kind.Double), SSEOp.CVTSI2SD, QWORD, input); case L2F: - return emitConvertOp(LIRKind.derive(input).changeType(Kind.Float), SSEOp.CVTSI2SS, QWORD, input); + return emitConvertOp(LIRKind.combine(input).changeType(Kind.Float), SSEOp.CVTSI2SS, QWORD, input); default: throw JVMCIError.shouldNotReachHere(); } @@ -1202,7 +1202,7 @@ public Value emitNarrow(Value inputVal, int bits) { if (inputVal.getKind() == Kind.Long && bits <= 32) { // TODO make it possible to reinterpret Long as Int in LIR without move - return emitConvertOp(LIRKind.derive(inputVal).changeType(Kind.Int), AMD64RMOp.MOV, DWORD, inputVal); + return emitConvertOp(LIRKind.combine(inputVal).changeType(Kind.Int), AMD64RMOp.MOV, DWORD, inputVal); } else { return inputVal; } @@ -1217,11 +1217,11 @@ // sign extend to 64 bits switch (fromBits) { case 8: - return emitConvertOp(LIRKind.derive(inputVal).changeType(Kind.Long), MOVSXB, QWORD, inputVal); + return emitConvertOp(LIRKind.combine(inputVal).changeType(Kind.Long), MOVSXB, QWORD, inputVal); case 16: - return emitConvertOp(LIRKind.derive(inputVal).changeType(Kind.Long), MOVSX, QWORD, inputVal); + return emitConvertOp(LIRKind.combine(inputVal).changeType(Kind.Long), MOVSX, QWORD, inputVal); case 32: - return emitConvertOp(LIRKind.derive(inputVal).changeType(Kind.Long), MOVSXD, QWORD, inputVal); + return emitConvertOp(LIRKind.combine(inputVal).changeType(Kind.Long), MOVSXD, QWORD, inputVal); default: throw JVMCIError.unimplemented("unsupported sign extension (" + fromBits + " bit -> " + toBits + " bit)"); } @@ -1229,9 +1229,9 @@ // sign extend to 32 bits (smaller values are internally represented as 32 bit values) switch (fromBits) { case 8: - return emitConvertOp(LIRKind.derive(inputVal).changeType(Kind.Int), MOVSXB, DWORD, inputVal); + return emitConvertOp(LIRKind.combine(inputVal).changeType(Kind.Int), MOVSXB, DWORD, inputVal); case 16: - return emitConvertOp(LIRKind.derive(inputVal).changeType(Kind.Int), MOVSX, DWORD, inputVal); + return emitConvertOp(LIRKind.combine(inputVal).changeType(Kind.Int), MOVSX, DWORD, inputVal); case 32: return inputVal; default: @@ -1247,14 +1247,14 @@ return inputVal; } else if (fromBits > 32) { assert inputVal.getKind() == Kind.Long; - Variable result = newVariable(LIRKind.derive(inputVal).changeType(Kind.Long)); + Variable result = newVariable(LIRKind.combine(inputVal).changeType(Kind.Long)); long mask = CodeUtil.mask(fromBits); append(new AMD64Binary.DataOp(AND.getRMOpcode(QWORD), QWORD, result, asAllocatable(inputVal), JavaConstant.forLong(mask))); return result; } else { assert inputVal.getKind().getStackKind() == Kind.Int; - LIRKind resultKind = LIRKind.derive(inputVal); + LIRKind resultKind = LIRKind.combine(inputVal); if (toBits > 32) { resultKind = resultKind.changeType(Kind.Long); } else { @@ -1311,7 +1311,7 @@ @Override public Variable emitBitCount(Value value) { - Variable result = newVariable(LIRKind.derive(value).changeType(Kind.Int)); + Variable result = newVariable(LIRKind.combine(value).changeType(Kind.Int)); if (value.getKind().getStackKind() == Kind.Int) { append(new AMD64Unary.RMOp(POPCNT, DWORD, result, asAllocatable(value))); } else { @@ -1322,14 +1322,14 @@ @Override public Variable emitBitScanForward(Value value) { - Variable result = newVariable(LIRKind.derive(value).changeType(Kind.Int)); + Variable result = newVariable(LIRKind.combine(value).changeType(Kind.Int)); append(new AMD64Unary.RMOp(BSF, QWORD, result, asAllocatable(value))); return result; } @Override public Variable emitBitScanReverse(Value value) { - Variable result = newVariable(LIRKind.derive(value).changeType(Kind.Int)); + Variable result = newVariable(LIRKind.combine(value).changeType(Kind.Int)); if (value.getKind().getStackKind() == Kind.Int) { append(new AMD64Unary.RMOp(BSR, DWORD, result, asAllocatable(value))); } else { @@ -1339,7 +1339,7 @@ } public Value emitCountLeadingZeros(Value value) { - Variable result = newVariable(LIRKind.derive(value).changeType(Kind.Int)); + Variable result = newVariable(LIRKind.combine(value).changeType(Kind.Int)); if (value.getKind().getStackKind() == Kind.Int) { append(new AMD64Unary.RMOp(LZCNT, DWORD, result, asAllocatable(value))); } else { @@ -1349,7 +1349,7 @@ } public Value emitCountTrailingZeros(Value value) { - Variable result = newVariable(LIRKind.derive(value).changeType(Kind.Int)); + Variable result = newVariable(LIRKind.combine(value).changeType(Kind.Int)); if (value.getKind().getStackKind() == Kind.Int) { append(new AMD64Unary.RMOp(TZCNT, DWORD, result, asAllocatable(value))); } else { @@ -1360,7 +1360,7 @@ @Override public Value emitMathAbs(Value input) { - Variable result = newVariable(LIRKind.derive(input)); + Variable result = newVariable(LIRKind.combine(input)); switch (input.getKind()) { case Float: append(new AMD64Binary.DataOp(SSEOp.AND, PS, result, asAllocatable(input), JavaConstant.forFloat(Float.intBitsToFloat(0x7FFFFFFF)), 16)); @@ -1376,7 +1376,7 @@ @Override public Value emitMathSqrt(Value input) { - Variable result = newVariable(LIRKind.derive(input)); + Variable result = newVariable(LIRKind.combine(input)); switch (input.getKind()) { case Float: append(new AMD64Unary.RMOp(SSEOp.SQRT, SS, result, asAllocatable(input))); @@ -1392,35 +1392,35 @@ @Override public Value emitMathLog(Value input, boolean base10) { - Variable result = newVariable(LIRKind.derive(input)); + Variable result = newVariable(LIRKind.combine(input)); append(new AMD64MathIntrinsicOp(base10 ? LOG10 : LOG, result, asAllocatable(input))); return result; } @Override public Value emitMathCos(Value input) { - Variable result = newVariable(LIRKind.derive(input)); + Variable result = newVariable(LIRKind.combine(input)); append(new AMD64MathIntrinsicOp(COS, result, asAllocatable(input))); return result; } @Override public Value emitMathSin(Value input) { - Variable result = newVariable(LIRKind.derive(input)); + Variable result = newVariable(LIRKind.combine(input)); append(new AMD64MathIntrinsicOp(SIN, result, asAllocatable(input))); return result; } @Override public Value emitMathTan(Value input) { - Variable result = newVariable(LIRKind.derive(input)); + Variable result = newVariable(LIRKind.combine(input)); append(new AMD64MathIntrinsicOp(TAN, result, asAllocatable(input))); return result; } @Override public Variable emitByteSwap(Value input) { - Variable result = newVariable(LIRKind.derive(input)); + Variable result = newVariable(LIRKind.combine(input)); append(new AMD64ByteSwapOp(result, input)); return result; } diff -r 3c32af2369d2 -r 488d54275360 graal/com.oracle.graal.compiler.sparc/src/com/oracle/graal/compiler/sparc/SPARCLIRGenerator.java --- a/graal/com.oracle.graal.compiler.sparc/src/com/oracle/graal/compiler/sparc/SPARCLIRGenerator.java Thu Jul 09 14:29:51 2015 +0200 +++ b/graal/com.oracle.graal.compiler.sparc/src/com/oracle/graal/compiler/sparc/SPARCLIRGenerator.java Thu Jul 09 14:39:08 2015 +0200 @@ -419,7 +419,7 @@ @Override public Variable emitBitCount(Value operand) { - Variable result = newVariable(LIRKind.derive(operand).changeType(Kind.Int)); + Variable result = newVariable(LIRKind.combine(operand).changeType(Kind.Int)); if (operand.getKind().getStackKind() == Kind.Int) { append(new SPARCBitManipulationOp(IPOPCNT, result, asAllocatable(operand), this)); } else { @@ -430,14 +430,14 @@ @Override public Variable emitBitScanForward(Value operand) { - Variable result = newVariable(LIRKind.derive(operand).changeType(Kind.Int)); + Variable result = newVariable(LIRKind.combine(operand).changeType(Kind.Int)); append(new SPARCBitManipulationOp(BSF, result, asAllocatable(operand), this)); return result; } @Override public Variable emitBitScanReverse(Value operand) { - Variable result = newVariable(LIRKind.derive(operand).changeType(Kind.Int)); + Variable result = newVariable(LIRKind.combine(operand).changeType(Kind.Int)); if (operand.getKind().getStackKind() == Kind.Int) { append(new SPARCBitManipulationOp(IBSR, result, asAllocatable(operand), this)); } else { @@ -448,21 +448,21 @@ @Override public Value emitMathAbs(Value input) { - Variable result = newVariable(LIRKind.derive(input)); + Variable result = newVariable(LIRKind.combine(input)); append(new SPARCMathIntrinsicOp(ABS, result, asAllocatable(input))); return result; } @Override public Value emitMathSqrt(Value input) { - Variable result = newVariable(LIRKind.derive(input)); + Variable result = newVariable(LIRKind.combine(input)); append(new SPARCMathIntrinsicOp(SQRT, result, asAllocatable(input))); return result; } @Override public Variable emitByteSwap(Value input) { - Variable result = newVariable(LIRKind.derive(input)); + Variable result = newVariable(LIRKind.combine(input)); append(new SPARCByteSwapOp(this, result, input)); return result; } @@ -503,7 +503,7 @@ } private Variable emitUnary(SPARCArithmetic op, Value input) { - Variable result = newVariable(LIRKind.derive(input)); + Variable result = newVariable(LIRKind.combine(input)); append(new Unary2Op(op, result, load(input))); return result; } @@ -537,7 +537,7 @@ case IMUL: case LMUL: if (canInlineConstant(b)) { - Variable result = newVariable(LIRKind.derive(a, b)); + Variable result = newVariable(LIRKind.combine(a, b)); append(new BinaryRegConst(op, result, a, b, state)); return result; } @@ -547,7 +547,7 @@ } private Variable emitBinaryVar(SPARCArithmetic op, AllocatableValue a, AllocatableValue b, LIRFrameState state) { - Variable result = newVariable(LIRKind.derive(a, b)); + Variable result = newVariable(LIRKind.combine(a, b)); append(new BinaryRegReg(op, result, a, b, state)); return result; } @@ -591,7 +591,7 @@ return emitBinary(setFlags ? IMULCC : IMUL, true, a, b); case Long: if (setFlags) { - Variable result = newVariable(LIRKind.derive(a, b)); + Variable result = newVariable(LIRKind.combine(a, b)); append(new SPARCLMulccOp(result, load(a), load(b), this)); return result; } else { @@ -631,8 +631,8 @@ } private Value emitMulHigh(SPARCArithmetic opcode, Value a, Value b) { - Variable result = newVariable(LIRKind.derive(a, b)); - MulHighOp mulHigh = new MulHighOp(opcode, load(a), load(b), result, newVariable(LIRKind.derive(a, b))); + Variable result = newVariable(LIRKind.combine(a, b)); + MulHighOp mulHigh = new MulHighOp(opcode, load(a), load(b), result, newVariable(LIRKind.combine(a, b))); append(mulHigh); return result; } @@ -655,7 +655,7 @@ @Override public Value emitRem(Value a, Value b, LIRFrameState state) { - Variable result = newVariable(LIRKind.derive(a, b)); + Variable result = newVariable(LIRKind.combine(a, b)); Variable q1; // Intermediate values Variable q2; Variable q3; @@ -697,7 +697,7 @@ @Override public Value emitURem(Value a, Value b, LIRFrameState state) { - Variable result = newVariable(LIRKind.derive(a, b)); + Variable result = newVariable(LIRKind.combine(a, b)); switch (a.getKind().getStackKind()) { case Int: append(new RemOp(IUREM, result, load(a), load(b), state, this)); @@ -770,7 +770,7 @@ } private Variable emitShift(SPARCArithmetic op, Value a, Value b) { - Variable result = newVariable(LIRKind.derive(a, b).changeType(a.getPlatformKind())); + Variable result = newVariable(LIRKind.combine(a, b).changeType(a.getPlatformKind())); if (isConstant(b) && canInlineConstant((JavaConstant) b)) { append(new BinaryRegConst(op, result, load(a), asConstant(b), null)); } else { @@ -832,11 +832,11 @@ AllocatableValue input = asAllocatable(inputVal); switch (op) { case D2F: - return emitConvert2Op(LIRKind.derive(inputVal).changeType(Kind.Float), D2F, input); + return emitConvert2Op(LIRKind.combine(inputVal).changeType(Kind.Float), D2F, input); case F2D: - return emitConvert2Op(LIRKind.derive(inputVal).changeType(Kind.Double), F2D, input); + return emitConvert2Op(LIRKind.combine(inputVal).changeType(Kind.Double), F2D, input); case I2F: { - AllocatableValue intEncodedFloatReg = newVariable(LIRKind.derive(input).changeType(Kind.Float)); + AllocatableValue intEncodedFloatReg = newVariable(LIRKind.combine(input).changeType(Kind.Float)); moveBetweenFpGp(intEncodedFloatReg, input); AllocatableValue convertedFloatReg = newVariable(intEncodedFloatReg.getLIRKind()); append(new Unary2Op(I2F, convertedFloatReg, intEncodedFloatReg)); @@ -845,48 +845,48 @@ case I2D: { // Unfortunately we must do int -> float -> double because fitod has float // and double encoding in one instruction - AllocatableValue convertedFloatReg = newVariable(LIRKind.derive(input).changeType(Kind.Float)); + AllocatableValue convertedFloatReg = newVariable(LIRKind.combine(input).changeType(Kind.Float)); moveBetweenFpGp(convertedFloatReg, input); - AllocatableValue convertedDoubleReg = newVariable(LIRKind.derive(input).changeType(Kind.Double)); + AllocatableValue convertedDoubleReg = newVariable(LIRKind.combine(input).changeType(Kind.Double)); append(new Unary2Op(I2D, convertedDoubleReg, convertedFloatReg)); return convertedDoubleReg; } case L2D: { - AllocatableValue longEncodedDoubleReg = newVariable(LIRKind.derive(input).changeType(Kind.Double)); + AllocatableValue longEncodedDoubleReg = newVariable(LIRKind.combine(input).changeType(Kind.Double)); moveBetweenFpGp(longEncodedDoubleReg, input); AllocatableValue convertedDoubleReg = newVariable(longEncodedDoubleReg.getLIRKind()); append(new Unary2Op(L2D, convertedDoubleReg, longEncodedDoubleReg)); return convertedDoubleReg; } case D2I: { - AllocatableValue convertedFloatReg = emitConvert2Op(LIRKind.derive(input).changeType(Kind.Float), D2I, input); - AllocatableValue convertedIntReg = newVariable(LIRKind.derive(convertedFloatReg).changeType(Kind.Int)); + AllocatableValue convertedFloatReg = emitConvert2Op(LIRKind.combine(input).changeType(Kind.Float), D2I, input); + AllocatableValue convertedIntReg = newVariable(LIRKind.combine(convertedFloatReg).changeType(Kind.Int)); moveBetweenFpGp(convertedIntReg, convertedFloatReg); return convertedIntReg; } case F2L: { - AllocatableValue convertedDoubleReg = emitConvert2Op(LIRKind.derive(input).changeType(Kind.Double), F2L, input); - AllocatableValue convertedLongReg = newVariable(LIRKind.derive(convertedDoubleReg).changeType(Kind.Long)); + AllocatableValue convertedDoubleReg = emitConvert2Op(LIRKind.combine(input).changeType(Kind.Double), F2L, input); + AllocatableValue convertedLongReg = newVariable(LIRKind.combine(convertedDoubleReg).changeType(Kind.Long)); moveBetweenFpGp(convertedLongReg, convertedDoubleReg); return convertedLongReg; } case F2I: { - AllocatableValue convertedFloatReg = emitConvert2Op(LIRKind.derive(input).changeType(Kind.Float), F2I, input); - AllocatableValue convertedIntReg = newVariable(LIRKind.derive(convertedFloatReg).changeType(Kind.Int)); + AllocatableValue convertedFloatReg = emitConvert2Op(LIRKind.combine(input).changeType(Kind.Float), F2I, input); + AllocatableValue convertedIntReg = newVariable(LIRKind.combine(convertedFloatReg).changeType(Kind.Int)); moveBetweenFpGp(convertedIntReg, convertedFloatReg); return convertedIntReg; } case D2L: { - AllocatableValue convertedDoubleReg = emitConvert2Op(LIRKind.derive(input).changeType(Kind.Double), D2L, input); - AllocatableValue convertedLongReg = newVariable(LIRKind.derive(convertedDoubleReg).changeType(Kind.Long)); + AllocatableValue convertedDoubleReg = emitConvert2Op(LIRKind.combine(input).changeType(Kind.Double), D2L, input); + AllocatableValue convertedLongReg = newVariable(LIRKind.combine(convertedDoubleReg).changeType(Kind.Long)); moveBetweenFpGp(convertedLongReg, convertedDoubleReg); return convertedLongReg; } case L2F: { // long -> double -> float see above - AllocatableValue convertedDoubleReg = newVariable(LIRKind.derive(input).changeType(Kind.Double)); + AllocatableValue convertedDoubleReg = newVariable(LIRKind.combine(input).changeType(Kind.Double)); moveBetweenFpGp(convertedDoubleReg, input); - AllocatableValue convertedFloatReg = newVariable(LIRKind.derive(input).changeType(Kind.Float)); + AllocatableValue convertedFloatReg = newVariable(LIRKind.combine(input).changeType(Kind.Float)); append(new Unary2Op(L2F, convertedFloatReg, convertedDoubleReg)); return convertedFloatReg; } @@ -919,7 +919,7 @@ @Override public Value emitNarrow(Value inputVal, int bits) { if (inputVal.getKind() == Kind.Long && bits <= 32) { - return emitConvert2Op(LIRKind.derive(inputVal).changeType(Kind.Int), L2I, asAllocatable(inputVal)); + return emitConvert2Op(LIRKind.combine(inputVal).changeType(Kind.Int), L2I, asAllocatable(inputVal)); } else { return inputVal; } @@ -934,11 +934,11 @@ // sign extend to 64 bits switch (fromBits) { case 8: - return emitConvert2Op(LIRKind.derive(inputVal).changeType(Kind.Long), B2L, asAllocatable(inputVal)); + return emitConvert2Op(LIRKind.combine(inputVal).changeType(Kind.Long), B2L, asAllocatable(inputVal)); case 16: - return emitConvert2Op(LIRKind.derive(inputVal).changeType(Kind.Long), S2L, asAllocatable(inputVal)); + return emitConvert2Op(LIRKind.combine(inputVal).changeType(Kind.Long), S2L, asAllocatable(inputVal)); case 32: - return emitConvert2Op(LIRKind.derive(inputVal).changeType(Kind.Long), I2L, asAllocatable(inputVal)); + return emitConvert2Op(LIRKind.combine(inputVal).changeType(Kind.Long), I2L, asAllocatable(inputVal)); default: throw JVMCIError.unimplemented("unsupported sign extension (" + fromBits + " bit -> " + toBits + " bit)"); } @@ -946,9 +946,9 @@ // sign extend to 32 bits (smaller values are internally represented as 32 bit values) switch (fromBits) { case 8: - return emitConvert2Op(LIRKind.derive(inputVal).changeType(Kind.Int), B2I, asAllocatable(inputVal)); + return emitConvert2Op(LIRKind.combine(inputVal).changeType(Kind.Int), B2I, asAllocatable(inputVal)); case 16: - return emitConvert2Op(LIRKind.derive(inputVal).changeType(Kind.Int), S2I, asAllocatable(inputVal)); + return emitConvert2Op(LIRKind.combine(inputVal).changeType(Kind.Int), S2I, asAllocatable(inputVal)); case 32: return inputVal; default: @@ -964,13 +964,13 @@ return inputVal; } else if (fromBits > 32) { assert inputVal.getKind() == Kind.Long; - Variable result = newVariable(LIRKind.derive(inputVal).changeType(Kind.Long)); + Variable result = newVariable(LIRKind.combine(inputVal).changeType(Kind.Long)); long mask = CodeUtil.mask(fromBits); append(new BinaryRegConst(SPARCArithmetic.LAND, result, asAllocatable(inputVal), JavaConstant.forLong(mask), null)); return result; } else { assert inputVal.getKind() == Kind.Int || inputVal.getKind() == Kind.Short || inputVal.getKind() == Kind.Byte || inputVal.getKind() == Kind.Char : inputVal.getKind(); - Variable result = newVariable(LIRKind.derive(inputVal).changeType(Kind.Int)); + Variable result = newVariable(LIRKind.combine(inputVal).changeType(Kind.Int)); long mask = CodeUtil.mask(fromBits); JavaConstant constant = JavaConstant.forInt((int) mask); if (fromBits == 32) { @@ -978,12 +978,12 @@ } else if (canInlineConstant(constant)) { append(new BinaryRegConst(SPARCArithmetic.IAND, result, asAllocatable(inputVal), constant, null)); } else { - Variable maskVar = newVariable(LIRKind.derive(inputVal).changeType(Kind.Int)); + Variable maskVar = newVariable(LIRKind.combine(inputVal).changeType(Kind.Int)); emitMove(maskVar, constant); append(new BinaryRegReg(IAND, result, maskVar, asAllocatable(inputVal))); } if (toBits > 32) { - Variable longResult = newVariable(LIRKind.derive(inputVal).changeType(Kind.Long)); + Variable longResult = newVariable(LIRKind.combine(inputVal).changeType(Kind.Long)); emitMove(longResult, result); return longResult; } else { diff -r 3c32af2369d2 -r 488d54275360 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/NodeLIRBuilder.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/NodeLIRBuilder.java Thu Jul 09 14:29:51 2015 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/NodeLIRBuilder.java Thu Jul 09 14:39:08 2015 +0200 @@ -215,7 +215,7 @@ } private static boolean verifyPHIKind(LIRKind derivedKind, LIRKind phiKind) { - assert derivedKind.getPlatformKind() != Kind.Object || !derivedKind.isDerivedReference(); + assert derivedKind.getPlatformKind() != Kind.Object || !derivedKind.isUnknownReference(); PlatformKind phiPlatformKind = phiKind.getPlatformKind(); assert derivedKind.equals(phiKind) || derivedKind.getPlatformKind().equals(phiPlatformKind instanceof Kind ? ((Kind) phiPlatformKind).getStackKind() : phiPlatformKind); return true; diff -r 3c32af2369d2 -r 488d54275360 graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLIRGenerator.java --- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLIRGenerator.java Thu Jul 09 14:29:51 2015 +0200 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLIRGenerator.java Thu Jul 09 14:39:08 2015 +0200 @@ -588,7 +588,7 @@ CompressEncoding encoding = config.getOopEncoding(); Value uncompressed; if (encoding.shift <= 3) { - LIRKind wordKind = LIRKind.derivedReference(target().wordKind); + LIRKind wordKind = LIRKind.unknownReference(target().wordKind); uncompressed = new AMD64AddressValue(wordKind, getProviders().getRegisters().getHeapBaseRegister().asValue(wordKind), asAllocatable(address), Scale.fromInt(1 << encoding.shift), 0); } else { uncompressed = emitUncompress(address, encoding, false); diff -r 3c32af2369d2 -r 488d54275360 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/GetObjectAddressNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/GetObjectAddressNode.java Thu Jul 09 14:29:51 2015 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/GetObjectAddressNode.java Thu Jul 09 14:39:08 2015 +0200 @@ -53,7 +53,7 @@ @Override public void generate(NodeLIRBuilderTool gen) { - AllocatableValue obj = gen.getLIRGeneratorTool().newVariable(LIRKind.derivedReference(gen.getLIRGeneratorTool().target().wordKind)); + AllocatableValue obj = gen.getLIRGeneratorTool().newVariable(LIRKind.unknownReference(gen.getLIRGeneratorTool().target().wordKind)); gen.getLIRGeneratorTool().emitMove(obj, gen.operand(object)); gen.setResult(this, obj); } diff -r 3c32af2369d2 -r 488d54275360 graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64ArrayEqualsOp.java --- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64ArrayEqualsOp.java Thu Jul 09 14:29:51 2015 +0200 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64ArrayEqualsOp.java Thu Jul 09 14:39:08 2015 +0200 @@ -78,8 +78,8 @@ this.lengthValue = length; // Allocate some temporaries. - this.temp1 = tool.newVariable(LIRKind.derivedReference(tool.target().wordKind)); - this.temp2 = tool.newVariable(LIRKind.derivedReference(tool.target().wordKind)); + this.temp1 = tool.newVariable(LIRKind.unknownReference(tool.target().wordKind)); + this.temp2 = tool.newVariable(LIRKind.unknownReference(tool.target().wordKind)); this.temp3 = tool.newVariable(LIRKind.value(tool.target().wordKind)); this.temp4 = tool.newVariable(LIRKind.value(tool.target().wordKind)); diff -r 3c32af2369d2 -r 488d54275360 graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCArithmetic.java --- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCArithmetic.java Thu Jul 09 14:29:51 2015 +0200 +++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCArithmetic.java Thu Jul 09 14:39:08 2015 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, 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 @@ -210,8 +210,8 @@ this.result = result; this.x = x; this.y = y; - this.scratch1 = gen.newVariable(LIRKind.derive(x, y)); - this.scratch2 = gen.newVariable(LIRKind.derive(x, y)); + this.scratch1 = gen.newVariable(LIRKind.combine(x, y)); + this.scratch2 = gen.newVariable(LIRKind.combine(x, y)); this.state = state; } @@ -245,8 +245,8 @@ this.result = result; this.x = x; this.y = y; - this.scratch1 = gen.newVariable(LIRKind.derive(x, y)); - this.scratch2 = gen.newVariable(LIRKind.derive(x, y)); + this.scratch1 = gen.newVariable(LIRKind.combine(x, y)); + this.scratch2 = gen.newVariable(LIRKind.combine(x, y)); } @Override diff -r 3c32af2369d2 -r 488d54275360 graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCArrayEqualsOp.java --- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCArrayEqualsOp.java Thu Jul 09 14:29:51 2015 +0200 +++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCArrayEqualsOp.java Thu Jul 09 14:39:08 2015 +0200 @@ -83,8 +83,8 @@ this.lengthValue = length; // Allocate some temporaries. - this.temp1 = tool.newVariable(LIRKind.derivedReference(tool.target().wordKind)); - this.temp2 = tool.newVariable(LIRKind.derivedReference(tool.target().wordKind)); + this.temp1 = tool.newVariable(LIRKind.unknownReference(tool.target().wordKind)); + this.temp2 = tool.newVariable(LIRKind.unknownReference(tool.target().wordKind)); this.temp3 = tool.newVariable(LIRKind.value(tool.target().wordKind)); this.temp4 = tool.newVariable(LIRKind.value(tool.target().wordKind)); this.temp5 = tool.newVariable(LIRKind.value(tool.target().wordKind)); diff -r 3c32af2369d2 -r 488d54275360 graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCBitManipulationOp.java --- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCBitManipulationOp.java Thu Jul 09 14:29:51 2015 +0200 +++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCBitManipulationOp.java Thu Jul 09 14:39:08 2015 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, 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 @@ -62,7 +62,7 @@ this.opcode = opcode; this.result = result; this.input = input; - scratch = gen.newVariable(LIRKind.derive(input)); + scratch = gen.newVariable(LIRKind.combine(input)); } @Override diff -r 3c32af2369d2 -r 488d54275360 graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCMove.java --- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCMove.java Thu Jul 09 14:29:51 2015 +0200 +++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCMove.java Thu Jul 09 14:39:08 2015 +0200 @@ -635,10 +635,10 @@ JavaConstant constant) { if (constant.isDefaultForKind() || constant.isNull()) { SPARCAddress resultAddress = (SPARCAddress) crb.asAddress(result); - emitStore(g0.asValue(LIRKind.derive(input)), resultAddress, input.getPlatformKind(), delaySlotLir, null, crb, masm); + emitStore(g0.asValue(LIRKind.combine(input)), resultAddress, input.getPlatformKind(), delaySlotLir, null, crb, masm); } else { try (ScratchRegister sc = masm.getScratchRegister()) { - Value scratchRegisterValue = sc.getRegister().asValue(LIRKind.derive(constant)); + Value scratchRegisterValue = sc.getRegister().asValue(LIRKind.combine(constant)); const2reg(crb, masm, scratchRegisterValue, constantTableBase, constant, SPARCDelayedControlTransfer.DUMMY); SPARCAddress resultAddress = (SPARCAddress) crb.asAddress(result); emitStore(scratchRegisterValue, resultAddress, input.getPlatformKind(), delaySlotLir, null, crb, masm); @@ -649,7 +649,7 @@ public static void stack2stack(CompilationResultBuilder crb, SPARCMacroAssembler masm, Value result, Value input, SPARCDelayedControlTransfer delaySlotLir) { try (ScratchRegister sc = masm.getScratchRegister()) { SPARCAddress inputAddress = (SPARCAddress) crb.asAddress(input); - Value scratchRegisterValue = sc.getRegister().asValue(LIRKind.derive(input)); + Value scratchRegisterValue = sc.getRegister().asValue(LIRKind.combine(input)); emitLoad(crb, masm, inputAddress, scratchRegisterValue, false, input.getPlatformKind(), SPARCDelayedControlTransfer.DUMMY, null); SPARCAddress resultAddress = (SPARCAddress) crb.asAddress(result); emitStore(scratchRegisterValue, resultAddress, input.getPlatformKind(), delaySlotLir, null, crb, masm); diff -r 3c32af2369d2 -r 488d54275360 graal/com.oracle.graal.lir/src/com/oracle/graal/lir/gen/LIRGenerator.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/gen/LIRGenerator.java Thu Jul 09 14:29:51 2015 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/gen/LIRGenerator.java Thu Jul 09 14:39:08 2015 +0200 @@ -397,7 +397,7 @@ } else if (base.getLIRKind().isReference(0) && displacement == 0L && index.equals(Value.ILLEGAL)) { return LIRKind.reference(target().wordKind); } else { - return LIRKind.derivedReference(target().wordKind); + return LIRKind.unknownReference(target().wordKind); } } diff -r 3c32af2369d2 -r 488d54275360 graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ssa/SSAUtils.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ssa/SSAUtils.java Thu Jul 09 14:29:51 2015 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ssa/SSAUtils.java Thu Jul 09 14:39:08 2015 +0200 @@ -141,7 +141,7 @@ for (AbstractBlockBase pred : merge.getPredecessors()) { forEachPhiValuePair(lir, merge, pred, (phiIn, phiOut) -> { assert phiIn.getLIRKind().equals(phiOut.getLIRKind()) || - (phiIn.getPlatformKind().equals(phiOut.getPlatformKind()) && phiIn.getLIRKind().isDerivedReference() && phiOut.getLIRKind().isValue()); + (phiIn.getPlatformKind().equals(phiOut.getPlatformKind()) && phiIn.getLIRKind().isUnknownReference() && phiOut.getLIRKind().isValue()); }); } } diff -r 3c32af2369d2 -r 488d54275360 jvmci/jdk.internal.jvmci.code/src/jdk/internal/jvmci/code/BytecodeFrame.java --- a/jvmci/jdk.internal.jvmci.code/src/jdk/internal/jvmci/code/BytecodeFrame.java Thu Jul 09 14:29:51 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.code/src/jdk/internal/jvmci/code/BytecodeFrame.java Thu Jul 09 14:39:08 2015 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2015, 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 @@ -197,7 +197,7 @@ assert values.length > i + 1 : String.format("missing second word %s", this); assert values[i + 1] == null || values[i + 1].getKind() == Kind.Illegal : this; } - assert derivedOk || ValueUtil.isIllegal(values[i]) || !values[i].getLIRKind().isDerivedReference() : "Unexpected derived value: " + values[i]; + assert derivedOk || ValueUtil.isIllegal(values[i]) || !values[i].getLIRKind().isUnknownReference() : "Unexpected derived value: " + values[i]; } } return true; diff -r 3c32af2369d2 -r 488d54275360 jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotReferenceMap.java --- a/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotReferenceMap.java Thu Jul 09 14:29:51 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotReferenceMap.java Thu Jul 09 14:39:08 2015 +0200 @@ -68,7 +68,7 @@ LIRKind lirKind = v.getLIRKind(); if (!lirKind.isValue()) { objectValues.add(v); - if (lirKind.isDerivedReference()) { + if (lirKind.isUnknownReference()) { objectCount++; } else { objectCount += lirKind.getReferenceCount(); @@ -92,7 +92,7 @@ for (Value obj : objectValues) { LIRKind kind = obj.getLIRKind(); int bytes = bytesPerElement(kind); - if (kind.isDerivedReference()) { + if (kind.isUnknownReference()) { throw JVMCIError.unimplemented("derived references not yet implemented"); } else { for (int i = 0; i < kind.getPlatformKind().getVectorLength(); i++) { diff -r 3c32af2369d2 -r 488d54275360 jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/LIRKind.java --- a/jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/LIRKind.java Thu Jul 09 14:29:51 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/LIRKind.java Thu Jul 09 14:39:08 2015 +0200 @@ -37,35 +37,35 @@ * *

* If the result value is created from one or more input values, the {@link LIRKind} should be - * created with {@link LIRKind#derive}(inputs). If the result has a different {@link PlatformKind} - * than the inputs, {@link LIRKind#derive}(inputs).{@link #changeType}(resultKind) should be used. + * created with {@link LIRKind#combine}(inputs). If the result has a different {@link PlatformKind} + * than the inputs, {@link LIRKind#combine}(inputs).{@link #changeType}(resultKind) should be used. *

* If the result is an exact copy of one of the inputs, {@link Value#getLIRKind()} can be used. Note * that this is only correct for move-like operations, like conditional move or compare-and-swap. - * For convert operations, {@link LIRKind#derive} should be used. + * For convert operations, {@link LIRKind#combine} should be used. *

* If it is known that the result will be a reference (e.g. pointer arithmetic where the end result * is a valid oop), {@link LIRKind#reference} should be used. *

* If it is known that the result will neither be a reference nor be derived from a reference, * {@link LIRKind#value} can be used. If the operation producing this value has inputs, this is very - * likely wrong, and {@link LIRKind#derive} should be used instead. + * likely wrong, and {@link LIRKind#combine} should be used instead. *

- * If it is known that the result is derived from a reference, {@link LIRKind#derivedReference} can - * be used. In most cases, {@link LIRKind#derive} should be used instead, since it is able to detect - * this automatically. + * If it is known that the result is derived from a reference in a way that the garbage collector + * can not track, {@link LIRKind#unknownReference} can be used. In most cases, + * {@link LIRKind#combine} should be used instead, since it is able to detect this automatically. */ public final class LIRKind { /** - * The non-type. This uses {@link #derivedReference}, so it can never be part of an oop map. + * The non-type. This uses {@link #unknownReference}, so it can never be part of an oop map. */ - public static final LIRKind Illegal = derivedReference(Kind.Illegal); + public static final LIRKind Illegal = unknownReference(Kind.Illegal); private final PlatformKind platformKind; private final int referenceMask; - private static final int DERIVED_REFERENCE = -1; + private static final int UNKNOWN_REFERENCE = -1; private LIRKind(PlatformKind platformKind, int referenceMask) { this.platformKind = platformKind; @@ -75,7 +75,7 @@ /** * Create a {@link LIRKind} of type {@code platformKind} that contains a primitive value. Should * be only used when it's guaranteed that the value is not even indirectly derived from a - * reference. Otherwise, {@link #derive(Value...)} should be used instead. + * reference. Otherwise, {@link #combine(Value...)} should be used instead. */ public static LIRKind value(PlatformKind platformKind) { assert platformKind != Kind.Object : "Object should always be used as reference type"; @@ -94,30 +94,30 @@ /** * Create a {@link LIRKind} of type {@code platformKind} that contains a value that is derived - * from a reference. Values of this {@link LIRKind} can not be live at safepoints. In most - * cases, this should not be called directly. {@link #derive} should be used instead to - * automatically propagate this information. + * from a reference in a non-linear way. Values of this {@link LIRKind} can not be live at + * safepoints. In most cases, this should not be called directly. {@link #combine} should be + * used instead to automatically propagate this information. */ - public static LIRKind derivedReference(PlatformKind platformKind) { - return new LIRKind(platformKind, DERIVED_REFERENCE); + public static LIRKind unknownReference(PlatformKind platformKind) { + return new LIRKind(platformKind, UNKNOWN_REFERENCE); } /** * Derive a new type from inputs. The result will have the {@link PlatformKind} of one of the - * inputs. If all inputs are values, the result is a value. Otherwise, the result is a derived + * inputs. If all inputs are values, the result is a value. Otherwise, the result is an unknown * reference. * * This method should be used to construct the result {@link LIRKind} of any operation that * modifies values (e.g. arithmetics). */ - public static LIRKind derive(Value... inputs) { + public static LIRKind combine(Value... inputs) { assert inputs.length > 0; for (Value input : inputs) { LIRKind kind = input.getLIRKind(); - if (kind.isDerivedReference()) { + if (kind.isUnknownReference()) { return kind; } else if (!kind.isValue()) { - return kind.makeDerivedReference(); + return kind.makeUnknownReference(); } } @@ -128,10 +128,10 @@ /** * Merge the types of the inputs. The result will have the {@link PlatformKind} of one of the * inputs. If all inputs are values (references), the result is a value (reference). Otherwise, - * the result is a derived reference. + * the result is an unknown reference. * - * This method should be used to construct the result {@link LIRKind} of merge operation that do - * not modify values (e.g. phis). + * This method should be used to construct the result {@link LIRKind} of merge operation that + * does not modify values (e.g. phis). */ public static LIRKind merge(Value... inputs) { assert inputs.length > 0; @@ -150,9 +150,9 @@ for (LIRKind kind : kinds) { - if (kind.isDerivedReference()) { + if (kind.isUnknownReference()) { /** - * Kind is a derived reference therefore the result can only be also a derived + * Kind is an unknown reference, therefore the result can only be also an unknown * reference. */ mergeKind = kind; @@ -167,10 +167,10 @@ /* Kind is a value. */ if (mergeKind.referenceMask != 0) { /* - * Inputs consists of values and references. Make the result a derived + * Inputs consists of values and references. Make the result an unknown * reference. */ - mergeKind = mergeKind.makeDerivedReference(); + mergeKind = mergeKind.makeUnknownReference(); break; } /* Check that other inputs are also values. */ @@ -178,9 +178,9 @@ /* Kind is a reference. */ if (mergeKind.referenceMask != kind.referenceMask) { /* - * Reference maps do not match so the result can only be a derived reference. + * Reference maps do not match so the result can only be an unknown reference. */ - mergeKind = mergeKind.makeDerivedReference(); + mergeKind = mergeKind.makeUnknownReference(); break; } } @@ -207,8 +207,8 @@ public LIRKind changeType(PlatformKind newPlatformKind) { if (newPlatformKind == platformKind) { return this; - } else if (isDerivedReference()) { - return derivedReference(newPlatformKind); + } else if (isUnknownReference()) { + return unknownReference(newPlatformKind); } else if (referenceMask == 0) { // value type return new LIRKind(newPlatformKind, 0); @@ -216,7 +216,7 @@ // reference type int newLength = Math.min(32, newPlatformKind.getVectorLength()); int newReferenceMask = referenceMask & (0xFFFFFFFF >>> (32 - newLength)); - assert newReferenceMask != DERIVED_REFERENCE; + assert newReferenceMask != UNKNOWN_REFERENCE; return new LIRKind(newPlatformKind, newReferenceMask); } } @@ -226,8 +226,8 @@ * new kind is longer than this, the reference positions are repeated to fill the vector. */ public LIRKind repeat(PlatformKind newPlatformKind) { - if (isDerivedReference()) { - return derivedReference(newPlatformKind); + if (isUnknownReference()) { + return unknownReference(newPlatformKind); } else if (referenceMask == 0) { // value type return new LIRKind(newPlatformKind, 0); @@ -243,16 +243,17 @@ newReferenceMask |= referenceMask << i; } - assert newReferenceMask != DERIVED_REFERENCE; + assert newReferenceMask != UNKNOWN_REFERENCE; return new LIRKind(newPlatformKind, newReferenceMask); } } /** - * Create a new {@link LIRKind} with the same type, but marked as containing a derivedReference. + * Create a new {@link LIRKind} with the same type, but marked as containing an + * {@link LIRKind#unknownReference}. */ - public LIRKind makeDerivedReference() { - return new LIRKind(platformKind, DERIVED_REFERENCE); + public LIRKind makeUnknownReference() { + return new LIRKind(platformKind, UNKNOWN_REFERENCE); } /** @@ -263,15 +264,15 @@ } /** - * Check whether this value is derived from a reference. If this returns {@code true}, this - * value must not be live at safepoints. + * Check whether this value is derived from a reference in a non-linear way. If this returns + * {@code true}, this value must not be live at safepoints. */ - public boolean isDerivedReference() { - return referenceMask == DERIVED_REFERENCE; + public boolean isUnknownReference() { + return referenceMask == UNKNOWN_REFERENCE; } public int getReferenceCount() { - assert !isDerivedReference(); + assert !isUnknownReference(); return Integer.bitCount(referenceMask); } @@ -284,7 +285,7 @@ */ public boolean isReference(int idx) { assert 0 <= idx && idx < platformKind.getVectorLength() : "invalid index " + idx + " in " + this; - return !isDerivedReference() && (referenceMask & 1 << idx) != 0; + return !isUnknownReference() && (referenceMask & 1 << idx) != 0; } /** @@ -298,7 +299,7 @@ public String toString() { if (isValue()) { return platformKind.name(); - } else if (isDerivedReference()) { + } else if (isUnknownReference()) { return platformKind.name() + "[*]"; } else { StringBuilder ret = new StringBuilder(); @@ -348,7 +349,7 @@ * (phi-)moves from e.g. integer to short can happen. Therefore we compare stack kinds. */ if (toStackKind(src.getPlatformKind()).equals(toStackKind(dst.getPlatformKind()))) { - return !src.isDerivedReference() || dst.isDerivedReference(); + return !src.isUnknownReference() || dst.isUnknownReference(); } return false; }