# HG changeset patch # User Andreas Woess # Date 1380196099 -7200 # Node ID ec90fc830e451bba2f3601754d098101cd08ceb4 # Parent 73a886a9564a72dd8f7058d8e3f97c79accab2a9# Parent 91a676d0bbbe5e9ce72df7cd2234d5f3b121d28a Merge diff -r 73a886a9564a -r ec90fc830e45 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 11:15:45 2013 +0200 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/FrameDescriptor.java Thu Sep 26 13:48:19 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 73a886a9564a -r ec90fc830e45 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 11:15:45 2013 +0200 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/AbstractAssumption.java Thu Sep 26 13:48:19 2013 +0200 @@ -43,6 +43,6 @@ @Override public String toString() { - return "Assumption: " + name; + return "Assumption(valid=" + isValid + "): " + name; } } diff -r 73a886a9564a -r ec90fc830e45 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 11:15:45 2013 +0200 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/NodeUtil.java Thu Sep 26 13:48:19 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 73a886a9564a -r ec90fc830e45 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 11:15:45 2013 +0200 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/UnexpectedResultException.java Thu Sep 26 13:48:19 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 73a886a9564a -r ec90fc830e45 mxtool/mx.py --- a/mxtool/mx.py Thu Sep 26 11:15:45 2013 +0200 +++ b/mxtool/mx.py Thu Sep 26 13:48:19 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])