Mercurial > hg > graal-jvmci-8
changeset 12448:930eb01324ec
Merge.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Wed, 16 Oct 2013 03:53:40 +0200 |
parents | 97fe8342a90f (diff) 39308acea2f7 (current diff) |
children | c0fa3796819b |
files | |
diffstat | 15 files changed, 38 insertions(+), 370 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java Tue Oct 15 18:04:13 2013 -0700 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java Wed Oct 16 03:53:40 2013 +0200 @@ -194,7 +194,7 @@ ServiceLoader<ReplacementsProvider> serviceLoader = ServiceLoader.loadInstalled(ReplacementsProvider.class); TargetDescription target = providers.getCodeCache().getTarget(); for (ReplacementsProvider provider : serviceLoader) { - provider.registerReplacements(metaAccess, replacements, target); + provider.registerReplacements(metaAccess, providers.getLowerer(), replacements, target); } providers.getForeignCalls().initialize(providers); HotSpotLoweringProvider lowerer = (HotSpotLoweringProvider) providers.getLowerer();
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CallSiteSubstitutions.java Tue Oct 15 18:04:13 2013 -0700 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CallSiteSubstitutions.java Wed Oct 16 03:53:40 2013 +0200 @@ -34,7 +34,7 @@ public class CallSiteSubstitutions implements ReplacementsProvider { @Override - public void registerReplacements(MetaAccessProvider metaAccess, Replacements replacements, TargetDescription target) { + public void registerReplacements(MetaAccessProvider metaAccess, LoweringProvider loweringProvider, Replacements replacements, TargetDescription target) { replacements.registerSubstitutions(ConstantCallSiteSubstitutions.class); replacements.registerSubstitutions(MutableCallSiteSubstitutions.class); replacements.registerSubstitutions(VolatileCallSiteSubstitutions.class);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ConstantNode.java Tue Oct 15 18:04:13 2013 -0700 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ConstantNode.java Wed Oct 16 03:53:40 2013 +0200 @@ -75,7 +75,9 @@ } public static ConstantNode forConstant(Constant constant, MetaAccessProvider metaAccess, Graph graph) { - if (constant.getKind() == Kind.Object) { + if (constant.getKind().getStackKind() == Kind.Int && constant.getKind() != Kind.Int) { + return forInt(constant.asInt(), graph); + } else if (constant.getKind() == Kind.Object) { return graph.unique(new ConstantNode(constant, metaAccess)); } else { return graph.unique(new ConstantNode(constant)); @@ -142,7 +144,7 @@ * @return a node representing the boolean */ public static ConstantNode forBoolean(boolean i, Graph graph) { - return graph.unique(new ConstantNode(Constant.forBoolean(i))); + return graph.unique(new ConstantNode(Constant.forInt(i ? 1 : 0))); } /** @@ -153,7 +155,7 @@ * @return a node representing the byte */ public static ConstantNode forByte(byte i, Graph graph) { - return graph.unique(new ConstantNode(Constant.forByte(i))); + return graph.unique(new ConstantNode(Constant.forInt(i))); } /** @@ -164,7 +166,7 @@ * @return a node representing the char */ public static ConstantNode forChar(char i, Graph graph) { - return graph.unique(new ConstantNode(Constant.forChar(i))); + return graph.unique(new ConstantNode(Constant.forInt(i))); } /** @@ -175,7 +177,7 @@ * @return a node representing the short */ public static ConstantNode forShort(short i, Graph graph) { - return graph.unique(new ConstantNode(Constant.forShort(i))); + return graph.unique(new ConstantNode(Constant.forInt(i))); } /** @@ -217,7 +219,6 @@ public static ConstantNode defaultForKind(Kind kind, Graph graph) { switch (kind) { case Boolean: - return ConstantNode.forBoolean(false, graph); case Byte: case Char: case Short:
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeLoadNode.java Tue Oct 15 18:04:13 2013 -0700 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeLoadNode.java Wed Oct 16 03:53:40 2013 +0200 @@ -65,7 +65,7 @@ int entryIndex = state.getVirtualObject().entryIndexForOffset(offset); if (entryIndex != -1) { ValueNode entry = state.getEntry(entryIndex); - if (entry.kind() == accessKind() || state.getVirtualObject().entryKind(entryIndex) == accessKind()) { + if (entry.kind() == kind() || state.getVirtualObject().entryKind(entryIndex) == accessKind()) { tool.replaceWith(entry); } }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeStoreNode.java Tue Oct 15 18:04:13 2013 -0700 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeStoreNode.java Wed Oct 16 03:53:40 2013 +0200 @@ -82,7 +82,7 @@ int entryIndex = state.getVirtualObject().entryIndexForOffset(offset); if (entryIndex != -1) { ValueNode entry = state.getEntry(entryIndex); - if (entry.kind() == this.accessKind() || state.getVirtualObject().entryKind(entryIndex) == this.accessKind()) { + if (entry.kind() == value.kind() || state.getVirtualObject().entryKind(entryIndex) == accessKind()) { tool.setVirtualEntry(state, entryIndex, value()); tool.delete(); }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/ReplacementsProvider.java Tue Oct 15 18:04:13 2013 -0700 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/ReplacementsProvider.java Wed Oct 16 03:53:40 2013 +0200 @@ -30,5 +30,5 @@ */ public interface ReplacementsProvider { - void registerReplacements(MetaAccessProvider metaAccess, Replacements replacements, TargetDescription target); + void registerReplacements(MetaAccessProvider metaAccess, LoweringProvider lowerer, Replacements replacements, TargetDescription target); }
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/GraalMethodSubstitutions.java Tue Oct 15 18:04:13 2013 -0700 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/GraalMethodSubstitutions.java Wed Oct 16 03:53:40 2013 +0200 @@ -35,7 +35,7 @@ @ServiceProvider(ReplacementsProvider.class) public class GraalMethodSubstitutions implements ReplacementsProvider { - public void registerReplacements(MetaAccessProvider metaAccess, Replacements replacements, TargetDescription target) { + public void registerReplacements(MetaAccessProvider metaAccess, LoweringProvider loweringProvider, Replacements replacements, TargetDescription target) { for (Class<?> clazz : BoxingSubstitutions.getClasses()) { replacements.registerSubstitutions(clazz); }
--- a/graal/com.oracle.graal.truffle.printer/src/com/oracle/graal/truffle/printer/InlinePrinterProcessor.java Tue Oct 15 18:04:13 2013 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,117 +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.truffle.printer; - -import java.util.*; - -import com.oracle.graal.debug.*; -import com.oracle.graal.truffle.printer.method.*; - -public final class InlinePrinterProcessor { - - private static final String IDENT = " "; - private static InlinePrinterProcessor instance; - - private final List<TruffleMethodNode> inlineTree = new ArrayList<>(); - - public static void initialize() { - if (instance == null) { - instance = new InlinePrinterProcessor(); - } else { - throw new IllegalStateException(); - } - } - - public static void addInlining(MethodHolder methodHolder) { - instance.addExecuteInline(methodHolder); - } - - public static void printTree() { - instance.print(); - } - - public static void reset() { - instance = null; - } - - private void addExecuteInline(MethodHolder executeMethod) { - if (inlineTree.isEmpty()) { - inlineTree.add(new TruffleMethodNode(null, executeMethod)); - } else { - TruffleMethodNode newNode = null; - for (TruffleMethodNode node : inlineTree) { - newNode = node.addTruffleExecuteMethodNode(executeMethod); - if (newNode != null) { - break; - } - } - if (newNode == null) { - throw new AssertionError("Not able to add " + executeMethod.getMethod().toString() + " to the inlineing tree"); - } - inlineTree.add(newNode); - } - } - - private TruffleMethodNode getInlineTree() { - TruffleMethodNode root = inlineTree.get(0); - while (root.getParent() != null) { - root = root.getParent(); - } - - // asserting: - for (TruffleMethodNode node : inlineTree) { - TruffleMethodNode nodeRoot = node; - while (nodeRoot.getParent() != null) { - nodeRoot = nodeRoot.getParent(); - } - if (root != nodeRoot) { - throw new AssertionError("Different roots found"); - } - } - - return root; - } - - private void print() { - String curIndent = ""; - TruffleMethodNode root = getInlineTree(); - String name = root.getJavaMethod().getDeclaringClass().getName(); - TTY.print(name.substring(name.lastIndexOf('/') + 1, name.lastIndexOf(';')) + "::" + root.getJavaMethod().getName()); - TTY.println(); - recursivePrint(curIndent, root); - } - - private void recursivePrint(String curIdent, TruffleMethodNode node) { - Map<Integer, List<TruffleMethodNode>> inlinings = node.getInlinings(); - for (int l : inlinings.keySet()) { - for (TruffleMethodNode n : inlinings.get(l)) { - TTY.print(curIdent); - TTY.print("L" + l + " "); - String name = n.getJavaMethod().getDeclaringClass().getName(); - TTY.print(name.substring(name.lastIndexOf('/') + 1, name.lastIndexOf(';')) + "::" + n.getJavaMethod().getName()); - TTY.println(); - recursivePrint(curIdent + IDENT, n); - } - } - } -}
--- a/graal/com.oracle.graal.truffle.printer/src/com/oracle/graal/truffle/printer/method/CallStackElement.java Tue Oct 15 18:04:13 2013 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +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.truffle.printer.method; - -import com.oracle.graal.api.meta.*; - -public class CallStackElement { - - private final int lineOfInvoke; - private final ResolvedJavaMethod callerMethod; - - public CallStackElement(ResolvedJavaMethod callerMethod, int lineOfInvoke) { - this.lineOfInvoke = lineOfInvoke; - this.callerMethod = callerMethod; - } - - public int getLineOfInvoke() { - return lineOfInvoke; - } - - @Override - public boolean equals(Object o) { - if (o instanceof CallStackElement) { - CallStackElement i = (CallStackElement) o; - if (i.getCallerMethod() == this.getCallerMethod()/* - * && i.lineOfInvoke == - * this.lineOfInvoke - */) { - return true; - } else { - return false; - } - } else { - return false; - } - } - - @Override - public int hashCode() { - return super.hashCode(); - } - - public ResolvedJavaMethod getCallerMethod() { - return callerMethod; - } -}
--- a/graal/com.oracle.graal.truffle.printer/src/com/oracle/graal/truffle/printer/method/MethodHolder.java Tue Oct 15 18:04:13 2013 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +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.truffle.printer.method; - -import java.util.*; - -import com.oracle.graal.api.meta.*; -import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.java.*; - -public final class MethodHolder { - - private final List<CallStackElement> callStack; - private final ResolvedJavaMethod method; - - public static MethodHolder getNewTruffleExecuteMethod(MethodCallTargetNode targetNode) { - return new MethodHolder(getCallStack(targetNode), targetNode.targetMethod()); - } - - private MethodHolder(List<CallStackElement> callStack, ResolvedJavaMethod callee) { - this.callStack = callStack; - this.method = callee; - } - - public List<CallStackElement> getCallStack() { - return callStack; - } - - public ResolvedJavaMethod getMethod() { - return method; - } - - private static List<CallStackElement> getCallStack(MethodCallTargetNode targetNode) { - List<CallStackElement> callStack = new ArrayList<>(); - FrameState state = targetNode.invoke().stateAfter(); - while (state != null) { - ResolvedJavaMethod method = state.method(); - LineNumberTable table = method.getLineNumberTable(); - int lineNr = table.getLineNumber(state.bci - 1); - callStack.add(new CallStackElement(method, lineNr)); - state = state.outerFrameState(); - } - return callStack; - } -}
--- a/graal/com.oracle.graal.truffle.printer/src/com/oracle/graal/truffle/printer/method/TruffleMethodNode.java Tue Oct 15 18:04:13 2013 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,102 +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.truffle.printer.method; - -import java.util.*; - -import com.oracle.graal.api.meta.*; - -public final class TruffleMethodNode { - - private final TruffleMethodNode parent; - private final MethodHolder truffleExecuteMethod; - private final Map<Integer, List<TruffleMethodNode>> inlinings; - - public TruffleMethodNode(TruffleMethodNode parent, MethodHolder truffleExecuteMethod) { - this.parent = parent; - this.truffleExecuteMethod = truffleExecuteMethod; - this.inlinings = new HashMap<>(); - } - - public TruffleMethodNode getParent() { - return parent; - } - - public ResolvedJavaMethod getJavaMethod() { - return truffleExecuteMethod.getMethod(); - } - - public Map<Integer, List<TruffleMethodNode>> getInlinings() { - return inlinings; - } - - public void putInlineList(int lineOfInvoke, List<TruffleMethodNode> list) { - inlinings.put(lineOfInvoke, list); - } - - public List<TruffleMethodNode> getInliningsAtLine(int line) { - return inlinings.get(line); - } - - public MethodHolder getTruffleExecuteMethod() { - return truffleExecuteMethod; - } - - public TruffleMethodNode addTruffleExecuteMethodNode(MethodHolder newMethod) { - int lineOfInvoke = newMethod.getCallStack().get(0).getLineOfInvoke(); - - if (!callStackMatch(newMethod.getCallStack())) { - return null; - } else { - TruffleMethodNode node = new TruffleMethodNode(this, newMethod); - if (getInliningsAtLine(lineOfInvoke) == null) { - List<TruffleMethodNode> list = new ArrayList<>(); - list.add(node); - putInlineList(lineOfInvoke, list); - } else { - getInliningsAtLine(lineOfInvoke).add(node); - } - return node; - } - } - - private boolean callStackMatch(List<CallStackElement> callStack) { - List<CallStackElement> curCallStack = truffleExecuteMethod.getCallStack(); - if (curCallStack.size() == callStack.size() - 1) { - if (curCallStack.size() >= 1) { - if (curCallStack.get(0).getCallerMethod() != callStack.get(1).getCallerMethod()) { - return false; - } - } - for (int i = 1; i < curCallStack.size(); i++) { - if (!curCallStack.get(i).equals(callStack.get(i + 1))) { - return false; - } - } - } else { - return false; - } - return true; - } - -}
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerOptions.java Tue Oct 15 18:04:13 2013 -0700 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerOptions.java Wed Oct 16 03:53:40 2013 +0200 @@ -56,7 +56,7 @@ @Option(help = "") public static final OptionValue<Boolean> TruffleFunctionInlining = new OptionValue<>(true); @Option(help = "") - public static final OptionValue<Integer> TruffleGraphMaxNodes = new OptionValue<>(20000); + public static final OptionValue<Integer> TruffleGraphMaxNodes = new OptionValue<>(25000); @Option(help = "") public static final OptionValue<Integer> TruffleInliningMaxRecursiveDepth = new OptionValue<>(2); @Option(help = "")
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/NewFrameNode.java Tue Oct 15 18:04:13 2013 -0700 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/NewFrameNode.java Wed Oct 16 03:53:40 2013 +0200 @@ -186,8 +186,14 @@ } private ValueNode initialValue(FrameSlotKind kind) { - Kind graalKind = Kind.Long; + Kind graalKind = null; switch (kind) { + case Boolean: + graalKind = Kind.Boolean; + break; + case Byte: + graalKind = Kind.Byte; + break; case Int: graalKind = Kind.Int; break; @@ -197,9 +203,17 @@ case Float: graalKind = Kind.Float; break; - case Boolean: - graalKind = Kind.Boolean; + case Long: + graalKind = Kind.Long; + break; + case Object: + graalKind = Kind.Object; break; + case Illegal: + graalKind = Kind.Long; + break; + default: + throw new IllegalStateException("Unexpected frame slot kind: " + kind); } return ConstantNode.defaultForKind(graalKind, graph());
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/typesystem/CustomizedUnsafeLoadMacroNode.java Tue Oct 15 18:04:13 2013 -0700 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/typesystem/CustomizedUnsafeLoadMacroNode.java Wed Oct 16 03:53:40 2013 +0200 @@ -61,9 +61,11 @@ } else { locationIdentity = ObjectLocationIdentity.create(locationIdentityObject); } - return graph().add( - new UnsafeLoadNode(objectArgument, offsetArgument, this.stamp().kind(), locationIdentity, CompareNode.createCompareNode(Condition.EQ, conditionArgument, - ConstantNode.forBoolean(true, graph())))); + Node result = graph().add( + new UnsafeLoadNode(objectArgument, offsetArgument, this.getTargetMethod().getSignature().getReturnKind(), locationIdentity, CompareNode.createCompareNode(Condition.EQ, + conditionArgument, ConstantNode.forBoolean(true, graph())))); + + return result; } return this; }
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/typesystem/CustomizedUnsafeStoreMacroNode.java Tue Oct 15 18:04:13 2013 -0700 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/typesystem/CustomizedUnsafeStoreMacroNode.java Wed Oct 16 03:53:40 2013 +0200 @@ -61,7 +61,8 @@ locationIdentity = ObjectLocationIdentity.create(locationIdentityObject); } - UnsafeStoreNode unsafeStoreNode = graph().add(new UnsafeStoreNode(objectArgument, offsetArgument, valueArgument, valueArgument.kind(), locationIdentity)); + UnsafeStoreNode unsafeStoreNode = graph().add( + new UnsafeStoreNode(objectArgument, offsetArgument, valueArgument, this.getTargetMethod().getSignature().getParameterKind(VALUE_ARGUMENT_INDEX), locationIdentity)); unsafeStoreNode.setStateAfter(this.stateAfter()); return unsafeStoreNode; }