src/share/vm/runtime/sweeper.hpp

changeset 5040
9ce110b1d14a
parent 5038
0cfa93c2fcc4
child 5237
f2110083203d
     1.1 --- a/src/share/vm/runtime/sweeper.hpp	Thu May 02 16:41:09 2013 -0700
     1.2 +++ b/src/share/vm/runtime/sweeper.hpp	Thu May 02 18:50:05 2013 -0700
     1.3 @@ -35,26 +35,29 @@
     1.4    static nmethod*  _current;      // Current nmethod
     1.5    static int       _seen;         // Nof. nmethod we have currently processed in current pass of CodeCache
     1.6  
     1.7 -  static volatile int      _invocations;   // No. of invocations left until we are completed with this pass
     1.8 -  static volatile int      _sweep_started; // Flag to control conc sweeper
     1.9 +  static volatile int  _invocations;   // No. of invocations left until we are completed with this pass
    1.10 +  static volatile int  _sweep_started; // Flag to control conc sweeper
    1.11  
    1.12 -  static bool      _rescan;          // Indicates that we should do a full rescan of the
    1.13 -                                     // of the code cache looking for work to do.
    1.14 -  static bool      _do_sweep;        // Flag to skip the conc sweep if no stack scan happened
    1.15 -  static int       _locked_seen;     // Number of locked nmethods encountered during the scan
    1.16 +  //The following are reset in scan_stacks and synchronized by the safepoint
    1.17 +  static bool      _resweep;           // Indicates that a change has happend and we want another sweep,
    1.18 +                                       // always checked and reset at a safepoint so memory will be in sync.
    1.19 +  static int       _locked_seen;       // Number of locked nmethods encountered during the scan
    1.20    static int       _not_entrant_seen_on_stack; // Number of not entrant nmethod were are still on stack
    1.21 +  static jint      _flush_token;       // token that guards method flushing, making sure it is executed only once.
    1.22  
    1.23 -  static bool      _was_full;        // remember if we did emergency unloading
    1.24 -  static jint      _advise_to_sweep; // flag to indicate code cache getting full
    1.25 -  static jlong     _last_was_full;   // timestamp of last emergency unloading
    1.26 -  static uint      _highest_marked;   // highest compile id dumped at last emergency unloading
    1.27 -  static long      _was_full_traversal;   // trav number at last emergency unloading
    1.28 +  // These are set during a flush, a VM-operation
    1.29 +  static long      _last_flush_traversal_id; // trav number at last flush unloading
    1.30 +  static jlong     _last_full_flush_time;    // timestamp of last emergency unloading
    1.31 +
    1.32 +  // These are synchronized by the _sweep_started token
    1.33 +  static int       _highest_marked;   // highest compile id dumped at last emergency unloading
    1.34 +  static int       _dead_compile_ids; // number of compile ids that where not in the cache last flush
    1.35  
    1.36    static void process_nmethod(nmethod *nm);
    1.37 -
    1.38    static void release_nmethod(nmethod* nm);
    1.39  
    1.40    static void log_sweep(const char* msg, const char* format = NULL, ...);
    1.41 +  static bool sweep_in_progress();
    1.42  
    1.43   public:
    1.44    static long traversal_count() { return _traversals; }
    1.45 @@ -71,17 +74,14 @@
    1.46    static void possibly_sweep();   // Compiler threads call this to sweep
    1.47  
    1.48    static void notify(nmethod* nm) {
    1.49 -    // Perform a full scan of the code cache from the beginning.  No
    1.50 +    // Request a new sweep of the code cache from the beginning. No
    1.51      // need to synchronize the setting of this flag since it only
    1.52      // changes to false at safepoint so we can never overwrite it with false.
    1.53 -     _rescan = true;
    1.54 +     _resweep = true;
    1.55    }
    1.56  
    1.57    static void handle_full_code_cache(bool is_full); // Called by compilers who fail to allocate
    1.58    static void speculative_disconnect_nmethods(bool was_full);   // Called by vm op to deal with alloc failure
    1.59 -
    1.60 -  static void set_was_full(bool state) { _was_full = state; }
    1.61 -  static bool was_full() { return _was_full; }
    1.62  };
    1.63  
    1.64  #endif // SHARE_VM_RUNTIME_SWEEPER_HPP

mercurial