< prev index next >

src/hotspot/share/runtime/sharedRuntime.hpp

Print this page


  38 class AdapterHandlerTable;
  39 class AdapterFingerPrint;
  40 class vframeStream;
  41 class SigEntry;
  42 
  43 // Runtime is the base class for various runtime interfaces
  44 // (InterpreterRuntime, CompilerRuntime, etc.). It provides
  45 // shared functionality such as exception forwarding (C++ to
  46 // Java exceptions), locking/unlocking mechanisms, statistical
  47 // information, etc.
  48 
  49 class SharedRuntime: AllStatic {
  50   friend class VMStructs;
  51 
  52  private:
  53   static bool resolve_sub_helper_internal(methodHandle callee_method, const frame& caller_frame,
  54                                           CompiledMethod* caller_nm, bool is_virtual, bool is_optimized,
  55                                           Handle receiver, CallInfo& call_info, Bytecodes::Code invoke_code, TRAPS);
  56   static methodHandle resolve_sub_helper(JavaThread *thread,
  57                                          bool is_virtual,
  58                                          bool is_optimized, TRAPS);

  59 
  60   // Shared stub locations
  61 
  62   static RuntimeStub*        _wrong_method_blob;
  63   static RuntimeStub*        _wrong_method_abstract_blob;
  64   static RuntimeStub*        _ic_miss_blob;
  65   static RuntimeStub*        _resolve_opt_virtual_call_blob;
  66   static RuntimeStub*        _resolve_virtual_call_blob;
  67   static RuntimeStub*        _resolve_static_call_blob;
  68   static address             _resolve_static_call_entry;
  69 
  70   static DeoptimizationBlob* _deopt_blob;
  71 
  72   static SafepointBlob*      _polling_page_vectors_safepoint_handler_blob;
  73   static SafepointBlob*      _polling_page_safepoint_handler_blob;
  74   static SafepointBlob*      _polling_page_return_handler_blob;
  75 
  76 #ifdef COMPILER2
  77   static UncommonTrapBlob*   _uncommon_trap_blob;
  78 #endif // COMPILER2


 306   static char* generate_class_cast_message(JavaThread* thr, Klass* caster_klass);
 307 
 308   // Fill in the "X cannot be cast to a Y" message for ClassCastException
 309   //
 310   // @param caster_klass the class of the object we are casting
 311   // @param target_klass the target klass attempt
 312   // @return the dynamically allocated exception message (must be freed
 313   // by the caller using a resource mark)
 314   //
 315   // This version does not require access the frame, so it can be called
 316   // from interpreted code
 317   // The caller (or one of it's callers) must use a ResourceMark
 318   // in order to correctly free the result.
 319   //
 320   static char* generate_class_cast_message(Klass* caster_klass, Klass* target_klass, Symbol* target_klass_name = NULL);
 321 
 322   // Resolves a call site- may patch in the destination of the call into the
 323   // compiled code.
 324   static methodHandle resolve_helper(JavaThread *thread,
 325                                      bool is_virtual,
 326                                      bool is_optimized, TRAPS);

 327 
 328  private:
 329   // deopt blob
 330   static void generate_deopt_blob(void);
 331 
 332   static bool handle_ic_miss_helper_internal(Handle receiver, CompiledMethod* caller_nm, const frame& caller_frame,
 333                                              methodHandle callee_method, Bytecodes::Code bc, CallInfo& call_info,
 334                                              bool& needs_ic_stub_refill, bool& is_optimized, TRAPS);
 335 
 336  public:
 337   static DeoptimizationBlob* deopt_blob(void)      { return _deopt_blob; }
 338 
 339   // Resets a call-site in compiled code so it will get resolved again.
 340   static methodHandle reresolve_call_site(JavaThread *thread, bool& is_optimized, TRAPS);
 341 
 342   // In the code prolog, if the klass comparison fails, the inline cache
 343   // misses and the call site is patched to megamorphic
 344   static methodHandle handle_ic_miss_helper(JavaThread* thread, bool& is_optimized, TRAPS);
 345 
 346   // Find the method that called us.
 347   static methodHandle find_callee_method(JavaThread* thread, TRAPS);
 348 













 349 
 350  private:
 351   static Handle find_callee_info(JavaThread* thread,
 352                                  Bytecodes::Code& bc,
 353                                  CallInfo& callinfo, TRAPS);
 354   static Handle find_callee_info_helper(JavaThread* thread,
 355                                         vframeStream& vfst,
 356                                         Bytecodes::Code& bc,
 357                                         CallInfo& callinfo, TRAPS);
 358 
 359   static methodHandle extract_attached_method(vframeStream& vfst);
 360 
 361   static address clean_virtual_call_entry();
 362   static address clean_opt_virtual_call_entry();
 363   static address clean_static_call_entry();
 364 
 365 #if defined(X86) && defined(COMPILER1)
 366   // For Object.hashCode, System.identityHashCode try to pull hashCode from object header if available.
 367   static void inline_check_hashcode_from_object_header(MacroAssembler* masm, const methodHandle& method, Register obj_reg, Register result);
 368 #endif // X86 && COMPILER1




  38 class AdapterHandlerTable;
  39 class AdapterFingerPrint;
  40 class vframeStream;
  41 class SigEntry;
  42 
  43 // Runtime is the base class for various runtime interfaces
  44 // (InterpreterRuntime, CompilerRuntime, etc.). It provides
  45 // shared functionality such as exception forwarding (C++ to
  46 // Java exceptions), locking/unlocking mechanisms, statistical
  47 // information, etc.
  48 
  49 class SharedRuntime: AllStatic {
  50   friend class VMStructs;
  51 
  52  private:
  53   static bool resolve_sub_helper_internal(methodHandle callee_method, const frame& caller_frame,
  54                                           CompiledMethod* caller_nm, bool is_virtual, bool is_optimized,
  55                                           Handle receiver, CallInfo& call_info, Bytecodes::Code invoke_code, TRAPS);
  56   static methodHandle resolve_sub_helper(JavaThread *thread,
  57                                          bool is_virtual,
  58                                          bool is_optimized,
  59                                          bool* caller_is_c1, TRAPS);
  60 
  61   // Shared stub locations
  62 
  63   static RuntimeStub*        _wrong_method_blob;
  64   static RuntimeStub*        _wrong_method_abstract_blob;
  65   static RuntimeStub*        _ic_miss_blob;
  66   static RuntimeStub*        _resolve_opt_virtual_call_blob;
  67   static RuntimeStub*        _resolve_virtual_call_blob;
  68   static RuntimeStub*        _resolve_static_call_blob;
  69   static address             _resolve_static_call_entry;
  70 
  71   static DeoptimizationBlob* _deopt_blob;
  72 
  73   static SafepointBlob*      _polling_page_vectors_safepoint_handler_blob;
  74   static SafepointBlob*      _polling_page_safepoint_handler_blob;
  75   static SafepointBlob*      _polling_page_return_handler_blob;
  76 
  77 #ifdef COMPILER2
  78   static UncommonTrapBlob*   _uncommon_trap_blob;
  79 #endif // COMPILER2


 307   static char* generate_class_cast_message(JavaThread* thr, Klass* caster_klass);
 308 
 309   // Fill in the "X cannot be cast to a Y" message for ClassCastException
 310   //
 311   // @param caster_klass the class of the object we are casting
 312   // @param target_klass the target klass attempt
 313   // @return the dynamically allocated exception message (must be freed
 314   // by the caller using a resource mark)
 315   //
 316   // This version does not require access the frame, so it can be called
 317   // from interpreted code
 318   // The caller (or one of it's callers) must use a ResourceMark
 319   // in order to correctly free the result.
 320   //
 321   static char* generate_class_cast_message(Klass* caster_klass, Klass* target_klass, Symbol* target_klass_name = NULL);
 322 
 323   // Resolves a call site- may patch in the destination of the call into the
 324   // compiled code.
 325   static methodHandle resolve_helper(JavaThread *thread,
 326                                      bool is_virtual,
 327                                      bool is_optimized,
 328                                      bool* caller_is_c1, TRAPS);
 329 
 330  private:
 331   // deopt blob
 332   static void generate_deopt_blob(void);
 333 
 334   static bool handle_ic_miss_helper_internal(Handle receiver, CompiledMethod* caller_nm, const frame& caller_frame,
 335                                              methodHandle callee_method, Bytecodes::Code bc, CallInfo& call_info,
 336                                              bool& needs_ic_stub_refill, bool& is_optimized, bool caller_is_c1, TRAPS);
 337 
 338  public:
 339   static DeoptimizationBlob* deopt_blob(void)      { return _deopt_blob; }
 340 
 341   // Resets a call-site in compiled code so it will get resolved again.
 342   static methodHandle reresolve_call_site(JavaThread *thread, bool& is_optimized, bool& caller_is_c1, TRAPS);
 343 
 344   // In the code prolog, if the klass comparison fails, the inline cache
 345   // misses and the call site is patched to megamorphic
 346   static methodHandle handle_ic_miss_helper(JavaThread* thread, bool& is_optimized, bool& caller_is_c1, TRAPS);
 347 
 348   // Find the method that called us.
 349   static methodHandle find_callee_method(JavaThread* thread, TRAPS);
 350 
 351 
 352   static address entry_for_handle_wrong_method(methodHandle callee_method, bool is_optimized, bool caller_is_c1) {
 353     assert(callee_method->verified_code_entry() != NULL, "Jump to zero!");
 354     assert(callee_method->verified_value_code_entry() != NULL, "Jump to zero!");
 355     assert(callee_method->verified_value_ro_code_entry() != NULL, "Jump to zero!");
 356     if (caller_is_c1) {
 357       return callee_method->verified_value_code_entry();
 358     } else if (is_optimized) {
 359       return callee_method->verified_code_entry();
 360     } else {
 361       return callee_method->verified_value_ro_code_entry();
 362     }
 363   }
 364 
 365  private:
 366   static Handle find_callee_info(JavaThread* thread,
 367                                  Bytecodes::Code& bc,
 368                                  CallInfo& callinfo, TRAPS);
 369   static Handle find_callee_info_helper(JavaThread* thread,
 370                                         vframeStream& vfst,
 371                                         Bytecodes::Code& bc,
 372                                         CallInfo& callinfo, TRAPS);
 373 
 374   static methodHandle extract_attached_method(vframeStream& vfst);
 375 
 376   static address clean_virtual_call_entry();
 377   static address clean_opt_virtual_call_entry();
 378   static address clean_static_call_entry();
 379 
 380 #if defined(X86) && defined(COMPILER1)
 381   // For Object.hashCode, System.identityHashCode try to pull hashCode from object header if available.
 382   static void inline_check_hashcode_from_object_header(MacroAssembler* masm, const methodHandle& method, Register obj_reg, Register result);
 383 #endif // X86 && COMPILER1


< prev index next >