Mercurial > hg > graal-compiler
diff graal/com.oracle.truffle.object/src/com/oracle/truffle/object/Transition.java @ 21901:19340125f182
Truffle: model property replace as direct transition
author | Andreas Woess <andreas.woess@oracle.com> |
---|---|
date | Wed, 10 Jun 2015 20:06:13 +0200 |
parents | ce46f909c176 |
children |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.object/src/com/oracle/truffle/object/Transition.java Wed Jun 10 20:05:52 2015 +0200 +++ b/graal/com.oracle.truffle.object/src/com/oracle/truffle/object/Transition.java Wed Jun 10 20:06:13 2015 +0200 @@ -133,10 +133,10 @@ } } - public static final class ReplacePropertyTransition extends PropertyTransition { + public abstract static class AbstractReplacePropertyTransition extends PropertyTransition { private final Property after; - public ReplacePropertyTransition(Property before, Property after) { + public AbstractReplacePropertyTransition(Property before, Property after) { super(before); this.after = after; } @@ -150,11 +150,41 @@ } @Override + public boolean equals(Object obj) { + return super.equals(obj) && this.after.equals(((AbstractReplacePropertyTransition) obj).after); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + after.hashCode(); + return result; + } + } + + public static final class IndirectReplacePropertyTransition extends AbstractReplacePropertyTransition { + public IndirectReplacePropertyTransition(Property before, Property after) { + super(before, after); + } + + @Override public boolean isDirect() { return false; } } + public static final class DirectReplacePropertyTransition extends AbstractReplacePropertyTransition { + public DirectReplacePropertyTransition(Property before, Property after) { + super(before, after); + } + + @Override + public boolean isDirect() { + return true; + } + } + public static final class ReservePrimitiveArrayTransition extends Transition { public ReservePrimitiveArrayTransition() { }