changeset 11811:ec90fc830e45

Merge
author Andreas Woess <andreas.woess@jku.at>
date Thu, 26 Sep 2013 13:48:19 +0200
parents 73a886a9564a (current diff) 91a676d0bbbe (diff)
children 4937347fa343
files
diffstat 5 files changed, 41 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- 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<FrameSlotImpl> slots;
     private final HashMap<Object, FrameSlotImpl> identifierToSlotMap;
     private Assumption version;
+    private HashMap<Object, Assumption> 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);
+            }
+        }
+    }
 }
--- 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;
     }
 }
--- 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 extends Node> T cloneNode(T orig) {
-        Class<? extends Node> 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);
             }
--- 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
--- 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])