src/hotspot/share/gc/z/zPageCache.hpp
changeset 54834 39ba09047e19
parent 54618 152c6c501ba5
child 58815 a4cdca87152b
equal deleted inserted replaced
54833:76751d3faf7b 54834:39ba09047e19
    28 #include "gc/z/zPage.hpp"
    28 #include "gc/z/zPage.hpp"
    29 #include "gc/z/zValue.hpp"
    29 #include "gc/z/zValue.hpp"
    30 #include "memory/allocation.hpp"
    30 #include "memory/allocation.hpp"
    31 
    31 
    32 class ZPageCacheFlushClosure : public StackObj {
    32 class ZPageCacheFlushClosure : public StackObj {
       
    33 protected:
       
    34   const size_t _requested;
       
    35   size_t       _flushed;
       
    36 
    33 public:
    37 public:
       
    38   ZPageCacheFlushClosure(size_t requested);
       
    39   size_t overflushed() const;
    34   virtual bool do_page(const ZPage* page) = 0;
    40   virtual bool do_page(const ZPage* page) = 0;
    35 };
    41 };
    36 
    42 
    37 class ZPageCache {
    43 class ZPageCache {
    38 private:
    44 private:
    43 
    49 
    44   ZPage* alloc_small_page();
    50   ZPage* alloc_small_page();
    45   ZPage* alloc_medium_page();
    51   ZPage* alloc_medium_page();
    46   ZPage* alloc_large_page(size_t size);
    52   ZPage* alloc_large_page(size_t size);
    47 
    53 
       
    54   ZPage* alloc_oversized_medium_page(size_t size);
       
    55   ZPage* alloc_oversized_large_page(size_t size);
       
    56   ZPage* alloc_oversized_page(size_t size);
       
    57 
       
    58   void free_page_inner(ZPage* page);
       
    59 
    48   bool flush_list_inner(ZPageCacheFlushClosure* cl, ZList<ZPage>* from, ZList<ZPage>* to);
    60   bool flush_list_inner(ZPageCacheFlushClosure* cl, ZList<ZPage>* from, ZList<ZPage>* to);
    49   void flush_list(ZPageCacheFlushClosure* cl, ZList<ZPage>* from, ZList<ZPage>* to);
    61   void flush_list(ZPageCacheFlushClosure* cl, ZList<ZPage>* from, ZList<ZPage>* to);
    50   void flush_per_numa_lists(ZPageCacheFlushClosure* cl, ZPerNUMA<ZList<ZPage> >* from, ZList<ZPage>* to);
    62   void flush_per_numa_lists(ZPageCacheFlushClosure* cl, ZPerNUMA<ZList<ZPage> >* from, ZList<ZPage>* to);
    51 
    63 
    52 public:
    64 public:
    56 
    68 
    57   ZPage* alloc_page(uint8_t type, size_t size);
    69   ZPage* alloc_page(uint8_t type, size_t size);
    58   void free_page(ZPage* page);
    70   void free_page(ZPage* page);
    59 
    71 
    60   void flush(ZPageCacheFlushClosure* cl, ZList<ZPage>* to);
    72   void flush(ZPageCacheFlushClosure* cl, ZList<ZPage>* to);
       
    73 
       
    74   template <typename Closure> void pages_do(Closure* cl) const;
    61 };
    75 };
    62 
    76 
    63 #endif // SHARE_GC_Z_ZPAGECACHE_HPP
    77 #endif // SHARE_GC_Z_ZPAGECACHE_HPP