src/hotspot/share/runtime/deoptimization.cpp
changeset 51522 b426c75da4b9
parent 51073 34696f3aa22b
child 51997 9ce37fa2e179
equal deleted inserted replaced
51521:76a51e26d0ac 51522:b426c75da4b9
   701           // calls. It seems to be hard to tell whether the compiler
   701           // calls. It seems to be hard to tell whether the compiler
   702           // has emitted debug information matching the "state before"
   702           // has emitted debug information matching the "state before"
   703           // a given bytecode or the state after, so we try both
   703           // a given bytecode or the state after, so we try both
   704           if (!Bytecodes::is_invoke(cur_code) && cur_code != Bytecodes::_athrow) {
   704           if (!Bytecodes::is_invoke(cur_code) && cur_code != Bytecodes::_athrow) {
   705             // Get expression stack size for the next bytecode
   705             // Get expression stack size for the next bytecode
       
   706             InterpreterOopMap next_mask;
       
   707             OopMapCache::compute_one_oop_map(mh, str.bci(), &next_mask);
       
   708             next_mask_expression_stack_size = next_mask.expression_stack_size();
   706             if (Bytecodes::is_invoke(next_code)) {
   709             if (Bytecodes::is_invoke(next_code)) {
   707               Bytecode_invoke invoke(mh, str.bci());
   710               Bytecode_invoke invoke(mh, str.bci());
   708               next_mask_expression_stack_size = invoke.size_of_parameters();
   711               next_mask_expression_stack_size += invoke.size_of_parameters();
   709             } else {
       
   710               InterpreterOopMap next_mask;
       
   711               OopMapCache::compute_one_oop_map(mh, str.bci(), &next_mask);
       
   712               next_mask_expression_stack_size = next_mask.expression_stack_size();
       
   713             }
   712             }
   714             // Need to subtract off the size of the result type of
   713             // Need to subtract off the size of the result type of
   715             // the bytecode because this is not described in the
   714             // the bytecode because this is not described in the
   716             // debug info but returned to the interpreter in the TOS
   715             // debug info but returned to the interpreter in the TOS
   717             // caching register
   716             // caching register
   737                                                                     top_frame_expression_stack_adjustment))) ||
   736                                                                     top_frame_expression_stack_adjustment))) ||
   738             (is_top_frame && (exec_mode == Unpack_exception) && iframe->interpreter_frame_expression_stack_size() == 0) ||
   737             (is_top_frame && (exec_mode == Unpack_exception) && iframe->interpreter_frame_expression_stack_size() == 0) ||
   739             (is_top_frame && (exec_mode == Unpack_uncommon_trap || exec_mode == Unpack_reexecute || el->should_reexecute()) &&
   738             (is_top_frame && (exec_mode == Unpack_uncommon_trap || exec_mode == Unpack_reexecute || el->should_reexecute()) &&
   740              (iframe->interpreter_frame_expression_stack_size() == mask.expression_stack_size() + cur_invoke_parameter_size))
   739              (iframe->interpreter_frame_expression_stack_size() == mask.expression_stack_size() + cur_invoke_parameter_size))
   741             )) {
   740             )) {
   742         ttyLocker ttyl;
   741         {
   743 
   742           ttyLocker ttyl;
   744         // Print out some information that will help us debug the problem
   743 
   745         tty->print_cr("Wrong number of expression stack elements during deoptimization");
   744           // Print out some information that will help us debug the problem
   746         tty->print_cr("  Error occurred while verifying frame %d (0..%d, 0 is topmost)", i, cur_array->frames() - 1);
   745           tty->print_cr("Wrong number of expression stack elements during deoptimization");
   747         tty->print_cr("  Fabricated interpreter frame had %d expression stack elements",
   746           tty->print_cr("  Error occurred while verifying frame %d (0..%d, 0 is topmost)", i, cur_array->frames() - 1);
   748                       iframe->interpreter_frame_expression_stack_size());
   747           tty->print_cr("  Fabricated interpreter frame had %d expression stack elements",
   749         tty->print_cr("  Interpreter oop map had %d expression stack elements", mask.expression_stack_size());
   748                         iframe->interpreter_frame_expression_stack_size());
   750         tty->print_cr("  try_next_mask = %d", try_next_mask);
   749           tty->print_cr("  Interpreter oop map had %d expression stack elements", mask.expression_stack_size());
   751         tty->print_cr("  next_mask_expression_stack_size = %d", next_mask_expression_stack_size);
   750           tty->print_cr("  try_next_mask = %d", try_next_mask);
   752         tty->print_cr("  callee_size_of_parameters = %d", callee_size_of_parameters);
   751           tty->print_cr("  next_mask_expression_stack_size = %d", next_mask_expression_stack_size);
   753         tty->print_cr("  callee_max_locals = %d", callee_max_locals);
   752           tty->print_cr("  callee_size_of_parameters = %d", callee_size_of_parameters);
   754         tty->print_cr("  top_frame_expression_stack_adjustment = %d", top_frame_expression_stack_adjustment);
   753           tty->print_cr("  callee_max_locals = %d", callee_max_locals);
   755         tty->print_cr("  exec_mode = %d", exec_mode);
   754           tty->print_cr("  top_frame_expression_stack_adjustment = %d", top_frame_expression_stack_adjustment);
   756         tty->print_cr("  cur_invoke_parameter_size = %d", cur_invoke_parameter_size);
   755           tty->print_cr("  exec_mode = %d", exec_mode);
   757         tty->print_cr("  Thread = " INTPTR_FORMAT ", thread ID = %d", p2i(thread), thread->osthread()->thread_id());
   756           tty->print_cr("  cur_invoke_parameter_size = %d", cur_invoke_parameter_size);
   758         tty->print_cr("  Interpreted frames:");
   757           tty->print_cr("  Thread = " INTPTR_FORMAT ", thread ID = %d", p2i(thread), thread->osthread()->thread_id());
   759         for (int k = 0; k < cur_array->frames(); k++) {
   758           tty->print_cr("  Interpreted frames:");
   760           vframeArrayElement* el = cur_array->element(k);
   759           for (int k = 0; k < cur_array->frames(); k++) {
   761           tty->print_cr("    %s (bci %d)", el->method()->name_and_sig_as_C_string(), el->bci());
   760             vframeArrayElement* el = cur_array->element(k);
   762         }
   761             tty->print_cr("    %s (bci %d)", el->method()->name_and_sig_as_C_string(), el->bci());
   763         cur_array->print_on_2(tty);
   762           }
       
   763           cur_array->print_on_2(tty);
       
   764         } // release tty lock before calling guarantee
   764         guarantee(false, "wrong number of expression stack elements during deopt");
   765         guarantee(false, "wrong number of expression stack elements during deopt");
   765       }
   766       }
   766       VerifyOopClosure verify;
   767       VerifyOopClosure verify;
   767       iframe->oops_interpreted_do(&verify, &rm, false);
   768       iframe->oops_interpreted_do(&verify, &rm, false);
   768       callee_size_of_parameters = mh->size_of_parameters();
   769       callee_size_of_parameters = mh->size_of_parameters();