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 *
23 */
24
25 #include "precompiled.hpp"
26 #include "gc/serial/genMarkSweep.hpp"
27 #include "gc/shared/blockOffsetTable.inline.hpp"
28 #include "gc/shared/cardTableRS.hpp"
29 #include "gc/shared/collectedHeap.inline.hpp"
30 #include "gc/shared/gcLocker.hpp"
31 #include "gc/shared/gcTimer.hpp"
32 #include "gc/shared/gcTrace.hpp"
33 #include "gc/shared/genCollectedHeap.hpp"
34 #include "gc/shared/genOopClosures.hpp"
35 #include "gc/shared/genOopClosures.inline.hpp"
36 #include "gc/shared/generation.hpp"
37 #include "gc/shared/space.inline.hpp"
38 #include "gc/shared/spaceDecorator.hpp"
39 #include "logging/log.hpp"
40 #include "memory/allocation.inline.hpp"
41 #include "oops/oop.inline.hpp"
42 #include "runtime/java.hpp"
43 #include "utilities/copy.hpp"
44 #include "utilities/events.hpp"
45
46 Generation::Generation(ReservedSpace rs, size_t initial_size) :
286 void Generation::object_iterate(ObjectClosure* cl) {
287 GenerationObjIterateClosure blk(cl);
288 space_iterate(&blk);
289 }
290
291 class GenerationSafeObjIterateClosure : public SpaceClosure {
292 private:
293 ObjectClosure* _cl;
294 public:
295 virtual void do_space(Space* s) {
296 s->safe_object_iterate(_cl);
297 }
298 GenerationSafeObjIterateClosure(ObjectClosure* cl) : _cl(cl) {}
299 };
300
301 void Generation::safe_object_iterate(ObjectClosure* cl) {
302 GenerationSafeObjIterateClosure blk(cl);
303 space_iterate(&blk);
304 }
305
306 void Generation::prepare_for_compaction(CompactPoint* cp) {
307 // Generic implementation, can be specialized
308 CompactibleSpace* space = first_compaction_space();
309 while (space != NULL) {
310 space->prepare_for_compaction(cp);
311 space = space->next_compaction_space();
312 }
313 }
314
315 class AdjustPointersClosure: public SpaceClosure {
316 public:
317 void do_space(Space* sp) {
318 sp->adjust_pointers();
319 }
320 };
321
322 void Generation::adjust_pointers() {
323 // Note that this is done over all spaces, not just the compactible
324 // ones.
325 AdjustPointersClosure blk;
326 space_iterate(&blk, true);
327 }
328
329 void Generation::compact() {
330 CompactibleSpace* sp = first_compaction_space();
331 while (sp != NULL) {
332 sp->compact();
333 sp = sp->next_compaction_space();
334 }
335 }
|
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 *
23 */
24
25 #include "precompiled.hpp"
26 #include "gc/shared/blockOffsetTable.inline.hpp"
27 #include "gc/shared/cardTableRS.hpp"
28 #include "gc/shared/collectedHeap.inline.hpp"
29 #include "gc/shared/gcLocker.hpp"
30 #include "gc/shared/gcTimer.hpp"
31 #include "gc/shared/gcTrace.hpp"
32 #include "gc/shared/genCollectedHeap.hpp"
33 #include "gc/shared/genOopClosures.hpp"
34 #include "gc/shared/genOopClosures.inline.hpp"
35 #include "gc/shared/generation.hpp"
36 #include "gc/shared/space.inline.hpp"
37 #include "gc/shared/spaceDecorator.hpp"
38 #include "logging/log.hpp"
39 #include "memory/allocation.inline.hpp"
40 #include "oops/oop.inline.hpp"
41 #include "runtime/java.hpp"
42 #include "utilities/copy.hpp"
43 #include "utilities/events.hpp"
44
45 Generation::Generation(ReservedSpace rs, size_t initial_size) :
285 void Generation::object_iterate(ObjectClosure* cl) {
286 GenerationObjIterateClosure blk(cl);
287 space_iterate(&blk);
288 }
289
290 class GenerationSafeObjIterateClosure : public SpaceClosure {
291 private:
292 ObjectClosure* _cl;
293 public:
294 virtual void do_space(Space* s) {
295 s->safe_object_iterate(_cl);
296 }
297 GenerationSafeObjIterateClosure(ObjectClosure* cl) : _cl(cl) {}
298 };
299
300 void Generation::safe_object_iterate(ObjectClosure* cl) {
301 GenerationSafeObjIterateClosure blk(cl);
302 space_iterate(&blk);
303 }
304
305 #if INCLUDE_SERIALGC
306
307 void Generation::prepare_for_compaction(CompactPoint* cp) {
308 // Generic implementation, can be specialized
309 CompactibleSpace* space = first_compaction_space();
310 while (space != NULL) {
311 space->prepare_for_compaction(cp);
312 space = space->next_compaction_space();
313 }
314 }
315
316 class AdjustPointersClosure: public SpaceClosure {
317 public:
318 void do_space(Space* sp) {
319 sp->adjust_pointers();
320 }
321 };
322
323 void Generation::adjust_pointers() {
324 // Note that this is done over all spaces, not just the compactible
325 // ones.
326 AdjustPointersClosure blk;
327 space_iterate(&blk, true);
328 }
329
330 void Generation::compact() {
331 CompactibleSpace* sp = first_compaction_space();
332 while (sp != NULL) {
333 sp->compact();
334 sp = sp->next_compaction_space();
335 }
336 }
337
338 #endif // INCLUDE_SERIALGC
|