# HG changeset patch # User Andreas Woess # Date 1380206787 -7200 # Node ID 22d47c2c74e99e1b7d80bf958aa3f306f6c58cdd # Parent 14904566a4b21e5c3dae8fb4ddaea5a67a7a7cfa# Parent 9af8b109ec0fca3478403a4d908eeb880174e53e Merge diff -r 14904566a4b2 -r 22d47c2c74e9 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCache.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCache.java Thu Sep 26 13:17:48 2013 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCache.java Thu Sep 26 16:46:27 2013 +0200 @@ -60,12 +60,14 @@ private final HashMap, StructuredGraph> cache = new HashMap<>(); private final StructuredGraph markerGraph = new StructuredGraph(); + private final ResolvedJavaType stringBuilderClass; public TruffleCache(MetaAccessProvider metaAccessProvider, GraphBuilderConfiguration config, OptimisticOptimizations optimisticOptimizations, Replacements replacements) { this.metaAccessProvider = metaAccessProvider; this.config = config; this.optimisticOptimizations = optimisticOptimizations; this.replacements = replacements; + this.stringBuilderClass = metaAccessProvider.lookupJavaType(StringBuilder.class); } @SuppressWarnings("unused") @@ -192,7 +194,8 @@ } if (inlineGraph == this.markerGraph) { // Can happen for recursive calls. - throw new IllegalStateException("Found illegal recursive call to " + methodCallTargetNode.targetMethod() + ", must annotate such calls with @CompilerDirectives.Slowpath!"); + throw GraphUtil.approxSourceException(methodCallTargetNode, new IllegalStateException("Found illegal recursive call to " + methodCallTargetNode.targetMethod() + + ", must annotate such calls with @CompilerDirectives.SlowPath!")); } Invoke invoke = methodCallTargetNode.invoke(); InliningUtil.inline(invoke, inlineGraph, true); @@ -214,9 +217,9 @@ return false; } - private static boolean shouldInline(final MethodCallTargetNode methodCallTargetNode) { + private boolean shouldInline(final MethodCallTargetNode methodCallTargetNode) { return (methodCallTargetNode.invokeKind() == InvokeKind.Special || methodCallTargetNode.invokeKind() == InvokeKind.Static) && !Modifier.isNative(methodCallTargetNode.targetMethod().getModifiers()) && methodCallTargetNode.targetMethod().getAnnotation(ExplodeLoop.class) == null && - methodCallTargetNode.targetMethod().getAnnotation(CompilerDirectives.SlowPath.class) == null; + methodCallTargetNode.targetMethod().getAnnotation(CompilerDirectives.SlowPath.class) == null && methodCallTargetNode.targetMethod().getDeclaringClass() != stringBuilderClass; } } diff -r 14904566a4b2 -r 22d47c2c74e9 graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/FrameDescriptor.java --- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/FrameDescriptor.java Thu Sep 26 13:17:48 2013 +0200 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/FrameDescriptor.java Thu Sep 26 16:46:27 2013 +0200 @@ -39,6 +39,7 @@ private final ArrayList slots; private final HashMap identifierToSlotMap; private Assumption version; + private HashMap identifierToNotInFrameAssumptionMap; public FrameDescriptor() { this(DefaultFrameTypeConversion.getInstance()); @@ -61,6 +62,7 @@ slots.add(slot); identifierToSlotMap.put(identifier, slot); updateVersion(); + invalidateNotInFrameAssumption(identifier); return slot; } @@ -93,7 +95,7 @@ } /** - * (db) to retrieve the list of all the identifiers associated with this frame descriptor. + * Retrieve the list of all the identifiers associated with this frame descriptor. * * @return the list of all the identifiers in this frame descriptor */ @@ -133,4 +135,32 @@ public FrameTypeConversion getTypeConversion() { return typeConversion; } + + public Assumption getNotInFrameAssumption(Object identifier) { + if (identifierToSlotMap.containsKey(identifier)) { + throw new IllegalArgumentException("Cannot get not-in-frame assumption for existing frame slot!"); + } + + if (identifierToNotInFrameAssumptionMap == null) { + identifierToNotInFrameAssumptionMap = new HashMap<>(); + } else { + Assumption assumption = identifierToNotInFrameAssumptionMap.get(identifier); + if (assumption != null) { + return assumption; + } + } + Assumption assumption = Truffle.getRuntime().createAssumption("not in frame: " + identifier); + identifierToNotInFrameAssumptionMap.put(identifier, assumption); + return assumption; + } + + private void invalidateNotInFrameAssumption(Object identifier) { + if (identifierToNotInFrameAssumptionMap != null) { + Assumption assumption = identifierToNotInFrameAssumptionMap.get(identifier); + if (assumption != null) { + assumption.invalidate(); + identifierToNotInFrameAssumptionMap.remove(identifier); + } + } + } } diff -r 14904566a4b2 -r 22d47c2c74e9 graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/AbstractAssumption.java --- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/AbstractAssumption.java Thu Sep 26 13:17:48 2013 +0200 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/AbstractAssumption.java Thu Sep 26 16:46:27 2013 +0200 @@ -43,6 +43,6 @@ @Override public String toString() { - return "Assumption: " + name; + return "Assumption(valid=" + isValid + "): " + name; } } diff -r 14904566a4b2 -r 22d47c2c74e9 graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/NodeUtil.java --- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/NodeUtil.java Thu Sep 26 13:17:48 2013 +0200 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/NodeUtil.java Thu Sep 26 16:46:27 2013 +0200 @@ -292,12 +292,8 @@ @SuppressWarnings("unchecked") public static T cloneNode(T orig) { - Class clazz = orig.getClass(); - NodeClass nodeClass = NodeClass.get(clazz); - Node clone = orig.copy(); - if (clone == null) { - return null; - } + final Node clone = orig.copy(); + NodeClass nodeClass = NodeClass.get(clone.getClass()); unsafe.putObject(clone, nodeClass.parentOffset, null); @@ -305,10 +301,6 @@ Node child = (Node) unsafe.getObject(orig, fieldOffset); if (child != null) { Node clonedChild = cloneNode(child); - if (clonedChild == null) { - return null; - } - unsafe.putObject(clonedChild, nodeClass.parentOffset, clone); unsafe.putObject(clone, fieldOffset, clonedChild); } @@ -316,16 +308,13 @@ for (long fieldOffset : nodeClass.childrenOffsets) { Node[] children = (Node[]) unsafe.getObject(orig, fieldOffset); if (children != null) { - Node[] clonedChildren = children.clone(); - Arrays.fill(clonedChildren, null); + Node[] clonedChildren = (Node[]) Array.newInstance(children.getClass().getComponentType(), children.length); for (int i = 0; i < children.length; i++) { - Node clonedChild = cloneNode(children[i]); - if (clonedChild == null) { - return null; + if (children[i] != null) { + Node clonedChild = cloneNode(children[i]); + clonedChildren[i] = clonedChild; + unsafe.putObject(clonedChild, nodeClass.parentOffset, clone); } - - clonedChildren[i] = clonedChild; - unsafe.putObject(clonedChild, nodeClass.parentOffset, clone); } unsafe.putObject(clone, fieldOffset, clonedChildren); } diff -r 14904566a4b2 -r 22d47c2c74e9 graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/UnexpectedResultException.java --- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/UnexpectedResultException.java Thu Sep 26 13:17:48 2013 +0200 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/UnexpectedResultException.java Thu Sep 26 16:46:27 2013 +0200 @@ -35,7 +35,7 @@ private final Object result; /** - * Creates the exception with the alternative result that cannot be respresented as a value of + * Creates the exception with the alternative result that cannot be represented as a value of * the return type. * * @param result the alternative result diff -r 14904566a4b2 -r 22d47c2c74e9 mxtool/mx.py --- a/mxtool/mx.py Thu Sep 26 13:17:48 2013 +0200 +++ b/mxtool/mx.py Thu Sep 26 16:46:27 2013 +0200 @@ -2810,8 +2810,7 @@ if exists(md): return wsdir split = os.path.split(wsdir) - # How to do this for Windows? - if split[0] == '/': + if split[0] == wsdir: # root directory return None else: return _find_eclipse_wsroot(split[0])