70 return _commit_map.at(idx);
71 }
72
73 virtual void commit_regions(uint start_idx, size_t num_regions = 1, WorkGang* pretouch_workers = NULL) = 0;
74 virtual void uncommit_regions(uint start_idx, size_t num_regions = 1) = 0;
75
76 // Creates an appropriate G1RegionToSpaceMapper for the given parameters.
77 // The actual space to be used within the given reservation is given by actual_size.
78 // This is because some OSes need to round up the reservation size to guarantee
79 // alignment of page_size.
80 // The byte_translation_factor defines how many bytes in a region correspond to
81 // a single byte in the data structure this mapper is for.
82 // Eg. in the card table, this value corresponds to the size a single card
83 // table entry corresponds to in the heap.
84 static G1RegionToSpaceMapper* create_mapper(ReservedSpace rs,
85 size_t actual_size,
86 size_t page_size,
87 size_t region_granularity,
88 size_t byte_translation_factor,
89 MemoryType type);
90 };
91
92 #endif // SHARE_VM_GC_G1_G1REGIONTOSPACEMAPPER_HPP
|
70 return _commit_map.at(idx);
71 }
72
73 virtual void commit_regions(uint start_idx, size_t num_regions = 1, WorkGang* pretouch_workers = NULL) = 0;
74 virtual void uncommit_regions(uint start_idx, size_t num_regions = 1) = 0;
75
76 // Creates an appropriate G1RegionToSpaceMapper for the given parameters.
77 // The actual space to be used within the given reservation is given by actual_size.
78 // This is because some OSes need to round up the reservation size to guarantee
79 // alignment of page_size.
80 // The byte_translation_factor defines how many bytes in a region correspond to
81 // a single byte in the data structure this mapper is for.
82 // Eg. in the card table, this value corresponds to the size a single card
83 // table entry corresponds to in the heap.
84 static G1RegionToSpaceMapper* create_mapper(ReservedSpace rs,
85 size_t actual_size,
86 size_t page_size,
87 size_t region_granularity,
88 size_t byte_translation_factor,
89 MemoryType type);
90
91 static G1RegionToSpaceMapper* create_heap_mapper(ReservedSpace rs,
92 size_t actual_size,
93 size_t page_size,
94 size_t region_granularity,
95 size_t byte_translation_factor,
96 MemoryType type);
97 };
98
99 // G1RegionToSpaceMapper implementation where
100 // part of space is mapped to dram and part to nv-dimm
101 class G1RegionToHeteroSpaceMapper : public G1RegionToSpaceMapper {
102 private:
103 size_t _pages_per_region;
104 ReservedSpace _rs;
105 G1RegionToSpaceMapper* _dram_mapper;
106 uint _num_committed_dram;
107 uint _num_committed_nvdimm;
108 uint _start_index_of_nvdimm;
109 uint _start_index_of_dram;
110 size_t _page_size;
111 size_t _commit_factor;
112 MemoryType _type;
113
114 public:
115 G1RegionToHeteroSpaceMapper(ReservedSpace rs, size_t used_size, size_t page_size, size_t region_granularity, size_t commit_factor, MemoryType type);
116 bool initialize();
117 uint num_committed_dram() const;
118 uint num_committed_nvdimm() const;
119
120 virtual void commit_regions(uint start_idx, size_t num_regions = 1, WorkGang* pretouch_workers = NULL);
121 virtual void uncommit_regions(uint start_idx, size_t num_regions = 1);
122 };
123 #endif // SHARE_VM_GC_G1_G1REGIONTOSPACEMAPPER_HPP
|