Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6830241

consider implementing an OSRTheWorld mode like the CompileTheWorld mode

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P5 P5
    • tbd
    • hs15, 9, 10
    • hotspot
    • generic
    • generic

      This is to record an idea I had about a way to stress test OSR compiles. Basically in CTW mode you record every backward branching bci and request an OSR compile there. I'm not sure it's generally a good idea but I played with it a little and here's the code which should go inte core CTW loop in classLoader.cpp.

      + if (OSRTheWorld) {
      + GrowableArray<int> bcis(4);
      + {
      + BytecodeStream bcs(m());
      + Bytecodes::Code bc;
      +
      + while ((bc = bcs.next()) >= 0) {
      + switch( bc ) {
      + case Bytecodes::_ifeq:
      + case Bytecodes::_ifnull:
      + case Bytecodes::_iflt:
      + case Bytecodes::_ifle:
      + case Bytecodes::_ifne:
      + case Bytecodes::_ifnonnull:
      + case Bytecodes::_ifgt:
      + case Bytecodes::_ifge:
      + case Bytecodes::_if_icmpeq:
      + case Bytecodes::_if_icmpne:
      + case Bytecodes::_if_icmplt:
      + case Bytecodes::_if_icmpgt:
      + case Bytecodes::_if_icmple:
      + case Bytecodes::_if_icmpge:
      + case Bytecodes::_if_acmpeq:
      + case Bytecodes::_if_acmpne:
      + case Bytecodes::_goto:
      + case Bytecodes::_jsr:
      + if (bcs.dest() < bcs.next_bci() && bcis.find(bcs.dest()) == -1) {
      + bcis.append(bcs.dest());
      + }
      + break;
      +
      + case Bytecodes::_goto_w:
      + case Bytecodes::_jsr_w:
      + if (bcs.dest_w() < bcs.next_bci() && bcis.find(bcs.dest_w()) == -1) {
      + bcis.append(bcs.dest_w());
      + }
      + break;
      + }
      + }
      + }
      +
      + for (int i = 0; i < bcis.length(); i++) {
      + InterpreterOopMap map;
      + OopMapCache::compute_one_oop_map(m, bcis.at(i), &map);
      + nmethod* nm = CompileBroker::compile_method(m, bcis.at(i),
      + methodHandle(), 0, "CTW", THREAD);
      + if (HAS_PENDING_EXCEPTION) {
      + CLEAR_PENDING_EXCEPTION;
      + tty->print_cr("CompileTheWorld (%d) : Skipping method: %s @ %d",
      + _compile_the_world_counter, m->name()->as_C_string(), bcis.at(i));
      + }
      + if (nm != NULL) {
      + nm->invalidate_osr_method();
      + }
      + }

            Unassigned Unassigned
            never Tom Rodriguez
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: