# HG changeset patch # User Doug Simon # Date 1371552366 -7200 # Node ID e04f128d719cce4dc93e81e95259335f4192868c # Parent 77772d794ffdacfbdf9abbabc4b545bd257b3cc3 cannot use DeoptimizationAction.None for deoptimizing instanceof snippet since it will miss application phase changes, causing repeated and expensive deoptimization diff -r 77772d794ffd -r e04f128d719c graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/InstanceOfSnippets.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/InstanceOfSnippets.java Tue Jun 18 11:01:32 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/InstanceOfSnippets.java Tue Jun 18 12:46:06 2013 +0200 @@ -83,8 +83,8 @@ if (probability(NOT_FREQUENT_PROBABILITY, checkNull && object == null)) { isNull.inc(); if (!nullSeen) { - // In this case, the execution is contradicting the profile - // so invalidating and re-profiling is justified. + // See comment below for other deoptimization path; the + // same reasoning applies here. DeoptimizeNode.deopt(InvalidateReprofile, OptimizedTypeCheckViolated); } return falseValue; @@ -100,9 +100,11 @@ return positive ? trueValue : falseValue; } } - // Don't throw away the code as we assume this is a rare event - // that will periodically occur. - DeoptimizeNode.deopt(DeoptimizationAction.None, OptimizedTypeCheckViolated); + // This maybe just be a rare event but it might also indicate a phase change + // in the application. Ideally we want to use DeoptimizationAction.None for + // the former but the cost is too high if indeed it is the latter. As such, + // we defensively opt for InvalidateReprofile. + DeoptimizeNode.deopt(DeoptimizationAction.InvalidateReprofile, OptimizedTypeCheckViolated); return falseValue; }