Mercurial > hg > truffle
diff graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/CheckCastSnippets.java @ 7368:f04a5e46cdd2
new facility to add branch probabilities for snippets, probabilities for frequently-used snippets
author | Lukas Stadler <lukas.stadler@jku.at> |
---|---|
date | Mon, 14 Jan 2013 16:29:08 +0100 |
parents | 2912b72d840a |
children | 4cc0efe5cffe |
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/CheckCastSnippets.java Mon Jan 14 15:23:13 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/CheckCastSnippets.java Mon Jan 14 16:29:08 2013 +0100 @@ -25,6 +25,7 @@ import static com.oracle.graal.hotspot.snippets.HotSpotSnippetUtils.*; import static com.oracle.graal.snippets.SnippetTemplate.*; import static com.oracle.graal.snippets.SnippetTemplate.Arguments.*; +import static com.oracle.graal.snippets.nodes.BranchProbabilityNode.*; import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; @@ -68,11 +69,13 @@ @Parameter("exactHub") Word exactHub, @ConstantParameter("checkNull") boolean checkNull) { if (checkNull && object == null) { + probability(0.1); isNull.inc(); return object; } Word objectHub = loadHub(object); if (objectHub != exactHub) { + probability(0.01); exactMiss.inc(); //bkpt(object, exactHub, objectHub); DeoptimizeNode.deopt(DeoptimizationAction.InvalidateReprofile, DeoptimizationReason.ClassCastException);