Mercurial > hg > truffle
diff graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodData.java @ 16616:29404eec7ced
eliminate duplicate entries from profile data
author | Tom Rodriguez <tom.rodriguez@oracle.com> |
---|---|
date | Tue, 29 Jul 2014 17:40:15 -0700 |
parents | 10c12d09a8d2 |
children | 52b4284cb496 |
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodData.java Tue Jul 29 17:40:00 2014 -0700 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodData.java Tue Jul 29 17:40:15 2014 -0700 @@ -488,11 +488,24 @@ long totalCount = 0; int entries = 0; - for (int i = 0; i < typeProfileWidth; i++) { + outer: for (int i = 0; i < typeProfileWidth; i++) { long receiverKlass = data.readWord(position, getTypeOffset(i)); if (receiverKlass != 0) { - types[entries] = HotSpotResolvedObjectType.fromMetaspaceKlass(receiverKlass); + ResolvedJavaType klass = HotSpotResolvedObjectType.fromMetaspaceKlass(receiverKlass); long count = data.readUnsignedInt(position, getTypeCountOffset(i)); + /* + * Because of races in the profile collection machinery it's possible for a + * class to appear multiple times so merge them to make the profile look + * rational. + */ + for (int j = 0; j < entries; j++) { + if (types[j].equals(klass)) { + totalCount += count; + counts[j] += count; + continue outer; + } + } + types[entries] = klass; totalCount += count; counts[entries] = count; entries++;