diff -r cc624b341ab2 -r 970dc585ab63 hotspot/src/share/vm/runtime/deoptimization.cpp --- a/hotspot/src/share/vm/runtime/deoptimization.cpp Thu Sep 02 11:40:02 2010 -0700 +++ b/hotspot/src/share/vm/runtime/deoptimization.cpp Fri Sep 03 17:51:07 2010 -0700 @@ -1301,7 +1301,7 @@ bool update_trap_state = true; bool make_not_entrant = false; bool make_not_compilable = false; - bool reset_counters = false; + bool reprofile = false; switch (action) { case Action_none: // Keep the old code. @@ -1328,7 +1328,7 @@ // had been traps taken from compiled code. This will update // the MDO trap history so that the next compilation will // properly detect hot trap sites. - reset_counters = true; + reprofile = true; break; case Action_make_not_entrant: // Request immediate recompilation, and get rid of the old code. @@ -1422,7 +1422,7 @@ // this trap point already, run the method in the interpreter // for a while to exercise it more thoroughly. if (make_not_entrant && maybe_prior_recompile && maybe_prior_trap) { - reset_counters = true; + reprofile = true; } } @@ -1452,24 +1452,21 @@ if (trap_method() == nm->method()) { make_not_compilable = true; } else { - trap_method->set_not_compilable(); + trap_method->set_not_compilable(CompLevel_full_optimization); // But give grace to the enclosing nm->method(). } } } - // Reset invocation counters - if (reset_counters) { - if (nm->is_osr_method()) - reset_invocation_counter(trap_scope, CompileThreshold); - else - reset_invocation_counter(trap_scope); + // Reprofile + if (reprofile) { + CompilationPolicy::policy()->reprofile(trap_scope, nm->is_osr_method()); } // Give up compiling - if (make_not_compilable && !nm->method()->is_not_compilable()) { + if (make_not_compilable && !nm->method()->is_not_compilable(CompLevel_full_optimization)) { assert(make_not_entrant, "consistent"); - nm->method()->set_not_compilable(); + nm->method()->set_not_compilable(CompLevel_full_optimization); } } // Free marked resources @@ -1569,22 +1566,6 @@ ignore_maybe_prior_recompile); } -void Deoptimization::reset_invocation_counter(ScopeDesc* trap_scope, jint top_count) { - ScopeDesc* sd = trap_scope; - for (; !sd->is_top(); sd = sd->sender()) { - // Reset ICs of inlined methods, since they can trigger compilations also. - sd->method()->invocation_counter()->reset(); - } - InvocationCounter* c = sd->method()->invocation_counter(); - if (top_count != _no_count) { - // It was an OSR method, so bump the count higher. - c->set(c->state(), top_count); - } else { - c->reset(); - } - sd->method()->backedge_counter()->reset(); -} - Deoptimization::UnrollBlock* Deoptimization::uncommon_trap(JavaThread* thread, jint trap_request) { // Still in Java no safepoints