# HG changeset patch # User Roland Schatz # Date 1402478250 -7200 # Node ID 640a875667fe42f5b33b5b294a46f66749f40786 # Parent 048943ad39bfc59550c9f6f5458947c5de0432fe Remove dead code. diff -r 048943ad39bf -r 640a875667fe graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64NodeLIRBuilder.java --- a/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64NodeLIRBuilder.java Wed Jun 11 11:14:30 2014 +0200 +++ b/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64NodeLIRBuilder.java Wed Jun 11 11:17:30 2014 +0200 @@ -133,33 +133,27 @@ } } - PlatformKind cmpKind = gen.getPlatformKind(compare.x().stamp()); - if (cmpKind instanceof Kind) { - // emitCompareBranchMemory expects the memory on the right, so mirror the condition if - // that's not true. It might be mirrored again the actual compare is emitted but that's - // ok. - Condition finalCondition = uncast(compare.x()) == access ? cond.mirror() : cond; - return new ComplexMatchResult() { - public Value evaluate(NodeLIRBuilder builder) { - LabelRef trueLabel = getLIRBlock(ifNode.trueSuccessor()); - LabelRef falseLabel = getLIRBlock(ifNode.falseSuccessor()); - boolean unorderedIsTrue = compare.unorderedIsTrue(); - double trueLabelProbability = ifNode.probability(ifNode.trueSuccessor()); - Value other; - if (value.isConstant()) { - other = value.asConstant(); - } else { - other = operand(value); - } + // emitCompareBranchMemory expects the memory on the right, so mirror the condition if + // that's not true. It might be mirrored again the actual compare is emitted but that's + // ok. + Condition finalCondition = uncast(compare.x()) == access ? cond.mirror() : cond; + return new ComplexMatchResult() { + public Value evaluate(NodeLIRBuilder builder) { + LabelRef trueLabel = getLIRBlock(ifNode.trueSuccessor()); + LabelRef falseLabel = getLIRBlock(ifNode.falseSuccessor()); + boolean unorderedIsTrue = compare.unorderedIsTrue(); + double trueLabelProbability = ifNode.probability(ifNode.trueSuccessor()); + Value other; + if (value.isConstant()) { + other = value.asConstant(); + } else { + other = operand(value); + } - getLIRGeneratorTool().emitCompareBranchMemory((Kind) cmpKind, other, makeAddress(access), getState(access), finalCondition, unorderedIsTrue, trueLabel, falseLabel, - trueLabelProbability); - return null; - } - }; - } - return null; - + getLIRGeneratorTool().emitCompareBranchMemory(kind, other, makeAddress(access), getState(access), finalCondition, unorderedIsTrue, trueLabel, falseLabel, trueLabelProbability); + return null; + } + }; } private ComplexMatchResult emitIntegerTestBranchMemory(IfNode x, ValueNode value, Access access) { diff -r 048943ad39bf -r 640a875667fe graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLIRGenerator.java --- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLIRGenerator.java Wed Jun 11 11:14:30 2014 +0200 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLIRGenerator.java Wed Jun 11 11:17:30 2014 +0200 @@ -26,21 +26,18 @@ import static com.oracle.graal.api.code.ValueUtil.*; import static com.oracle.graal.hotspot.HotSpotBackend.*; import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*; -import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*; import java.util.*; import com.oracle.graal.amd64.*; import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; -import com.oracle.graal.asm.amd64.*; import com.oracle.graal.compiler.amd64.*; import com.oracle.graal.compiler.common.*; import com.oracle.graal.compiler.common.calc.*; import com.oracle.graal.hotspot.*; import com.oracle.graal.hotspot.HotSpotVMConfig.CompressEncoding; import com.oracle.graal.hotspot.amd64.AMD64HotSpotMove.HotSpotStoreConstantOp; -import com.oracle.graal.hotspot.data.*; import com.oracle.graal.hotspot.meta.*; import com.oracle.graal.hotspot.nodes.type.*; import com.oracle.graal.hotspot.stubs.*; @@ -48,7 +45,6 @@ import com.oracle.graal.lir.StandardOp.NoOp; import com.oracle.graal.lir.StandardOp.SaveRegistersOp; import com.oracle.graal.lir.amd64.*; -import com.oracle.graal.lir.amd64.AMD64ControlFlow.BranchOp; import com.oracle.graal.lir.amd64.AMD64ControlFlow.CondMoveOp; import com.oracle.graal.lir.amd64.AMD64Move.CompareAndSwapOp; import com.oracle.graal.lir.amd64.AMD64Move.LeaDataOp; @@ -56,7 +52,6 @@ import com.oracle.graal.lir.amd64.AMD64Move.MoveFromRegOp; import com.oracle.graal.lir.amd64.AMD64Move.MoveToRegOp; import com.oracle.graal.lir.amd64.AMD64Move.StoreOp; -import com.oracle.graal.lir.asm.*; import com.oracle.graal.lir.gen.*; /** @@ -563,14 +558,6 @@ return result; } - public static Register asNarrowReg(Value value) { - if (value.getPlatformKind() != NarrowOopStamp.NarrowOop) { - throw new InternalError("needed NarrowOop got: " + value.getKind()); - } else { - return asRegister(value); - } - } - public Value emitAtomicReadAndWrite(Value address, Value newValue) { PlatformKind kind = newValue.getPlatformKind(); Kind memKind = getMemoryKind(kind); @@ -580,62 +567,6 @@ return result; } - public static class CompareMemoryCompressedOp extends AMD64LIRInstruction { - @Alive({COMPOSITE}) protected AMD64AddressValue x; - @Use({CONST, REG}) protected Value y; - @State protected LIRFrameState state; - - public CompareMemoryCompressedOp(AMD64AddressValue x, Value y, LIRFrameState state) { - assert HotSpotGraalRuntime.runtime().getConfig().useCompressedOops; - this.x = x; - this.y = y; - this.state = state; - } - - @Override - protected void verify() { - assert y instanceof Constant || y.getPlatformKind() == NarrowOopStamp.NarrowOop; - } - - @Override - public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) { - if (state != null) { - crb.recordImplicitException(masm.position(), state); - } - if (y instanceof Constant) { - Constant constant = (Constant) y; - if (constant.isNull()) { - masm.cmpl(x.toAddress(), 0); - } else { - if (y.getKind() == Kind.Object) { - crb.recordInlineDataInCode(new OopData(0, HotSpotObjectConstant.asObject(constant), true)); - } else if (y.getKind() == Kind.Long) { - crb.recordInlineDataInCode(new MetaspaceData(0, constant.asLong(), HotSpotMetaspaceConstant.getMetaspaceObject(constant), true)); - } else { - throw GraalInternalError.shouldNotReachHere(); - } - masm.cmpl(x.toAddress(), 0xdeaddead); - } - } else { - masm.cmpl(asNarrowReg(y), x.toAddress()); - } - } - } - - protected void emitCompareBranchMemoryCompressed(Value left, Value right, Condition cond, LabelRef trueLabel, LabelRef falseLabel, double trueLabelProbability, LIRFrameState state) { - boolean mirrored = false; - if (left instanceof AMD64AddressValue) { - append(new CompareMemoryCompressedOp((AMD64AddressValue) left, right, state)); - } else { - assert right instanceof AMD64AddressValue; - append(new CompareMemoryCompressedOp((AMD64AddressValue) right, left, state)); - mirrored = true; - } - - Condition finalCondition = mirrored ? cond.mirror() : cond; - append(new BranchOp(finalCondition, trueLabel, falseLabel, trueLabelProbability)); - } - public void emitNullCheck(Value address, LIRFrameState state) { assert address.getKind() == Kind.Object : address + " - " + address.getKind() + " not an object!"; append(new AMD64Move.NullCheckOp(load(address), state)); diff -r 048943ad39bf -r 640a875667fe graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotNodeLIRBuilder.java --- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotNodeLIRBuilder.java Wed Jun 11 11:14:30 2014 +0200 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotNodeLIRBuilder.java Wed Jun 11 11:17:30 2014 +0200 @@ -67,36 +67,6 @@ return result; } - private void emitCompareMemoryObject(IfNode ifNode, ValueNode valueNode, Access access, CompareNode compare) { - Value value; - // This works by embedding the compressed form for constants, so force a constant instead of - // respecting what operand() would return. - if (valueNode.isConstant()) { - value = valueNode.asConstant(); - } else { - value = gen.load(operand(valueNode)); - } - AMD64AddressValue address = makeAddress(access); - - Condition cond = compare.condition(); - Value left; - Value right; - if (access == filterCompression(compare.x())) { - left = value; - right = address; - } else { - assert access == filterCompression(compare.y()); - left = address; - right = value; - cond = cond.mirror(); - } - - LabelRef trueLabel = getLIRBlock(ifNode.trueSuccessor()); - LabelRef falseLabel = getLIRBlock(ifNode.falseSuccessor()); - double trueLabelProbability = ifNode.probability(ifNode.trueSuccessor()); - getGen().emitCompareBranchMemoryCompressed(left, right, cond, trueLabel, falseLabel, trueLabelProbability, getState(access)); - } - private void emitCompareCompressedMemory(Kind kind, IfNode ifNode, ValueNode valueNode, CompressionNode compress, ConstantLocationNode location, Access access, CompareNode compare) { Value value = gen.load(operand(valueNode)); AMD64AddressValue address = makeCompressedAddress(compress, location); @@ -271,24 +241,6 @@ return address; } - @MatchRule("(If (ObjectEquals=compare Constant=value (Pi (Compression Read=access))))") - @MatchRule("(If (ObjectEquals=compare Constant=value (Pi (Compression FloatingRead=access))))") - @MatchRule("(If (ObjectEquals=compare (Compression value) (Pi (Compression Read=access))))") - @MatchRule("(If (ObjectEquals=compare (Compression value) (Pi (Compression FloatingRead=access))))") - @MatchRule("(If (ObjectEquals=compare Constant=value (Compression Read=access)))") - @MatchRule("(If (ObjectEquals=compare Constant=value (Compression FloatingRead=access)))") - @MatchRule("(If (ObjectEquals=compare (Compression value) (Compression Read=access)))") - @MatchRule("(If (ObjectEquals=compare (Compression value) (Compression FloatingRead=access)))") - public ComplexMatchResult ifCompareMemoryObject(IfNode root, CompareNode compare, ValueNode value, Access access) { - if (HotSpotGraalRuntime.runtime().getConfig().useCompressedOops) { - return builder -> { - emitCompareMemoryObject(root, value, access, compare); - return null; - }; - } - return null; - } - @MatchRule("(If (IntegerEquals=compare value (FloatingRead=access (Compression=compress object) ConstantLocation=location)))") @MatchRule("(If (IntegerLessThan=compare value (FloatingRead=access (Compression=compress object) ConstantLocation=location)))") @MatchRule("(If (IntegerBelowThan=compare value (FloatingRead=access (Compression=compress object) ConstantLocation=location)))")