1 /*
2 * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
42
43 protected:
44 MemRegion _reserved; // Used for simple containment tests
45 PSVirtualSpace* _virtual_space; // Controls mapping and unmapping of virtual mem
46 ObjectStartArray _start_array; // Keeps track of where objects start in a 512b block
47 MutableSpace* _object_space; // Where all the objects live
48 #if INCLUDE_SERIALGC
49 PSMarkSweepDecorator* _object_mark_sweep; // The mark sweep view of _object_space
50 #endif
51 const char* const _name; // Name of this generation.
52
53 // Performance Counters
54 PSGenerationCounters* _gen_counters;
55 SpaceCounters* _space_counters;
56
57 // Sizing information, in bytes, set in constructor
58 const size_t _init_gen_size;
59 const size_t _min_gen_size;
60 const size_t _max_gen_size;
61
62 // Used when initializing the _name field.
63 static inline const char* select_name();
64
65 #ifdef ASSERT
66 void assert_block_in_covered_region(MemRegion new_memregion) {
67 // Explictly capture current covered_region in a local
68 MemRegion covered_region = this->start_array()->covered_region();
69 assert(covered_region.contains(new_memregion),
70 "new region is not in covered_region [ " PTR_FORMAT ", " PTR_FORMAT " ], "
71 "new region [ " PTR_FORMAT ", " PTR_FORMAT " ], "
72 "object space [ " PTR_FORMAT ", " PTR_FORMAT " ]",
73 p2i(covered_region.start()),
74 p2i(covered_region.end()),
75 p2i(new_memregion.start()),
76 p2i(new_memregion.end()),
77 p2i(this->object_space()->used_region().start()),
78 p2i(this->object_space()->used_region().end()));
79 }
80 #endif
81
120 void post_resize();
121
122 public:
123 // Initialize the generation.
124 PSOldGen(ReservedSpace rs, size_t alignment,
125 size_t initial_size, size_t min_size, size_t max_size,
126 const char* perf_data_name, int level);
127
128 PSOldGen(size_t initial_size, size_t min_size, size_t max_size,
129 const char* perf_data_name, int level);
130
131 virtual void initialize(ReservedSpace rs, size_t alignment,
132 const char* perf_data_name, int level);
133 void initialize_virtual_space(ReservedSpace rs, size_t alignment);
134 virtual void initialize_work(const char* perf_data_name, int level);
135 virtual void initialize_performance_counters(const char* perf_data_name, int level);
136
137 MemRegion reserved() const { return _reserved; }
138 virtual size_t max_gen_size() { return _max_gen_size; }
139 size_t min_gen_size() { return _min_gen_size; }
140
141 // Returns limit on the maximum size of the generation. This
142 // is the same as _max_gen_size for PSOldGen but need not be
143 // for a derived class.
144 virtual size_t gen_size_limit();
145
146 bool is_in(const void* p) const {
147 return _virtual_space->contains((void *)p);
148 }
149
150 bool is_in_reserved(const void* p) const {
151 return reserved().contains(p);
152 }
153
154 MutableSpace* object_space() const { return _object_space; }
155 #if INCLUDE_SERIALGC
156 PSMarkSweepDecorator* object_mark_sweep() const { return _object_mark_sweep; }
157 #endif
158 ObjectStartArray* start_array() { return &_start_array; }
159 PSVirtualSpace* virtual_space() const { return _virtual_space;}
160
201 void print_used_change(size_t prev_used) const;
202
203 void verify();
204 void verify_object_start_array();
205
206 // These should not used
207 virtual void reset_after_change();
208
209 // These should not used
210 virtual size_t available_for_expansion();
211 virtual size_t available_for_contraction();
212
213 void space_invariants() PRODUCT_RETURN;
214
215 // Performance Counter support
216 void update_counters();
217
218 // Printing support
219 virtual const char* name() const { return _name; }
220
221 // Debugging support
222 // Save the tops of all spaces for later use during mangling.
223 void record_spaces_top() PRODUCT_RETURN;
224 };
225
226 #endif // SHARE_VM_GC_PARALLEL_PSOLDGEN_HPP
|
1 /*
2 * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
42
43 protected:
44 MemRegion _reserved; // Used for simple containment tests
45 PSVirtualSpace* _virtual_space; // Controls mapping and unmapping of virtual mem
46 ObjectStartArray _start_array; // Keeps track of where objects start in a 512b block
47 MutableSpace* _object_space; // Where all the objects live
48 #if INCLUDE_SERIALGC
49 PSMarkSweepDecorator* _object_mark_sweep; // The mark sweep view of _object_space
50 #endif
51 const char* const _name; // Name of this generation.
52
53 // Performance Counters
54 PSGenerationCounters* _gen_counters;
55 SpaceCounters* _space_counters;
56
57 // Sizing information, in bytes, set in constructor
58 const size_t _init_gen_size;
59 const size_t _min_gen_size;
60 const size_t _max_gen_size;
61
62 // NVDIMM handle to expand/shrink old gen on NVDIMM.
63 int _nvdimm_fd;
64
65 // Used when initializing the _name field.
66 static inline const char* select_name();
67
68 #ifdef ASSERT
69 void assert_block_in_covered_region(MemRegion new_memregion) {
70 // Explictly capture current covered_region in a local
71 MemRegion covered_region = this->start_array()->covered_region();
72 assert(covered_region.contains(new_memregion),
73 "new region is not in covered_region [ " PTR_FORMAT ", " PTR_FORMAT " ], "
74 "new region [ " PTR_FORMAT ", " PTR_FORMAT " ], "
75 "object space [ " PTR_FORMAT ", " PTR_FORMAT " ]",
76 p2i(covered_region.start()),
77 p2i(covered_region.end()),
78 p2i(new_memregion.start()),
79 p2i(new_memregion.end()),
80 p2i(this->object_space()->used_region().start()),
81 p2i(this->object_space()->used_region().end()));
82 }
83 #endif
84
123 void post_resize();
124
125 public:
126 // Initialize the generation.
127 PSOldGen(ReservedSpace rs, size_t alignment,
128 size_t initial_size, size_t min_size, size_t max_size,
129 const char* perf_data_name, int level);
130
131 PSOldGen(size_t initial_size, size_t min_size, size_t max_size,
132 const char* perf_data_name, int level);
133
134 virtual void initialize(ReservedSpace rs, size_t alignment,
135 const char* perf_data_name, int level);
136 void initialize_virtual_space(ReservedSpace rs, size_t alignment);
137 virtual void initialize_work(const char* perf_data_name, int level);
138 virtual void initialize_performance_counters(const char* perf_data_name, int level);
139
140 MemRegion reserved() const { return _reserved; }
141 virtual size_t max_gen_size() { return _max_gen_size; }
142 size_t min_gen_size() { return _min_gen_size; }
143 int nvdimm_fd() { return _nvdimm_fd; }
144 // Returns limit on the maximum size of the generation. This
145 // is the same as _max_gen_size for PSOldGen but need not be
146 // for a derived class.
147 virtual size_t gen_size_limit();
148
149 bool is_in(const void* p) const {
150 return _virtual_space->contains((void *)p);
151 }
152
153 bool is_in_reserved(const void* p) const {
154 return reserved().contains(p);
155 }
156
157 MutableSpace* object_space() const { return _object_space; }
158 #if INCLUDE_SERIALGC
159 PSMarkSweepDecorator* object_mark_sweep() const { return _object_mark_sweep; }
160 #endif
161 ObjectStartArray* start_array() { return &_start_array; }
162 PSVirtualSpace* virtual_space() const { return _virtual_space;}
163
204 void print_used_change(size_t prev_used) const;
205
206 void verify();
207 void verify_object_start_array();
208
209 // These should not used
210 virtual void reset_after_change();
211
212 // These should not used
213 virtual size_t available_for_expansion();
214 virtual size_t available_for_contraction();
215
216 void space_invariants() PRODUCT_RETURN;
217
218 // Performance Counter support
219 void update_counters();
220
221 // Printing support
222 virtual const char* name() const { return _name; }
223
224 // set up fd for NVDIMM
225 void setup_fd(int fd) {_nvdimm_fd = fd; }
226 // Debugging support
227 // Save the tops of all spaces for later use during mangling.
228 void record_spaces_top() PRODUCT_RETURN;
229 };
230
231 #endif // SHARE_VM_GC_PARALLEL_PSOLDGEN_HPP
|