src/share/vm/memory/blockOffsetTable.inline.hpp

Mon, 23 Jun 2008 16:49:37 -0700

author
ysr
date
Mon, 23 Jun 2008 16:49:37 -0700
changeset 782
60fb9c4db4e6
parent 435
a61af66fc99e
child 1907
c18cbe5936b8
permissions
-rw-r--r--

6718086: CMS assert: _concurrent_iteration_safe_limit update missed
Summary: Initialize the field correctly in ContiguousSpace's constructor and initialize() methods, using the latter for the survivor spaces upon initial construction or a subsequent resizing of the young generation. Add some missing Space sub-class constructors.
Reviewed-by: apetrusenko

duke@435 1 /*
duke@435 2 * Copyright 2000-2002 Sun Microsystems, Inc. All Rights Reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
duke@435 19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
duke@435 20 * CA 95054 USA or visit www.sun.com if you need additional information or
duke@435 21 * have any questions.
duke@435 22 *
duke@435 23 */
duke@435 24
duke@435 25 //////////////////////////////////////////////////////////////////////////
duke@435 26 // BlockOffsetTable inlines
duke@435 27 //////////////////////////////////////////////////////////////////////////
duke@435 28 inline HeapWord* BlockOffsetTable::block_start(const void* addr) const {
duke@435 29 if (addr >= _bottom && addr < _end) {
duke@435 30 return block_start_unsafe(addr);
duke@435 31 } else {
duke@435 32 return NULL;
duke@435 33 }
duke@435 34 }
duke@435 35
duke@435 36 //////////////////////////////////////////////////////////////////////////
duke@435 37 // BlockOffsetSharedArray inlines
duke@435 38 //////////////////////////////////////////////////////////////////////////
duke@435 39 inline size_t BlockOffsetSharedArray::index_for(const void* p) const {
duke@435 40 char* pc = (char*)p;
duke@435 41 assert(pc >= (char*)_reserved.start() &&
duke@435 42 pc < (char*)_reserved.end(),
duke@435 43 "p not in range.");
duke@435 44 size_t delta = pointer_delta(pc, _reserved.start(), sizeof(char));
duke@435 45 size_t result = delta >> LogN;
duke@435 46 assert(result < _vs.committed_size(), "bad index from address");
duke@435 47 return result;
duke@435 48 }
duke@435 49
duke@435 50 inline HeapWord* BlockOffsetSharedArray::address_for_index(size_t index) const {
duke@435 51 assert(index < _vs.committed_size(), "bad index");
duke@435 52 HeapWord* result = _reserved.start() + (index << LogN_words);
duke@435 53 assert(result >= _reserved.start() && result < _reserved.end(),
duke@435 54 "bad address from index");
duke@435 55 return result;
duke@435 56 }
duke@435 57
duke@435 58
duke@435 59 //////////////////////////////////////////////////////////////////////////
duke@435 60 // BlockOffsetArrayNonContigSpace inlines
duke@435 61 //////////////////////////////////////////////////////////////////////////
duke@435 62 inline void BlockOffsetArrayNonContigSpace::freed(HeapWord* blk_start,
duke@435 63 HeapWord* blk_end) {
duke@435 64 // Verify that the BOT shows [blk_start, blk_end) to be one block.
duke@435 65 verify_single_block(blk_start, blk_end);
duke@435 66 // adjust _unallocated_block upward or downward
duke@435 67 // as appropriate
duke@435 68 if (BlockOffsetArrayUseUnallocatedBlock) {
duke@435 69 assert(_unallocated_block <= _end,
duke@435 70 "Inconsistent value for _unallocated_block");
duke@435 71 if (blk_end >= _unallocated_block && blk_start <= _unallocated_block) {
duke@435 72 // CMS-specific note: a block abutting _unallocated_block to
duke@435 73 // its left is being freed, a new block is being added or
duke@435 74 // we are resetting following a compaction
duke@435 75 _unallocated_block = blk_start;
duke@435 76 }
duke@435 77 }
duke@435 78 }

mercurial