src/share/vm/code/nmethod.hpp

changeset 2624
46a56fac55c7
parent 2603
1b4e6a5d98e0
child 2625
65f880e2869b
     1.1 --- a/src/share/vm/code/nmethod.hpp	Tue Mar 15 06:35:10 2011 -0700
     1.2 +++ b/src/share/vm/code/nmethod.hpp	Tue Mar 15 06:37:31 2011 -0700
     1.3 @@ -194,7 +194,10 @@
     1.4  
     1.5    NOT_PRODUCT(bool _has_debug_info; )
     1.6  
     1.7 -  // Nmethod Flushing lock (if non-zero, then the nmethod is not removed)
     1.8 +  // Nmethod Flushing lock. If non-zero, then the nmethod is not removed
     1.9 +  // and is not made into a zombie. However, once the nmethod is made into
    1.10 +  // a zombie, it will be locked one final time if CompiledMethodUnload
    1.11 +  // event processing needs to be done.
    1.12    jint  _lock_count;
    1.13  
    1.14    // not_entrant method removal. Each mark_sweep pass will update
    1.15 @@ -522,8 +525,9 @@
    1.16    void flush();
    1.17  
    1.18   public:
    1.19 -  // If returning true, it is unsafe to remove this nmethod even though it is a zombie
    1.20 -  // nmethod, since the VM might have a reference to it. Should only be called from a  safepoint.
    1.21 +  // When true is returned, it is unsafe to remove this nmethod even if
    1.22 +  // it is a zombie, since the VM or the ServiceThread might still be
    1.23 +  // using it.
    1.24    bool is_locked_by_vm() const                    { return _lock_count >0; }
    1.25  
    1.26    // See comment at definition of _last_seen_on_stack
    1.27 @@ -689,13 +693,20 @@
    1.28  
    1.29  };
    1.30  
    1.31 -// Locks an nmethod so its code will not get removed, even if it is a zombie/not_entrant method
    1.32 +// Locks an nmethod so its code will not get removed and it will not
    1.33 +// be made into a zombie, even if it is a not_entrant method. After the
    1.34 +// nmethod becomes a zombie, if CompiledMethodUnload event processing
    1.35 +// needs to be done, then lock_nmethod() is used directly to keep the
    1.36 +// generated code from being reused too early.
    1.37  class nmethodLocker : public StackObj {
    1.38    nmethod* _nm;
    1.39  
    1.40   public:
    1.41  
    1.42 -  static void lock_nmethod(nmethod* nm);   // note: nm can be NULL
    1.43 +  // note: nm can be NULL
    1.44 +  // Only JvmtiDeferredEvent::compiled_method_unload_event()
    1.45 +  // should pass zombie_ok == true.
    1.46 +  static void lock_nmethod(nmethod* nm, bool zombie_ok = false);
    1.47    static void unlock_nmethod(nmethod* nm); // (ditto)
    1.48  
    1.49    nmethodLocker(address pc); // derive nm from pc

mercurial