# HG changeset patch # User Thomas Wuerthinger # Date 1339081625 -7200 # Node ID d89b20486d8785925770105454233af51a55fa5c # Parent d2f2dede7c1a646bd91c85fe3b06360b5a55f4bc Renaming CiConstant => RiConstant. diff -r d2f2dede7c1a -r d89b20486d87 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:06:29 2012 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/DebugInfoBuilder.java Thu Jun 07 17:07:05 2012 +0200 @@ -169,7 +169,7 @@ } else if (value != null) { Debug.metric("StateVariables").increment(); CiValue operand = nodeOperands.get(value); - assert operand != null && (operand instanceof Variable || operand instanceof CiConstant); + assert operand != null && (operand instanceof Variable || operand instanceof RiConstant); return operand; } else { diff -r d2f2dede7c1a -r d89b20486d87 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:06:29 2012 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java Thu Jun 07 17:07:05 2012 +0200 @@ -229,14 +229,14 @@ } public CiValue loadNonConst(CiValue value) { - if (isConstant(value) && !canInlineConstant((CiConstant) value)) { + if (isConstant(value) && !canInlineConstant((RiConstant) value)) { return emitMove(value); } return value; } public CiValue loadForStore(CiValue value, CiKind storeKind) { - if (isConstant(value) && canStoreConstant((CiConstant) value)) { + if (isConstant(value) && canStoreConstant((RiConstant) value)) { return value; } if (storeKind == CiKind.Byte || storeKind == CiKind.Boolean) { @@ -723,12 +723,12 @@ private void emitNullCheckBranch(IsNullNode node, LabelRef trueSuccessor, LabelRef falseSuccessor, LIRDebugInfo info) { if (falseSuccessor != null) { - emitBranch(operand(node.object()), CiConstant.NULL_OBJECT, Condition.NE, false, falseSuccessor, info); + emitBranch(operand(node.object()), RiConstant.NULL_OBJECT, Condition.NE, false, falseSuccessor, info); if (trueSuccessor != null) { emitJump(trueSuccessor, null); } } else { - emitBranch(operand(node.object()), CiConstant.NULL_OBJECT, Condition.EQ, false, trueSuccessor, info); + emitBranch(operand(node.object()), RiConstant.NULL_OBJECT, Condition.EQ, false, trueSuccessor, info); } } @@ -788,7 +788,7 @@ } private Variable emitNullCheckConditional(IsNullNode node, CiValue trueValue, CiValue falseValue) { - return emitCMove(operand(node.object()), CiConstant.NULL_OBJECT, Condition.EQ, false, trueValue, falseValue); + return emitCMove(operand(node.object()), RiConstant.NULL_OBJECT, Condition.EQ, false, trueValue, falseValue); } private Variable emitInstanceOfConditional(InstanceOfNode x, CiValue trueValue, CiValue falseValue) { @@ -963,7 +963,7 @@ argumentList = Collections.emptyList(); } - emitCall(target, physReg, argumentList, CiConstant.forLong(0), info, null); + emitCall(target, physReg, argumentList, RiConstant.forLong(0), info, null); if (isLegal(physReg)) { return emitMove(physReg); @@ -998,7 +998,7 @@ info = stateFor(stateBeforeReturn, -1); } - emitCall(x.call(), resultOperand, argList, CiConstant.forLong(0), info, null); + emitCall(x.call(), resultOperand, argList, RiConstant.forLong(0), info, null); if (isLegal(resultOperand)) { setResult(x, emitMove(resultOperand)); @@ -1011,7 +1011,7 @@ if (x.numberOfCases() == 0 || x.numberOfCases() < GraalOptions.SequentialSwitchLimit) { int len = x.numberOfCases(); for (int i = 0; i < len; i++) { - emitBranch(tag, CiConstant.forInt(x.keyAt(i)), Condition.EQ, false, getLIRBlock(x.blockSuccessor(i)), null); + emitBranch(tag, RiConstant.forInt(x.keyAt(i)), Condition.EQ, false, getLIRBlock(x.blockSuccessor(i)), null); } emitJump(getLIRBlock(x.defaultSuccessor()), null); } else { @@ -1027,7 +1027,7 @@ int loKey = x.lowKey(); int len = x.numberOfCases(); for (int i = 0; i < len; i++) { - emitBranch(value, CiConstant.forInt(i + loKey), Condition.EQ, false, getLIRBlock(x.blockSuccessor(i)), null); + emitBranch(value, RiConstant.forInt(i + loKey), Condition.EQ, false, getLIRBlock(x.blockSuccessor(i)), null); } emitJump(getLIRBlock(x.defaultSuccessor()), null); } else { @@ -1101,14 +1101,14 @@ int highKey = oneRange.highKey; LabelRef dest = oneRange.sux; if (lowKey == highKey) { - emitBranch(value, CiConstant.forInt(lowKey), Condition.EQ, false, dest, null); + emitBranch(value, RiConstant.forInt(lowKey), Condition.EQ, false, dest, null); } else if (highKey - lowKey == 1) { - emitBranch(value, CiConstant.forInt(lowKey), Condition.EQ, false, dest, null); - emitBranch(value, CiConstant.forInt(highKey), Condition.EQ, false, dest, null); + emitBranch(value, RiConstant.forInt(lowKey), Condition.EQ, false, dest, null); + emitBranch(value, RiConstant.forInt(highKey), Condition.EQ, false, dest, null); } else { Label l = new Label(); - emitBranch(value, CiConstant.forInt(lowKey), Condition.LT, false, LabelRef.forLabel(l), null); - emitBranch(value, CiConstant.forInt(highKey), Condition.LE, false, dest, null); + emitBranch(value, RiConstant.forInt(lowKey), Condition.LT, false, LabelRef.forLabel(l), null); + emitBranch(value, RiConstant.forInt(highKey), Condition.LE, false, dest, null); emitLabel(l, false); } } @@ -1302,7 +1302,7 @@ argumentList = Util.uncheckedCast(Collections.emptyList()); } - emitCall(runtimeCall, physReg, argumentList, CiConstant.forLong(0), info, null); + emitCall(runtimeCall, physReg, argumentList, RiConstant.forLong(0), info, null); return physReg; } diff -r d2f2dede7c1a -r d89b20486d87 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/CanonicalizerPhase.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/CanonicalizerPhase.java Thu Jun 07 17:06:29 2012 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/CanonicalizerPhase.java Thu Jun 07 17:07:05 2012 +0200 @@ -109,7 +109,7 @@ * Determines if a given constant is an object/array whose current * fields/elements will never change. */ - boolean apply(CiConstant constant); + boolean apply(RiConstant constant); } private void processWorkSet(StructuredGraph graph) { @@ -269,7 +269,7 @@ } @Override - public boolean isImmutable(CiConstant objectConstant) { + public boolean isImmutable(RiConstant objectConstant) { return immutabilityPredicate != null && immutabilityPredicate.apply(objectConstant); } } diff -r d2f2dede7c1a -r d89b20486d87 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/SnippetIntrinsificationPhase.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/SnippetIntrinsificationPhase.java Thu Jun 07 17:06:29 2012 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/SnippetIntrinsificationPhase.java Thu Jun 07 17:07:05 2012 +0200 @@ -86,7 +86,7 @@ } // Call the method - CiConstant constant = callMethod(target.signature().returnKind(false), target.holder().toJava(), target.name(), parameterTypes, receiver, arguments); + RiConstant constant = callMethod(target.signature().returnKind(false), target.holder().toJava(), target.name(), parameterTypes, receiver, arguments); if (constant != null) { // Replace the invoke with the result of the call @@ -120,7 +120,7 @@ if (folding || CiUtil.getParameterAnnotation(ConstantNodeParameter.class, parameterIndex, target) != null) { assert argument instanceof ConstantNode : "parameter " + parameterIndex + " must be a compile time constant for calling " + invoke.callTarget().targetMethod() + ": " + argument; ConstantNode constantNode = (ConstantNode) argument; - CiConstant constant = constantNode.asConstant(); + RiConstant constant = constantNode.asConstant(); Object o = constant.boxedValue(); if (o instanceof Class< ? >) { reflectionCallArguments[i] = runtime.getType((Class< ? >) o); @@ -214,7 +214,7 @@ /** * Calls a Java method via reflection. */ - private static CiConstant callMethod(CiKind returnKind, Class< ? > holder, String name, Class< ? >[] parameterTypes, Object receiver, Object[] arguments) { + private static RiConstant callMethod(CiKind returnKind, Class< ? > holder, String name, Class< ? >[] parameterTypes, Object receiver, Object[] arguments) { Method method; try { method = holder.getDeclaredMethod(name, parameterTypes); @@ -227,7 +227,7 @@ if (result == null) { return null; } - return CiConstant.forBoxed(returnKind, result); + return RiConstant.forBoxed(returnKind, result); } catch (Exception e) { throw new RuntimeException(e); } diff -r d2f2dede7c1a -r d89b20486d87 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:06:29 2012 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/amd64/AMD64DeoptimizationStub.java Thu Jun 07 17:07:05 2012 +0200 @@ -58,7 +58,7 @@ if (GraalOptions.CreateDeoptInfo && deoptInfo != null) { masm.nop(); keepAlive.add(deoptInfo.toString()); - AMD64Move.move(tasm, masm, scratch.asValue(), CiConstant.forObject(deoptInfo)); + AMD64Move.move(tasm, masm, scratch.asValue(), RiConstant.forObject(deoptInfo)); // TODO Make this an explicit calling convention instead of using a scratch register AMD64Call.directCall(tasm, masm, CiRuntimeCall.SetDeoptInfo, info); } diff -r d2f2dede7c1a -r d89b20486d87 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:06:29 2012 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/amd64/AMD64LIRGenerator.java Thu Jun 07 17:07:05 2012 +0200 @@ -113,7 +113,7 @@ } @Override - public boolean canStoreConstant(CiConstant c) { + public boolean canStoreConstant(RiConstant c) { // there is no immediate move of 64-bit constants on Intel switch (c.kind) { case Long: return Util.isInt(c.asLong()); @@ -124,7 +124,7 @@ } @Override - public boolean canInlineConstant(CiConstant c) { + public boolean canInlineConstant(RiConstant c) { switch (c.kind) { case Long: return NumUtil.isInt(c.asLong()); case Object: return c.isNull(); @@ -286,8 +286,8 @@ switch (input.kind) { case Int: append(new Op1Stack(INEG, result, input)); break; case Long: append(new Op1Stack(LNEG, result, input)); break; - case Float: append(new Op2Reg(FXOR, result, input, CiConstant.forFloat(Float.intBitsToFloat(0x80000000)))); break; - case Double: append(new Op2Reg(DXOR, result, input, CiConstant.forDouble(Double.longBitsToDouble(0x8000000000000000L)))); break; + case Float: append(new Op2Reg(FXOR, result, input, RiConstant.forFloat(Float.intBitsToFloat(0x80000000)))); break; + case Double: append(new Op2Reg(DXOR, result, input, RiConstant.forDouble(Double.longBitsToDouble(0x8000000000000000L)))); break; default: throw GraalInternalError.shouldNotReachHere(); } return result; @@ -607,7 +607,7 @@ append(new CompareAndSwapOp(rax, address, rax, newValue)); Variable result = newVariable(node.kind()); - append(new CondMoveOp(result, Condition.EQ, load(CiConstant.TRUE), CiConstant.FALSE)); + append(new CondMoveOp(result, Condition.EQ, load(RiConstant.TRUE), RiConstant.FALSE)); setResult(node, result); } } diff -r d2f2dede7c1a -r d89b20486d87 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:06:29 2012 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/amd64/AMD64XirOp.java Thu Jun 07 17:07:05 2012 +0200 @@ -194,7 +194,7 @@ CiAddress src; if (isConstant(index)) { assert index.kind == CiKind.Int; - CiConstant constantIndex = (CiConstant) index; + RiConstant constantIndex = (RiConstant) index; src = new CiAddress(inst.kind, pointer, constantIndex.asInt() * scale.value + displacement); } else { src = new CiAddress(inst.kind, pointer, index, scale, displacement); @@ -238,7 +238,7 @@ CiAddress dst; if (isConstant(index)) { assert index.kind == CiKind.Int; - CiConstant constantIndex = (CiConstant) index; + RiConstant constantIndex = (RiConstant) index; dst = new CiAddress(inst.kind, pointer, IllegalValue, scale, constantIndex.asInt() * scale.value + displacement); } else { dst = new CiAddress(inst.kind, pointer, index, scale, displacement); @@ -370,8 +370,8 @@ CiValue offset = operands[inst.y().index]; CiValue bit = operands[inst.z().index]; assert isConstant(offset) && isConstant(bit); - CiConstant constantOffset = (CiConstant) offset; - CiConstant constantBit = (CiConstant) bit; + RiConstant constantOffset = (RiConstant) offset; + RiConstant constantBit = (RiConstant) bit; CiAddress src = new CiAddress(inst.kind, pointer, constantOffset.asInt()); masm.btli(src, constantBit.asInt()); masm.jcc(ConditionFlag.aboveEqual, label); diff -r d2f2dede7c1a -r d89b20486d87 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/types/NegateObjectTypeFeedback.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/types/NegateObjectTypeFeedback.java Thu Jun 07 17:06:29 2012 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/types/NegateObjectTypeFeedback.java Thu Jun 07 17:07:05 2012 +0200 @@ -38,7 +38,7 @@ } @Override - public void constantBound(Condition condition, CiConstant constant) { + public void constantBound(Condition condition, RiConstant constant) { delegate.constantBound(condition.negate(), constant); } diff -r d2f2dede7c1a -r d89b20486d87 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/types/NegateScalarTypeFeedback.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/types/NegateScalarTypeFeedback.java Thu Jun 07 17:06:29 2012 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/types/NegateScalarTypeFeedback.java Thu Jun 07 17:07:05 2012 +0200 @@ -37,7 +37,7 @@ } @Override - public void constantBound(Condition condition, CiConstant constant) { + public void constantBound(Condition condition, RiConstant constant) { delegate.constantBound(condition.negate(), constant); } @@ -47,7 +47,7 @@ } @Override - public void setTranslated(CiConstant delta, ScalarTypeQuery old) { + public void setTranslated(RiConstant delta, ScalarTypeQuery old) { throw new UnsupportedOperationException(); } } diff -r d2f2dede7c1a -r d89b20486d87 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVM.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVM.java Thu Jun 07 17:06:29 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVM.java Thu Jun 07 17:07:05 2012 +0200 @@ -87,11 +87,11 @@ RiType RiType_superType(HotSpotTypeResolved klass); - int getArrayLength(CiConstant array); + int getArrayLength(RiConstant array); - boolean compareConstantObjects(CiConstant x, CiConstant y); + boolean compareConstantObjects(RiConstant x, RiConstant y); - RiType getRiType(CiConstant constant); + RiType getRiType(RiConstant constant); RiResolvedField[] RiType_fields(HotSpotTypeResolved klass); diff -r d2f2dede7c1a -r d89b20486d87 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVMImpl.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVMImpl.java Thu Jun 07 17:06:29 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVMImpl.java Thu Jun 07 17:07:05 2012 +0200 @@ -117,17 +117,17 @@ public native RiType getType(Class javaClass); @Override - public int getArrayLength(CiConstant array) { + public int getArrayLength(RiConstant array) { return Array.getLength(array.asObject()); } @Override - public boolean compareConstantObjects(CiConstant x, CiConstant y) { + public boolean compareConstantObjects(RiConstant x, RiConstant y) { return x.asObject() == y.asObject(); } @Override - public RiType getRiType(CiConstant constant) { + public RiType getRiType(RiConstant constant) { Object o = constant.asObject(); if (o == null) { return null; diff -r d2f2dede7c1a -r d89b20486d87 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompiler.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompiler.java Thu Jun 07 17:06:29 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompiler.java Thu Jun 07 17:07:05 2012 +0200 @@ -58,13 +58,13 @@ RiType createRiTypeUnresolved(String name); - CiConstant createCiConstant(CiKind kind, long value); + RiConstant createCiConstant(CiKind kind, long value); - CiConstant createCiConstantFloat(float value); + RiConstant createCiConstantFloat(float value); - CiConstant createCiConstantDouble(double value); + RiConstant createCiConstantDouble(double value); - CiConstant createCiConstantObject(Object object); + RiConstant createCiConstantObject(Object object); PhasePlan createPhasePlan(OptimisticOptimizations optimisticOpts); } diff -r d2f2dede7c1a -r d89b20486d87 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java Thu Jun 07 17:06:29 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java Thu Jun 07 17:07:05 2012 +0200 @@ -454,37 +454,37 @@ } @Override - public CiConstant createCiConstant(CiKind kind, long value) { + public RiConstant createCiConstant(CiKind kind, long value) { if (kind == CiKind.Long) { - return CiConstant.forLong(value); + return RiConstant.forLong(value); } else if (kind == CiKind.Int) { - return CiConstant.forInt((int) value); + return RiConstant.forInt((int) value); } else if (kind == CiKind.Short) { - return CiConstant.forShort((short) value); + return RiConstant.forShort((short) value); } else if (kind == CiKind.Char) { - return CiConstant.forChar((char) value); + return RiConstant.forChar((char) value); } else if (kind == CiKind.Byte) { - return CiConstant.forByte((byte) value); + return RiConstant.forByte((byte) value); } else if (kind == CiKind.Boolean) { - return (value == 0) ? CiConstant.FALSE : CiConstant.TRUE; + return (value == 0) ? RiConstant.FALSE : RiConstant.TRUE; } else { throw new IllegalArgumentException(); } } @Override - public CiConstant createCiConstantFloat(float value) { - return CiConstant.forFloat(value); + public RiConstant createCiConstantFloat(float value) { + return RiConstant.forFloat(value); } @Override - public CiConstant createCiConstantDouble(double value) { - return CiConstant.forDouble(value); + public RiConstant createCiConstantDouble(double value) { + return RiConstant.forDouble(value); } @Override - public CiConstant createCiConstantObject(Object object) { - return CiConstant.forObject(object); + public RiConstant createCiConstantObject(Object object) { + return RiConstant.forObject(object); } diff -r d2f2dede7c1a -r d89b20486d87 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:06:29 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/counters/MethodEntryCounters.java Thu Jun 07 17:07:05 2012 +0200 @@ -84,7 +84,7 @@ int off = Unsafe.getUnsafe().arrayBaseOffset(long[].class); int scale = Unsafe.getUnsafe().arrayIndexScale(long[].class); - AMD64Move.move(tasm, masm, counterArr, CiConstant.forObject(counter.counts)); + AMD64Move.move(tasm, masm, counterArr, RiConstant.forObject(counter.counts)); AMD64Move.load(tasm, masm, callerPc, new CiAddress(CiKind.Long, AMD64.rbp.asValue(CiKind.Long), 8), null); Label done = new Label(); diff -r d2f2dede7c1a -r d89b20486d87 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:06:29 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/WriteBarrier.java Thu Jun 07 17:07:05 2012 +0200 @@ -36,15 +36,15 @@ protected void generateBarrier(CiValue adr, LIRGeneratorTool gen) { HotSpotVMConfig config = CompilerImpl.getInstance().getConfig(); - CiValue base = gen.emitUShr(adr, CiConstant.forInt(config.cardtableShift)); + CiValue base = gen.emitUShr(adr, RiConstant.forInt(config.cardtableShift)); long startAddress = config.cardtableStartAddress; int displacement = 0; if (((int) startAddress) == startAddress) { displacement = (int) startAddress; } else { - base = gen.emitAdd(base, CiConstant.forLong(config.cardtableStartAddress)); + base = gen.emitAdd(base, RiConstant.forLong(config.cardtableStartAddress)); } - gen.emitStore(new CiAddress(CiKind.Boolean, base, displacement), CiConstant.FALSE, false); + gen.emitStore(new CiAddress(CiKind.Boolean, base, displacement), RiConstant.FALSE, false); } } diff -r d2f2dede7c1a -r d89b20486d87 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotField.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotField.java Thu Jun 07 17:06:29 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotField.java Thu Jun 07 17:07:05 2012 +0200 @@ -44,7 +44,7 @@ private final RiType type; private final int offset; private final int accessFlags; - private CiConstant constant; // Constant part only valid for static fields. + private RiConstant constant; // Constant part only valid for static fields. public HotSpotField(Compiler compiler, RiResolvedType holder, String name, RiType type, int offset, int accessFlags) { super(compiler); @@ -62,13 +62,13 @@ } @Override - public CiConstant constantValue(CiConstant receiver) { + public RiConstant constantValue(RiConstant receiver) { if (receiver == null) { assert Modifier.isStatic(accessFlags); if (constant == null) { if (holder.isInitialized() && holder.toJava() != System.class) { if (Modifier.isFinal(accessFlags()) || assumeStaticFieldsFinal(holder.toJava())) { - CiConstant encoding = holder.getEncoding(Representation.StaticFields); + RiConstant encoding = holder.getEncoding(Representation.StaticFields); constant = this.kind(false).readUnsafeConstant(encoding.asObject(), offset); } } diff -r d2f2dede7c1a -r d89b20486d87 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:06:29 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotRuntime.java Thu Jun 07 17:07:05 2012 +0200 @@ -189,7 +189,7 @@ } @Override - public RiResolvedType getTypeOf(CiConstant constant) { + public RiResolvedType getTypeOf(RiConstant constant) { return (RiResolvedType) compiler.getCompilerToVM().getRiType(constant); } @@ -200,7 +200,7 @@ } @Override - public boolean areConstantObjectsEqual(CiConstant x, CiConstant y) { + public boolean areConstantObjectsEqual(RiConstant x, RiConstant y) { return compiler.getCompilerToVM().compareConstantObjects(x, y); } @@ -224,7 +224,7 @@ } @Override - public int getArrayLength(CiConstant array) { + public int getArrayLength(RiConstant array) { return compiler.getCompilerToVM().getArrayLength(array); } diff -r d2f2dede7c1a -r d89b20486d87 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotTypePrimitive.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotTypePrimitive.java Thu Jun 07 17:06:29 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotTypePrimitive.java Thu Jun 07 17:07:05 2012 +0200 @@ -78,7 +78,7 @@ } @Override - public CiConstant getEncoding(Representation r) { + public RiConstant getEncoding(Representation r) { throw GraalInternalError.unimplemented("HotSpotTypePrimitive.getEncoding"); } @@ -113,7 +113,7 @@ } @Override - public boolean isInstance(CiConstant obj) { + public boolean isInstance(RiConstant obj) { return false; } diff -r d2f2dede7c1a -r d89b20486d87 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotTypeResolvedImpl.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotTypeResolvedImpl.java Thu Jun 07 17:06:29 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotTypeResolvedImpl.java Thu Jun 07 17:07:05 2012 +0200 @@ -115,14 +115,14 @@ } @Override - public CiConstant getEncoding(Representation r) { + public RiConstant getEncoding(Representation r) { switch (r) { case JavaClass: - return CiConstant.forObject(javaMirror); + return RiConstant.forObject(javaMirror); case ObjectHub: - return CiConstant.forObject(klassOop()); + return RiConstant.forObject(klassOop()); case StaticFields: - return CiConstant.forObject(javaMirror); + return RiConstant.forObject(javaMirror); default: return null; } @@ -162,7 +162,7 @@ } @Override - public boolean isInstance(CiConstant obj) { + public boolean isInstance(RiConstant obj) { return javaMirror.isInstance(obj); } diff -r d2f2dede7c1a -r d89b20486d87 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:06:29 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotXirGenerator.java Thu Jun 07 17:07:05 2012 +0200 @@ -90,10 +90,10 @@ private XirConstant wordConst(CiXirAssembler asm, long value) { if (target.wordKind == CiKind.Long) { - return asm.createConstant(CiConstant.forLong(value)); + return asm.createConstant(RiConstant.forLong(value)); } else { assert target.wordKind == CiKind.Int; - return asm.createConstant(CiConstant.forInt((int) value)); + return asm.createConstant(RiConstant.forInt((int) value)); } } @@ -121,7 +121,7 @@ asm.pload(target.wordKind, temp, receiver, true); } asm.mark(MARK_INVOKEINTERFACE); - asm.mov(tempO, asm.createConstant(CiConstant.forObject(HotSpotProxy.DUMMY_CONSTANT_OBJ))); + asm.mov(tempO, asm.createConstant(RiConstant.forObject(HotSpotProxy.DUMMY_CONSTANT_OBJ))); return asm.finishTemplate(addr, "invokeinterface"); } @@ -142,7 +142,7 @@ asm.pload(target.wordKind, temp, receiver, true); } asm.mark(MARK_INVOKEVIRTUAL); - asm.mov(tempO, asm.createConstant(CiConstant.forObject(HotSpotProxy.DUMMY_CONSTANT_OBJ))); + asm.mov(tempO, asm.createConstant(RiConstant.forObject(HotSpotProxy.DUMMY_CONSTANT_OBJ))); return asm.finishTemplate(addr, "invokevirtual"); } diff -r d2f2dede7c1a -r d89b20486d87 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:06:29 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/server/ReplacingStreams.java Thu Jun 07 17:07:05 2012 +0200 @@ -165,8 +165,8 @@ } // is the object a constant of object type? - if (obj.getClass() == CiConstant.class) { - CiConstant constant = (CiConstant) obj; + if (obj.getClass() == RiConstant.class) { + RiConstant constant = (RiConstant) obj; if (constant.kind != CiKind.Object) { return obj; } @@ -180,12 +180,12 @@ } placeholder = objectMap.get(contents); if (placeholder != null) { - return CiConstant.forObject(placeholder); + return RiConstant.forObject(placeholder); } if (contents instanceof Remote) { - return CiConstant.forObject(createRemoteCallPlaceholder(contents)); + return RiConstant.forObject(createRemoteCallPlaceholder(contents)); } - return CiConstant.forObject(createDummyPlaceholder(contents)); + return RiConstant.forObject(createDummyPlaceholder(contents)); } return obj; } diff -r d2f2dede7c1a -r d89b20486d87 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:06:29 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/HotSpotAMD64Backend.java Thu Jun 07 17:07:05 2012 +0200 @@ -72,8 +72,8 @@ CiAddress exceptionAddress = new CiAddress(CiKind.Object, thread, config.threadExceptionOopOffset); CiAddress pcAddress = new CiAddress(CiKind.Long, thread, config.threadExceptionPcOffset); CiValue exception = emitLoad(exceptionAddress, false); - emitStore(exceptionAddress, CiConstant.NULL_OBJECT, false); - emitStore(pcAddress, CiConstant.LONG_0, false); + emitStore(exceptionAddress, RiConstant.NULL_OBJECT, false); + emitStore(pcAddress, RiConstant.LONG_0, false); setResult(x, exception); } diff -r d2f2dede7c1a -r d89b20486d87 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:06:29 2012 +0200 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java Thu Jun 07 17:07:05 2012 +0200 @@ -289,8 +289,8 @@ append(currentGraph.add(new DeoptimizeNode(RiDeoptAction.InvalidateRecompile, RiDeoptReason.Unresolved, graphId))); frameState.push(CiKind.Object, append(ConstantNode.forObject(null, runtime, currentGraph))); } - } else if (con instanceof CiConstant) { - CiConstant constant = (CiConstant) con; + } else if (con instanceof RiConstant) { + RiConstant constant = (RiConstant) con; frameState.push(constant.kind.stackKind(), appendConstant(constant)); } else { throw new Error("lookupConstant returned an object of incorrect type"); @@ -545,13 +545,13 @@ } private void genIfZero(Condition cond) { - ValueNode y = appendConstant(CiConstant.INT_0); + ValueNode y = appendConstant(RiConstant.INT_0); ValueNode x = frameState.ipop(); ifNode(x, cond, y); } private void genIfNull(Condition cond) { - ValueNode y = appendConstant(CiConstant.NULL_OBJECT); + ValueNode y = appendConstant(RiConstant.NULL_OBJECT); ValueNode x = frameState.apop(); ifNode(x, cond, y); } @@ -636,7 +636,7 @@ } else { ValueNode object = frameState.apop(); append(currentGraph.add(new FixedGuardNode(currentGraph.unique(new IsNullNode(object)), RiDeoptReason.Unresolved, RiDeoptAction.InvalidateRecompile, graphId))); - frameState.apush(appendConstant(CiConstant.NULL_OBJECT)); + frameState.apush(appendConstant(RiConstant.NULL_OBJECT)); } } @@ -655,7 +655,7 @@ IfNode ifNode = currentGraph.add(new IfNode(currentGraph.unique(new IsNullNode(object)), successor, deopt, 0)); append(ifNode); lastInstr = successor; - frameState.ipush(appendConstant(CiConstant.INT_0)); + frameState.ipush(appendConstant(RiConstant.INT_0)); } } @@ -666,7 +666,7 @@ frameState.apush(append(n)); } else { append(currentGraph.add(new DeoptimizeNode(RiDeoptAction.InvalidateRecompile, RiDeoptReason.Unresolved, graphId))); - frameState.apush(appendConstant(CiConstant.NULL_OBJECT)); + frameState.apush(appendConstant(RiConstant.NULL_OBJECT)); } } @@ -707,7 +707,7 @@ frameState.apush(append(n)); } else { append(currentGraph.add(new DeoptimizeNode(RiDeoptAction.InvalidateRecompile, RiDeoptReason.Unresolved, graphId))); - frameState.apush(appendConstant(CiConstant.NULL_OBJECT)); + frameState.apush(appendConstant(RiConstant.NULL_OBJECT)); } } @@ -724,7 +724,7 @@ frameState.apush(append(n)); } else { append(currentGraph.add(new DeoptimizeNode(RiDeoptAction.InvalidateRecompile, RiDeoptReason.Unresolved, graphId))); - frameState.apush(appendConstant(CiConstant.NULL_OBJECT)); + frameState.apush(appendConstant(RiConstant.NULL_OBJECT)); } } @@ -821,7 +821,7 @@ private void genGetStatic(RiField field) { RiType holder = field.holder(); boolean isInitialized = (field instanceof RiResolvedField) && ((RiResolvedType) holder).isInitialized(); - CiConstant constantValue = null; + RiConstant constantValue = null; if (isInitialized) { constantValue = ((RiResolvedField) field).constantValue(null); } @@ -1096,7 +1096,7 @@ append(lookupSwitch); } - private ConstantNode appendConstant(CiConstant constant) { + private ConstantNode appendConstant(RiConstant constant) { return ConstantNode.forCiConstant(constant, runtime, currentGraph); } @@ -1514,23 +1514,23 @@ // Checkstyle: stop switch (opcode) { case NOP : /* nothing to do */ break; - case ACONST_NULL : frameState.apush(appendConstant(CiConstant.NULL_OBJECT)); break; - case ICONST_M1 : frameState.ipush(appendConstant(CiConstant.INT_MINUS_1)); break; - case ICONST_0 : frameState.ipush(appendConstant(CiConstant.INT_0)); break; - case ICONST_1 : frameState.ipush(appendConstant(CiConstant.INT_1)); break; - case ICONST_2 : frameState.ipush(appendConstant(CiConstant.INT_2)); break; - case ICONST_3 : frameState.ipush(appendConstant(CiConstant.INT_3)); break; - case ICONST_4 : frameState.ipush(appendConstant(CiConstant.INT_4)); break; - case ICONST_5 : frameState.ipush(appendConstant(CiConstant.INT_5)); break; - case LCONST_0 : frameState.lpush(appendConstant(CiConstant.LONG_0)); break; - case LCONST_1 : frameState.lpush(appendConstant(CiConstant.LONG_1)); break; - case FCONST_0 : frameState.fpush(appendConstant(CiConstant.FLOAT_0)); break; - case FCONST_1 : frameState.fpush(appendConstant(CiConstant.FLOAT_1)); break; - case FCONST_2 : frameState.fpush(appendConstant(CiConstant.FLOAT_2)); break; - case DCONST_0 : frameState.dpush(appendConstant(CiConstant.DOUBLE_0)); break; - case DCONST_1 : frameState.dpush(appendConstant(CiConstant.DOUBLE_1)); break; - case BIPUSH : frameState.ipush(appendConstant(CiConstant.forInt(stream.readByte()))); break; - case SIPUSH : frameState.ipush(appendConstant(CiConstant.forInt(stream.readShort()))); break; + case ACONST_NULL : frameState.apush(appendConstant(RiConstant.NULL_OBJECT)); break; + case ICONST_M1 : frameState.ipush(appendConstant(RiConstant.INT_MINUS_1)); break; + case ICONST_0 : frameState.ipush(appendConstant(RiConstant.INT_0)); break; + case ICONST_1 : frameState.ipush(appendConstant(RiConstant.INT_1)); break; + case ICONST_2 : frameState.ipush(appendConstant(RiConstant.INT_2)); break; + case ICONST_3 : frameState.ipush(appendConstant(RiConstant.INT_3)); break; + case ICONST_4 : frameState.ipush(appendConstant(RiConstant.INT_4)); break; + case ICONST_5 : frameState.ipush(appendConstant(RiConstant.INT_5)); break; + case LCONST_0 : frameState.lpush(appendConstant(RiConstant.LONG_0)); break; + case LCONST_1 : frameState.lpush(appendConstant(RiConstant.LONG_1)); break; + case FCONST_0 : frameState.fpush(appendConstant(RiConstant.FLOAT_0)); break; + case FCONST_1 : frameState.fpush(appendConstant(RiConstant.FLOAT_1)); break; + case FCONST_2 : frameState.fpush(appendConstant(RiConstant.FLOAT_2)); break; + case DCONST_0 : frameState.dpush(appendConstant(RiConstant.DOUBLE_0)); break; + case DCONST_1 : frameState.dpush(appendConstant(RiConstant.DOUBLE_1)); break; + case BIPUSH : frameState.ipush(appendConstant(RiConstant.forInt(stream.readByte()))); break; + case SIPUSH : frameState.ipush(appendConstant(RiConstant.forInt(stream.readShort()))); break; case LDC : // fall through case LDC_W : // fall through case LDC2_W : genLoadConstant(stream.readCPI(), opcode); break; diff -r d2f2dede7c1a -r d89b20486d87 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:06:29 2012 +0200 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Arithmetic.java Thu Jun 07 17:07:05 2012 +0200 @@ -503,7 +503,7 @@ tasm.stubs.add(slowPath); switch (result.kind) { case Int: masm.cmpl(asIntReg(result), Integer.MIN_VALUE); break; - case Long: masm.cmpq(asLongReg(result), tasm.asLongConstRef(CiConstant.forLong(java.lang.Long.MIN_VALUE))); break; + case Long: masm.cmpq(asLongReg(result), tasm.asLongConstRef(RiConstant.forLong(java.lang.Long.MIN_VALUE))); break; default: throw GraalInternalError.shouldNotReachHere(); } masm.jcc(ConditionFlag.equal, slowPath.start); @@ -525,8 +525,8 @@ public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) { masm.bind(start); switch (x.kind) { - case Float: masm.ucomiss(asFloatReg(x), tasm.asFloatConstRef(CiConstant.FLOAT_0)); break; - case Double: masm.ucomisd(asDoubleReg(x), tasm.asDoubleConstRef(CiConstant.DOUBLE_0)); break; + case Float: masm.ucomiss(asFloatReg(x), tasm.asFloatConstRef(RiConstant.FLOAT_0)); break; + case Double: masm.ucomisd(asDoubleReg(x), tasm.asDoubleConstRef(RiConstant.DOUBLE_0)); break; default: throw GraalInternalError.shouldNotReachHere(); } Label nan = new Label(); diff -r d2f2dede7c1a -r d89b20486d87 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:06:29 2012 +0200 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Compare.java Thu Jun 07 17:07:05 2012 +0200 @@ -87,7 +87,7 @@ case ICMP: masm.cmpl(asIntReg(x), tasm.asIntConst(y)); break; case LCMP: masm.cmpq(asLongReg(x), tasm.asIntConst(y)); break; case ACMP: - if (((CiConstant) y).isNull()) { + if (((RiConstant) y).isNull()) { masm.cmpq(asObjectReg(x), 0); break; } else { throw GraalInternalError.shouldNotReachHere("Only null object constants are allowed in comparisons"); diff -r d2f2dede7c1a -r d89b20486d87 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:06:29 2012 +0200 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Move.java Thu Jun 07 17:07:05 2012 +0200 @@ -281,9 +281,9 @@ } } else if (isConstant(input)) { if (isRegister(result)) { - const2reg(tasm, masm, result, (CiConstant) input); + const2reg(tasm, masm, result, (RiConstant) input); } else if (isStackSlot(result)) { - const2stack(tasm, masm, result, (CiConstant) input); + const2stack(tasm, masm, result, (RiConstant) input); } else { throw GraalInternalError.shouldNotReachHere(); } @@ -331,7 +331,7 @@ } } - private static void const2reg(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue result, CiConstant input) { + private static void const2reg(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue 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). @@ -383,7 +383,7 @@ } } - private static void const2stack(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue result, CiConstant input) { + private static void const2stack(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue result, RiConstant input) { switch (input.kind.stackKind()) { case Jsr: case Int: masm.movl(tasm.asAddress(result), input.asInt()); break; @@ -440,7 +440,7 @@ default: throw GraalInternalError.shouldNotReachHere(); } } else if (isConstant(input)) { - CiConstant c = (CiConstant) input; + RiConstant c = (RiConstant) input; switch (storeAddr.kind) { case Boolean: case Byte: masm.movb(storeAddr, c.asInt() & 0xFF); break; diff -r d2f2dede7c1a -r d89b20486d87 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:06:29 2012 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/FrameMap.java Thu Jun 07 17:07:05 2012 +0200 @@ -317,7 +317,7 @@ /** * Marks the specified location as a reference in the reference map of the debug information. * The tracked location can be a {@link CiRegisterValue} or a {@link CiStackSlot}. Note that a - * {@link CiConstant} is automatically tracked. + * {@link RiConstant} is automatically tracked. * * @param location The location to be added to the reference map. * @param registerRefMap A register reference map, as created by {@link #initRegisterRefMap()}. @@ -341,7 +341,7 @@ /** * Clears the specified location as a reference in the reference map of the debug information. * The tracked location can be a {@link CiRegisterValue} or a {@link CiStackSlot}. Note that a - * {@link CiConstant} is automatically tracked. + * {@link RiConstant} is automatically tracked. * * @param location The location to be removed from the reference map. * @param registerRefMap A register reference map, as created by {@link #initRegisterRefMap()}. diff -r d2f2dede7c1a -r d89b20486d87 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:06:29 2012 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/asm/TargetMethodAssembler.java Thu Jun 07 17:07:05 2012 +0200 @@ -202,7 +202,7 @@ targetMethod.recordSafepoint(pos, debugInfo); } - public CiAddress recordDataReferenceInCode(CiConstant data, int alignment) { + public CiAddress recordDataReferenceInCode(RiConstant data, int alignment) { assert data != null; int pos = asm.codeBuffer.position(); Debug.log("Data reference in code: pos = %d, data = %s", pos, data.toString()); @@ -221,7 +221,7 @@ */ public int asIntConst(CiValue value) { assert (value.kind.stackKind() == CiKind.Int || value.kind == CiKind.Jsr || value.kind == CiKind.Long) && isConstant(value); - long c = ((CiConstant) value).asLong(); + long c = ((RiConstant) value).asLong(); if (!(NumUtil.isInt(c))) { throw GraalInternalError.shouldNotReachHere(); } @@ -237,7 +237,7 @@ public CiAddress asFloatConstRef(CiValue value, int alignment) { assert value.kind == CiKind.Float && isConstant(value); - return recordDataReferenceInCode((CiConstant) value, alignment); + return recordDataReferenceInCode((RiConstant) value, alignment); } /** @@ -249,7 +249,7 @@ public CiAddress asDoubleConstRef(CiValue value, int alignment) { assert value.kind == CiKind.Double && isConstant(value); - return recordDataReferenceInCode((CiConstant) value, alignment); + return recordDataReferenceInCode((RiConstant) value, alignment); } /** @@ -257,7 +257,7 @@ */ public CiAddress asLongConstRef(CiValue value) { assert value.kind == CiKind.Long && isConstant(value); - return recordDataReferenceInCode((CiConstant) value, 8); + return recordDataReferenceInCode((RiConstant) value, 8); } public CiAddress asIntAddr(CiValue value) { diff -r d2f2dede7c1a -r d89b20486d87 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ConstantNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ConstantNode.java Thu Jun 07 17:06:29 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ConstantNode.java Thu Jun 07 17:07:05 2012 +0200 @@ -36,9 +36,9 @@ @NodeInfo(shortName = "Const") public class ConstantNode extends BooleanNode implements LIRLowerable { - public final CiConstant value; + public final RiConstant value; - protected ConstantNode(CiConstant value) { + protected ConstantNode(RiConstant value) { super(StampFactory.forConstant(value)); this.value = value; } @@ -47,7 +47,7 @@ * Constructs a new ConstantNode representing the specified constant. * @param value the constant */ - protected ConstantNode(CiConstant value, RiRuntime runtime) { + protected ConstantNode(RiConstant value, RiRuntime runtime) { super(StampFactory.forConstant(value, runtime)); this.value = value; } @@ -65,7 +65,7 @@ return usages().filter(NodePredicates.isNotA(FrameState.class)).isEmpty(); } - public static ConstantNode forCiConstant(CiConstant constant, RiRuntime runtime, Graph graph) { + public static ConstantNode forCiConstant(RiConstant constant, RiRuntime runtime, Graph graph) { if (constant.kind == CiKind.Object) { return graph.unique(new ConstantNode(constant, runtime)); } else { @@ -80,7 +80,7 @@ * @return a node for a double constant */ public static ConstantNode forDouble(double d, Graph graph) { - return graph.unique(new ConstantNode(CiConstant.forDouble(d))); + return graph.unique(new ConstantNode(RiConstant.forDouble(d))); } /** @@ -90,7 +90,7 @@ * @return a node for a float constant */ public static ConstantNode forFloat(float f, Graph graph) { - return graph.unique(new ConstantNode(CiConstant.forFloat(f))); + return graph.unique(new ConstantNode(RiConstant.forFloat(f))); } /** @@ -100,7 +100,7 @@ * @return a node for an long constant */ public static ConstantNode forLong(long i, Graph graph) { - return graph.unique(new ConstantNode(CiConstant.forLong(i))); + return graph.unique(new ConstantNode(RiConstant.forLong(i))); } /** @@ -110,7 +110,7 @@ * @return a node for an integer constant */ public static ConstantNode forInt(int i, Graph graph) { - return graph.unique(new ConstantNode(CiConstant.forInt(i))); + return graph.unique(new ConstantNode(RiConstant.forInt(i))); } /** @@ -120,7 +120,7 @@ * @return a node representing the boolean */ public static ConstantNode forBoolean(boolean i, Graph graph) { - return graph.unique(new ConstantNode(CiConstant.forBoolean(i))); + return graph.unique(new ConstantNode(RiConstant.forBoolean(i))); } /** @@ -130,7 +130,7 @@ * @return a node representing the byte */ public static ConstantNode forByte(byte i, Graph graph) { - return graph.unique(new ConstantNode(CiConstant.forByte(i))); + return graph.unique(new ConstantNode(RiConstant.forByte(i))); } /** @@ -140,7 +140,7 @@ * @return a node representing the char */ public static ConstantNode forChar(char i, Graph graph) { - return graph.unique(new ConstantNode(CiConstant.forChar(i))); + return graph.unique(new ConstantNode(RiConstant.forChar(i))); } /** @@ -150,7 +150,7 @@ * @return a node representing the short */ public static ConstantNode forShort(short i, Graph graph) { - return graph.unique(new ConstantNode(CiConstant.forShort(i))); + return graph.unique(new ConstantNode(RiConstant.forShort(i))); } /** @@ -160,7 +160,7 @@ * @return a node representing the address */ public static ConstantNode forJsr(int i, Graph graph) { - return graph.unique(new ConstantNode(CiConstant.forJsr(i))); + return graph.unique(new ConstantNode(RiConstant.forJsr(i))); } /** @@ -170,7 +170,7 @@ * @return a node representing the object */ public static ConstantNode forObject(Object o, RiRuntime runtime, Graph graph) { - return graph.unique(new ConstantNode(CiConstant.forObject(o), runtime)); + return graph.unique(new ConstantNode(RiConstant.forObject(o), runtime)); } public static ConstantNode forIntegerKind(CiKind kind, long value, Graph graph) { diff -r d2f2dede7c1a -r d89b20486d87 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueNode.java Thu Jun 07 17:06:29 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueNode.java Thu Jun 07 17:07:05 2012 +0200 @@ -98,10 +98,10 @@ /** * Convert this value to a constant if it is a constant, otherwise return null. - * @return the {@link CiConstant} represented by this value if it is a constant; {@code null} + * @return the {@link RiConstant} represented by this value if it is a constant; {@code null} * otherwise */ - public final CiConstant asConstant() { + public final RiConstant asConstant() { if (this instanceof ConstantNode) { return ((ConstantNode) this).value; } diff -r d2f2dede7c1a -r d89b20486d87 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/CompareNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/CompareNode.java Thu Jun 07 17:06:29 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/CompareNode.java Thu Jun 07 17:07:05 2012 +0200 @@ -80,9 +80,9 @@ } - private ValueNode optimizeMaterialize(CiConstant constant, MaterializeNode materializeNode, RiRuntime runtime, Condition cond) { - CiConstant trueConstant = materializeNode.trueValue().asConstant(); - CiConstant falseConstant = materializeNode.falseValue().asConstant(); + private ValueNode optimizeMaterialize(RiConstant constant, MaterializeNode materializeNode, RiRuntime runtime, Condition cond) { + RiConstant trueConstant = materializeNode.trueValue().asConstant(); + RiConstant falseConstant = materializeNode.falseValue().asConstant(); if (falseConstant != null && trueConstant != null) { Boolean trueResult = cond.foldCondition(trueConstant, constant, runtime, unorderedIsTrue()); @@ -109,7 +109,7 @@ return this; } - protected ValueNode optimizeNormalizeCmp(CiConstant constant, NormalizeCompareNode normalizeNode, boolean mirrored) { + protected ValueNode optimizeNormalizeCmp(RiConstant constant, NormalizeCompareNode normalizeNode, boolean mirrored) { throw new GraalInternalError("NormalizeCompareNode connected to %s (%s %s %s)", this, constant, normalizeNode, mirrored); } diff -r d2f2dede7c1a -r d89b20486d87 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/Condition.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/Condition.java Thu Jun 07 17:06:29 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/Condition.java Thu Jun 07 17:07:05 2012 +0200 @@ -246,7 +246,7 @@ * @return {@link Boolean#TRUE} if the comparison is known to be true, * {@link Boolean#FALSE} if the comparison is known to be false */ - public boolean foldCondition(CiConstant lt, CiConstant rt, RiRuntime runtime) { + public boolean foldCondition(RiConstant lt, RiConstant rt, RiRuntime runtime) { assert !lt.kind.isFloatOrDouble() && !rt.kind.isFloatOrDouble(); return foldCondition(lt, rt, runtime, false); } @@ -259,7 +259,7 @@ * @param unorderedIsTrue true if an undecided float comparison should result in "true" * @return true if the comparison is known to be true, false if the comparison is known to be false */ - public boolean foldCondition(CiConstant lt, CiConstant rt, RiRuntime runtime, boolean unorderedIsTrue) { + public boolean foldCondition(RiConstant lt, RiConstant rt, RiRuntime runtime, boolean unorderedIsTrue) { switch (lt.kind) { case Boolean: case Byte: diff -r d2f2dede7c1a -r d89b20486d87 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ConvertNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ConvertNode.java Thu Jun 07 17:06:29 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ConvertNode.java Thu Jun 07 17:07:05 2012 +0200 @@ -89,7 +89,7 @@ @Override public ValueNode canonical(CanonicalizerTool tool) { if (value instanceof ConstantNode) { - CiConstant c = ((ConstantNode) value).asConstant(); + RiConstant c = ((ConstantNode) value).asConstant(); switch (opcode) { case I2L: return ConstantNode.forLong(c.asInt(), graph()); case L2I: return ConstantNode.forInt((int) c.asLong(), graph()); diff -r d2f2dede7c1a -r d89b20486d87 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerEqualsNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerEqualsNode.java Thu Jun 07 17:06:29 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerEqualsNode.java Thu Jun 07 17:07:05 2012 +0200 @@ -53,7 +53,7 @@ } @Override - protected ValueNode optimizeNormalizeCmp(CiConstant constant, NormalizeCompareNode normalizeNode, boolean mirrored) { + protected ValueNode optimizeNormalizeCmp(RiConstant constant, NormalizeCompareNode normalizeNode, boolean mirrored) { if (constant.kind == CiKind.Int && constant.asInt() == 0) { ValueNode a = mirrored ? normalizeNode.y() : normalizeNode.x(); ValueNode b = mirrored ? normalizeNode.x() : normalizeNode.y(); diff -r d2f2dede7c1a -r d89b20486d87 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerLessThanNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerLessThanNode.java Thu Jun 07 17:06:29 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerLessThanNode.java Thu Jun 07 17:07:05 2012 +0200 @@ -53,7 +53,7 @@ } @Override - protected ValueNode optimizeNormalizeCmp(CiConstant constant, NormalizeCompareNode normalizeNode, boolean mirrored) { + protected ValueNode optimizeNormalizeCmp(RiConstant constant, NormalizeCompareNode normalizeNode, boolean mirrored) { assert condition() == Condition.LT; if (constant.kind == CiKind.Int && constant.asInt() == 0) { ValueNode a = mirrored ? normalizeNode.y() : normalizeNode.x(); diff -r d2f2dede7c1a -r d89b20486d87 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IsNullNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IsNullNode.java Thu Jun 07 17:06:29 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IsNullNode.java Thu Jun 07 17:07:05 2012 +0200 @@ -63,7 +63,7 @@ @Override public ValueNode canonical(CanonicalizerTool tool) { - CiConstant constant = object().asConstant(); + RiConstant constant = object().asConstant(); if (constant != null) { assert constant.kind == CiKind.Object; return ConstantNode.forBoolean(constant.isNull(), graph()); diff -r d2f2dede7c1a -r d89b20486d87 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FloatingReadNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FloatingReadNode.java Thu Jun 07 17:06:29 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FloatingReadNode.java Thu Jun 07 17:07:05 2012 +0200 @@ -66,7 +66,7 @@ Object value = object().asConstant().asObject(); long displacement = location().displacement(); CiKind kind = location().kind(); - CiConstant constant = kind.readUnsafeConstant(value, displacement); + RiConstant constant = kind.readUnsafeConstant(value, displacement); if (constant != null) { return ConstantNode.forCiConstant(constant, runtime, graph()); } diff -r d2f2dede7c1a -r d89b20486d87 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/IndexedLocationNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/IndexedLocationNode.java Thu Jun 07 17:06:29 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/IndexedLocationNode.java Thu Jun 07 17:07:05 2012 +0200 @@ -68,7 +68,7 @@ @Override public ValueNode canonical(CanonicalizerTool tool) { - CiConstant constantIndex = index.asConstant(); + RiConstant constantIndex = index.asConstant(); if (constantIndex != null && constantIndex.kind.stackKind().isInt()) { long constantIndexLong = constantIndex.asInt(); if (indexScalingEnabled) { diff -r d2f2dede7c1a -r d89b20486d87 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadNode.java Thu Jun 07 17:06:29 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadNode.java Thu Jun 07 17:07:05 2012 +0200 @@ -49,7 +49,7 @@ Object value = object().asConstant().asObject(); long displacement = location().displacement(); CiKind kind = location().kind(); - CiConstant constant = kind.readUnsafeConstant(value, displacement); + RiConstant constant = kind.readUnsafeConstant(value, displacement); if (constant != null) { return ConstantNode.forCiConstant(constant, runtime, graph()); } diff -r d2f2dede7c1a -r d89b20486d87 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnboxNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnboxNode.java Thu Jun 07 17:06:29 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnboxNode.java Thu Jun 07 17:07:05 2012 +0200 @@ -62,7 +62,7 @@ @Override public ValueNode canonical(CanonicalizerTool tool) { if (source.isConstant()) { - CiConstant constant = source.asConstant(); + RiConstant constant = source.asConstant(); Object o = constant.asObject(); if (o != null) { switch (destinationKind) { diff -r d2f2dede7c1a -r d89b20486d87 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ValueAnchorNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ValueAnchorNode.java Thu Jun 07 17:06:29 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ValueAnchorNode.java Thu Jun 07 17:07:05 2012 +0200 @@ -69,7 +69,7 @@ if (node instanceof IntegerDivNode || node instanceof IntegerRemNode) { ArithmeticNode arithmeticNode = (ArithmeticNode) node; if (arithmeticNode.y().isConstant()) { - CiConstant constant = arithmeticNode.y().asConstant(); + RiConstant constant = arithmeticNode.y().asConstant(); assert constant.kind == arithmeticNode.kind() : constant.kind + " != " + arithmeticNode.kind(); if (constant.asLong() != 0) { continue; diff -r d2f2dede7c1a -r d89b20486d87 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessIndexedNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessIndexedNode.java Thu Jun 07 17:06:29 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessIndexedNode.java Thu Jun 07 17:07:05 2012 +0200 @@ -70,6 +70,6 @@ @Override public void typeFeedback(TypeFeedbackTool tool) { - tool.addScalar(index()).constantBound(Condition.GE, CiConstant.INT_0); + tool.addScalar(index()).constantBound(Condition.GE, RiConstant.INT_0); } } diff -r d2f2dede7c1a -r d89b20486d87 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ArrayLengthNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ArrayLengthNode.java Thu Jun 07 17:06:29 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ArrayLengthNode.java Thu Jun 07 17:07:05 2012 +0200 @@ -54,7 +54,7 @@ } RiRuntime runtime = tool.runtime(); if (runtime != null && array().isConstant() && !array().isNullConstant()) { - CiConstant constantValue = array().asConstant(); + RiConstant constantValue = array().asConstant(); if (constantValue != null && constantValue.isNonNull()) { return ConstantNode.forInt(runtime.getArrayLength(constantValue), graph()); } diff -r d2f2dede7c1a -r d89b20486d87 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java Thu Jun 07 17:06:29 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java Thu Jun 07 17:07:05 2012 +0200 @@ -82,7 +82,7 @@ } } - CiConstant constant = object().asConstant(); + RiConstant constant = object().asConstant(); if (constant != null) { assert constant.kind == CiKind.Object; if (constant.isNull()) { @@ -102,7 +102,7 @@ @Override public Result canonical(TypeFeedbackTool tool) { ObjectTypeQuery query = tool.queryObject(object()); - if (query.constantBound(Condition.EQ, CiConstant.NULL_OBJECT)) { + if (query.constantBound(Condition.EQ, RiConstant.NULL_OBJECT)) { return new Result(object(), query); } else if (targetClass() != null) { if (query.declaredType(targetClass())) { diff -r d2f2dede7c1a -r d89b20486d87 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfNode.java Thu Jun 07 17:06:29 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfNode.java Thu Jun 07 17:07:05 2012 +0200 @@ -105,7 +105,7 @@ } } - CiConstant constant = object().asConstant(); + RiConstant constant = object().asConstant(); if (constant != null) { assert constant.kind == CiKind.Object; if (constant.isNull()) { @@ -125,13 +125,13 @@ @Override public Result canonical(TypeFeedbackTool tool) { ObjectTypeQuery query = tool.queryObject(object()); - if (query.constantBound(Condition.EQ, CiConstant.NULL_OBJECT)) { + if (query.constantBound(Condition.EQ, RiConstant.NULL_OBJECT)) { return new Result(ConstantNode.forBoolean(false, graph()), query); } else if (targetClass() != null) { if (query.notDeclaredType(targetClass())) { return new Result(ConstantNode.forBoolean(false, graph()), query); } - if (query.constantBound(Condition.NE, CiConstant.NULL_OBJECT)) { + if (query.constantBound(Condition.NE, RiConstant.NULL_OBJECT)) { if (query.declaredType(targetClass())) { return new Result(ConstantNode.forBoolean(true, graph()), query); } diff -r d2f2dede7c1a -r d89b20486d87 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/IsTypeNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/IsTypeNode.java Thu Jun 07 17:06:29 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/IsTypeNode.java Thu Jun 07 17:07:05 2012 +0200 @@ -64,8 +64,8 @@ @Override public ValueNode canonical(CanonicalizerTool tool) { if (objectClass().isConstant()) { - CiConstant constant = objectClass().asConstant(); - CiConstant typeHub = type.getEncoding(Representation.ObjectHub); + RiConstant constant = objectClass().asConstant(); + RiConstant typeHub = type.getEncoding(Representation.ObjectHub); assert constant.kind == typeHub.kind; return ConstantNode.forBoolean(constant.equivalent(typeHub), graph()); } diff -r d2f2dede7c1a -r d89b20486d87 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadFieldNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadFieldNode.java Thu Jun 07 17:06:29 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadFieldNode.java Thu Jun 07 17:07:05 2012 +0200 @@ -57,7 +57,7 @@ public ValueNode canonical(CanonicalizerTool tool) { RiRuntime runtime = tool.runtime(); if (runtime != null) { - CiConstant constant = null; + RiConstant constant = null; if (isStatic()) { constant = field().constantValue(null); } else if (object().isConstant() && !object().isNullConstant()) { diff -r d2f2dede7c1a -r d89b20486d87 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadIndexedNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadIndexedNode.java Thu Jun 07 17:06:29 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadIndexedNode.java Thu Jun 07 17:07:05 2012 +0200 @@ -64,7 +64,7 @@ public ValueNode canonical(CanonicalizerTool tool) { RiRuntime runtime = tool.runtime(); if (runtime != null && index().isConstant() && array().isConstant() && !array().isNullConstant()) { - CiConstant arrayConst = array().asConstant(); + RiConstant arrayConst = array().asConstant(); if (tool.isImmutable(arrayConst)) { int index = index().asConstant().asInt(); Object array = arrayConst.asObject(); diff -r d2f2dede7c1a -r d89b20486d87 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewArrayNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewArrayNode.java Thu Jun 07 17:06:29 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewArrayNode.java Thu Jun 07 17:07:05 2012 +0200 @@ -80,7 +80,7 @@ @Override public void typeFeedback(TypeFeedbackTool tool) { assert length.kind() == CiKind.Int; - tool.addScalar(length).constantBound(Condition.GE, CiConstant.INT_0); + tool.addScalar(length).constantBound(Condition.GE, RiConstant.INT_0); } public EscapeOp getEscapeOp() { @@ -92,7 +92,7 @@ @Override public boolean canAnalyze(Node node) { NewArrayNode x = (NewArrayNode) node; - CiConstant length = x.dimension(0).asConstant(); + RiConstant length = x.dimension(0).asConstant(); return length != null && length.asInt() >= 0 && length.asInt() < MaximumEscapeAnalysisArrayLength; } diff -r d2f2dede7c1a -r d89b20486d87 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewMultiArrayNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewMultiArrayNode.java Thu Jun 07 17:06:29 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewMultiArrayNode.java Thu Jun 07 17:07:05 2012 +0200 @@ -75,7 +75,7 @@ public void typeFeedback(TypeFeedbackTool tool) { for (ValueNode length : dimensions) { assert length.kind() == CiKind.Int; - tool.addScalar(length).constantBound(Condition.GE, CiConstant.INT_0); + tool.addScalar(length).constantBound(Condition.GE, RiConstant.INT_0); } } } diff -r d2f2dede7c1a -r d89b20486d87 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/CanonicalizerTool.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/CanonicalizerTool.java Thu Jun 07 17:06:29 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/CanonicalizerTool.java Thu Jun 07 17:07:05 2012 +0200 @@ -35,5 +35,5 @@ * Determines if a given constant is an object/array whose current * fields/elements will never change. */ - boolean isImmutable(CiConstant objectConstant); + boolean isImmutable(RiConstant objectConstant); } diff -r d2f2dede7c1a -r d89b20486d87 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/EscapeOp.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/EscapeOp.java Thu Jun 07 17:06:29 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/EscapeOp.java Thu Jun 07 17:07:05 2012 +0200 @@ -94,9 +94,9 @@ } public static boolean isValidConstantIndex(AccessIndexedNode x) { - CiConstant index = x.index().asConstant(); + RiConstant index = x.index().asConstant(); if (x.array() instanceof NewArrayNode) { - CiConstant length = ((NewArrayNode) x.array()).dimension(0).asConstant(); + RiConstant length = ((NewArrayNode) x.array()).dimension(0).asConstant(); return index != null && length != null && index.asInt() >= 0 && index.asInt() < length.asInt(); } else { return false; diff -r d2f2dede7c1a -r d89b20486d87 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:06:29 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/LIRGeneratorTool.java Thu Jun 07 17:07:05 2012 +0200 @@ -38,7 +38,7 @@ * @param c The constant to check. * @return True if the constant can be used directly, false if the constant needs to be in a register. */ - public abstract boolean canInlineConstant(CiConstant c); + public abstract boolean canInlineConstant(RiConstant c); /** * Checks whether the supplied constant can be used without loading it into a register @@ -46,7 +46,7 @@ * @param c The constant to check. * @return True if the constant can be used directly, false if the constant needs to be in a register. */ - public abstract boolean canStoreConstant(CiConstant c); + public abstract boolean canStoreConstant(RiConstant c); public abstract CiValue operand(ValueNode object); public abstract CiValue newVariable(CiKind kind); diff -r d2f2dede7c1a -r d89b20486d87 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/types/ObjectTypeFeedbackStore.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/types/ObjectTypeFeedbackStore.java Thu Jun 07 17:06:29 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/types/ObjectTypeFeedbackStore.java Thu Jun 07 17:07:05 2012 +0200 @@ -45,7 +45,7 @@ } @Override - public boolean constantBound(Condition condition, final CiConstant constant) { + public boolean constantBound(Condition condition, final RiConstant constant) { assert condition == Condition.EQ || condition == Condition.NE; if (condition == Condition.EQ) { return store.prove(Equals.class, new BooleanPredicate() { @@ -150,9 +150,9 @@ } private static final class Equals extends Info { - public final CiConstant constant; + public final RiConstant constant; - public Equals(CiConstant constant) { + public Equals(RiConstant constant) { this.constant = constant; } @@ -163,9 +163,9 @@ } private static final class NotEquals extends Info { - public final CiConstant constant; + public final RiConstant constant; - public NotEquals(CiConstant constant) { + public NotEquals(RiConstant constant) { this.constant = constant; } @@ -291,7 +291,7 @@ } @Override - public void constantBound(Condition condition, CiConstant constant) { + public void constantBound(Condition condition, RiConstant constant) { assert condition == Condition.EQ || condition == Condition.NE; if (condition == Condition.EQ) { @@ -358,7 +358,7 @@ if (typeInfo.type == type && index == 0) { if (index == 0) { if (nonNull) { - constantBound(Condition.NE, CiConstant.NULL_OBJECT); + constantBound(Condition.NE, RiConstant.NULL_OBJECT); } return; } else { @@ -370,7 +370,7 @@ infos.add(new ObjectTypeDeclared(type)); updateDependency(); if (nonNull) { - constantBound(Condition.NE, CiConstant.NULL_OBJECT); + constantBound(Condition.NE, RiConstant.NULL_OBJECT); } } @@ -385,7 +385,7 @@ ObjectTypeExact typeInfo = (ObjectTypeExact) info; if (typeInfo.type == type && index == 0) { if (index == 0) { - constantBound(Condition.NE, CiConstant.NULL_OBJECT); + constantBound(Condition.NE, RiConstant.NULL_OBJECT); return; } else { iter.remove(); @@ -395,7 +395,7 @@ } infos.add(new ObjectTypeExact(type)); updateDependency(); - constantBound(Condition.NE, CiConstant.NULL_OBJECT); + constantBound(Condition.NE, RiConstant.NULL_OBJECT); } @Override diff -r d2f2dede7c1a -r d89b20486d87 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/types/ObjectTypeFeedbackTool.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/types/ObjectTypeFeedbackTool.java Thu Jun 07 17:06:29 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/types/ObjectTypeFeedbackTool.java Thu Jun 07 17:07:05 2012 +0200 @@ -29,7 +29,7 @@ public interface ObjectTypeFeedbackTool { - void constantBound(Condition condition, CiConstant constant); + void constantBound(Condition condition, RiConstant constant); void valueBound(Condition condition, ValueNode otherValue); diff -r d2f2dede7c1a -r d89b20486d87 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/types/ObjectTypeQuery.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/types/ObjectTypeQuery.java Thu Jun 07 17:06:29 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/types/ObjectTypeQuery.java Thu Jun 07 17:07:05 2012 +0200 @@ -29,7 +29,7 @@ public interface ObjectTypeQuery extends TypeQuery { - boolean constantBound(Condition condition, CiConstant constant); + boolean constantBound(Condition condition, RiConstant constant); boolean valueBound(Condition condition, ValueNode otherValue); diff -r d2f2dede7c1a -r d89b20486d87 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/types/ScalarTypeFeedbackStore.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/types/ScalarTypeFeedbackStore.java Thu Jun 07 17:06:29 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/types/ScalarTypeFeedbackStore.java Thu Jun 07 17:07:05 2012 +0200 @@ -39,7 +39,7 @@ } @Override - public boolean constantBound(Condition condition, CiConstant constant) { + public boolean constantBound(Condition condition, RiConstant constant) { if (constant.kind == CiKind.Int || constant.kind == CiKind.Long) { switch (condition) { case EQ: @@ -156,7 +156,7 @@ } @Override - public void constantBound(Condition condition, CiConstant constant) { + public void constantBound(Condition condition, RiConstant constant) { ConstantBound newBound = createBounds(condition, constant); if (newBound != null) { if (constantBounds.join(newBound)) { @@ -165,7 +165,7 @@ } } - private static ConstantBound createBounds(Condition condition, CiConstant constant) { + private static ConstantBound createBounds(Condition condition, RiConstant constant) { ConstantBound newBound; if (constant.kind == CiKind.Int || constant.kind == CiKind.Long) { switch (condition) { @@ -236,39 +236,39 @@ case LE: case LT: simpleValueBound(condition, otherValue); - constantBound(condition, new CiConstant(kind, other.constantBounds.upperBound)); + constantBound(condition, new RiConstant(kind, other.constantBounds.upperBound)); break; case GE: case GT: simpleValueBound(condition, otherValue); - constantBound(condition, new CiConstant(kind, other.constantBounds.lowerBound)); + constantBound(condition, new RiConstant(kind, other.constantBounds.lowerBound)); break; case BT: if (other.constantBounds.lowerBound >= 0) { simpleValueBound(Condition.LT, otherValue); - constantBound(Condition.GE, new CiConstant(kind, 0)); - constantBound(Condition.LT, new CiConstant(kind, other.constantBounds.upperBound)); + constantBound(Condition.GE, new RiConstant(kind, 0)); + constantBound(Condition.LT, new RiConstant(kind, other.constantBounds.upperBound)); } break; case BE: if (other.constantBounds.lowerBound >= 0) { simpleValueBound(Condition.LE, otherValue); - constantBound(Condition.GE, new CiConstant(kind, 0)); - constantBound(Condition.LE, new CiConstant(kind, other.constantBounds.upperBound)); + constantBound(Condition.GE, new RiConstant(kind, 0)); + constantBound(Condition.LE, new RiConstant(kind, other.constantBounds.upperBound)); } break; case AT: if (other.constantBounds.upperBound < 0) { simpleValueBound(Condition.GT, otherValue); - constantBound(Condition.LT, new CiConstant(kind, 0)); - constantBound(Condition.GT, new CiConstant(kind, other.constantBounds.lowerBound)); + constantBound(Condition.LT, new RiConstant(kind, 0)); + constantBound(Condition.GT, new RiConstant(kind, other.constantBounds.lowerBound)); } break; case AE: if (other.constantBounds.upperBound < 0) { simpleValueBound(Condition.GE, otherValue); - constantBound(Condition.LT, new CiConstant(kind, 0)); - constantBound(Condition.GE, new CiConstant(kind, other.constantBounds.lowerBound)); + constantBound(Condition.LT, new RiConstant(kind, 0)); + constantBound(Condition.GE, new RiConstant(kind, other.constantBounds.lowerBound)); } break; } @@ -357,7 +357,7 @@ } @Override - public void setTranslated(CiConstant deltaConstant, ScalarTypeQuery old) { + public void setTranslated(RiConstant deltaConstant, ScalarTypeQuery old) { assert deltaConstant.kind == kind; ScalarTypeFeedbackStore other = old.store(); assert other.kind == kind; diff -r d2f2dede7c1a -r d89b20486d87 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/types/ScalarTypeFeedbackTool.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/types/ScalarTypeFeedbackTool.java Thu Jun 07 17:06:29 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/types/ScalarTypeFeedbackTool.java Thu Jun 07 17:07:05 2012 +0200 @@ -28,9 +28,9 @@ public interface ScalarTypeFeedbackTool { - void constantBound(Condition condition, CiConstant constant); + void constantBound(Condition condition, RiConstant constant); void valueBound(Condition condition, ValueNode otherValue, ScalarTypeQuery type); - void setTranslated(CiConstant delta, ScalarTypeQuery old); + void setTranslated(RiConstant delta, ScalarTypeQuery old); } diff -r d2f2dede7c1a -r d89b20486d87 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/types/ScalarTypeQuery.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/types/ScalarTypeQuery.java Thu Jun 07 17:06:29 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/types/ScalarTypeQuery.java Thu Jun 07 17:07:05 2012 +0200 @@ -28,7 +28,7 @@ public interface ScalarTypeQuery extends TypeQuery { - boolean constantBound(Condition condition, CiConstant constant); + boolean constantBound(Condition condition, RiConstant constant); boolean valueBound(Condition condition, ValueNode otherValue); diff -r d2f2dede7c1a -r d89b20486d87 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/StampFactory.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/StampFactory.java Thu Jun 07 17:06:29 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/StampFactory.java Thu Jun 07 17:07:05 2012 +0200 @@ -105,7 +105,7 @@ return new IntegerStamp(CiKind.Long, lowerBound, upperBound); } - public static Stamp forConstant(CiConstant value) { + public static Stamp forConstant(RiConstant value) { assert value.kind != CiKind.Object; if (value.kind == CiKind.Object) { throw new GraalInternalError("unexpected kind: %s", value.kind); @@ -119,7 +119,7 @@ } } - public static Stamp forConstant(CiConstant value, RiRuntime runtime) { + public static Stamp forConstant(RiConstant value, RiRuntime runtime) { assert value.kind == CiKind.Object; if (value.kind == CiKind.Object) { RiResolvedType type = value.isNull() ? null : runtime.getTypeOf(value); diff -r d2f2dede7c1a -r d89b20486d87 graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetTemplate.java --- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetTemplate.java Thu Jun 07 17:06:29 2012 +0200 +++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetTemplate.java Thu Jun 07 17:07:05 2012 +0200 @@ -197,7 +197,7 @@ assert arg != null : method + ": requires a constant named " + name; CiKind kind = signature.argumentKindAt(i, false); assert checkConstantArgument(method, signature, i, name, arg, kind); - replacements.put(snippetGraph.getLocal(i), ConstantNode.forCiConstant(CiConstant.forBoxed(kind, arg), runtime, snippetCopy)); + replacements.put(snippetGraph.getLocal(i), ConstantNode.forCiConstant(RiConstant.forBoxed(kind, arg), runtime, snippetCopy)); } else { Parameter p = CiUtil.getParameterAnnotation(Parameter.class, i, method); assert p != null : method + ": parameter " + i + " must be annotated with either @Constant or @Parameter"; @@ -385,7 +385,7 @@ replacements.put((LocalNode) parameter, (ValueNode) argument); } else { CiKind kind = ((LocalNode) parameter).kind(); - CiConstant constant = CiConstant.forBoxed(kind, argument); + RiConstant constant = RiConstant.forBoxed(kind, argument); replacements.put((LocalNode) parameter, ConstantNode.forCiConstant(constant, runtime, replaceeGraph)); } } else { @@ -398,7 +398,7 @@ for (int j = 0; j < length; j++) { LocalNode local = locals[j]; assert local != null; - CiConstant constant = CiConstant.forBoxed(local.kind(), Array.get(array, j)); + RiConstant constant = RiConstant.forBoxed(local.kind(), Array.get(array, j)); ConstantNode element = ConstantNode.forCiConstant(constant, runtime, replaceeGraph); replacements.put(local, element); } diff -r d2f2dede7c1a -r d89b20486d87 graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/MathIntrinsicNode.java --- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/MathIntrinsicNode.java Thu Jun 07 17:06:29 2012 +0200 +++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/MathIntrinsicNode.java Thu Jun 07 17:07:05 2012 +0200 @@ -65,7 +65,7 @@ Variable input = gen.load(gen.operand(x())); Variable result = gen.newVariable(kind()); switch (operation()) { - case ABS: gen.append(new Op2Reg(DAND, result, input, CiConstant.forDouble(Double.longBitsToDouble(0x7FFFFFFFFFFFFFFFL)))); break; + case ABS: gen.append(new Op2Reg(DAND, result, input, RiConstant.forDouble(Double.longBitsToDouble(0x7FFFFFFFFFFFFFFFL)))); break; case SQRT: gen.append(new AMD64MathIntrinsicOp(AMD64MathIntrinsicOp.Opcode.SQRT, result, input)); break; case LOG: gen.append(new AMD64MathIntrinsicOp(AMD64MathIntrinsicOp.Opcode.LOG, result, input)); break; case LOG10: gen.append(new AMD64MathIntrinsicOp(AMD64MathIntrinsicOp.Opcode.LOG10, result, input)); break; diff -r d2f2dede7c1a -r d89b20486d87 graal/com.oracle.graal.tests/src/com/oracle/graal/compiler/tests/ConditionTest.java --- a/graal/com.oracle.graal.tests/src/com/oracle/graal/compiler/tests/ConditionTest.java Thu Jun 07 17:06:29 2012 +0200 +++ b/graal/com.oracle.graal.tests/src/com/oracle/graal/compiler/tests/ConditionTest.java Thu Jun 07 17:07:05 2012 +0200 @@ -42,8 +42,8 @@ boolean implies = c1.implies(c2); if (implies) { for (int i = 0; i < 1000; i++) { - CiConstant a = CiConstant.forInt(rand.nextInt()); - CiConstant b = CiConstant.forInt(i < 100 ? a.asInt() : rand.nextInt()); + RiConstant a = RiConstant.forInt(rand.nextInt()); + RiConstant b = RiConstant.forInt(i < 100 ? a.asInt() : rand.nextInt()); boolean result1 = c1.foldCondition(a, b, null, false); boolean result2 = c2.foldCondition(a, b, null, false); if (result1 && implies) { @@ -64,8 +64,8 @@ assertTrue(join == c2.join(c1)); if (join != null) { for (int i = 0; i < 1000; i++) { - CiConstant a = CiConstant.forInt(rand.nextInt()); - CiConstant b = CiConstant.forInt(i < 100 ? a.asInt() : rand.nextInt()); + RiConstant a = RiConstant.forInt(rand.nextInt()); + RiConstant b = RiConstant.forInt(i < 100 ? a.asInt() : rand.nextInt()); boolean result1 = c1.foldCondition(a, b, null, false); boolean result2 = c2.foldCondition(a, b, null, false); boolean resultJoin = join.foldCondition(a, b, null, false); @@ -87,8 +87,8 @@ assertTrue(meet == c2.meet(c1)); if (meet != null) { for (int i = 0; i < 1000; i++) { - CiConstant a = CiConstant.forInt(rand.nextInt()); - CiConstant b = CiConstant.forInt(i < 100 ? a.asInt() : rand.nextInt()); + RiConstant a = RiConstant.forInt(rand.nextInt()); + RiConstant b = RiConstant.forInt(i < 100 ? a.asInt() : rand.nextInt()); boolean result1 = c1.foldCondition(a, b, null, false); boolean result2 = c2.foldCondition(a, b, null, false); boolean resultMeet = meet.foldCondition(a, b, null, false); diff -r d2f2dede7c1a -r d89b20486d87 graal/com.oracle.graal.tests/src/com/oracle/graal/compiler/tests/EscapeAnalysisTest.java --- a/graal/com.oracle.graal.tests/src/com/oracle/graal/compiler/tests/EscapeAnalysisTest.java Thu Jun 07 17:06:29 2012 +0200 +++ b/graal/com.oracle.graal.tests/src/com/oracle/graal/compiler/tests/EscapeAnalysisTest.java Thu Jun 07 17:07:05 2012 +0200 @@ -41,7 +41,7 @@ @Test public void test1() { - test("test1Snippet", CiConstant.forInt(101)); + test("test1Snippet", RiConstant.forInt(101)); } @SuppressWarnings("all") @@ -52,7 +52,7 @@ @Test public void test2() { - test("test2Snippet", CiConstant.forInt(0)); + test("test2Snippet", RiConstant.forInt(0)); } @SuppressWarnings("all") @@ -63,7 +63,7 @@ @Test public void test3() { - test("test3Snippet", CiConstant.forObject(null)); + test("test3Snippet", RiConstant.forObject(null)); } @SuppressWarnings("all") @@ -74,7 +74,7 @@ @Test public void testMonitor() { - test("testMonitorSnippet", CiConstant.forInt(0)); + test("testMonitorSnippet", RiConstant.forInt(0)); } private static native void notInlineable(); @@ -95,7 +95,7 @@ } public void testMonitor2() { - test("testMonitor2Snippet", CiConstant.forInt(0)); + test("testMonitor2Snippet", RiConstant.forInt(0)); } /** @@ -116,7 +116,7 @@ } } - private void test(String snippet, CiConstant expectedResult) { + private void test(String snippet, RiConstant expectedResult) { StructuredGraph graph = parse(snippet); for (Invoke n : graph.getInvokes()) { n.node().setProbability(100000); diff -r d2f2dede7c1a -r d89b20486d87 graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiConstant.java --- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiConstant.java Thu Jun 07 17:06:29 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,498 +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; - -/** - * 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 CiConstant extends CiValue { - private static final long serialVersionUID = -6355452536852663986L; - - private static final CiConstant[] INT_CONSTANT_CACHE = new CiConstant[100]; - static { - for (int i = 0; i < INT_CONSTANT_CACHE.length; ++i) { - INT_CONSTANT_CACHE[i] = new CiConstant(CiKind.Int, i); - } - } - - public static final CiConstant NULL_OBJECT = new CiConstant(CiKind.Object, null); - public static final CiConstant INT_MINUS_1 = new CiConstant(CiKind.Int, -1); - public static final CiConstant INT_0 = forInt(0); - public static final CiConstant INT_1 = forInt(1); - public static final CiConstant INT_2 = forInt(2); - public static final CiConstant INT_3 = forInt(3); - public static final CiConstant INT_4 = forInt(4); - public static final CiConstant INT_5 = forInt(5); - public static final CiConstant LONG_0 = new CiConstant(CiKind.Long, 0L); - public static final CiConstant LONG_1 = new CiConstant(CiKind.Long, 1L); - public static final CiConstant FLOAT_0 = new CiConstant(CiKind.Float, Float.floatToRawIntBits(0.0F)); - public static final CiConstant FLOAT_1 = new CiConstant(CiKind.Float, Float.floatToRawIntBits(1.0F)); - public static final CiConstant FLOAT_2 = new CiConstant(CiKind.Float, Float.floatToRawIntBits(2.0F)); - public static final CiConstant DOUBLE_0 = new CiConstant(CiKind.Double, Double.doubleToRawLongBits(0.0D)); - public static final CiConstant DOUBLE_1 = new CiConstant(CiKind.Double, Double.doubleToRawLongBits(1.0D)); - public static final CiConstant TRUE = new CiConstant(CiKind.Boolean, 1L); - public static final CiConstant FALSE = new CiConstant(CiKind.Boolean, 0L); - - static { - assert NULL_OBJECT.isDefaultValue(); - assert INT_0.isDefaultValue(); - assert FLOAT_0.isDefaultValue(); - assert DOUBLE_0.isDefaultValue(); - assert FALSE.isDefaultValue(); - - // Ensure difference between 0.0f and -0.0f is preserved - assert FLOAT_0 != forFloat(-0.0F); - assert !forFloat(-0.0F).isDefaultValue(); - - // Ensure difference between 0.0d and -0.0d is preserved - assert DOUBLE_0 != forDouble(-0.0d); - assert !forDouble(-0.0D).isDefaultValue(); - - assert NULL_OBJECT.isNull(); - } - - /** - * The boxed object value. This is ignored iff {@code !kind.isObject()}. - */ - private final Object object; - - /** - * The boxed primitive value as a {@code long}. This is ignored iff {@code kind.isObject()}. - * For {@code float} and {@code double} values, this value is the result of - * {@link Float#floatToRawIntBits(float)} and {@link Double#doubleToRawLongBits(double)} respectively. - */ - private final long primitive; - - /** - * Create a new constant represented by the specified object reference. - * - * @param kind the type of this constant - * @param object the value of this constant - */ - private CiConstant(CiKind kind, Object object) { - super(kind); - this.object = object; - this.primitive = 0L; - } - - /** - * Create a new constant represented by the specified primitive. - * - * @param kind the type of this constant - * @param primitive the value of this constant - */ - public CiConstant(CiKind kind, long primitive) { - super(kind); - this.object = null; - this.primitive = primitive; - } - - /** - * Checks whether this constant is non-null. - * @return {@code true} if this constant is a primitive, or an object constant that is not null - */ - public boolean isNonNull() { - return !kind.isObject() || object != null; - } - - /** - * Checks whether this constant is null. - * @return {@code true} if this constant is the null constant - */ - public boolean isNull() { - return kind.isObject() && object == null; - } - - @Override - public String toString() { - return kind.javaName + "[" + kind.format(boxedValue()) + (kind != CiKind.Object ? "|0x" + Long.toHexString(primitive) : "") + "]"; - } - - /** - * Gets this constant's value as a string. - * - * @return this constant's value as a string - */ - public String valueString() { - if (kind.isPrimitive()) { - return boxedValue().toString(); - } else if (kind.isObject()) { - if (object == null) { - return "null"; - } else if (object instanceof String) { - return "\"" + object + "\""; - } else { - return ""; - } - } else if (kind.isJsr()) { - return "bci:" + boxedValue().toString(); - } else { - return "???"; - } - } - - /** - * Returns the value of this constant as a boxed Java value. - * @return the value of this constant - */ - public Object boxedValue() { - // Checkstyle: stop - switch (kind) { - case Byte: return (byte) asInt(); - case Boolean: return asInt() == 0 ? Boolean.FALSE : Boolean.TRUE; - case Short: return (short) asInt(); - case Char: return (char) asInt(); - case Jsr: return (int) primitive; - case Int: return asInt(); - case Long: return asLong(); - case Float: return asFloat(); - case Double: return asDouble(); - case Object: return object; - } - // Checkstyle: resume - throw new IllegalArgumentException(); - } - - private boolean valueEqual(CiConstant other, boolean ignoreKind) { - // must have equivalent kinds to be equal - if (!ignoreKind && kind != other.kind) { - return false; - } - if (kind.isObject()) { - return object == other.object; - } - return primitive == other.primitive; - } - - /** - * Converts this constant to a primitive int. - * @return the int value of this constant - */ - public int asInt() { - if (kind.stackKind().isInt() || kind.isJsr()) { - return (int) primitive; - } - throw new Error("Constant is not int: " + this); - } - - /** - * Converts this constant to a primitive boolean. - * @return the boolean value of this constant - */ - public boolean asBoolean() { - if (kind == CiKind.Boolean) { - return primitive != 0L; - } - throw new Error("Constant is not boolean: " + this); - } - - /** - * Converts this constant to a primitive long. - * @return the long value of this constant - */ - public long asLong() { - // Checkstyle: stop - switch (kind.stackKind()) { - case Jsr: - case Int: - case Long: return primitive; - case Float: return (long) asFloat(); - case Double: return (long) asDouble(); - default: throw new Error("Constant is not long: " + this); - } - // Checkstyle: resume - } - - /** - * Converts this constant to a primitive float. - * @return the float value of this constant - */ - public float asFloat() { - if (kind.isFloat()) { - return Float.intBitsToFloat((int) primitive); - } - throw new Error("Constant is not float: " + this); - } - - /** - * Converts this constant to a primitive double. - * @return the double value of this constant - */ - public double asDouble() { - if (kind.isFloat()) { - return Float.intBitsToFloat((int) primitive); - } - if (kind.isDouble()) { - return Double.longBitsToDouble(primitive); - } - throw new Error("Constant is not double: " + this); - } - - /** - * Converts this constant to the object reference it represents. - * @return the object which this constant represents - */ - public Object asObject() { - if (kind.isObject()) { - return object; - } - throw new Error("Constant is not object: " + this); - } - - /** - * Converts this constant to the jsr reference it represents. - * @return the object which this constant represents - */ - public int asJsr() { - if (kind.isJsr()) { - return (int) primitive; - } - throw new Error("Constant is not jsr: " + this); - } - - /** - * Unchecked access to a primitive value. - * @return - */ - public long asPrimitive() { - if (kind.isObject()) { - throw new Error("Constant is not primitive: " + this); - } - return primitive; - } - - /** - * Computes the hashcode of this constant. - * @return a suitable hashcode for this constant - */ - @Override - public int hashCode() { - if (kind.isObject()) { - return System.identityHashCode(object); - } - return (int) primitive; - } - - /** - * Checks whether this constant equals another object. This is only - * true if the other object is a constant and has the same value. - * @param o the object to compare equality - * @return {@code true} if this constant is equivalent to the specified object - */ - @Override - public boolean equals(Object o) { - return o == this || o instanceof CiConstant && valueEqual((CiConstant) o, false); - } - - /** - * Checks whether this constant is identical to another constant or has the same value as it. - * @param other the constant to compare for equality against this constant - * @return {@code true} if this constant is equivalent to {@code other} - */ - public boolean equivalent(CiConstant other) { - return other == this || valueEqual(other, false); - } - - /** - * Checks whether this constant is the default value for its type. - * @return {@code true} if the value is the default value for its type; {@code false} otherwise - */ - public boolean isDefaultValue() { - // Checkstyle: stop - switch (kind.stackKind()) { - case Int: return asInt() == 0; - case Long: return asLong() == 0; - case Float: return this == FLOAT_0; - case Double: return this == DOUBLE_0; - case Object: return object == null; - } - // Checkstyle: resume - throw new IllegalArgumentException("Cannot det default CiConstant for kind " + kind); - } - - /** - * Gets the default value for a given kind. - * - * @return the default value for {@code kind}'s {@linkplain CiKind#stackKind() stack kind} - */ - public static CiConstant defaultValue(CiKind kind) { - // Checkstyle: stop - switch (kind.stackKind()) { - case Int: return INT_0; - case Long: return LONG_0; - case Float: return FLOAT_0; - case Double: return DOUBLE_0; - case Object: return NULL_OBJECT; - } - // Checkstyle: resume - throw new IllegalArgumentException("Cannot get default CiConstant for kind " + kind); - } - - /** - * Creates a boxed double constant. - * @param d the double value to box - * @return a boxed copy of {@code value} - */ - public static CiConstant forDouble(double d) { - if (Double.compare(0.0D, d) == 0) { - return DOUBLE_0; - } - if (Double.compare(d, 1.0D) == 0) { - return DOUBLE_1; - } - return new CiConstant(CiKind.Double, Double.doubleToRawLongBits(d)); - } - - /** - * Creates a boxed float constant. - * @param f the float value to box - * @return a boxed copy of {@code value} - */ - public static CiConstant forFloat(float f) { - if (Float.compare(f, 0.0F) == 0) { - return FLOAT_0; - } - if (Float.compare(f, 1.0F) == 0) { - return FLOAT_1; - } - if (Float.compare(f, 2.0F) == 0) { - return FLOAT_2; - } - return new CiConstant(CiKind.Float, Float.floatToRawIntBits(f)); - } - - /** - * Creates a boxed long constant. - * @param i the long value to box - * @return a boxed copy of {@code value} - */ - public static CiConstant forLong(long i) { - return i == 0 ? LONG_0 : i == 1 ? LONG_1 : new CiConstant(CiKind.Long, i); - } - - /** - * Creates a boxed integer constant. - * @param i the integer value to box - * @return a boxed copy of {@code value} - */ - public static CiConstant forInt(int i) { - if (i == -1) { - return INT_MINUS_1; - } - if (i >= 0 && i < INT_CONSTANT_CACHE.length) { - return INT_CONSTANT_CACHE[i]; - } - return new CiConstant(CiKind.Int, i); - } - - /** - * Creates a boxed byte constant. - * @param i the byte value to box - * @return a boxed copy of {@code value} - */ - public static CiConstant forByte(byte i) { - return new CiConstant(CiKind.Byte, i); - } - - /** - * Creates a boxed boolean constant. - * @param i the boolean value to box - * @return a boxed copy of {@code value} - */ - public static CiConstant forBoolean(boolean i) { - return i ? TRUE : FALSE; - } - - /** - * Creates a boxed char constant. - * @param i the char value to box - * @return a boxed copy of {@code value} - */ - public static CiConstant forChar(char i) { - return new CiConstant(CiKind.Char, i); - } - - /** - * Creates a boxed short constant. - * @param i the short value to box - * @return a boxed copy of {@code value} - */ - public static CiConstant forShort(short i) { - return new CiConstant(CiKind.Short, i); - } - - /** - * Creates a boxed address (jsr/ret address) constant. - * @param i the address value to box - * @return a boxed copy of {@code value} - */ - public static CiConstant forJsr(int i) { - return new CiConstant(CiKind.Jsr, i); - } - - /** - * Creates a boxed object constant. - * @param o the object value to box - * @return a boxed copy of {@code value} - */ - public static CiConstant forObject(Object o) { - if (o == null) { - return NULL_OBJECT; - } - return new CiConstant(CiKind.Object, o); - } - - /** - * Creates a boxed constant for the given kind from an Object. - * The object needs to be of the Java boxed type corresponding to the kind. - * @param kind the kind of the constant to create - * @param value the Java boxed value: a Byte instance for CiKind Byte, etc. - * @return the boxed copy of {@code value} - */ - public static CiConstant forBoxed(CiKind kind, Object value) { - switch (kind) { - case Boolean: - return forBoolean((Boolean) value); - case Byte: - return forByte((Byte) value); - case Char: - return forChar((Character) value); - case Short: - return forShort((Short) value); - case Int: - return forInt((Integer) value); - case Long: - return forLong((Long) value); - case Float: - return forFloat((Float) value); - case Double: - return forDouble((Double) value); - case Object: - return forObject(value); - default: - throw new RuntimeException("cannot create CiConstant for boxed " + kind + " value"); - } - } -} diff -r d2f2dede7c1a -r d89b20486d87 graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiKind.java --- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiKind.java Thu Jun 07 17:06:29 2012 +0200 +++ b/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiKind.java Thu Jun 07 17:07:05 2012 +0200 @@ -396,28 +396,28 @@ } } - public CiConstant readUnsafeConstant(Object value, long displacement) { + public RiConstant readUnsafeConstant(Object value, long displacement) { assert value != null; Unsafe u = Unsafe.getUnsafe(); switch(this) { case Boolean: - return CiConstant.forBoolean(u.getBoolean(value, displacement)); + return RiConstant.forBoolean(u.getBoolean(value, displacement)); case Byte: - return CiConstant.forByte(u.getByte(value, displacement)); + return RiConstant.forByte(u.getByte(value, displacement)); case Char: - return CiConstant.forChar(u.getChar(value, displacement)); + return RiConstant.forChar(u.getChar(value, displacement)); case Short: - return CiConstant.forShort(u.getShort(value, displacement)); + return RiConstant.forShort(u.getShort(value, displacement)); case Int: - return CiConstant.forInt(u.getInt(value, displacement)); + return RiConstant.forInt(u.getInt(value, displacement)); case Long: - return CiConstant.forLong(u.getLong(value, displacement)); + return RiConstant.forLong(u.getLong(value, displacement)); case Float: - return CiConstant.forFloat(u.getFloat(value, displacement)); + return RiConstant.forFloat(u.getFloat(value, displacement)); case Double: - return CiConstant.forDouble(u.getDouble(value, displacement)); + return RiConstant.forDouble(u.getDouble(value, displacement)); case Object: - return CiConstant.forObject(u.getObject(value, displacement)); + return RiConstant.forObject(u.getObject(value, displacement)); default: assert false : "unexpected kind: " + this; return null; diff -r d2f2dede7c1a -r d89b20486d87 graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiTargetMethod.java --- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiTargetMethod.java Thu Jun 07 17:06:29 2012 +0200 +++ b/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiTargetMethod.java Thu Jun 07 17:07:05 2012 +0200 @@ -134,10 +134,10 @@ */ public static final class DataPatch extends Site { private static final long serialVersionUID = 5771730331604867476L; - public final CiConstant constant; + public final RiConstant constant; public final int alignment; - DataPatch(int pcOffset, CiConstant data, int alignment) { + DataPatch(int pcOffset, RiConstant data, int alignment) { super(pcOffset); this.constant = data; this.alignment = alignment; @@ -394,7 +394,7 @@ * @param data the data that is referenced * @param alignment the alignment requirement of the data or 0 if there is no alignment requirement */ - public void recordDataReference(int codePos, CiConstant data, int alignment) { + public void recordDataReference(int codePos, RiConstant data, int alignment) { assert codePos >= 0 && data != null; dataReferences.add(new DataPatch(codePos, data, alignment)); } diff -r d2f2dede7c1a -r d89b20486d87 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:06:29 2012 +0200 +++ b/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiValueUtil.java Thu Jun 07 17:07:05 2012 +0200 @@ -44,12 +44,12 @@ public static boolean isConstant(CiValue value) { assert value != null; - return value instanceof CiConstant; + return value instanceof RiConstant; } - public static CiConstant asConstant(CiValue value) { + public static RiConstant asConstant(CiValue value) { assert value != null; - return (CiConstant) value; + return (RiConstant) value; } diff -r d2f2dede7c1a -r d89b20486d87 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:06:29 2012 +0200 +++ b/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiVirtualObject.java Thu Jun 07 17:07:05 2012 +0200 @@ -125,9 +125,9 @@ } public CiVirtualObject constantProxy(CiKind kind, CiValue objectValue, CiValue primitiveValue) { - CiConstant cKind = CiConstant.forObject(kind); + 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(CiConstant.class), new CiValue[] {cKind, primitiveValue, CiValue.IllegalValue, objectValue}, nextId++); + return new CiVirtualObject(runtime.getType(RiConstant.class), new CiValue[] {cKind, primitiveValue, CiValue.IllegalValue, objectValue}, nextId++); } public CiValue proxy(CiValue ciValue) { diff -r d2f2dede7c1a -r d89b20486d87 graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/RiConstant.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/RiConstant.java Thu Jun 07 17:07:05 2012 +0200 @@ -0,0 +1,498 @@ +/* + * 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; + +/** + * 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 { + private static final long serialVersionUID = -6355452536852663986L; + + private static final RiConstant[] INT_CONSTANT_CACHE = new RiConstant[100]; + static { + for (int i = 0; i < INT_CONSTANT_CACHE.length; ++i) { + INT_CONSTANT_CACHE[i] = new RiConstant(CiKind.Int, i); + } + } + + public static final RiConstant NULL_OBJECT = new RiConstant(CiKind.Object, null); + public static final RiConstant INT_MINUS_1 = new RiConstant(CiKind.Int, -1); + public static final RiConstant INT_0 = forInt(0); + public static final RiConstant INT_1 = forInt(1); + public static final RiConstant INT_2 = forInt(2); + public static final RiConstant INT_3 = forInt(3); + public static final RiConstant INT_4 = forInt(4); + public static final RiConstant INT_5 = forInt(5); + public static final RiConstant LONG_0 = new RiConstant(CiKind.Long, 0L); + public static final RiConstant LONG_1 = new RiConstant(CiKind.Long, 1L); + public static final RiConstant FLOAT_0 = new RiConstant(CiKind.Float, Float.floatToRawIntBits(0.0F)); + public static final RiConstant FLOAT_1 = new RiConstant(CiKind.Float, Float.floatToRawIntBits(1.0F)); + public static final RiConstant FLOAT_2 = new RiConstant(CiKind.Float, Float.floatToRawIntBits(2.0F)); + public static final RiConstant DOUBLE_0 = new RiConstant(CiKind.Double, Double.doubleToRawLongBits(0.0D)); + public static final RiConstant DOUBLE_1 = new RiConstant(CiKind.Double, Double.doubleToRawLongBits(1.0D)); + public static final RiConstant TRUE = new RiConstant(CiKind.Boolean, 1L); + public static final RiConstant FALSE = new RiConstant(CiKind.Boolean, 0L); + + static { + assert NULL_OBJECT.isDefaultValue(); + assert INT_0.isDefaultValue(); + assert FLOAT_0.isDefaultValue(); + assert DOUBLE_0.isDefaultValue(); + assert FALSE.isDefaultValue(); + + // Ensure difference between 0.0f and -0.0f is preserved + assert FLOAT_0 != forFloat(-0.0F); + assert !forFloat(-0.0F).isDefaultValue(); + + // Ensure difference between 0.0d and -0.0d is preserved + assert DOUBLE_0 != forDouble(-0.0d); + assert !forDouble(-0.0D).isDefaultValue(); + + assert NULL_OBJECT.isNull(); + } + + /** + * The boxed object value. This is ignored iff {@code !kind.isObject()}. + */ + private final Object object; + + /** + * The boxed primitive value as a {@code long}. This is ignored iff {@code kind.isObject()}. + * For {@code float} and {@code double} values, this value is the result of + * {@link Float#floatToRawIntBits(float)} and {@link Double#doubleToRawLongBits(double)} respectively. + */ + private final long primitive; + + /** + * Create a new constant represented by the specified object reference. + * + * @param kind the type of this constant + * @param object the value of this constant + */ + private RiConstant(CiKind kind, Object object) { + super(kind); + this.object = object; + this.primitive = 0L; + } + + /** + * Create a new constant represented by the specified primitive. + * + * @param kind the type of this constant + * @param primitive the value of this constant + */ + public RiConstant(CiKind kind, long primitive) { + super(kind); + this.object = null; + this.primitive = primitive; + } + + /** + * Checks whether this constant is non-null. + * @return {@code true} if this constant is a primitive, or an object constant that is not null + */ + public boolean isNonNull() { + return !kind.isObject() || object != null; + } + + /** + * Checks whether this constant is null. + * @return {@code true} if this constant is the null constant + */ + public boolean isNull() { + return kind.isObject() && object == null; + } + + @Override + public String toString() { + return kind.javaName + "[" + kind.format(boxedValue()) + (kind != CiKind.Object ? "|0x" + Long.toHexString(primitive) : "") + "]"; + } + + /** + * Gets this constant's value as a string. + * + * @return this constant's value as a string + */ + public String valueString() { + if (kind.isPrimitive()) { + return boxedValue().toString(); + } else if (kind.isObject()) { + if (object == null) { + return "null"; + } else if (object instanceof String) { + return "\"" + object + "\""; + } else { + return ""; + } + } else if (kind.isJsr()) { + return "bci:" + boxedValue().toString(); + } else { + return "???"; + } + } + + /** + * Returns the value of this constant as a boxed Java value. + * @return the value of this constant + */ + public Object boxedValue() { + // Checkstyle: stop + switch (kind) { + case Byte: return (byte) asInt(); + case Boolean: return asInt() == 0 ? Boolean.FALSE : Boolean.TRUE; + case Short: return (short) asInt(); + case Char: return (char) asInt(); + case Jsr: return (int) primitive; + case Int: return asInt(); + case Long: return asLong(); + case Float: return asFloat(); + case Double: return asDouble(); + case Object: return object; + } + // Checkstyle: resume + throw new IllegalArgumentException(); + } + + private boolean valueEqual(RiConstant other, boolean ignoreKind) { + // must have equivalent kinds to be equal + if (!ignoreKind && kind != other.kind) { + return false; + } + if (kind.isObject()) { + return object == other.object; + } + return primitive == other.primitive; + } + + /** + * Converts this constant to a primitive int. + * @return the int value of this constant + */ + public int asInt() { + if (kind.stackKind().isInt() || kind.isJsr()) { + return (int) primitive; + } + throw new Error("Constant is not int: " + this); + } + + /** + * Converts this constant to a primitive boolean. + * @return the boolean value of this constant + */ + public boolean asBoolean() { + if (kind == CiKind.Boolean) { + return primitive != 0L; + } + throw new Error("Constant is not boolean: " + this); + } + + /** + * Converts this constant to a primitive long. + * @return the long value of this constant + */ + public long asLong() { + // Checkstyle: stop + switch (kind.stackKind()) { + case Jsr: + case Int: + case Long: return primitive; + case Float: return (long) asFloat(); + case Double: return (long) asDouble(); + default: throw new Error("Constant is not long: " + this); + } + // Checkstyle: resume + } + + /** + * Converts this constant to a primitive float. + * @return the float value of this constant + */ + public float asFloat() { + if (kind.isFloat()) { + return Float.intBitsToFloat((int) primitive); + } + throw new Error("Constant is not float: " + this); + } + + /** + * Converts this constant to a primitive double. + * @return the double value of this constant + */ + public double asDouble() { + if (kind.isFloat()) { + return Float.intBitsToFloat((int) primitive); + } + if (kind.isDouble()) { + return Double.longBitsToDouble(primitive); + } + throw new Error("Constant is not double: " + this); + } + + /** + * Converts this constant to the object reference it represents. + * @return the object which this constant represents + */ + public Object asObject() { + if (kind.isObject()) { + return object; + } + throw new Error("Constant is not object: " + this); + } + + /** + * Converts this constant to the jsr reference it represents. + * @return the object which this constant represents + */ + public int asJsr() { + if (kind.isJsr()) { + return (int) primitive; + } + throw new Error("Constant is not jsr: " + this); + } + + /** + * Unchecked access to a primitive value. + * @return + */ + public long asPrimitive() { + if (kind.isObject()) { + throw new Error("Constant is not primitive: " + this); + } + return primitive; + } + + /** + * Computes the hashcode of this constant. + * @return a suitable hashcode for this constant + */ + @Override + public int hashCode() { + if (kind.isObject()) { + return System.identityHashCode(object); + } + return (int) primitive; + } + + /** + * Checks whether this constant equals another object. This is only + * true if the other object is a constant and has the same value. + * @param o the object to compare equality + * @return {@code true} if this constant is equivalent to the specified object + */ + @Override + public boolean equals(Object o) { + return o == this || o instanceof RiConstant && valueEqual((RiConstant) o, false); + } + + /** + * Checks whether this constant is identical to another constant or has the same value as it. + * @param other the constant to compare for equality against this constant + * @return {@code true} if this constant is equivalent to {@code other} + */ + public boolean equivalent(RiConstant other) { + return other == this || valueEqual(other, false); + } + + /** + * Checks whether this constant is the default value for its type. + * @return {@code true} if the value is the default value for its type; {@code false} otherwise + */ + public boolean isDefaultValue() { + // Checkstyle: stop + switch (kind.stackKind()) { + case Int: return asInt() == 0; + case Long: return asLong() == 0; + case Float: return this == FLOAT_0; + case Double: return this == DOUBLE_0; + case Object: return object == null; + } + // Checkstyle: resume + throw new IllegalArgumentException("Cannot det default CiConstant for kind " + kind); + } + + /** + * Gets the default value for a given kind. + * + * @return the default value for {@code kind}'s {@linkplain CiKind#stackKind() stack kind} + */ + public static RiConstant defaultValue(CiKind kind) { + // Checkstyle: stop + switch (kind.stackKind()) { + case Int: return INT_0; + case Long: return LONG_0; + case Float: return FLOAT_0; + case Double: return DOUBLE_0; + case Object: return NULL_OBJECT; + } + // Checkstyle: resume + throw new IllegalArgumentException("Cannot get default CiConstant for kind " + kind); + } + + /** + * Creates a boxed double constant. + * @param d the double value to box + * @return a boxed copy of {@code value} + */ + public static RiConstant forDouble(double d) { + if (Double.compare(0.0D, d) == 0) { + return DOUBLE_0; + } + if (Double.compare(d, 1.0D) == 0) { + return DOUBLE_1; + } + return new RiConstant(CiKind.Double, Double.doubleToRawLongBits(d)); + } + + /** + * Creates a boxed float constant. + * @param f the float value to box + * @return a boxed copy of {@code value} + */ + public static RiConstant forFloat(float f) { + if (Float.compare(f, 0.0F) == 0) { + return FLOAT_0; + } + if (Float.compare(f, 1.0F) == 0) { + return FLOAT_1; + } + if (Float.compare(f, 2.0F) == 0) { + return FLOAT_2; + } + return new RiConstant(CiKind.Float, Float.floatToRawIntBits(f)); + } + + /** + * Creates a boxed long constant. + * @param i the long value to box + * @return a boxed copy of {@code value} + */ + public static RiConstant forLong(long i) { + return i == 0 ? LONG_0 : i == 1 ? LONG_1 : new RiConstant(CiKind.Long, i); + } + + /** + * Creates a boxed integer constant. + * @param i the integer value to box + * @return a boxed copy of {@code value} + */ + public static RiConstant forInt(int i) { + if (i == -1) { + return INT_MINUS_1; + } + if (i >= 0 && i < INT_CONSTANT_CACHE.length) { + return INT_CONSTANT_CACHE[i]; + } + return new RiConstant(CiKind.Int, i); + } + + /** + * Creates a boxed byte constant. + * @param i the byte value to box + * @return a boxed copy of {@code value} + */ + public static RiConstant forByte(byte i) { + return new RiConstant(CiKind.Byte, i); + } + + /** + * Creates a boxed boolean constant. + * @param i the boolean value to box + * @return a boxed copy of {@code value} + */ + public static RiConstant forBoolean(boolean i) { + return i ? TRUE : FALSE; + } + + /** + * Creates a boxed char constant. + * @param i the char value to box + * @return a boxed copy of {@code value} + */ + public static RiConstant forChar(char i) { + return new RiConstant(CiKind.Char, i); + } + + /** + * Creates a boxed short constant. + * @param i the short value to box + * @return a boxed copy of {@code value} + */ + public static RiConstant forShort(short i) { + return new RiConstant(CiKind.Short, i); + } + + /** + * Creates a boxed address (jsr/ret address) constant. + * @param i the address value to box + * @return a boxed copy of {@code value} + */ + public static RiConstant forJsr(int i) { + return new RiConstant(CiKind.Jsr, i); + } + + /** + * Creates a boxed object constant. + * @param o the object value to box + * @return a boxed copy of {@code value} + */ + public static RiConstant forObject(Object o) { + if (o == null) { + return NULL_OBJECT; + } + return new RiConstant(CiKind.Object, o); + } + + /** + * Creates a boxed constant for the given kind from an Object. + * The object needs to be of the Java boxed type corresponding to the kind. + * @param kind the kind of the constant to create + * @param value the Java boxed value: a Byte instance for CiKind Byte, etc. + * @return the boxed copy of {@code value} + */ + public static RiConstant forBoxed(CiKind kind, Object value) { + switch (kind) { + case Boolean: + return forBoolean((Boolean) value); + case Byte: + return forByte((Byte) value); + case Char: + return forChar((Character) value); + case Short: + return forShort((Short) value); + case Int: + return forInt((Integer) value); + case Long: + return forLong((Long) value); + case Float: + return forFloat((Float) value); + case Double: + return forDouble((Double) value); + case Object: + return forObject(value); + default: + throw new RuntimeException("cannot create CiConstant for boxed " + kind + " value"); + } + } +} diff -r d2f2dede7c1a -r d89b20486d87 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:06:29 2012 +0200 +++ b/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/package-info.java Thu Jun 07 17:07:05 2012 +0200 @@ -36,7 +36,7 @@ * The compiler manipulates {@link com.oracle.max.cri.ci.CiValue} instances that have a {@link com.oracle.max.cri.ci.CiKind}, and are * immutable. A concrete {@link com.oracle.max.cri.ci.CiValue value} is one of the following subclasses: *
    - *
  • {@link com.oracle.max.cri.ci.CiConstant}: a constant value. + *
  • {@link com.oracle.max.cri.ci.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}. *
  • {@link com.oracle.max.cri.ci.CiStackSlot}: a spill slot or an outgoing stack-based argument in a method's frame. *
  • {@link com.oracle.max.cri.ci.CiAddress}: an address in target machine memory. diff -r d2f2dede7c1a -r d89b20486d87 graal/com.oracle.max.cri/src/com/oracle/max/cri/ri/RiResolvedField.java --- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ri/RiResolvedField.java Thu Jun 07 17:06:29 2012 +0200 +++ b/graal/com.oracle.max.cri/src/com/oracle/max/cri/ri/RiResolvedField.java Thu Jun 07 17:07:05 2012 +0200 @@ -47,7 +47,7 @@ * @param receiver object from which this field's value is to be read. This value is ignored if this field is static. * @return the constant value of this field or {@code null} if the constant value is not available */ - CiConstant constantValue(CiConstant receiver); + RiConstant constantValue(RiConstant receiver); /** * Gets the holder of this field as a compiler-runtime interface type. diff -r d2f2dede7c1a -r d89b20486d87 graal/com.oracle.max.cri/src/com/oracle/max/cri/ri/RiResolvedType.java --- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ri/RiResolvedType.java Thu Jun 07 17:06:29 2012 +0200 +++ b/graal/com.oracle.max.cri/src/com/oracle/max/cri/ri/RiResolvedType.java Thu Jun 07 17:07:05 2012 +0200 @@ -39,7 +39,7 @@ * @param r the part of the this type * @return a constant representing a reference to the specified part of this type */ - CiConstant getEncoding(Representation r); + RiConstant getEncoding(Representation r); /** * Checks whether this type has any subclasses so far. Any decisions @@ -107,7 +107,7 @@ * @param obj the object to test * @return {@code true} if the object is an instance of this type */ - boolean isInstance(CiConstant obj); + boolean isInstance(RiConstant obj); /** * Attempts to get an exact type for this type. Final classes, diff -r d2f2dede7c1a -r d89b20486d87 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:06:29 2012 +0200 +++ b/graal/com.oracle.max.cri/src/com/oracle/max/cri/ri/RiRuntime.java Thu Jun 07 17:07:05 2012 +0200 @@ -63,7 +63,7 @@ * * @return {@code null} if {@code constant.isNull() || !constant.kind.isObject()} */ - RiResolvedType getTypeOf(CiConstant constant); + RiResolvedType getTypeOf(RiConstant constant); RiResolvedType getType(Class clazz); @@ -73,7 +73,7 @@ * * @return true if the two parameters represent the same runtime object, false otherwise */ - boolean areConstantObjectsEqual(CiConstant x, CiConstant y); + boolean areConstantObjectsEqual(RiConstant x, RiConstant y); /** * Gets the register configuration to use when compiling a given method. @@ -100,7 +100,7 @@ /** * Gets the length of the array that is wrapped in a CiConstant object. */ - int getArrayLength(CiConstant array); + int getArrayLength(RiConstant array); /** * Performs any runtime-specific conversion on the object used to describe the target of a call. diff -r d2f2dede7c1a -r d89b20486d87 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:06:29 2012 +0200 +++ b/graal/com.oracle.max.cri/src/com/oracle/max/cri/xir/CiXirAssembler.java Thu Jun 07 17:07:05 2012 +0200 @@ -224,9 +224,9 @@ } public static class XirConstant extends XirOperand implements XirConstantOperand { - public final CiConstant value; + public final RiConstant value; - XirConstant(CiXirAssembler asm, CiConstant value) { + XirConstant(CiXirAssembler asm, RiConstant value) { super(asm, value, value.kind); this.value = value; } @@ -820,7 +820,7 @@ return new XirConstantParameter(this, name, kind); } - public XirConstant createConstant(CiConstant constant) { + public XirConstant createConstant(RiConstant constant) { assert !finished; XirConstant temp = new XirConstant(this, constant); constants.add(temp); @@ -868,19 +868,19 @@ } public XirConstant i(int v) { - return createConstant(CiConstant.forInt(v)); + return createConstant(RiConstant.forInt(v)); } public XirConstant l(long v) { - return createConstant(CiConstant.forLong(v)); + return createConstant(RiConstant.forLong(v)); } public XirConstant b(boolean v) { - return createConstant(CiConstant.forBoolean(v)); + return createConstant(RiConstant.forBoolean(v)); } public XirConstant o(Object obj) { - return createConstant(CiConstant.forObject(obj)); + return createConstant(RiConstant.forObject(obj)); } public void reserveOutgoingStack(int size) { diff -r d2f2dede7c1a -r d89b20486d87 graal/com.oracle.max.cri/src/com/oracle/max/cri/xir/XirArgument.java --- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/xir/XirArgument.java Thu Jun 07 17:06:29 2012 +0200 +++ b/graal/com.oracle.max.cri/src/com/oracle/max/cri/xir/XirArgument.java Thu Jun 07 17:07:05 2012 +0200 @@ -26,14 +26,14 @@ /** * Represents an argument to an {@link XirSnippet}. - * Currently, this is a union type; it is either a {@link CiConstant} or an {@code Object}. + * Currently, this is a union type; it is either a {@link RiConstant} or an {@code Object}. */ public final class XirArgument { - public final CiConstant constant; + public final RiConstant constant; public final Object object; - private XirArgument(CiConstant value) { + private XirArgument(RiConstant value) { this.constant = value; this.object = null; } @@ -48,15 +48,15 @@ } public static XirArgument forInt(int x) { - return new XirArgument(CiConstant.forInt(x)); + return new XirArgument(RiConstant.forInt(x)); } public static XirArgument forLong(long x) { - return new XirArgument(CiConstant.forLong(x)); + return new XirArgument(RiConstant.forLong(x)); } public static XirArgument forObject(Object o) { - return new XirArgument(CiConstant.forObject(o)); + return new XirArgument(RiConstant.forObject(o)); } @Override