< prev index next >

src/hotspot/share/code/compiledMethod.cpp

Print this page

 67              frame_complete_offset, frame_size, oop_maps, caller_must_gc_arguments, compiled),
 68     _deoptimization_status(not_marked),
 69     _deoptimization_generation(0),
 70     _method(method),
 71     _gc_data(nullptr)
 72 {
 73   init_defaults();
 74 }
 75 
 76 void CompiledMethod::init_defaults() {
 77   { // avoid uninitialized fields, even for short time periods
 78     _scopes_data_begin          = nullptr;
 79     _deopt_handler_begin        = nullptr;
 80     _deopt_mh_handler_begin     = nullptr;
 81     _exception_cache            = nullptr;
 82   }
 83   _has_unsafe_access          = 0;
 84   _has_method_handle_invokes  = 0;
 85   _has_wide_vectors           = 0;
 86   _has_monitors               = 0;


 87 }
 88 
 89 bool CompiledMethod::is_method_handle_return(address return_pc) {
 90   if (!has_method_handle_invokes())  return false;
 91   PcDesc* pd = pc_desc_at(return_pc);
 92   if (pd == nullptr)
 93     return false;
 94   return pd->is_method_handle_invoke();
 95 }
 96 
 97 // Returns a string version of the method state.
 98 const char* CompiledMethod::state() const {
 99   int state = get_state();
100   switch (state) {
101   case not_installed:
102     return "not installed";
103   case in_use:
104     return "in use";
105   case not_used:
106     return "not_used";

401 
402 void CompiledMethod::clear_inline_caches() {
403   assert(SafepointSynchronize::is_at_safepoint(), "clearing of IC's only allowed at safepoint");
404   RelocIterator iter(this);
405   while (iter.next()) {
406     iter.reloc()->clear_inline_cache();
407   }
408 }
409 
410 #ifdef ASSERT
411 // Check class_loader is alive for this bit of metadata.
412 class CheckClass : public MetadataClosure {
413   void do_metadata(Metadata* md) {
414     Klass* klass = nullptr;
415     if (md->is_klass()) {
416       klass = ((Klass*)md);
417     } else if (md->is_method()) {
418       klass = ((Method*)md)->method_holder();
419     } else if (md->is_methodData()) {
420       klass = ((MethodData*)md)->method()->method_holder();


421     } else {
422       md->print();
423       ShouldNotReachHere();
424     }
425     assert(klass->is_loader_alive(), "must be alive");
426   }
427 };
428 #endif // ASSERT
429 
430 
431 static void clean_ic_if_metadata_is_dead(CompiledIC *ic) {
432   ic->clean_metadata();
433 }
434 
435 // Clean references to unloaded nmethods at addr from this one, which is not unloaded.
436 template <typename CallsiteT>
437 static void clean_if_nmethod_is_unloaded(CallsiteT* callsite, CompiledMethod* from,
438                                          bool clean_all) {
439   CodeBlob* cb = CodeCache::find_blob(callsite->destination());
440   if (!cb->is_compiled()) {

 67              frame_complete_offset, frame_size, oop_maps, caller_must_gc_arguments, compiled),
 68     _deoptimization_status(not_marked),
 69     _deoptimization_generation(0),
 70     _method(method),
 71     _gc_data(nullptr)
 72 {
 73   init_defaults();
 74 }
 75 
 76 void CompiledMethod::init_defaults() {
 77   { // avoid uninitialized fields, even for short time periods
 78     _scopes_data_begin          = nullptr;
 79     _deopt_handler_begin        = nullptr;
 80     _deopt_mh_handler_begin     = nullptr;
 81     _exception_cache            = nullptr;
 82   }
 83   _has_unsafe_access          = 0;
 84   _has_method_handle_invokes  = 0;
 85   _has_wide_vectors           = 0;
 86   _has_monitors               = 0;
 87   _preloaded                  = 0;
 88   _has_clinit_barriers        = 0;
 89 }
 90 
 91 bool CompiledMethod::is_method_handle_return(address return_pc) {
 92   if (!has_method_handle_invokes())  return false;
 93   PcDesc* pd = pc_desc_at(return_pc);
 94   if (pd == nullptr)
 95     return false;
 96   return pd->is_method_handle_invoke();
 97 }
 98 
 99 // Returns a string version of the method state.
100 const char* CompiledMethod::state() const {
101   int state = get_state();
102   switch (state) {
103   case not_installed:
104     return "not installed";
105   case in_use:
106     return "in use";
107   case not_used:
108     return "not_used";

403 
404 void CompiledMethod::clear_inline_caches() {
405   assert(SafepointSynchronize::is_at_safepoint(), "clearing of IC's only allowed at safepoint");
406   RelocIterator iter(this);
407   while (iter.next()) {
408     iter.reloc()->clear_inline_cache();
409   }
410 }
411 
412 #ifdef ASSERT
413 // Check class_loader is alive for this bit of metadata.
414 class CheckClass : public MetadataClosure {
415   void do_metadata(Metadata* md) {
416     Klass* klass = nullptr;
417     if (md->is_klass()) {
418       klass = ((Klass*)md);
419     } else if (md->is_method()) {
420       klass = ((Method*)md)->method_holder();
421     } else if (md->is_methodData()) {
422       klass = ((MethodData*)md)->method()->method_holder();
423     } else if (md->is_methodCounters()) {
424       klass = ((MethodCounters*)md)->method()->method_holder();
425     } else {
426       md->print();
427       ShouldNotReachHere();
428     }
429     assert(klass->is_loader_alive(), "must be alive");
430   }
431 };
432 #endif // ASSERT
433 
434 
435 static void clean_ic_if_metadata_is_dead(CompiledIC *ic) {
436   ic->clean_metadata();
437 }
438 
439 // Clean references to unloaded nmethods at addr from this one, which is not unloaded.
440 template <typename CallsiteT>
441 static void clean_if_nmethod_is_unloaded(CallsiteT* callsite, CompiledMethod* from,
442                                          bool clean_all) {
443   CodeBlob* cb = CodeCache::find_blob(callsite->destination());
444   if (!cb->is_compiled()) {
< prev index next >