hotspot/src/share/vm/runtime/sweeper.hpp
changeset 27642 8c9eff693145
parent 27420 04e6f914cce1
child 27917 c5937f7b4e8b
equal deleted inserted replaced
27641:fca9ac607ebc 27642:8c9eff693145
    22  *
    22  *
    23  */
    23  */
    24 
    24 
    25 #ifndef SHARE_VM_RUNTIME_SWEEPER_HPP
    25 #ifndef SHARE_VM_RUNTIME_SWEEPER_HPP
    26 #define SHARE_VM_RUNTIME_SWEEPER_HPP
    26 #define SHARE_VM_RUNTIME_SWEEPER_HPP
       
    27 
       
    28 class WhiteBox;
    27 
    29 
    28 #include "utilities/ticks.hpp"
    30 #include "utilities/ticks.hpp"
    29 // An NmethodSweeper is an incremental cleaner for:
    31 // An NmethodSweeper is an incremental cleaner for:
    30 //    - cleanup inline caches
    32 //    - cleanup inline caches
    31 //    - reclamation of nmethods
    33 //    - reclamation of nmethods
    50 //     cleared. After that, the nmethod can be evicted from the code cache. Each nmethod's
    52 //     cleared. After that, the nmethod can be evicted from the code cache. Each nmethod's
    51 //     state change happens during separate sweeps. It may take at least 3 sweeps before an
    53 //     state change happens during separate sweeps. It may take at least 3 sweeps before an
    52 //     nmethod's space is freed.
    54 //     nmethod's space is freed.
    53 
    55 
    54 class NMethodSweeper : public AllStatic {
    56 class NMethodSweeper : public AllStatic {
       
    57   friend class WhiteBox;
       
    58  private:
    55   static long      _traversals;                   // Stack scan count, also sweep ID.
    59   static long      _traversals;                   // Stack scan count, also sweep ID.
    56   static long      _total_nof_code_cache_sweeps;  // Total number of full sweeps of the code cache
    60   static long      _total_nof_code_cache_sweeps;  // Total number of full sweeps of the code cache
    57   static long      _time_counter;                 // Virtual time used to periodically invoke sweeper
    61   static long      _time_counter;                 // Virtual time used to periodically invoke sweeper
    58   static long      _last_sweep;                   // Value of _time_counter when the last sweep happened
    62   static long      _last_sweep;                   // Value of _time_counter when the last sweep happened
    59   static NMethodIterator _current;                // Current nmethod
    63   static NMethodIterator _current;                // Current nmethod
    86   static bool wait_for_stack_scanning();
    90   static bool wait_for_stack_scanning();
    87   static void sweep_code_cache();
    91   static void sweep_code_cache();
    88   static void handle_safepoint_request();
    92   static void handle_safepoint_request();
    89   static void do_stack_scanning();
    93   static void do_stack_scanning();
    90   static void possibly_sweep();
    94   static void possibly_sweep();
    91 
       
    92  public:
    95  public:
    93   static long traversal_count()              { return _traversals; }
    96   static long traversal_count()              { return _traversals; }
    94   static int  total_nof_methods_reclaimed()  { return _total_nof_methods_reclaimed; }
    97   static int  total_nof_methods_reclaimed()  { return _total_nof_methods_reclaimed; }
    95   static const Tickspan total_time_sweeping()      { return _total_time_sweeping; }
    98   static const Tickspan total_time_sweeping()      { return _total_time_sweeping; }
    96   static const Tickspan peak_sweep_time()          { return _peak_sweep_time; }
    99   static const Tickspan peak_sweep_time()          { return _peak_sweep_time; }