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 #if INCLUDE_RTM_OPT
197 // RTM state at compile time. Used during deoptimization to decide
198 // whether to restart collecting RTM locking abort statistic again.
199 RTMState _rtm_state;
200 #endif
201
202 // Nmethod Flushing lock. If non-zero, then the nmethod is not removed
203 // and is not made into a zombie. However, once the nmethod is made into
204 // a zombie, it will be locked one final time if CompiledMethodUnload
205 // event processing needs to be done.
206 jint _lock_count;
207
208 // not_entrant method removal. Each mark_sweep pass will update
209 // this mark to current sweep invocation count if it is seen on the
210 // stack. An not_entrant method can be removed when there are no
211 // more activations, i.e., when the _stack_traversal_mark is less than
212 // current sweep traversal index.
213 long _stack_traversal_mark;
214
215 // The _hotness_counter indicates the hotness of a method. The higher
216 // the value the hotter the method. The hotness counter of a nmethod is
217 // set to [(ReservedCodeCacheSize / (1024 * 1024)) * 2] each time the method
218 // is active while stack scanning (mark_active_nmethods()). The hotness
219 // counter is decreased (by 1) while sweeping.
220 int _hotness_counter;
221
403 bool insts_contains (address addr) const { return insts_begin () <= addr && addr < insts_end (); }
404 bool stub_contains (address addr) const { return stub_begin () <= addr && addr < stub_end (); }
405 bool oops_contains (oop* addr) const { return oops_begin () <= addr && addr < oops_end (); }
406 bool metadata_contains (Metadata** addr) const { return metadata_begin () <= addr && addr < metadata_end (); }
407 bool scopes_data_contains (address addr) const { return scopes_data_begin () <= addr && addr < scopes_data_end (); }
408 bool scopes_pcs_contains (PcDesc* addr) const { return scopes_pcs_begin () <= addr && addr < scopes_pcs_end (); }
409 bool handler_table_contains(address addr) const { return handler_table_begin() <= addr && addr < handler_table_end(); }
410 bool nul_chk_table_contains(address addr) const { return nul_chk_table_begin() <= addr && addr < nul_chk_table_end(); }
411
412 // entry points
413 address entry_point() const { return _entry_point; } // normal entry point
414 address verified_entry_point() const { return _verified_entry_point; } // if klass is correct
415
416 // flag accessing and manipulation
417 bool is_in_use() const { return _state == in_use; }
418 bool is_alive() const { return _state == in_use || _state == not_entrant; }
419 bool is_not_entrant() const { return _state == not_entrant; }
420 bool is_zombie() const { return _state == zombie; }
421 bool is_unloaded() const { return _state == unloaded; }
422
423 #if INCLUDE_RTM_OPT
424 // rtm state accessing and manipulating
425 RTMState rtm_state() const { return _rtm_state; }
426 void set_rtm_state(RTMState state) { _rtm_state = state; }
427 #endif
428
429 // Make the nmethod non entrant. The nmethod will continue to be
430 // alive. It is used when an uncommon trap happens. Returns true
431 // if this thread changed the state of the nmethod or false if
432 // another thread performed the transition.
433 bool make_not_entrant() { return make_not_entrant_or_zombie(not_entrant); }
434 bool make_zombie() { return make_not_entrant_or_zombie(zombie); }
435
436 // used by jvmti to track if the unload event has been reported
437 bool unload_reported() { return _unload_reported; }
438 void set_unload_reported() { _unload_reported = true; }
439
440 bool is_marked_for_deoptimization() const { return _marked_for_deoptimization; }
441 void mark_for_deoptimization() { _marked_for_deoptimization = true; }
442
443 void make_unloaded(BoolObjectClosure* is_alive, oop cause);
444
445 bool has_dependencies() { return dependencies_size() != 0; }
446 void flush_dependencies(BoolObjectClosure* is_alive);
447 bool has_flushed_dependencies() { return _has_flushed_dependencies; }
448 void set_has_flushed_dependencies() {
|