Mercurial > hg > truffle
changeset 22367:1b48778cee21
add toString() methods to transitions
author | Andreas Woess <andreas.woess@oracle.com> |
---|---|
date | Fri, 13 Nov 2015 16:25:04 +0100 |
parents | 78306843f20c |
children | 0d4b0e4263ee |
files | truffle/com.oracle.truffle.object/src/com/oracle/truffle/object/Transition.java truffle/com.oracle.truffle.object/src/com/oracle/truffle/object/debug/IGVShapeVisitor.java |
diffstat | 2 files changed, 23 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/truffle/com.oracle.truffle.object/src/com/oracle/truffle/object/Transition.java Fri Nov 13 15:36:25 2015 +0100 +++ b/truffle/com.oracle.truffle.object/src/com/oracle/truffle/object/Transition.java Fri Nov 13 16:25:04 2015 +0100 @@ -22,9 +22,10 @@ */ package com.oracle.truffle.object; +import java.util.Objects; + import com.oracle.truffle.api.object.ObjectType; import com.oracle.truffle.api.object.Property; -import java.util.Objects; public abstract class Transition { @Override @@ -90,6 +91,11 @@ public boolean isDirect() { return true; } + + @Override + public String toString() { + return String.format("add(%s)", getProperty()); + } } public static final class RemovePropertyTransition extends PropertyTransition { @@ -101,6 +107,11 @@ public boolean isDirect() { return false; } + + @Override + public String toString() { + return String.format("remove(%s)", getProperty()); + } } public static final class ObjectTypeTransition extends Transition { @@ -131,6 +142,11 @@ public boolean isDirect() { return true; } + + @Override + public String toString() { + return String.format("objectType(%s)", getObjectType()); + } } public abstract static class AbstractReplacePropertyTransition extends PropertyTransition { @@ -161,6 +177,11 @@ result = prime * result + after.hashCode(); return result; } + + @Override + public String toString() { + return String.format("replace(%s,%s)", getPropertyBefore(), getPropertyAfter()); + } } public static final class IndirectReplacePropertyTransition extends AbstractReplacePropertyTransition {
--- a/truffle/com.oracle.truffle.object/src/com/oracle/truffle/object/debug/IGVShapeVisitor.java Fri Nov 13 15:36:25 2015 +0100 +++ b/truffle/com.oracle.truffle.object/src/com/oracle/truffle/object/debug/IGVShapeVisitor.java Fri Nov 13 16:25:04 2015 +0100 @@ -57,7 +57,7 @@ Shape dst = entry.getValue(); ((ShapeImpl) dst).accept(IGVShapeVisitor.this); assert printer.visited(dst); - printer.connectNodes(s, dst, entry.getKey().getShortName()); + printer.connectNodes(s, dst, entry.getKey().toString()); } } }