Print this page
8236073: G1: Use SoftMaxHeapSize to guide GC heuristics
Split |
Close |
Expand all |
Collapse all |
--- old/src/hotspot/share/gc/g1/g1RegionToSpaceMapper.hpp
+++ new/src/hotspot/share/gc/g1/g1RegionToSpaceMapper.hpp
1 1 /*
2 2 * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 4 *
5 5 * This code is free software; you can redistribute it and/or modify it
6 6 * under the terms of the GNU General Public License version 2 only, as
7 7 * published by the Free Software Foundation.
8 8 *
9 9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 12 * version 2 for more details (a copy is included in the LICENSE file that
13 13 * accompanied this code).
14 14 *
15 15 * You should have received a copy of the GNU General Public License version
16 16 * 2 along with this work; if not, write to the Free Software Foundation,
17 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 18 *
19 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 20 * or visit www.oracle.com if you need additional information or have any
21 21 * questions.
22 22 *
23 23 */
24 24
25 25 #ifndef SHARE_GC_G1_G1REGIONTOSPACEMAPPER_HPP
26 26 #define SHARE_GC_G1_G1REGIONTOSPACEMAPPER_HPP
27 27
28 28 #include "gc/g1/g1PageBasedVirtualSpace.hpp"
29 29 #include "memory/allocation.hpp"
30 30 #include "utilities/debug.hpp"
31 31
32 32 class WorkGang;
33 33
34 34 class G1MappingChangedListener {
35 35 public:
36 36 // Fired after commit of the memory, i.e. the memory this listener is registered
37 37 // for can be accessed.
38 38 // Zero_filled indicates that the memory can be considered as filled with zero bytes
39 39 // when called.
40 40 virtual void on_commit(uint start_idx, size_t num_regions, bool zero_filled) = 0;
41 41 };
42 42
43 43 // Maps region based commit/uncommit requests to the underlying page sized virtual
44 44 // space.
45 45 class G1RegionToSpaceMapper : public CHeapObj<mtGC> {
46 46 private:
47 47 G1MappingChangedListener* _listener;
48 48 protected:
49 49 // Backing storage.
50 50 G1PageBasedVirtualSpace _storage;
51 51
52 52 size_t _region_granularity;
53 53 // Mapping management
54 54 CHeapBitMap _commit_map;
55 55
56 56 MemoryType _memory_type;
57 57
58 58 G1RegionToSpaceMapper(ReservedSpace rs, size_t used_size, size_t page_size, size_t region_granularity, size_t commit_factor, MemoryType type);
59 59
60 60 void fire_on_commit(uint start_idx, size_t num_regions, bool zero_filled);
61 61 public:
62 62 MemRegion reserved() { return _storage.reserved(); }
63 63
64 64 size_t reserved_size() { return _storage.reserved_size(); }
65 65 size_t committed_size() { return _storage.committed_size(); }
66 66
67 67 void set_mapping_changed_listener(G1MappingChangedListener* listener) { _listener = listener; }
68 68
69 69 virtual ~G1RegionToSpaceMapper() {}
70 70
71 71 bool is_committed(uintptr_t idx) const {
72 72 return _commit_map.at(idx);
73 73 }
74 74
75 75 void commit_and_set_special();
76 76 virtual void commit_regions(uint start_idx, size_t num_regions = 1, WorkGang* pretouch_workers = NULL) = 0;
77 77 virtual void uncommit_regions(uint start_idx, size_t num_regions = 1) = 0;
78 78
79 79 // Creates an appropriate G1RegionToSpaceMapper for the given parameters.
80 80 // The actual space to be used within the given reservation is given by actual_size.
81 81 // This is because some OSes need to round up the reservation size to guarantee
82 82 // alignment of page_size.
83 83 // The byte_translation_factor defines how many bytes in a region correspond to
84 84 // a single byte in the data structure this mapper is for.
85 85 // Eg. in the card table, this value corresponds to the size a single card
86 86 // table entry corresponds to in the heap.
87 87 static G1RegionToSpaceMapper* create_mapper(ReservedSpace rs,
88 88 size_t actual_size,
89 89 size_t page_size,
↓ open down ↓ |
89 lines elided |
↑ open up ↑ |
90 90 size_t region_granularity,
91 91 size_t byte_translation_factor,
92 92 MemoryType type);
93 93
94 94 static G1RegionToSpaceMapper* create_heap_mapper(ReservedSpace rs,
95 95 size_t actual_size,
96 96 size_t page_size,
97 97 size_t region_granularity,
98 98 size_t byte_translation_factor,
99 99 MemoryType type);
100 +
101 + // If the mapper can commit/uncommit region parallelly
102 + virtual bool can_parallelly_commit_and_uncommit() const = 0;
100 103 };
101 104
102 105 // G1RegionToSpaceMapper implementation where
103 106 // part of space is mapped to dram and part to nv-dimm
104 107 class G1RegionToHeteroSpaceMapper : public G1RegionToSpaceMapper {
105 108 private:
106 109 ReservedSpace _rs;
107 110 G1RegionToSpaceMapper* _dram_mapper;
108 111 uint _num_committed_dram;
109 112 uint _num_committed_nvdimm;
110 113 uint _start_index_of_dram;
111 114 size_t _page_size;
112 115 size_t _commit_factor;
↓ open down ↓ |
3 lines elided |
↑ open up ↑ |
113 116 MemoryType _type;
114 117
115 118 public:
116 119 G1RegionToHeteroSpaceMapper(ReservedSpace rs, size_t used_size, size_t page_size, size_t region_granularity, size_t commit_factor, MemoryType type);
117 120 bool initialize();
118 121 uint num_committed_dram() const;
119 122 uint num_committed_nvdimm() const;
120 123
121 124 virtual void commit_regions(uint start_idx, size_t num_regions = 1, WorkGang* pretouch_workers = NULL);
122 125 virtual void uncommit_regions(uint start_idx, size_t num_regions = 1);
126 +
127 + virtual bool can_parallelly_commit_and_uncommit() const;
123 128 };
124 129 #endif // SHARE_GC_G1_G1REGIONTOSPACEMAPPER_HPP
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX