176 unsigned int _has_method_handle_invokes:1; // Has this method MethodHandle invokes? 177 unsigned int _lazy_critical_native:1; // Lazy JNI critical native 178 unsigned int _has_wide_vectors:1; // Preserve wide vectors at safepoints 179 180 // Protected by Patching_lock 181 volatile unsigned char _state; // {alive, not_entrant, zombie, unloaded} 182 183 #ifdef ASSERT 184 bool _oops_are_stale; // indicates that it's no longer safe to access oops section 185 #endif 186 187 enum { in_use = 0, // executable nmethod 188 not_entrant = 1, // marked for deoptimization but activations may still exist, 189 // will be transformed to zombie when all activations are gone 190 zombie = 2, // no activations exist, nmethod is ready for purge 191 unloaded = 3 }; // there should be no activations, should not be called, 192 // will be transformed to zombie immediately 193 194 jbyte _scavenge_root_state; 195 196 // Nmethod Flushing lock. If non-zero, then the nmethod is not removed 197 // and is not made into a zombie. However, once the nmethod is made into 198 // a zombie, it will be locked one final time if CompiledMethodUnload 199 // event processing needs to be done. 200 jint _lock_count; 201 202 // not_entrant method removal. Each mark_sweep pass will update 203 // this mark to current sweep invocation count if it is seen on the 204 // stack. An not_entrant method can be removed when there are no 205 // more activations, i.e., when the _stack_traversal_mark is less than 206 // current sweep traversal index. 207 long _stack_traversal_mark; 208 209 // The _hotness_counter indicates the hotness of a method. The higher 210 // the value the hotter the method. The hotness counter of a nmethod is 211 // set to [(ReservedCodeCacheSize / (1024 * 1024)) * 2] each time the method 212 // is active while stack scanning (mark_active_nmethods()). The hotness 213 // counter is decreased (by 1) while sweeping. 214 int _hotness_counter; 215 397 bool insts_contains (address addr) const { return insts_begin () <= addr && addr < insts_end (); } 398 bool stub_contains (address addr) const { return stub_begin () <= addr && addr < stub_end (); } 399 bool oops_contains (oop* addr) const { return oops_begin () <= addr && addr < oops_end (); } 400 bool metadata_contains (Metadata** addr) const { return metadata_begin () <= addr && addr < metadata_end (); } 401 bool scopes_data_contains (address addr) const { return scopes_data_begin () <= addr && addr < scopes_data_end (); } 402 bool scopes_pcs_contains (PcDesc* addr) const { return scopes_pcs_begin () <= addr && addr < scopes_pcs_end (); } 403 bool handler_table_contains(address addr) const { return handler_table_begin() <= addr && addr < handler_table_end(); } 404 bool nul_chk_table_contains(address addr) const { return nul_chk_table_begin() <= addr && addr < nul_chk_table_end(); } 405 406 // entry points 407 address entry_point() const { return _entry_point; } // normal entry point 408 address verified_entry_point() const { return _verified_entry_point; } // if klass is correct 409 410 // flag accessing and manipulation 411 bool is_in_use() const { return _state == in_use; } 412 bool is_alive() const { return _state == in_use || _state == not_entrant; } 413 bool is_not_entrant() const { return _state == not_entrant; } 414 bool is_zombie() const { return _state == zombie; } 415 bool is_unloaded() const { return _state == unloaded; } 416 417 // Make the nmethod non entrant. The nmethod will continue to be 418 // alive. It is used when an uncommon trap happens. Returns true 419 // if this thread changed the state of the nmethod or false if 420 // another thread performed the transition. 421 bool make_not_entrant() { return make_not_entrant_or_zombie(not_entrant); } 422 bool make_zombie() { return make_not_entrant_or_zombie(zombie); } 423 424 // used by jvmti to track if the unload event has been reported 425 bool unload_reported() { return _unload_reported; } 426 void set_unload_reported() { _unload_reported = true; } 427 428 bool is_marked_for_deoptimization() const { return _marked_for_deoptimization; } 429 void mark_for_deoptimization() { _marked_for_deoptimization = true; } 430 431 void make_unloaded(BoolObjectClosure* is_alive, oop cause); 432 433 bool has_dependencies() { return dependencies_size() != 0; } 434 void flush_dependencies(BoolObjectClosure* is_alive); 435 bool has_flushed_dependencies() { return _has_flushed_dependencies; } 436 void set_has_flushed_dependencies() { | 176 unsigned int _has_method_handle_invokes:1; // Has this method MethodHandle invokes? 177 unsigned int _lazy_critical_native:1; // Lazy JNI critical native 178 unsigned int _has_wide_vectors:1; // Preserve wide vectors at safepoints 179 180 // Protected by Patching_lock 181 volatile unsigned char _state; // {alive, not_entrant, zombie, unloaded} 182 183 #ifdef ASSERT 184 bool _oops_are_stale; // indicates that it's no longer safe to access oops section 185 #endif 186 187 enum { in_use = 0, // executable nmethod 188 not_entrant = 1, // marked for deoptimization but activations may still exist, 189 // will be transformed to zombie when all activations are gone 190 zombie = 2, // no activations exist, nmethod is ready for purge 191 unloaded = 3 }; // there should be no activations, should not be called, 192 // will be transformed to zombie immediately 193 194 jbyte _scavenge_root_state; 195 196 // RTM state at compile time. Used during deoptimization to decide 197 // whether to restart collecting RTM locking abort statistic again. 198 RTMState _rtm_state; 199 200 // Nmethod Flushing lock. If non-zero, then the nmethod is not removed 201 // and is not made into a zombie. However, once the nmethod is made into 202 // a zombie, it will be locked one final time if CompiledMethodUnload 203 // event processing needs to be done. 204 jint _lock_count; 205 206 // not_entrant method removal. Each mark_sweep pass will update 207 // this mark to current sweep invocation count if it is seen on the 208 // stack. An not_entrant method can be removed when there are no 209 // more activations, i.e., when the _stack_traversal_mark is less than 210 // current sweep traversal index. 211 long _stack_traversal_mark; 212 213 // The _hotness_counter indicates the hotness of a method. The higher 214 // the value the hotter the method. The hotness counter of a nmethod is 215 // set to [(ReservedCodeCacheSize / (1024 * 1024)) * 2] each time the method 216 // is active while stack scanning (mark_active_nmethods()). The hotness 217 // counter is decreased (by 1) while sweeping. 218 int _hotness_counter; 219 401 bool insts_contains (address addr) const { return insts_begin () <= addr && addr < insts_end (); } 402 bool stub_contains (address addr) const { return stub_begin () <= addr && addr < stub_end (); } 403 bool oops_contains (oop* addr) const { return oops_begin () <= addr && addr < oops_end (); } 404 bool metadata_contains (Metadata** addr) const { return metadata_begin () <= addr && addr < metadata_end (); } 405 bool scopes_data_contains (address addr) const { return scopes_data_begin () <= addr && addr < scopes_data_end (); } 406 bool scopes_pcs_contains (PcDesc* addr) const { return scopes_pcs_begin () <= addr && addr < scopes_pcs_end (); } 407 bool handler_table_contains(address addr) const { return handler_table_begin() <= addr && addr < handler_table_end(); } 408 bool nul_chk_table_contains(address addr) const { return nul_chk_table_begin() <= addr && addr < nul_chk_table_end(); } 409 410 // entry points 411 address entry_point() const { return _entry_point; } // normal entry point 412 address verified_entry_point() const { return _verified_entry_point; } // if klass is correct 413 414 // flag accessing and manipulation 415 bool is_in_use() const { return _state == in_use; } 416 bool is_alive() const { return _state == in_use || _state == not_entrant; } 417 bool is_not_entrant() const { return _state == not_entrant; } 418 bool is_zombie() const { return _state == zombie; } 419 bool is_unloaded() const { return _state == unloaded; } 420 421 // rtm state accessing and manipulating 422 RTMState rtm_state() const { return _rtm_state; } 423 void set_rtm_state(RTMState state) { _rtm_state = state; } 424 425 // Make the nmethod non entrant. The nmethod will continue to be 426 // alive. It is used when an uncommon trap happens. Returns true 427 // if this thread changed the state of the nmethod or false if 428 // another thread performed the transition. 429 bool make_not_entrant() { return make_not_entrant_or_zombie(not_entrant); } 430 bool make_zombie() { return make_not_entrant_or_zombie(zombie); } 431 432 // used by jvmti to track if the unload event has been reported 433 bool unload_reported() { return _unload_reported; } 434 void set_unload_reported() { _unload_reported = true; } 435 436 bool is_marked_for_deoptimization() const { return _marked_for_deoptimization; } 437 void mark_for_deoptimization() { _marked_for_deoptimization = true; } 438 439 void make_unloaded(BoolObjectClosure* is_alive, oop cause); 440 441 bool has_dependencies() { return dependencies_size() != 0; } 442 void flush_dependencies(BoolObjectClosure* is_alive); 443 bool has_flushed_dependencies() { return _has_flushed_dependencies; } 444 void set_has_flushed_dependencies() { |