# HG changeset patch # User Andreas Woess # Date 1417717454 -3600 # Node ID 073e7f314516c17ca1aa0c820bbcb20542934dd1 # Parent a9a14b31f3b3a7662660fa024ff4d8bbd0fb9ca4 OM: add Transition#isDirect() diff -r a9a14b31f3b3 -r 073e7f314516 graal/com.oracle.truffle.object/src/com/oracle/truffle/object/ShapeImpl.java --- 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); } diff -r a9a14b31f3b3 -r 073e7f314516 graal/com.oracle.truffle.object/src/com/oracle/truffle/object/Transition.java --- 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() {