changeset 18625:073e7f314516

OM: add Transition#isDirect()
author Andreas Woess <andreas.woess@jku.at>
date Thu, 04 Dec 2014 19:24:14 +0100
parents a9a14b31f3b3
children ce46f909c176
files graal/com.oracle.truffle.object/src/com/oracle/truffle/object/ShapeImpl.java graal/com.oracle.truffle.object/src/com/oracle/truffle/object/Transition.java
diffstat 2 files changed, 29 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.truffle.object/src/com/oracle/truffle/object/ShapeImpl.java	Thu Dec 04 14:42:33 2014 +0100
+++ b/graal/com.oracle.truffle.object/src/com/oracle/truffle/object/ShapeImpl.java	Thu Dec 04 19:24:14 2014 +0100
@@ -288,12 +288,12 @@
     }
 
     protected final void addDirectTransition(Transition transition, ShapeImpl next) {
-        assert next.getParent() == this;
+        assert next.getParent() == this && transition.isDirect();
         addTransitionInternal(transition, next);
     }
 
     public final void addIndirectTransition(Transition transition, ShapeImpl next) {
-        assert next.getParent() != this;
+        assert next.getParent() != this && !transition.isDirect();
         addTransitionInternal(transition, next);
     }
 
--- a/graal/com.oracle.truffle.object/src/com/oracle/truffle/object/Transition.java	Thu Dec 04 14:42:33 2014 +0100
+++ b/graal/com.oracle.truffle.object/src/com/oracle/truffle/object/Transition.java	Thu Dec 04 19:24:14 2014 +0100
@@ -47,6 +47,8 @@
         return true;
     }
 
+    public abstract boolean isDirect();
+
     public abstract static class PropertyTransition extends Transition {
         private final Property property;
 
@@ -83,12 +85,22 @@
         public AddPropertyTransition(Property property) {
             super(property);
         }
+
+        @Override
+        public boolean isDirect() {
+            return true;
+        }
     }
 
     public static final class RemovePropertyTransition extends PropertyTransition {
         public RemovePropertyTransition(Property property) {
             super(property);
         }
+
+        @Override
+        public boolean isDirect() {
+            return false;
+        }
     }
 
     public static final class ObjectTypeTransition extends Transition {
@@ -114,6 +126,11 @@
             result = prime * result + ((objectType == null) ? 0 : objectType.hashCode());
             return result;
         }
+
+        @Override
+        public boolean isDirect() {
+            return true;
+        }
     }
 
     public static final class PropertyTypeTransition extends PropertyTransition {
@@ -131,11 +148,21 @@
         public Property getPropertyAfter() {
             return after;
         }
+
+        @Override
+        public boolean isDirect() {
+            return false;
+        }
     }
 
     public static final class ReservePrimitiveArrayTransition extends Transition {
         public ReservePrimitiveArrayTransition() {
         }
+
+        @Override
+        public boolean isDirect() {
+            return true;
+        }
     }
 
     public String getShortName() {