src/share/vm/runtime/deoptimization.cpp

changeset 2138
d5d065957597
parent 2047
d2ede61b7a12
child 2169
fd5d4527cdf5
     1.1 --- a/src/share/vm/runtime/deoptimization.cpp	Thu Sep 02 11:40:02 2010 -0700
     1.2 +++ b/src/share/vm/runtime/deoptimization.cpp	Fri Sep 03 17:51:07 2010 -0700
     1.3 @@ -1301,7 +1301,7 @@
     1.4      bool update_trap_state = true;
     1.5      bool make_not_entrant = false;
     1.6      bool make_not_compilable = false;
     1.7 -    bool reset_counters = false;
     1.8 +    bool reprofile = false;
     1.9      switch (action) {
    1.10      case Action_none:
    1.11        // Keep the old code.
    1.12 @@ -1328,7 +1328,7 @@
    1.13        // had been traps taken from compiled code.  This will update
    1.14        // the MDO trap history so that the next compilation will
    1.15        // properly detect hot trap sites.
    1.16 -      reset_counters = true;
    1.17 +      reprofile = true;
    1.18        break;
    1.19      case Action_make_not_entrant:
    1.20        // Request immediate recompilation, and get rid of the old code.
    1.21 @@ -1422,7 +1422,7 @@
    1.22        // this trap point already, run the method in the interpreter
    1.23        // for a while to exercise it more thoroughly.
    1.24        if (make_not_entrant && maybe_prior_recompile && maybe_prior_trap) {
    1.25 -        reset_counters = true;
    1.26 +        reprofile = true;
    1.27        }
    1.28  
    1.29      }
    1.30 @@ -1452,24 +1452,21 @@
    1.31          if (trap_method() == nm->method()) {
    1.32            make_not_compilable = true;
    1.33          } else {
    1.34 -          trap_method->set_not_compilable();
    1.35 +          trap_method->set_not_compilable(CompLevel_full_optimization);
    1.36            // But give grace to the enclosing nm->method().
    1.37          }
    1.38        }
    1.39      }
    1.40  
    1.41 -    // Reset invocation counters
    1.42 -    if (reset_counters) {
    1.43 -      if (nm->is_osr_method())
    1.44 -        reset_invocation_counter(trap_scope, CompileThreshold);
    1.45 -      else
    1.46 -        reset_invocation_counter(trap_scope);
    1.47 +    // Reprofile
    1.48 +    if (reprofile) {
    1.49 +      CompilationPolicy::policy()->reprofile(trap_scope, nm->is_osr_method());
    1.50      }
    1.51  
    1.52      // Give up compiling
    1.53 -    if (make_not_compilable && !nm->method()->is_not_compilable()) {
    1.54 +    if (make_not_compilable && !nm->method()->is_not_compilable(CompLevel_full_optimization)) {
    1.55        assert(make_not_entrant, "consistent");
    1.56 -      nm->method()->set_not_compilable();
    1.57 +      nm->method()->set_not_compilable(CompLevel_full_optimization);
    1.58      }
    1.59  
    1.60    } // Free marked resources
    1.61 @@ -1569,22 +1566,6 @@
    1.62                             ignore_maybe_prior_recompile);
    1.63  }
    1.64  
    1.65 -void Deoptimization::reset_invocation_counter(ScopeDesc* trap_scope, jint top_count) {
    1.66 -  ScopeDesc* sd = trap_scope;
    1.67 -  for (; !sd->is_top(); sd = sd->sender()) {
    1.68 -    // Reset ICs of inlined methods, since they can trigger compilations also.
    1.69 -    sd->method()->invocation_counter()->reset();
    1.70 -  }
    1.71 -  InvocationCounter* c = sd->method()->invocation_counter();
    1.72 -  if (top_count != _no_count) {
    1.73 -    // It was an OSR method, so bump the count higher.
    1.74 -    c->set(c->state(), top_count);
    1.75 -  } else {
    1.76 -    c->reset();
    1.77 -  }
    1.78 -  sd->method()->backedge_counter()->reset();
    1.79 -}
    1.80 -
    1.81  Deoptimization::UnrollBlock* Deoptimization::uncommon_trap(JavaThread* thread, jint trap_request) {
    1.82  
    1.83    // Still in Java no safepoints

mercurial