src/share/vm/gc_implementation/g1/g1CodeCacheRemSet.hpp

changeset 6925
82693fb204a5
parent 0
f90c822e73f8
child 6932
828056cf311f
     1.1 --- a/src/share/vm/gc_implementation/g1/g1CodeCacheRemSet.hpp	Tue May 20 10:04:03 2014 -0700
     1.2 +++ b/src/share/vm/gc_implementation/g1/g1CodeCacheRemSet.hpp	Wed Apr 16 10:14:50 2014 +0200
     1.3 @@ -128,19 +128,45 @@
     1.4    }
     1.5  };
     1.6  
     1.7 +// Manages free chunks.
     1.8 +class G1CodeRootChunkManager VALUE_OBJ_CLASS_SPEC {
     1.9 + private:
    1.10 +  // Global free chunk list management
    1.11 +  FreeList<G1CodeRootChunk> _free_list;
    1.12 +  // Total number of chunks handed out
    1.13 +  size_t _num_chunks_handed_out;
    1.14 +
    1.15 + public:
    1.16 +  G1CodeRootChunkManager();
    1.17 +
    1.18 +  G1CodeRootChunk* new_chunk();
    1.19 +  void free_chunk(G1CodeRootChunk* chunk);
    1.20 +  // Free all elements of the given list.
    1.21 +  void free_all_chunks(FreeList<G1CodeRootChunk>* list);
    1.22 +
    1.23 +  void initialize();
    1.24 +  void purge_chunks(size_t keep_ratio);
    1.25 +
    1.26 +  size_t static_mem_size();
    1.27 +  size_t fl_mem_size();
    1.28 +
    1.29 +#ifndef PRODUCT
    1.30 +  size_t num_chunks_handed_out() const;
    1.31 +  size_t num_free_chunks() const;
    1.32 +#endif
    1.33 +};
    1.34 +
    1.35  // Implements storage for a set of code roots.
    1.36  // All methods that modify the set are not thread-safe except if otherwise noted.
    1.37  class G1CodeRootSet VALUE_OBJ_CLASS_SPEC {
    1.38   private:
    1.39 -  // Global free chunk list management
    1.40 -  static FreeList<G1CodeRootChunk> _free_list;
    1.41 -  // Total number of chunks handed out
    1.42 -  static size_t _num_chunks_handed_out;
    1.43 +  // Global default free chunk manager instance.
    1.44 +  static G1CodeRootChunkManager _default_chunk_manager;
    1.45  
    1.46 -  static G1CodeRootChunk* new_chunk();
    1.47 -  static void free_chunk(G1CodeRootChunk* chunk);
    1.48 +  G1CodeRootChunk* new_chunk() { return _manager->new_chunk(); }
    1.49 +  void free_chunk(G1CodeRootChunk* chunk) { _manager->free_chunk(chunk); }
    1.50    // Free all elements of the given list.
    1.51 -  static void free_all_chunks(FreeList<G1CodeRootChunk>* list);
    1.52 +  void free_all_chunks(FreeList<G1CodeRootChunk>* list) { _manager->free_all_chunks(list); }
    1.53  
    1.54    // Return the chunk that contains the given nmethod, NULL otherwise.
    1.55    // Scans the list of chunks backwards, as this method is used to add new
    1.56 @@ -150,16 +176,18 @@
    1.57  
    1.58    size_t _length;
    1.59    FreeList<G1CodeRootChunk> _list;
    1.60 +  G1CodeRootChunkManager* _manager;
    1.61  
    1.62   public:
    1.63 -  G1CodeRootSet();
    1.64 +  // If an instance is initialized with a chunk manager of NULL, use the global
    1.65 +  // default one.
    1.66 +  G1CodeRootSet(G1CodeRootChunkManager* manager = NULL);
    1.67    ~G1CodeRootSet();
    1.68  
    1.69 -  static void initialize();
    1.70    static void purge_chunks(size_t keep_ratio);
    1.71  
    1.72    static size_t static_mem_size();
    1.73 -  static size_t fl_mem_size();
    1.74 +  static size_t free_chunks_mem_size();
    1.75  
    1.76    // Search for the code blob from the recently allocated ones to find duplicates more quickly, as this
    1.77    // method is likely to be repeatedly called with the same nmethod.

mercurial