comparison graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaTypeProfile.java @ 21501:ce585b0ac3e2

Create different nodes in the graph builder when instanceof and checkcast have a single type profile.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Tue, 26 May 2015 21:22:00 +0200
parents 082417ac43e4
children
comparison
equal deleted inserted replaced
21500:ac86179c56ad 21501:ce585b0ac3e2
172 ProfiledType ptype = getTypes()[j]; 172 ProfiledType ptype = getTypes()[j];
173 buf.append(String.format("%.6f:%s", ptype.getProbability(), ptype.getType())); 173 buf.append(String.format("%.6f:%s", ptype.getProbability(), ptype.getType()));
174 } 174 }
175 return buf.append(String.format("], notRecorded:%.6f>", getNotRecordedProbability())).toString(); 175 return buf.append(String.format("], notRecorded:%.6f>", getNotRecordedProbability())).toString();
176 } 176 }
177
178 /**
179 * Returns {@code true} if all types seen at this location have been recorded in the profile.
180 */
181 public boolean allTypesRecorded() {
182 return this.getNotRecordedProbability() == 0.0;
183 }
184
185 /**
186 * Returns the single monormorphic type representing this profile or {@code null} if no such
187 * type exists.
188 */
189 public ResolvedJavaType asSingleType() {
190 if (allTypesRecorded() && this.getTypes().length == 1) {
191 return getTypes()[0].getType();
192 }
193 return null;
194 }
177 } 195 }