# HG changeset patch # User Christos Kotselidis # Date 1364225486 -3600 # Node ID 6ed17512f672b60c3ec8741d4a280472de7e5aa8 # Parent 32e57c4e0e9d45410b30b1c50e7812d953798422# Parent 149dee7367e0d07c30b36044ff0a958c0fc0d626 -Merge diff -r 32e57c4e0e9d -r 6ed17512f672 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 Mon Mar 25 16:20:07 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java Mon Mar 25 16:31:26 2013 +0100 @@ -152,7 +152,9 @@ // to be valid for the entire run of the VM. Assumptions assumptions = new Assumptions(false); ReplacementsInstaller installer = new HotSpotReplacementsInstaller(runtime, assumptions, runtime.getGraalRuntime().getTarget()); - GraalMethodSubstitutions.installIntrinsics(installer); + for (ReplacementsProvider provider : ServiceLoader.loadInstalled(ReplacementsProvider.class)) { + provider.installReplacements(installer); + } runtime.installReplacements(graalRuntime.getBackend(), installer, assumptions); } }); diff -r 32e57c4e0e9d -r 6ed17512f672 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/OnStackReplacementPhase.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/OnStackReplacementPhase.java Mon Mar 25 16:20:07 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/OnStackReplacementPhase.java Mon Mar 25 16:31:26 2013 +0100 @@ -79,16 +79,17 @@ NodeIterable osrNodes = graph.getNodes(EntryMarkerNode.class); osr = osrNodes.first(); if (osr == null) { - throw new BailoutException("no OnStackReplacementNode generated"); + throw new BailoutException("No OnStackReplacementNode generated"); } if (osrNodes.count() > 1) { - throw new GraalInternalError("multiple OnStackReplacementNodes generated"); + // this can happen with JSR inlining + throw new BailoutException("Multiple OnStackReplacementNodes generated"); } if (osr.stateAfter().locksSize() != 0) { - throw new BailoutException("osr with locks not supported"); + throw new BailoutException("OSR with locks not supported"); } if (osr.stateAfter().stackSize() != 0) { - throw new BailoutException("osr with stack entries not supported: " + osr.stateAfter().toString(Verbosity.Debugger)); + throw new BailoutException("OSR with stack entries not supported: " + osr.stateAfter().toString(Verbosity.Debugger)); } LoopEx osrLoop = null; LoopsData loops = new LoopsData(graph); diff -r 32e57c4e0e9d -r 6ed17512f672 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 Mon Mar 25 16:20:07 2013 +0100 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java Mon Mar 25 16:31:26 2013 +0100 @@ -1128,7 +1128,7 @@ frameState.pushReturn(resultType, result); return invoke; } else { - ExceptionObjectNode exceptionEdge = (ExceptionObjectNode) handleException(null, bci()); + DispatchBeginNode exceptionEdge = handleException(null, bci()); InvokeWithExceptionNode invoke = currentGraph.add(new InvokeWithExceptionNode(callTarget, exceptionEdge, bci())); ValueNode result = append(invoke); frameState.pushReturn(resultType, result); diff -r 32e57c4e0e9d -r 6ed17512f672 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeWithExceptionNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeWithExceptionNode.java Mon Mar 25 16:20:07 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeWithExceptionNode.java Mon Mar 25 16:31:26 2013 +0100 @@ -35,7 +35,7 @@ public class InvokeWithExceptionNode extends ControlSplitNode implements Node.IterableNodeType, Invoke, MemoryCheckpoint, LIRLowerable { @Successor private BeginNode next; - @Successor private ExceptionObjectNode exceptionEdge; + @Successor private DispatchBeginNode exceptionEdge; @Input private final CallTargetNode callTarget; @Input private FrameState stateAfter; private final int bci; @@ -43,7 +43,7 @@ private boolean useForInlining; private double inliningRelevance; - public InvokeWithExceptionNode(CallTargetNode callTarget, ExceptionObjectNode exceptionEdge, int bci) { + public InvokeWithExceptionNode(CallTargetNode callTarget, DispatchBeginNode exceptionEdge, int bci) { super(callTarget.returnStamp()); this.exceptionEdge = exceptionEdge; this.bci = bci; @@ -53,11 +53,11 @@ this.inliningRelevance = Double.NaN; } - public ExceptionObjectNode exceptionEdge() { + public DispatchBeginNode exceptionEdge() { return exceptionEdge; } - public void setExceptionEdge(ExceptionObjectNode x) { + public void setExceptionEdge(DispatchBeginNode x) { updatePredecessor(exceptionEdge, x); exceptionEdge = x; } diff -r 32e57c4e0e9d -r 6ed17512f672 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningUtil.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningUtil.java Mon Mar 25 16:20:07 2013 +0100 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningUtil.java Mon Mar 25 16:31:26 2013 +0100 @@ -448,7 +448,7 @@ PhiNode exceptionObjectPhi = null; if (invoke instanceof InvokeWithExceptionNode) { InvokeWithExceptionNode invokeWithException = (InvokeWithExceptionNode) invoke; - ExceptionObjectNode exceptionEdge = invokeWithException.exceptionEdge(); + ExceptionObjectNode exceptionEdge = (ExceptionObjectNode) invokeWithException.exceptionEdge(); exceptionMerge = graph.add(new MergeNode()); exceptionMerge.setProbability(exceptionEdge.probability()); @@ -484,7 +484,7 @@ // replace the invoke exception edge if (invoke instanceof InvokeWithExceptionNode) { InvokeWithExceptionNode invokeWithExceptionNode = (InvokeWithExceptionNode) invoke; - ExceptionObjectNode exceptionEdge = invokeWithExceptionNode.exceptionEdge(); + ExceptionObjectNode exceptionEdge = (ExceptionObjectNode) invokeWithExceptionNode.exceptionEdge(); exceptionEdge.replaceAtUsages(exceptionObjectPhi); exceptionEdge.setNext(null); GraphUtil.killCFG(invokeWithExceptionNode.exceptionEdge()); @@ -656,7 +656,7 @@ assert exceptionMerge != null && exceptionObjectPhi != null; InvokeWithExceptionNode invokeWithException = (InvokeWithExceptionNode) invoke; - ExceptionObjectNode exceptionEdge = invokeWithException.exceptionEdge(); + ExceptionObjectNode exceptionEdge = (ExceptionObjectNode) invokeWithException.exceptionEdge(); FrameState stateAfterException = exceptionEdge.stateAfter(); ExceptionObjectNode newExceptionEdge = (ExceptionObjectNode) exceptionEdge.copyWithInputs(); @@ -1063,7 +1063,7 @@ if (unwindNode != null) { assert unwindNode.predecessor() != null; assert invokeWithException.exceptionEdge().successors().count() == 1; - ExceptionObjectNode obj = invokeWithException.exceptionEdge(); + ExceptionObjectNode obj = (ExceptionObjectNode) invokeWithException.exceptionEdge(); stateAtExceptionEdge = obj.stateAfter(); UnwindNode unwindDuplicate = (UnwindNode) duplicates.get(unwindNode); obj.replaceAtUsages(unwindDuplicate.exception()); diff -r 32e57c4e0e9d -r 6ed17512f672 graal/com.oracle.graal.replacements/src/META-INF/services/com.oracle.graal.replacements.ReplacementsProvider --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.replacements/src/META-INF/services/com.oracle.graal.replacements.ReplacementsProvider Mon Mar 25 16:31:26 2013 +0100 @@ -0,0 +1,1 @@ +com.oracle.graal.replacements.GraalMethodSubstitutions diff -r 32e57c4e0e9d -r 6ed17512f672 graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/GraalMethodSubstitutions.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/GraalMethodSubstitutions.java Mon Mar 25 16:20:07 2013 +0100 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/GraalMethodSubstitutions.java Mon Mar 25 16:31:26 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 @@ -27,9 +27,9 @@ /** * Method substitutions that are VM-independent. */ -public class GraalMethodSubstitutions { +public class GraalMethodSubstitutions implements ReplacementsProvider { - public static void installIntrinsics(ReplacementsInstaller installer) { + public void installReplacements(ReplacementsInstaller installer) { if (GraalOptions.Intrinsify) { installer.installSubstitutions(MathSubstitutionsX86.class); installer.installSubstitutions(DoubleSubstitutions.class); diff -r 32e57c4e0e9d -r 6ed17512f672 graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsProvider.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsProvider.java Mon Mar 25 16:31:26 2013 +0100 @@ -0,0 +1,31 @@ +/* + * 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.replacements; + +/** + * Interface for service providers that install replacements into the compiler. + */ +public interface ReplacementsProvider { + + void installReplacements(ReplacementsInstaller installer); +} diff -r 32e57c4e0e9d -r 6ed17512f672 mx/commands.py --- a/mx/commands.py Mon Mar 25 16:20:07 2013 +0100 +++ b/mx/commands.py Mon Mar 25 16:31:26 2013 +0100 @@ -1025,6 +1025,8 @@ vm = _vm if len(args) is 0: args = ['all'] + + vmArgs = [arg for arg in args if arg.startswith('-')] def benchmarks_in_group(group): prefix = group + ':' @@ -1069,7 +1071,7 @@ benchmarks += [sanitycheck.getSPECjbb2013()] for test in benchmarks: - for (groupName, res) in test.bench(vm).items(): + for (groupName, res) in test.bench(vm, opts=vmArgs).items(): group = results.setdefault(groupName, {}) group.update(res) mx.log(json.dumps(results)) diff -r 32e57c4e0e9d -r 6ed17512f672 mxtool/mx --- a/mxtool/mx Mon Mar 25 16:20:07 2013 +0100 +++ b/mxtool/mx Mon Mar 25 16:31:26 2013 +0100 @@ -37,14 +37,27 @@ exit 1 fi -python </dev/null 2>&1 +if [ $? -eq 0 ]; then + python_exe=python2.7 +else + type python2 > /dev/null 2>&1 + if [ $? -eq 0]; then + python_exe=python2 + else + python_exe=python + fi +fi + +$python_exe <', d.path