Mercurial > hg > truffle
diff graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaUtil.java @ 9760:c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
author | Christian Haeubl <haeubl@ssw.jku.at> |
---|---|
date | Fri, 17 May 2013 15:38:22 +0200 |
parents | 5c258c1feb82 |
children | 51545c49083a |
line wrap: on
line diff
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaUtil.java Fri May 17 09:28:41 2013 +0200 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaUtil.java Fri May 17 15:38:22 2013 +0200 @@ -28,7 +28,6 @@ import java.lang.reflect.*; import java.util.*; -import com.oracle.graal.api.meta.JavaTypeProfile.ProfiledType; import com.oracle.graal.api.meta.ProfilingInfo.TriState; /** @@ -546,21 +545,10 @@ } JavaTypeProfile typeProfile = info.getTypeProfile(i); - if (typeProfile != null) { - ProfiledType[] ptypes = typeProfile.getTypes(); - if (ptypes != null) { - buf.append(String.format("types@%d:", i)); - for (int j = 0; j < ptypes.length; j++) { - ProfiledType ptype = ptypes[j]; - buf.append(String.format(" %.6f (%s)%s", ptype.getProbability(), ptype.getType(), sep)); - } - if (typeProfile.getNotRecordedProbability() != 0) { - buf.append(String.format(" %.6f <other types>%s", typeProfile.getNotRecordedProbability(), sep)); - } else { - buf.append(String.format(" <no other types>%s", sep)); - } - } - } + appendProfile(buf, typeProfile, i, "types", sep); + + JavaMethodProfile methodProfile = info.getMethodProfile(i); + appendProfile(buf, methodProfile, i, "methods", sep); } boolean firstDeoptReason = true; @@ -582,6 +570,24 @@ return s.substring(0, s.length() - sep.length()); } + private static void appendProfile(StringBuilder buf, AbstractJavaProfile profile, int bci, String kind, String sep) { + if (profile != null) { + AbstractProfiledItem[] pitems = profile.getItems(); + if (pitems != null) { + buf.append(String.format("%s@%d:", kind, bci)); + for (int j = 0; j < pitems.length; j++) { + AbstractProfiledItem pitem = pitems[j]; + buf.append(String.format(" %.6f (%s)%s", pitem.getProbability(), pitem.getItem(), sep)); + } + if (profile.getNotRecordedProbability() != 0) { + buf.append(String.format(" %.6f <other %s>%s", profile.getNotRecordedProbability(), kind, sep)); + } else { + buf.append(String.format(" <no other %s>%s", kind, sep)); + } + } + } + } + /** * Converts a Java source-language class name into the internal form. *