# HG changeset patch # User Doug Simon # Date 1363029027 -3600 # Node ID aadd8f02449a4f791ff673ab03a393aa023db33d # Parent 3ebe0b86736e9739388f621e6ec806e5fbe39629# Parent 74896b25297a2964c9ee5bff8f4126d04e301463 Merge. diff -r 3ebe0b86736e -r aadd8f02449a 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 Mon Mar 11 18:58:42 2013 +0100 +++ b/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java Mon Mar 11 20:10:27 2013 +0100 @@ -279,6 +279,11 @@ } @Override + public void emitOverflowCheckBranch(LabelRef destination, LIRFrameState info, boolean negated) { + append(new BranchOp(negated ? ConditionFlag.NoOverflow : ConditionFlag.Overflow, destination, info)); + } + + @Override public void emitIntegerTestBranch(Value left, Value right, boolean negated, LabelRef label, LIRFrameState info) { emitIntegerTest(left, right); append(new BranchOp(negated ? Condition.NE : Condition.EQ, label, info)); @@ -775,13 +780,6 @@ } @Override - public void emitDeoptimize(DeoptimizationAction action, DeoptimizationReason reason) { - LIRFrameState info = state(); - LabelRef stubEntry = createDeoptStub(action, reason, info); - append(new JumpOp(stubEntry, info)); - } - - @Override public void emitMembar(int barriers) { int necessaryBarriers = target.arch.requiredBarriers(barriers); if (target.isMP && necessaryBarriers != 0) { diff -r 3ebe0b86736e -r aadd8f02449a 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 Mon Mar 11 18:58:42 2013 +0100 +++ b/graal/com.oracle.graal.compiler.ptx/src/com/oracle/graal/compiler/ptx/PTXLIRGenerator.java Mon Mar 11 20:10:27 2013 +0100 @@ -200,6 +200,11 @@ } @Override + public void emitOverflowCheckBranch(LabelRef label, LIRFrameState info, boolean negated) { + throw new InternalError("NYI"); + } + + @Override public void emitIntegerTestBranch(Value left, Value right, boolean negated, LabelRef label, LIRFrameState info) { throw new InternalError("NYI"); } @@ -350,7 +355,7 @@ @Override public void emitDeoptimize(DeoptimizationAction action, DeoptimizationReason reason) { - throw new InternalError("NYI"); + append(new ReturnOp(Value.ILLEGAL)); } @Override diff -r 3ebe0b86736e -r aadd8f02449a 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 Mon Mar 11 18:58:42 2013 +0100 +++ b/graal/com.oracle.graal.compiler.sparc/src/com/oracle/graal/compiler/sparc/SPARCLIRGenerator.java Mon Mar 11 20:10:27 2013 +0100 @@ -76,6 +76,12 @@ } @Override + public void emitOverflowCheckBranch(LabelRef label, LIRFrameState info, boolean negated) { + // SPARC: Auto-generated method stub + + } + + @Override public void emitIntegerTestBranch(Value left, Value right, boolean negated, LabelRef label, LIRFrameState info) { // SPARC: Auto-generated method stub diff -r 3ebe0b86736e -r aadd8f02449a graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Mon Mar 11 18:58:42 2013 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Mon Mar 11 20:10:27 2013 +0100 @@ -193,6 +193,8 @@ plan.runPhases(PhasePosition.LOW_LEVEL, graph); + new GuardLoweringPhase().apply(graph); + // Add safepoints to loops new SafepointInsertionPhase().apply(graph); diff -r 3ebe0b86736e -r aadd8f02449a 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 Mon Mar 11 18:58:42 2013 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java Mon Mar 11 20:10:27 2013 +0100 @@ -641,6 +641,17 @@ } } + public void emitOverflowCheckBranch(LabelRef noOverflowBlock, LabelRef overflowBlock, LIRFrameState info) { + if (overflowBlock != null) { + emitOverflowCheckBranch(overflowBlock, info, false); + if (noOverflowBlock != null) { + emitJump(noOverflowBlock, null); + } + } else { + emitOverflowCheckBranch(noOverflowBlock, info, true); + } + } + public void emitIntegerTestBranch(IntegerTestNode test, LabelRef trueSuccessorBlock, LabelRef falseSuccessorBlock, LIRFrameState info) { if (falseSuccessorBlock != null) { emitIntegerTestBranch(operand(test.x()), operand(test.y()), true, falseSuccessorBlock, info); @@ -687,6 +698,8 @@ public abstract void emitCompareBranch(Value left, Value right, Condition cond, boolean unorderedIsTrue, LabelRef label, LIRFrameState info); + public abstract void emitOverflowCheckBranch(LabelRef label, LIRFrameState info, boolean negated); + public abstract void emitIntegerTestBranch(Value left, Value right, boolean negated, LabelRef label, LIRFrameState info); public abstract Variable emitConditionalMove(Value leftVal, Value right, Condition cond, boolean unorderedIsTrue, Value trueValue, Value falseValue); diff -r 3ebe0b86736e -r aadd8f02449a graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64DeoptimizeOp.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64DeoptimizeOp.java Mon Mar 11 20:10:27 2013 +0100 @@ -0,0 +1,55 @@ +/* + * Copyright (c) 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.hotspot.amd64; + +import com.oracle.graal.api.code.*; +import com.oracle.graal.api.code.RuntimeCallTarget.Descriptor; +import com.oracle.graal.api.meta.*; +import com.oracle.graal.asm.amd64.*; +import com.oracle.graal.lir.*; +import com.oracle.graal.lir.LIRInstruction.Opcode; +import com.oracle.graal.lir.amd64.*; +import com.oracle.graal.lir.asm.*; + +@Opcode("DEOPT") +final class AMD64DeoptimizeOp extends AMD64LIRInstruction { + + public static final Descriptor DEOPTIMIZE = new Descriptor("deoptimize", true, void.class); + + private DeoptimizationAction action; + private DeoptimizationReason reason; + @State private LIRFrameState info; + + AMD64DeoptimizeOp(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.movl(scratch, tasm.runtime.encodeDeoptActionAndReason(action, reason)); + AMD64Call.directCall(tasm, masm, tasm.runtime.lookupRuntimeCall(DEOPTIMIZE), info); + } +} diff -r 3ebe0b86736e -r aadd8f02449a graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java --- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java Mon Mar 11 18:58:42 2013 +0100 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java Mon Mar 11 20:10:27 2013 +0100 @@ -182,6 +182,11 @@ emitMove(exceptionParameter, exception); append(new AMD64HotSpotUnwindOp(exceptionParameter)); } + + @Override + public void emitDeoptimize(DeoptimizationAction action, DeoptimizationReason reason) { + append(new AMD64DeoptimizeOp(action, reason, state())); + } } /** diff -r 3ebe0b86736e -r aadd8f02449a graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotRuntime.java --- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotRuntime.java Mon Mar 11 18:58:42 2013 +0100 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotRuntime.java Mon Mar 11 20:10:27 2013 +0100 @@ -23,8 +23,8 @@ package com.oracle.graal.hotspot.amd64; import static com.oracle.graal.amd64.AMD64.*; -import static com.oracle.graal.compiler.amd64.AMD64DeoptimizationStub.*; import static com.oracle.graal.compiler.amd64.AMD64LIRGenerator.*; +import static com.oracle.graal.hotspot.amd64.AMD64DeoptimizeOp.*; import static com.oracle.graal.hotspot.nodes.IdentityHashCodeStubCall.*; import static com.oracle.graal.hotspot.nodes.MonitorEnterStubCall.*; import static com.oracle.graal.hotspot.nodes.MonitorExitStubCall.*; diff -r 3ebe0b86736e -r aadd8f02449a graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/GuardLoweringPhase.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/GuardLoweringPhase.java Mon Mar 11 20:10:27 2013 +0100 @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2013, 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.phases.common; + +import java.util.*; + +import com.oracle.graal.graph.*; +import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.cfg.*; +import com.oracle.graal.phases.*; +import com.oracle.graal.phases.schedule.*; + +public class GuardLoweringPhase extends Phase { + + @Override + protected void run(StructuredGraph graph) { + SchedulePhase schedule = new SchedulePhase(); + schedule.apply(graph); + + for (Block block : schedule.getCFG().getBlocks()) { + processBlock(block, schedule, graph); + } + } + + private static void processBlock(Block block, SchedulePhase schedule, StructuredGraph graph) { + List nodes = schedule.nodesFor(block); + FixedWithNextNode lastFixed = block.getBeginNode(); + BeginNode lastFastPath = null; + for (Node node : nodes) { + if (lastFastPath != null && node instanceof FixedNode) { + lastFastPath.setNext((FixedNode) node); + lastFastPath = null; + } + if (node instanceof FixedWithNextNode) { + lastFixed = (FixedWithNextNode) node; + } else if (node instanceof GuardNode) { + GuardNode guard = (GuardNode) node; + BeginNode fastPath = graph.add(new BeginNode()); + BeginNode trueSuccessor; + BeginNode falseSuccessor; + DeoptimizeNode deopt = graph.add(new DeoptimizeNode(guard.action(), guard.reason())); + if (guard.negated()) { + trueSuccessor = BeginNode.begin(deopt); + falseSuccessor = fastPath; + } else { + trueSuccessor = fastPath; + falseSuccessor = BeginNode.begin(deopt); + } + IfNode ifNode = graph.add(new IfNode(guard.condition(), trueSuccessor, falseSuccessor, trueSuccessor == fastPath ? 1 : 0)); + guard.replaceAndDelete(fastPath); + lastFixed.setNext(ifNode); + lastFixed = fastPath; + lastFastPath = fastPath; + } + } + } +} diff -r 3ebe0b86736e -r aadd8f02449a graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java Mon Mar 11 18:58:42 2013 +0100 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java Mon Mar 11 20:10:27 2013 +0100 @@ -45,7 +45,7 @@ /** * This closure iterates over all nodes of a scheduled graph (it expects a - * {@link SchedulingStrategy#EARLIEST} schedule) and keeps a list of "actuve" reads. Whenever it + * {@link SchedulingStrategy#EARLIEST} schedule) and keeps a list of "active" reads. Whenever it * encounters a read, it adds it to the active reads. Whenever it encounters a memory * checkpoint, it adds all reads that need to be committed before this checkpoint to the * "phantom" usages and inputs, so that the read is scheduled before the checkpoint afterwards. @@ -135,10 +135,6 @@ private final Map> phantomUsages = new IdentityHashMap<>(); private final Map> phantomInputs = new IdentityHashMap<>(); - public SchedulePhase() { - super("Schedule"); - } - @Override protected void run(StructuredGraph graph) { SchedulingStrategy strategy = GraalOptions.OptScheduleOutOfLoops ? SchedulingStrategy.LATEST_OUT_OF_LOOPS : SchedulingStrategy.LATEST; diff -r 3ebe0b86736e -r aadd8f02449a mx/commands.py --- a/mx/commands.py Mon Mar 11 18:58:42 2013 +0100 +++ b/mx/commands.py Mon Mar 11 20:10:27 2013 +0100 @@ -784,11 +784,22 @@ if mx.eclipseformat(['-e', eclipse_exe]) != 0: t.abort('Formatter modified files - run "mx eclipseformat", check in changes and repush') tasks.append(t.stop()) + + t = Task('Canonicalization Check') + mx.log(time.strftime('%d %b %Y %H:%M:%S - Ensuring mx/projects files are canonicalized...')) + if mx.canonicalizeprojects([]) != 0: + t.abort('Rerun "mx canonicalizeprojects" and check-in the modified mx/projects files.') + tasks.append(t.stop()) t = Task('BuildJava') build(['--no-native', '--jdt-warning-as-error']) tasks.append(t.stop()) + t = Task('Checkstyle') + if mx.checkstyle([]) != 0: + t.abort('Checkstyle warnings were found') + tasks.append(t.stop()) + if exists('jacoco.exec'): os.unlink('jacoco.exec') @@ -796,10 +807,9 @@ _jacoco = 'append' else: _jacoco = 'off' - t = Task('BuildHotSpotGraal: fastdebug,product') - buildvms(['--vms', 'graal', '--builds', 'fastdebug,product']) + buildvms(['--vms', 'graal,server', '--builds', 'fastdebug,product']) tasks.append(t.stop()) _vmbuild = 'fastdebug' @@ -808,9 +818,12 @@ tasks.append(t.stop()) _vmbuild = 'product' - t = Task('UnitTests:product') + originalVm = _vm + _vm = 'server' # hosted mode + t = Task('UnitTests:hosted-product') unittest([]) tasks.append(t.stop()) + _vm = originalVm for vmbuild in ['fastdebug', 'product']: for test in sanitycheck.getDacapos(level=sanitycheck.SanityCheckLevel.Gate, gateBuildLevel=vmbuild): @@ -824,17 +837,6 @@ _jacoco = 'off' - t = Task('Checkstyle') - if mx.checkstyle([]) != 0: - t.abort('Checkstyle warnings were found') - tasks.append(t.stop()) - - t = Task('Canonicalization Check') - mx.log(time.strftime('%d %b %Y %H:%M:%S - Ensuring mx/projects files are canonicalized...')) - if mx.canonicalizeprojects([]) != 0: - t.abort('Rerun "mx canonicalizeprojects" and check-in the modified mx/projects files.') - tasks.append(t.stop()) - t = Task('CleanAndBuildGraalVisualizer') mx.run(['ant', '-f', join(_graal_home, 'visualizer', 'build.xml'), '-q', 'clean', 'build']) tasks.append(t.stop()) diff -r 3ebe0b86736e -r aadd8f02449a mx/sanitycheck.py --- a/mx/sanitycheck.py Mon Mar 11 18:58:42 2013 +0100 +++ b/mx/sanitycheck.py Mon Mar 11 20:10:27 2013 +0100 @@ -270,9 +270,12 @@ if len(valueMaps) == 0: return False - assert len(valueMaps) == 1, 'Test matchers should not return more than one record' - - record = valueMaps[0] + record = {} + for valueMap in valueMaps: + for key, value in valueMap.items(): + if record.has_key(key) and record[key] != value: + mx.abort('Inconsistant values returned by test machers : ' + str(valueMaps)) + record[key] = value jvmErrorFile = record.get('jvmError') if jvmErrorFile: