# HG changeset patch # User Doug Simon # Date 1368715297 -7200 # Node ID 857632c8086a4dfcafde80f0f06173dde9a35bba # Parent 34c892fdfb6d0c4066e8500fbd39192bdce822a9 renamed: RuntimeCallNode -> ForeignCallNode, RuntimeCallStateSplitNode -> ForeignCallStateSplitNode diff -r 34c892fdfb6d -r 857632c8086a graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Thu May 16 16:32:46 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Thu May 16 16:41:37 2013 +0200 @@ -712,7 +712,7 @@ OSRStartNode osrStart = (OSRStartNode) n; StartNode newStart = graph.add(new StartNode()); LocalNode buffer = graph.unique(new LocalNode(0, StampFactory.forKind(wordKind()))); - RuntimeCallNode migrationEnd = graph.add(new RuntimeCallNode(OSR_MIGRATION_END, buffer)); + ForeignCallNode migrationEnd = graph.add(new ForeignCallNode(OSR_MIGRATION_END, buffer)); newStart.setStateAfter(osrStart.stateAfter()); newStart.setNext(migrationEnd); diff -r 34c892fdfb6d -r 857632c8086a 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 May 16 16:32:46 2013 +0200 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java Thu May 16 16:41:37 2013 +0200 @@ -940,7 +940,7 @@ ValueNode exception = ConstantNode.forObject(cachedNullPointerException, runtime, currentGraph); trueSucc.setNext(handleException(exception, bci())); } else { - RuntimeCallStateSplitNode call = currentGraph.add(new RuntimeCallStateSplitNode(runtime, CREATE_NULL_POINTER_EXCEPTION)); + ForeignCallStateSplitNode call = currentGraph.add(new ForeignCallStateSplitNode(runtime, CREATE_NULL_POINTER_EXCEPTION)); call.setStateAfter(frameState.create(bci())); trueSucc.setNext(call); call.setNext(handleException(call, bci())); @@ -966,7 +966,7 @@ ValueNode exception = ConstantNode.forObject(cachedArrayIndexOutOfBoundsException, runtime, currentGraph); falseSucc.setNext(handleException(exception, bci())); } else { - RuntimeCallStateSplitNode call = currentGraph.add(new RuntimeCallStateSplitNode(runtime, CREATE_OUT_OF_BOUNDS_EXCEPTION, index)); + ForeignCallStateSplitNode call = currentGraph.add(new ForeignCallStateSplitNode(runtime, CREATE_OUT_OF_BOUNDS_EXCEPTION, index)); call.setStateAfter(frameState.create(bci())); falseSucc.setNext(call); call.setNext(handleException(call, bci())); diff -r 34c892fdfb6d -r 857632c8086a graal/com.oracle.graal.loop/src/com/oracle/graal/loop/phases/LoopSafepointEliminationPhase.java --- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/phases/LoopSafepointEliminationPhase.java Thu May 16 16:32:46 2013 +0200 +++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/phases/LoopSafepointEliminationPhase.java Thu May 16 16:41:37 2013 +0200 @@ -52,7 +52,7 @@ blocks: while (b != loop.lirLoop().header) { assert b != null; for (FixedNode node : b.getNodes()) { - if (node instanceof Invoke || node instanceof RuntimeCallNode) { + if (node instanceof Invoke || node instanceof ForeignCallNode) { loopEnd.disableSafepoint(); break blocks; } diff -r 34c892fdfb6d -r 857632c8086a graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ForeignCallNode.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ForeignCallNode.java Thu May 16 16:41:37 2013 +0200 @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2011, 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.nodes.extended; + +import com.oracle.graal.api.code.*; +import com.oracle.graal.api.meta.*; +import com.oracle.graal.graph.*; +import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.spi.*; +import com.oracle.graal.nodes.type.*; + +/** + * Node for a {@linkplain ForeignCallDescriptor foreign} call. + */ +@NodeInfo(nameTemplate = "ForeignCall#{p#descriptor/s}") +public class ForeignCallNode extends DeoptimizingFixedWithNextNode implements LIRLowerable, DeoptimizingNode { + + @Input private final NodeInputList arguments; + + private final ForeignCallDescriptor descriptor; + + public ForeignCallNode(ForeignCallDescriptor descriptor, ValueNode... arguments) { + super(StampFactory.forKind(Kind.fromJavaClass(descriptor.getResultType()))); + this.arguments = new NodeInputList<>(this, arguments); + this.descriptor = descriptor; + } + + public ForeignCallDescriptor getDescriptor() { + return descriptor; + } + + public NodeInputList arguments() { + return arguments; + } + + @Override + public void generate(LIRGeneratorTool gen) { + RuntimeCallTarget stub = gen.getRuntime().lookupRuntimeCall(descriptor); + Value[] args = new Value[arguments.size()]; + for (int i = 0; i < args.length; i++) { + args[i] = gen.operand(arguments.get(i)); + } + Value result = gen.emitCall(stub, stub.getCallingConvention(), this, args); + if (result != null) { + gen.setResult(this, result); + } + } + + @Override + public String toString(Verbosity verbosity) { + if (verbosity == Verbosity.Name) { + return super.toString(verbosity) + "#" + descriptor; + } + return super.toString(verbosity); + } + + @Override + public boolean canDeoptimize() { + return true; + } + + @Override + public DeoptimizationReason getDeoptimizationReason() { + return null; + } +} diff -r 34c892fdfb6d -r 857632c8086a graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ForeignCallStateSplitNode.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ForeignCallStateSplitNode.java Thu May 16 16:41:37 2013 +0200 @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2011, 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.nodes.extended; + +import com.oracle.graal.api.meta.*; +import com.oracle.graal.graph.*; +import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.spi.*; + +/** + * A foreign call that is also a state split. + */ +@NodeInfo(nameTemplate = "ForeignCallStateSplit#{p#descriptor/s}") +public class ForeignCallStateSplitNode extends ForeignCallNode implements LIRLowerable, StateSplit, DeoptimizingNode { + + @Input(notDataflow = true) private FrameState stateAfter; + private MetaAccessProvider runtime; + + public ForeignCallStateSplitNode(MetaAccessProvider runtime, ForeignCallDescriptor descriptor, ValueNode... arguments) { + super(descriptor, arguments); + this.runtime = runtime; + } + + public FrameState stateAfter() { + return stateAfter; + } + + public void setStateAfter(FrameState x) { + assert x == null || x.isAlive() : "frame state must be in a graph"; + updateUsages(stateAfter, x); + stateAfter = x; + } + + public boolean hasSideEffect() { + return runtime.hasSideEffect(getDescriptor()); + } + + @Override + public FrameState getDeoptimizationState() { + if (super.getDeoptimizationState() != null) { + return super.getDeoptimizationState(); + } else if (stateAfter() != null) { + FrameState stateDuring = stateAfter(); + if ((stateDuring.stackSize() > 0 && stateDuring.stackAt(stateDuring.stackSize() - 1) == this) || (stateDuring.stackSize() > 1 && stateDuring.stackAt(stateDuring.stackSize() - 2) == this)) { + stateDuring = stateDuring.duplicateModified(stateDuring.bci, stateDuring.rethrowException(), this.kind()); + } + setDeoptimizationState(stateDuring); + return stateDuring; + } + return null; + } + + @Override + public void setDeoptimizationState(FrameState f) { + if (super.getDeoptimizationState() != null) { + throw new IllegalStateException(); + } + super.setDeoptimizationState(f); + } +} diff -r 34c892fdfb6d -r 857632c8086a graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/RuntimeCallNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/RuntimeCallNode.java Thu May 16 16:32:46 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2011, 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.nodes.extended; - -import com.oracle.graal.api.code.*; -import com.oracle.graal.api.meta.*; -import com.oracle.graal.graph.*; -import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.spi.*; -import com.oracle.graal.nodes.type.*; - -@NodeInfo(nameTemplate = "RuntimeCall#{p#descriptor/s}") -public class RuntimeCallNode extends DeoptimizingFixedWithNextNode implements LIRLowerable, DeoptimizingNode { - - @Input private final NodeInputList arguments; - - private final ForeignCallDescriptor descriptor; - - public RuntimeCallNode(ForeignCallDescriptor descriptor, ValueNode... arguments) { - super(StampFactory.forKind(Kind.fromJavaClass(descriptor.getResultType()))); - this.arguments = new NodeInputList<>(this, arguments); - this.descriptor = descriptor; - } - - public ForeignCallDescriptor getDescriptor() { - return descriptor; - } - - public NodeInputList arguments() { - return arguments; - } - - @Override - public void generate(LIRGeneratorTool gen) { - RuntimeCallTarget stub = gen.getRuntime().lookupRuntimeCall(descriptor); - Value[] args = new Value[arguments.size()]; - for (int i = 0; i < args.length; i++) { - args[i] = gen.operand(arguments.get(i)); - } - Value result = gen.emitCall(stub, stub.getCallingConvention(), this, args); - if (result != null) { - gen.setResult(this, result); - } - } - - @Override - public String toString(Verbosity verbosity) { - if (verbosity == Verbosity.Name) { - return super.toString(verbosity) + "#" + descriptor; - } - return super.toString(verbosity); - } - - @Override - public boolean canDeoptimize() { - return true; - } - - @Override - public DeoptimizationReason getDeoptimizationReason() { - return null; - } -} diff -r 34c892fdfb6d -r 857632c8086a graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/RuntimeCallStateSplitNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/RuntimeCallStateSplitNode.java Thu May 16 16:32:46 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2011, 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.nodes.extended; - -import com.oracle.graal.api.meta.*; -import com.oracle.graal.graph.*; -import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.spi.*; - -/** - * A foreign call that is also a state split. - */ -@NodeInfo(nameTemplate = "RuntimeCallStateSplit#{p#descriptor/s}") -public class RuntimeCallStateSplitNode extends RuntimeCallNode implements LIRLowerable, StateSplit, DeoptimizingNode { - - @Input(notDataflow = true) private FrameState stateAfter; - private MetaAccessProvider runtime; - - public RuntimeCallStateSplitNode(MetaAccessProvider runtime, ForeignCallDescriptor descriptor, ValueNode... arguments) { - super(descriptor, arguments); - this.runtime = runtime; - } - - public FrameState stateAfter() { - return stateAfter; - } - - public void setStateAfter(FrameState x) { - assert x == null || x.isAlive() : "frame state must be in a graph"; - updateUsages(stateAfter, x); - stateAfter = x; - } - - public boolean hasSideEffect() { - return runtime.hasSideEffect(getDescriptor()); - } - - @Override - public FrameState getDeoptimizationState() { - if (super.getDeoptimizationState() != null) { - return super.getDeoptimizationState(); - } else if (stateAfter() != null) { - FrameState stateDuring = stateAfter(); - if ((stateDuring.stackSize() > 0 && stateDuring.stackAt(stateDuring.stackSize() - 1) == this) || (stateDuring.stackSize() > 1 && stateDuring.stackAt(stateDuring.stackSize() - 2) == this)) { - stateDuring = stateDuring.duplicateModified(stateDuring.bci, stateDuring.rethrowException(), this.kind()); - } - setDeoptimizationState(stateDuring); - return stateDuring; - } - return null; - } - - @Override - public void setDeoptimizationState(FrameState f) { - if (super.getDeoptimizationState() != null) { - throw new IllegalStateException(); - } - super.setDeoptimizationState(f); - } -} diff -r 34c892fdfb6d -r 857632c8086a graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/Log.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/Log.java Thu May 16 16:32:46 2013 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/Log.java Thu May 16 16:41:37 2013 +0200 @@ -45,13 +45,13 @@ private static final int LOG_OBJECT_STRING = 0x02; private static final int LOG_OBJECT_ADDRESS = 0x04; - @NodeIntrinsic(RuntimeCallNode.class) + @NodeIntrinsic(ForeignCallNode.class) private static native void log(@ConstantNodeParameter ForeignCallDescriptor logObject, Object object, int flags); - @NodeIntrinsic(RuntimeCallNode.class) + @NodeIntrinsic(ForeignCallNode.class) private static native void log(@ConstantNodeParameter ForeignCallDescriptor logPrimitive, int typeChar, long value, boolean newline); - @NodeIntrinsic(RuntimeCallNode.class) + @NodeIntrinsic(ForeignCallNode.class) private static native void printf(@ConstantNodeParameter ForeignCallDescriptor logPrintf, String format, long v1, long v2, long v3); public static void print(boolean value) { diff -r 34c892fdfb6d -r 857632c8086a graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/MathSubstitutionsX86.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/MathSubstitutionsX86.java Thu May 16 16:32:46 2013 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/MathSubstitutionsX86.java Thu May 16 16:41:37 2013 +0200 @@ -95,7 +95,7 @@ public static final ForeignCallDescriptor ARITHMETIC_COS = new ForeignCallDescriptor("arithmeticCos", double.class, double.class); public static final ForeignCallDescriptor ARITHMETIC_TAN = new ForeignCallDescriptor("arithmeticTan", double.class, double.class); - @NodeIntrinsic(value = RuntimeCallNode.class, setStampFromReturnType = true) + @NodeIntrinsic(value = ForeignCallNode.class, setStampFromReturnType = true) public static double callDouble(@ConstantNodeParameter ForeignCallDescriptor descriptor, double value) { if (descriptor == ARITHMETIC_SIN) { return Math.sin(value);