Top


定義場所(file name)

hotspot/src/share/vm/runtime/thread.cpp

説明(description)

// Deoptimization
// Function for testing deoptimization

名前(function name)

void JavaThread::deoptimize() {

本体部(body)

      // BiasedLocking needs an updated RegisterMap for the revoke monitors pass
      StackFrameStream fst(this, UseBiasedLocking);
      bool deopt = false;           // Dump stack only if a deopt actually happens.
      bool only_at = strlen(DeoptimizeOnlyAt) > 0;
      // Iterate over all frames in the thread and deoptimize
      for(; !fst.is_done(); fst.next()) {
        if(fst.current()->can_be_deoptimized()) {

          if (only_at) {
            // Deoptimize only at particular bcis.  DeoptimizeOnlyAt
            // consists of comma or carriage return separated numbers so
            // search for the current bci in that string.
            address pc = fst.current()->pc();
            nmethod* nm =  (nmethod*) fst.current()->cb();
            ScopeDesc* sd = nm->scope_desc_at( pc);
            char buffer[8];
            jio_snprintf(buffer, sizeof(buffer), "%d", sd->bci());
            size_t len = strlen(buffer);
            const char * found = strstr(DeoptimizeOnlyAt, buffer);
            while (found != NULL) {
              if ((found[len] == ',' || found[len] == '\n' || found[len] == '\0') &&
                  (found == DeoptimizeOnlyAt || found[-1] == ',' || found[-1] == '\n')) {
                // Check that the bci found is bracketed by terminators.
                break;
              }
              found = strstr(found + 1, buffer);
            }
            if (!found) {
              continue;
            }
          }

          if (DebugDeoptimization && !deopt) {
            deopt = true; // One-time only print before deopt
            tty->print_cr("[BEFORE Deoptimization]");
            trace_frames();
            trace_stack();
          }
          Deoptimization::deoptimize(this, *fst.current(), fst.register_map());
        }
      }

      if (DebugDeoptimization && deopt) {
        tty->print_cr("[AFTER Deoptimization]");
        trace_frames();
      }
    }

This document is available under the GNU GENERAL PUBLIC LICENSE Version 2.