comparison src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp @ 1716:be3f9c242c9d

6948538: CMS: BOT walkers can fall into object allocation and initialization cracks Summary: GC workers now recognize an intermediate transient state of blocks which are allocated but have not yet completed initialization. blk_start() calls do not attempt to determine the size of a block in the transient state, rather waiting for the block to become initialized so that it is safe to query its size. Audited and ensured the order of initialization of object fields (klass, free bit and size) to respect block state transition protocol. Also included some new assertion checking code enabled in debug mode. Reviewed-by: chrisphi, johnc, poonam
author ysr
date Mon, 16 Aug 2010 15:58:42 -0700
parents e9ff18c4ace7
children f95d63e2154a
comparison
equal deleted inserted replaced
1713:7fcd5f39bd7a 1716:be3f9c242c9d
1 /* 1 /*
2 * Copyright (c) 2001, 2009, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 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 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
46 } 46 }
47 HeapWord* _ptr; 47 HeapWord* _ptr;
48 size_t _word_size; 48 size_t _word_size;
49 size_t _refillSize; 49 size_t _refillSize;
50 size_t _allocation_size_limit; // largest size that will be allocated 50 size_t _allocation_size_limit; // largest size that will be allocated
51
52 void print_on(outputStream* st) const;
51 }; 53 };
52 54
53 // Concrete subclass of CompactibleSpace that implements 55 // Concrete subclass of CompactibleSpace that implements
54 // a free list space, such as used in the concurrent mark sweep 56 // a free list space, such as used in the concurrent mark sweep
55 // generation. 57 // generation.
247 void reportIndexedFreeListStatistics() const; 249 void reportIndexedFreeListStatistics() const;
248 size_t maxChunkSizeInIndexedFreeLists() const; 250 size_t maxChunkSizeInIndexedFreeLists() const;
249 size_t numFreeBlocksInIndexedFreeLists() const; 251 size_t numFreeBlocksInIndexedFreeLists() const;
250 // Accessor 252 // Accessor
251 HeapWord* unallocated_block() const { 253 HeapWord* unallocated_block() const {
252 HeapWord* ub = _bt.unallocated_block(); 254 if (BlockOffsetArrayUseUnallocatedBlock) {
253 assert(ub >= bottom() && 255 HeapWord* ub = _bt.unallocated_block();
254 ub <= end(), "space invariant"); 256 assert(ub >= bottom() &&
255 return ub; 257 ub <= end(), "space invariant");
258 return ub;
259 } else {
260 return end();
261 }
256 } 262 }
257 void freed(HeapWord* start, size_t size) { 263 void freed(HeapWord* start, size_t size) {
258 _bt.freed(start, size); 264 _bt.freed(start, size);
259 } 265 }
260 266
474 // space has been done. 480 // space has been done.
475 virtual void reset_after_compaction(); 481 virtual void reset_after_compaction();
476 482
477 // Debugging support 483 // Debugging support
478 void print() const; 484 void print() const;
485 void print_on(outputStream* st) const;
479 void prepare_for_verify(); 486 void prepare_for_verify();
480 void verify(bool allow_dirty) const; 487 void verify(bool allow_dirty) const;
481 void verifyFreeLists() const PRODUCT_RETURN; 488 void verifyFreeLists() const PRODUCT_RETURN;
482 void verifyIndexedFreeLists() const; 489 void verifyIndexedFreeLists() const;
483 void verifyIndexedFreeList(size_t size) const; 490 void verifyIndexedFreeList(size_t size) const;