comparison src/share/vm/memory/blockOffsetTable.inline.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 c18cbe5936b8
children f95d63e2154a
comparison
equal deleted inserted replaced
1713:7fcd5f39bd7a 1716:be3f9c242c9d
1 /* 1 /*
2 * Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2000, 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.
53 assert(result >= _reserved.start() && result < _reserved.end(), 53 assert(result >= _reserved.start() && result < _reserved.end(),
54 "bad address from index"); 54 "bad address from index");
55 return result; 55 return result;
56 } 56 }
57 57
58 inline void BlockOffsetSharedArray::check_reducing_assertion(bool reducing) {
59 assert(reducing || !SafepointSynchronize::is_at_safepoint() || init_to_zero() ||
60 Thread::current()->is_VM_thread() ||
61 Thread::current()->is_ConcurrentGC_thread() ||
62 ((!Thread::current()->is_ConcurrentGC_thread()) &&
63 ParGCRareEvent_lock->owned_by_self()), "Crack");
64 }
58 65
59 ////////////////////////////////////////////////////////////////////////// 66 //////////////////////////////////////////////////////////////////////////
60 // BlockOffsetArrayNonContigSpace inlines 67 // BlockOffsetArrayNonContigSpace inlines
61 ////////////////////////////////////////////////////////////////////////// 68 //////////////////////////////////////////////////////////////////////////
69 inline void BlockOffsetArrayNonContigSpace::freed(HeapWord* blk,
70 size_t size) {
71 freed(blk, blk + size);
72 }
73
62 inline void BlockOffsetArrayNonContigSpace::freed(HeapWord* blk_start, 74 inline void BlockOffsetArrayNonContigSpace::freed(HeapWord* blk_start,
63 HeapWord* blk_end) { 75 HeapWord* blk_end) {
64 // Verify that the BOT shows [blk_start, blk_end) to be one block. 76 // Verify that the BOT shows [blk_start, blk_end) to be one block.
65 verify_single_block(blk_start, blk_end); 77 verify_single_block(blk_start, blk_end);
66 // adjust _unallocated_block upward or downward 78 // adjust _unallocated_block upward or downward