src/share/vm/interpreter/interpreter.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File 8026328 Sdiff src/share/vm/interpreter

src/share/vm/interpreter/interpreter.cpp

Print this page




 312     case java_util_zip_CRC32_updateBytes      : tty->print("java_util_zip_CRC32_updateBytes"); break;
 313     case java_util_zip_CRC32_updateByteBuffer : tty->print("java_util_zip_CRC32_updateByteBuffer"); break;
 314     default:
 315       if (kind >= method_handle_invoke_FIRST &&
 316           kind <= method_handle_invoke_LAST) {
 317         const char* kind_name = vmIntrinsics::name_at(method_handle_intrinsic(kind));
 318         if (kind_name[0] == '_')  kind_name = &kind_name[1];  // '_invokeExact' => 'invokeExact'
 319         tty->print("method_handle_%s", kind_name);
 320         break;
 321       }
 322       ShouldNotReachHere();
 323       break;
 324   }
 325 }
 326 #endif // PRODUCT
 327 
 328 
 329 //------------------------------------------------------------------------------------------------------------------------
 330 // Deoptimization support
 331 
 332 // If deoptimization happens, this function returns the point of next bytecode to continue execution


 333 address AbstractInterpreter::deopt_continue_after_entry(Method* method, address bcp, int callee_parameters, bool is_top_frame) {
 334   assert(method->contains(bcp), "just checkin'");


 335   Bytecodes::Code code   = Bytecodes::java_code_at(method, bcp);
 336   assert(!Interpreter::bytecode_should_reexecute(code), "should not reexecute");
 337   int             bci    = method->bci_from(bcp);
 338   int             length = -1; // initial value for debugging

 339   // compute continuation length
 340   length = Bytecodes::length_at(method, bcp);

 341   // compute result type
 342   BasicType type = T_ILLEGAL;
 343 
 344   switch (code) {
 345     case Bytecodes::_invokevirtual  :
 346     case Bytecodes::_invokespecial  :
 347     case Bytecodes::_invokestatic   :
 348     case Bytecodes::_invokeinterface: {
 349       Thread *thread = Thread::current();
 350       ResourceMark rm(thread);
 351       methodHandle mh(thread, method);
 352       type = Bytecode_invoke(mh, bci).result_type();
 353       // since the cache entry might not be initialized:
 354       // (NOT needed for the old calling convension)
 355       if (!is_top_frame) {
 356         int index = Bytes::get_native_u2(bcp+1);
 357         method->constants()->cache()->entry_at(index)->set_parameter_size(callee_parameters);
 358       }
 359       break;
 360     }


 376     case Bytecodes::_ldc   :
 377     case Bytecodes::_ldc_w : // fall through
 378     case Bytecodes::_ldc2_w:
 379       {
 380         Thread *thread = Thread::current();
 381         ResourceMark rm(thread);
 382         methodHandle mh(thread, method);
 383         type = Bytecode_loadconstant(mh, bci).result_type();
 384         break;
 385       }
 386 
 387     default:
 388       type = Bytecodes::result_type(code);
 389       break;
 390   }
 391 
 392   // return entry point for computed continuation state & bytecode length
 393   return
 394     is_top_frame
 395     ? Interpreter::deopt_entry (as_TosState(type), length)
 396     : Interpreter::return_entry(as_TosState(type), length);
 397 }
 398 
 399 // If deoptimization happens, this function returns the point where the interpreter reexecutes
 400 // the bytecode.
 401 // Note: Bytecodes::_athrow is a special case in that it does not return
 402 //       Interpreter::deopt_entry(vtos, 0) like others
 403 address AbstractInterpreter::deopt_reexecute_entry(Method* method, address bcp) {
 404   assert(method->contains(bcp), "just checkin'");
 405   Bytecodes::Code code   = Bytecodes::java_code_at(method, bcp);
 406 #ifdef COMPILER1
 407   if(code == Bytecodes::_athrow ) {
 408     return Interpreter::rethrow_exception_entry();
 409   }
 410 #endif /* COMPILER1 */
 411   return Interpreter::deopt_entry(vtos, 0);
 412 }
 413 
 414 // If deoptimization happens, the interpreter should reexecute these bytecodes.
 415 // This function mainly helps the compilers to set up the reexecute bit.
 416 bool AbstractInterpreter::bytecode_should_reexecute(Bytecodes::Code code) {




 312     case java_util_zip_CRC32_updateBytes      : tty->print("java_util_zip_CRC32_updateBytes"); break;
 313     case java_util_zip_CRC32_updateByteBuffer : tty->print("java_util_zip_CRC32_updateByteBuffer"); break;
 314     default:
 315       if (kind >= method_handle_invoke_FIRST &&
 316           kind <= method_handle_invoke_LAST) {
 317         const char* kind_name = vmIntrinsics::name_at(method_handle_intrinsic(kind));
 318         if (kind_name[0] == '_')  kind_name = &kind_name[1];  // '_invokeExact' => 'invokeExact'
 319         tty->print("method_handle_%s", kind_name);
 320         break;
 321       }
 322       ShouldNotReachHere();
 323       break;
 324   }
 325 }
 326 #endif // PRODUCT
 327 
 328 
 329 //------------------------------------------------------------------------------------------------------------------------
 330 // Deoptimization support
 331 
 332 /**
 333  * If a deoptimization happens, this function returns the point of next bytecode to continue execution.
 334  */
 335 address AbstractInterpreter::deopt_continue_after_entry(Method* method, address bcp, int callee_parameters, bool is_top_frame) {
 336   assert(method->contains(bcp), "just checkin'");
 337 
 338   // Get the original and rewritten bytecode.
 339   Bytecodes::Code code = Bytecodes::java_code_at(method, bcp);
 340   assert(!Interpreter::bytecode_should_reexecute(code), "should not reexecute");
 341 
 342   const int bci = method->bci_from(bcp);
 343 
 344   // compute continuation length
 345   const int length = Bytecodes::length_at(method, bcp);
 346 
 347   // compute result type
 348   BasicType type = T_ILLEGAL;
 349 
 350   switch (code) {
 351     case Bytecodes::_invokevirtual  :
 352     case Bytecodes::_invokespecial  :
 353     case Bytecodes::_invokestatic   :
 354     case Bytecodes::_invokeinterface: {
 355       Thread *thread = Thread::current();
 356       ResourceMark rm(thread);
 357       methodHandle mh(thread, method);
 358       type = Bytecode_invoke(mh, bci).result_type();
 359       // since the cache entry might not be initialized:
 360       // (NOT needed for the old calling convension)
 361       if (!is_top_frame) {
 362         int index = Bytes::get_native_u2(bcp+1);
 363         method->constants()->cache()->entry_at(index)->set_parameter_size(callee_parameters);
 364       }
 365       break;
 366     }


 382     case Bytecodes::_ldc   :
 383     case Bytecodes::_ldc_w : // fall through
 384     case Bytecodes::_ldc2_w:
 385       {
 386         Thread *thread = Thread::current();
 387         ResourceMark rm(thread);
 388         methodHandle mh(thread, method);
 389         type = Bytecode_loadconstant(mh, bci).result_type();
 390         break;
 391       }
 392 
 393     default:
 394       type = Bytecodes::result_type(code);
 395       break;
 396   }
 397 
 398   // return entry point for computed continuation state & bytecode length
 399   return
 400     is_top_frame
 401     ? Interpreter::deopt_entry (as_TosState(type), length)
 402     : Interpreter::return_entry(as_TosState(type), length, code);
 403 }
 404 
 405 // If deoptimization happens, this function returns the point where the interpreter reexecutes
 406 // the bytecode.
 407 // Note: Bytecodes::_athrow is a special case in that it does not return
 408 //       Interpreter::deopt_entry(vtos, 0) like others
 409 address AbstractInterpreter::deopt_reexecute_entry(Method* method, address bcp) {
 410   assert(method->contains(bcp), "just checkin'");
 411   Bytecodes::Code code   = Bytecodes::java_code_at(method, bcp);
 412 #ifdef COMPILER1
 413   if(code == Bytecodes::_athrow ) {
 414     return Interpreter::rethrow_exception_entry();
 415   }
 416 #endif /* COMPILER1 */
 417   return Interpreter::deopt_entry(vtos, 0);
 418 }
 419 
 420 // If deoptimization happens, the interpreter should reexecute these bytecodes.
 421 // This function mainly helps the compilers to set up the reexecute bit.
 422 bool AbstractInterpreter::bytecode_should_reexecute(Bytecodes::Code code) {


src/share/vm/interpreter/interpreter.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File