# HG changeset patch # User Gilles Duboscq # Date 1363263928 -3600 # Node ID ad4f977b49ced57a4b0d6274f41f3df7c5e1b0c6 # Parent 0269ef50021f267cc13d1b4b1a55ba91be0809bf Remove emitDeoptimizeOnOverflow and emitGuardCheck. Remove LIR.stubs and LIR.Code since it is not used anymore diff -r 0269ef50021f -r ad4f977b49ce graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64DeoptimizationStub.java --- a/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64DeoptimizationStub.java Thu Mar 14 12:19:01 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2011, 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.graal.compiler.amd64; - -import com.oracle.graal.api.code.*; -import com.oracle.graal.api.code.RuntimeCallTarget.*; -import com.oracle.graal.api.meta.*; -import com.oracle.graal.asm.*; -import com.oracle.graal.asm.amd64.*; -import com.oracle.graal.lir.*; -import com.oracle.graal.lir.amd64.*; -import com.oracle.graal.lir.asm.*; - -public class AMD64DeoptimizationStub extends AMD64Code { - - public static final Descriptor DEOPTIMIZE = new Descriptor("deoptimize", true, void.class); - - public final Label label = new Label(); - public final LIRFrameState info; - public final DeoptimizationAction action; - public final DeoptimizationReason reason; - - public AMD64DeoptimizationStub(DeoptimizationAction action, DeoptimizationReason reason, LIRFrameState info) { - this.action = action; - this.reason = reason; - this.info = info; - } - - @Override - public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) { - Register scratch = tasm.frameMap.registerConfig.getScratchRegister(); - masm.bind(label); - masm.movl(scratch, tasm.runtime.encodeDeoptActionAndReason(action, reason)); - AMD64Call.directCall(tasm, masm, tasm.runtime.lookupRuntimeCall(DEOPTIMIZE), info); - } - - @Override - public String description() { - return "deopt stub[reason=" + reason + ", action=" + action + "]"; - } -} diff -r 0269ef50021f -r ad4f977b49ce graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java --- a/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java Thu Mar 14 12:19:01 2013 +0100 +++ b/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java Thu Mar 14 13:25:28 2013 +0100 @@ -67,7 +67,6 @@ import com.oracle.graal.lir.amd64.AMD64Move.MembarOp; import com.oracle.graal.lir.amd64.AMD64Move.MoveFromRegOp; import com.oracle.graal.lir.amd64.AMD64Move.MoveToRegOp; -import com.oracle.graal.lir.amd64.AMD64Move.NullCheckOp; import com.oracle.graal.lir.amd64.AMD64Move.StackLeaOp; import com.oracle.graal.lir.amd64.AMD64Move.StoreConstantOp; import com.oracle.graal.lir.amd64.AMD64Move.StoreOp; @@ -773,13 +772,6 @@ } @Override - public void emitDeoptimizeOnOverflow(DeoptimizationAction action, DeoptimizationReason reason) { - LIRFrameState info = state(reason); - LabelRef stubEntry = createDeoptStub(action, reason, info); - append(new BranchOp(ConditionFlag.Overflow, stubEntry, info)); - } - - @Override public void emitMembar(int barriers) { int necessaryBarriers = target.arch.requiredBarriers(barriers); if (target.isMP && necessaryBarriers != 0) { @@ -899,29 +891,6 @@ } @Override - protected LabelRef createDeoptStub(DeoptimizationAction action, DeoptimizationReason reason, LIRFrameState info) { - assert info.topFrame.getBCI() >= 0 : "invalid bci for deopt framestate"; - AMD64DeoptimizationStub stub = new AMD64DeoptimizationStub(action, reason, info); - lir.stubs.add(stub); - return LabelRef.forLabel(stub.label); - } - - @Override - public void emitGuardCheck(LogicNode comp, DeoptimizationReason deoptReason, DeoptimizationAction action, boolean negated) { - if (comp instanceof IsNullNode && negated) { - emitNullCheckGuard(((IsNullNode) comp).object()); - } else { - super.emitGuardCheck(comp, deoptReason, action, negated); - } - } - - private void emitNullCheckGuard(ValueNode object) { - Variable value = load(operand(object)); - LIRFrameState info = state(); - append(new NullCheckOp(value, info)); - } - - @Override public void visitCompareAndSwap(CompareAndSwapNode node) { Kind kind = node.newValue().kind(); assert kind == node.expected().kind(); diff -r 0269ef50021f -r ad4f977b49ce graal/com.oracle.graal.compiler.ptx/src/com/oracle/graal/compiler/ptx/PTXDeoptimizationStub.java --- a/graal/com.oracle.graal.compiler.ptx/src/com/oracle/graal/compiler/ptx/PTXDeoptimizationStub.java Thu Mar 14 12:19:01 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2013, 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.graal.compiler.ptx; - -import com.oracle.graal.api.code.*; -import com.oracle.graal.api.code.RuntimeCallTarget.*; -import com.oracle.graal.api.meta.*; -import com.oracle.graal.asm.*; -import com.oracle.graal.asm.ptx.*; -import com.oracle.graal.lir.*; -import com.oracle.graal.lir.ptx.*; -import com.oracle.graal.lir.asm.*; - -public class PTXDeoptimizationStub extends PTXCode { - - public static final Descriptor DEOPTIMIZE = new Descriptor("deoptimize", true, void.class); - public static final Descriptor SET_DEOPT_INFO = new Descriptor("setDeoptInfo", true, void.class, Object.class); - - public final Label label = new Label(); - public final LIRFrameState info; - public final DeoptimizationAction action; - public final DeoptimizationReason reason; - - public PTXDeoptimizationStub(DeoptimizationAction action, DeoptimizationReason reason, LIRFrameState info) { - this.action = action; - this.reason = reason; - this.info = info; - } - - @Override - public void emitCode(TargetMethodAssembler tasm, PTXAssembler masm) { - masm.exit(); - } - - @Override - public String description() { - return "deopt stub[reason=" + reason + ", action=" + action + "]"; - } -} diff -r 0269ef50021f -r ad4f977b49ce graal/com.oracle.graal.compiler.ptx/src/com/oracle/graal/compiler/ptx/PTXLIRGenerator.java --- a/graal/com.oracle.graal.compiler.ptx/src/com/oracle/graal/compiler/ptx/PTXLIRGenerator.java Thu Mar 14 12:19:01 2013 +0100 +++ b/graal/com.oracle.graal.compiler.ptx/src/com/oracle/graal/compiler/ptx/PTXLIRGenerator.java Thu Mar 14 13:25:28 2013 +0100 @@ -349,11 +349,6 @@ } @Override - public void emitDeoptimizeOnOverflow(DeoptimizationAction action, DeoptimizationReason reason) { - throw new InternalError("NYI"); - } - - @Override public void emitDeoptimize(DeoptimizationAction action, DeoptimizationReason reason) { append(new ReturnOp(Value.ILLEGAL)); } @@ -453,14 +448,6 @@ } @Override - protected LabelRef createDeoptStub(DeoptimizationAction action, DeoptimizationReason reason, LIRFrameState info) { - assert info.topFrame.getBCI() >= 0 : "invalid bci for deopt framestate"; - PTXDeoptimizationStub stub = new PTXDeoptimizationStub(action, reason, info); - lir.stubs.add(stub); - return LabelRef.forLabel(stub.label); - } - - @Override public void visitCompareAndSwap(CompareAndSwapNode node) { throw new InternalError("NYI"); } diff -r 0269ef50021f -r ad4f977b49ce graal/com.oracle.graal.compiler.sparc/src/com/oracle/graal/compiler/sparc/SPARCLIRGenerator.java --- a/graal/com.oracle.graal.compiler.sparc/src/com/oracle/graal/compiler/sparc/SPARCLIRGenerator.java Thu Mar 14 12:19:01 2013 +0100 +++ b/graal/com.oracle.graal.compiler.sparc/src/com/oracle/graal/compiler/sparc/SPARCLIRGenerator.java Thu Mar 14 13:25:28 2013 +0100 @@ -118,12 +118,6 @@ } @Override - protected LabelRef createDeoptStub(DeoptimizationAction action, DeoptimizationReason reason, LIRFrameState info) { - // SPARC: Auto-generated method stub - return null; - } - - @Override protected void emitSequentialSwitch(Constant[] keyConstants, LabelRef[] keyTargets, LabelRef defaultTarget, Value key) { // SPARC: Auto-generated method stub @@ -340,12 +334,6 @@ } @Override - public void emitDeoptimizeOnOverflow(DeoptimizationAction action, DeoptimizationReason reason) { - // SPARC: Auto-generated method stub - - } - - @Override public void emitDeoptimize(DeoptimizationAction action, DeoptimizationReason reason) { // SPARC: Auto-generated method stub diff -r 0269ef50021f -r ad4f977b49ce 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 Mar 14 12:19:01 2013 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java Thu Mar 14 13:25:28 2013 +0100 @@ -592,23 +592,6 @@ emitBranch(x.condition(), getLIRBlock(x.trueSuccessor()), getLIRBlock(x.falseSuccessor()), null); } - @Override - public void emitGuardCheck(LogicNode comp, DeoptimizationReason deoptReason, DeoptimizationAction action, boolean negated) { - if (comp instanceof LogicConstantNode && ((LogicConstantNode) comp).getValue() != negated) { - // True constant, nothing to emit. - // False constants are handled within emitBranch. - } else { - // Fall back to a normal branch. - LIRFrameState info = state(deoptReason); - LabelRef stubEntry = createDeoptStub(action, deoptReason, info); - if (negated) { - emitBranch(comp, stubEntry, null, info); - } else { - emitBranch(comp, null, stubEntry, info); - } - } - } - public void emitBranch(LogicNode node, LabelRef trueSuccessor, LabelRef falseSuccessor, LIRFrameState info) { if (node instanceof IsNullNode) { emitNullCheckBranch((IsNullNode) node, trueSuccessor, falseSuccessor, info); @@ -776,8 +759,6 @@ return result; } - protected abstract LabelRef createDeoptStub(DeoptimizationAction action, DeoptimizationReason reason, LIRFrameState info); - @Override public Variable emitCall(RuntimeCallTarget callTarget, CallingConvention cc, boolean canTrap, Value... args) { LIRFrameState info = canTrap ? state() : null; diff -r 0269ef50021f -r ad4f977b49ce graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Code.java --- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Code.java Thu Mar 14 12:19:01 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2012, 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.graal.lir.amd64; - -import com.oracle.graal.asm.amd64.*; -import com.oracle.graal.lir.*; -import com.oracle.graal.lir.asm.*; - -/** - * Convenience class to provide AMD64MacroAssembler for the {@link #emitCode} method. - */ -public abstract class AMD64Code implements LIR.Code { - - @Override - public final void emitCode(TargetMethodAssembler tasm) { - emitCode(tasm, (AMD64MacroAssembler) tasm.asm); - } - - public abstract void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm); -} diff -r 0269ef50021f -r ad4f977b49ce graal/com.oracle.graal.lir.ptx/src/com/oracle/graal/lir/ptx/PTXCode.java --- a/graal/com.oracle.graal.lir.ptx/src/com/oracle/graal/lir/ptx/PTXCode.java Thu Mar 14 12:19:01 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2013, 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.graal.lir.ptx; - -import com.oracle.graal.asm.ptx.*; -import com.oracle.graal.lir.*; -import com.oracle.graal.lir.asm.*; - -/** - * Convenience class to provide PTXAssembler for the {@link #emitCode} method. - */ -public abstract class PTXCode implements LIR.Code { - - @Override - public final void emitCode(TargetMethodAssembler tasm) { - emitCode(tasm, (PTXAssembler) tasm.asm); - } - - public abstract void emitCode(TargetMethodAssembler tasm, PTXAssembler masm); -} diff -r 0269ef50021f -r ad4f977b49ce graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIR.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIR.java Thu Mar 14 12:19:01 2013 +0100 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIR.java Thu Mar 14 13:25:28 2013 +0100 @@ -56,12 +56,6 @@ */ private final List codeEmittingOrder; - /** - * Various out-of-line stubs to be emitted near the end of the method after all other LIR code - * has been emitted. - */ - public final List stubs; - private int numVariables; public SpillMoveFactory spillMoveFactory; @@ -78,19 +72,6 @@ private final SpeculationLog speculationLog; /** - * An opaque chunk of machine code. - */ - public interface Code { - - void emitCode(TargetMethodAssembler tasm); - - /** - * A description of this code stub useful for commenting the code in a disassembly. - */ - String description(); - } - - /** * Creates a new LIR instance for the specified compilation. */ public LIR(ControlFlowGraph cfg, BlockMap> blockToNodesMap, List linearScanOrder, List codeEmittingOrder, SpeculationLog speculationLog) { @@ -99,8 +80,6 @@ this.codeEmittingOrder = codeEmittingOrder; this.linearScanOrder = linearScanOrder; this.lirInstructions = new BlockMap<>(cfg); - - stubs = new ArrayList<>(); this.speculationLog = speculationLog; } @@ -167,11 +146,6 @@ for (Block b : codeEmittingOrder()) { emitBlock(tasm, b); } - - // generate code stubs - for (Code c : stubs) { - emitCodeStub(tasm, c); - } } private void emitBlock(TargetMethodAssembler tasm, Block block) { @@ -202,13 +176,6 @@ } } - private static void emitCodeStub(TargetMethodAssembler tasm, Code code) { - if (Debug.isDumpEnabled()) { - tasm.blockComment(String.format("code stub: %s", code.description())); - } - code.emitCode(tasm); - } - public void setHasArgInCallerFrame() { hasArgInCallerFrame = true; } diff -r 0269ef50021f -r ad4f977b49ce graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FixedGuardNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FixedGuardNode.java Thu Mar 14 12:19:01 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FixedGuardNode.java Thu Mar 14 13:25:28 2013 +0100 @@ -29,7 +29,7 @@ import com.oracle.graal.nodes.type.*; @NodeInfo(nameTemplate = "FixedGuard(!={p#negated}) {p#reason/s}") -public final class FixedGuardNode extends FixedWithNextNode implements Simplifiable, Lowerable, LIRLowerable, Node.IterableNodeType, Negatable { +public final class FixedGuardNode extends FixedWithNextNode implements Simplifiable, Lowerable, Node.IterableNodeType, Negatable { @Input private LogicNode condition; private final DeoptimizationReason reason; @@ -79,11 +79,6 @@ } @Override - public void generate(LIRGeneratorTool gen) { - gen.emitGuardCheck(condition, reason, action, negated); - } - - @Override public void simplify(SimplifierTool tool) { if (condition instanceof LogicConstantNode) { LogicConstantNode c = (LogicConstantNode) condition; diff -r 0269ef50021f -r ad4f977b49ce graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardNode.java Thu Mar 14 12:19:01 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardNode.java Thu Mar 14 13:25:28 2013 +0100 @@ -42,7 +42,7 @@ * control flow would have reached the guarded node (without taking exceptions into account). */ @NodeInfo(nameTemplate = "Guard(!={p#negated}) {p#reason/s}") -public final class GuardNode extends FloatingNode implements Canonicalizable, LIRLowerable, Node.IterableNodeType, Negatable { +public final class GuardNode extends FloatingNode implements Canonicalizable, Node.IterableNodeType, Negatable { @Input private LogicNode condition; private final DeoptimizationReason reason; @@ -91,11 +91,6 @@ } @Override - public void generate(LIRGeneratorTool gen) { - gen.emitGuardCheck(condition(), reason(), action(), negated()); - } - - @Override public ValueNode canonical(CanonicalizerTool tool) { if (condition() instanceof LogicConstantNode) { LogicConstantNode c = (LogicConstantNode) condition(); diff -r 0269ef50021f -r ad4f977b49ce 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 Mar 14 12:19:01 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/LIRGeneratorTool.java Thu Mar 14 13:25:28 2013 +0100 @@ -97,8 +97,6 @@ public abstract void emitMembar(int barriers); - public abstract void emitDeoptimizeOnOverflow(DeoptimizationAction action, DeoptimizationReason reason); - public abstract void emitDeoptimize(DeoptimizationAction action, DeoptimizationReason reason); public abstract Value emitCall(RuntimeCallTarget callTarget, CallingConvention cc, boolean canTrap, Value... args); @@ -107,8 +105,6 @@ public abstract void emitConditional(ConditionalNode i); - public abstract void emitGuardCheck(LogicNode comp, DeoptimizationReason deoptReason, DeoptimizationAction deoptAction, boolean negated); - public abstract void emitSwitch(SwitchNode i); public abstract void emitInvoke(Invoke i);