comparison src/share/vm/code/nmethod.hpp @ 2343:65f880e2869b

Merge
author dcubed
date Tue, 15 Mar 2011 06:50:01 -0700
parents 3d5a546351ef 46a56fac55c7
children d673ef06fe96
comparison
equal deleted inserted replaced
2340:4775a1e3e923 2343:65f880e2869b
191 191
192 jbyte _scavenge_root_state; 192 jbyte _scavenge_root_state;
193 193
194 NOT_PRODUCT(bool _has_debug_info; ) 194 NOT_PRODUCT(bool _has_debug_info; )
195 195
196 // Nmethod Flushing lock (if non-zero, then the nmethod is not removed) 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.
197 jint _lock_count; 200 jint _lock_count;
198 201
199 // not_entrant method removal. Each mark_sweep pass will update 202 // not_entrant method removal. Each mark_sweep pass will update
200 // this mark to current sweep invocation count if it is seen on the 203 // this mark to current sweep invocation count if it is seen on the
201 // stack. An not_entrant method can be removed when there is no 204 // stack. An not_entrant method can be removed when there is no
519 522
520 protected: 523 protected:
521 void flush(); 524 void flush();
522 525
523 public: 526 public:
524 // If returning true, it is unsafe to remove this nmethod even though it is a zombie 527 // When true is returned, it is unsafe to remove this nmethod even if
525 // nmethod, since the VM might have a reference to it. Should only be called from a safepoint. 528 // it is a zombie, since the VM or the ServiceThread might still be
529 // using it.
526 bool is_locked_by_vm() const { return _lock_count >0; } 530 bool is_locked_by_vm() const { return _lock_count >0; }
527 531
528 // See comment at definition of _last_seen_on_stack 532 // See comment at definition of _last_seen_on_stack
529 void mark_as_seen_on_stack(); 533 void mark_as_seen_on_stack();
530 bool can_not_entrant_be_converted(); 534 bool can_not_entrant_be_converted();
686 static int osr_entry_point_offset() { return offset_of(nmethod, _osr_entry_point); } 690 static int osr_entry_point_offset() { return offset_of(nmethod, _osr_entry_point); }
687 static int entry_bci_offset() { return offset_of(nmethod, _entry_bci); } 691 static int entry_bci_offset() { return offset_of(nmethod, _entry_bci); }
688 692
689 }; 693 };
690 694
691 // Locks an nmethod so its code will not get removed, even if it is a zombie/not_entrant method 695 // Locks an nmethod so its code will not get removed and it will not
696 // be made into a zombie, even if it is a not_entrant method. After the
697 // nmethod becomes a zombie, if CompiledMethodUnload event processing
698 // needs to be done, then lock_nmethod() is used directly to keep the
699 // generated code from being reused too early.
692 class nmethodLocker : public StackObj { 700 class nmethodLocker : public StackObj {
693 nmethod* _nm; 701 nmethod* _nm;
694 702
695 public: 703 public:
696 704
697 static void lock_nmethod(nmethod* nm); // note: nm can be NULL 705 // note: nm can be NULL
706 // Only JvmtiDeferredEvent::compiled_method_unload_event()
707 // should pass zombie_ok == true.
708 static void lock_nmethod(nmethod* nm, bool zombie_ok = false);
698 static void unlock_nmethod(nmethod* nm); // (ditto) 709 static void unlock_nmethod(nmethod* nm); // (ditto)
699 710
700 nmethodLocker(address pc); // derive nm from pc 711 nmethodLocker(address pc); // derive nm from pc
701 nmethodLocker(nmethod *nm) { _nm = nm; lock_nmethod(_nm); } 712 nmethodLocker(nmethod *nm) { _nm = nm; lock_nmethod(_nm); }
702 nmethodLocker() { _nm = NULL; } 713 nmethodLocker() { _nm = NULL; }