Mercurial > hg > truffle
changeset 9999:828f342cb275
improved toString() for JavaTypeProfile and ProfiledType
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 11 Jun 2013 17:00:48 +0200 |
parents | 3754bb5aab2f |
children | d9c14b1828fc |
files | graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaTypeProfile.java |
diffstat | 1 files changed, 15 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaTypeProfile.java Tue Jun 11 13:14:52 2013 +0200 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaTypeProfile.java Tue Jun 11 17:00:48 2013 +0200 @@ -62,7 +62,7 @@ public JavaTypeProfile restrict(JavaTypeProfile otherProfile) { if (otherProfile.getNotRecordedProbability() > 0.0) { - // Not useful for restricting since there is an unknown set of types occuring. + // Not useful for restricting since there is an unknown set of types occurring. return this; } @@ -155,7 +155,20 @@ @Override public String toString() { - return "{" + item.getName() + ", " + probability + "}"; + return String.format("%.6f#%s", probability, item); } } + + @Override + public String toString() { + StringBuilder buf = new StringBuilder("JavaTypeProfile<nullSeen=").append(getNullSeen()).append(", types=["); + for (int j = 0; j < getTypes().length; j++) { + if (j != 0) { + buf.append(", "); + } + ProfiledType ptype = getTypes()[j]; + buf.append(String.format("%.6f:%s", ptype.getProbability(), ptype.getType())); + } + return buf.append(String.format("], notRecorded:%.6f>", getNotRecordedProbability())).toString(); + } }