blockOffsetTable.inline.hpp revision 1636
0N/A/*
1472N/A * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1472N/A * or visit www.oracle.com if you need additional information or have any
1472N/A * questions.
0N/A *
0N/A */
0N/A
1879N/A//////////////////////////////////////////////////////////////////////////
1879N/A// BlockOffsetTable inlines
1879N/A//////////////////////////////////////////////////////////////////////////
1879N/Ainline HeapWord* BlockOffsetTable::block_start(const void* addr) const {
1879N/A if (addr >= _bottom && addr < _end) {
1879N/A return block_start_unsafe(addr);
1879N/A } else {
1879N/A return NULL;
1879N/A }
1879N/A}
1879N/A
1879N/A//////////////////////////////////////////////////////////////////////////
1879N/A// BlockOffsetSharedArray inlines
1879N/A//////////////////////////////////////////////////////////////////////////
1879N/Ainline size_t BlockOffsetSharedArray::index_for(const void* p) const {
0N/A char* pc = (char*)p;
0N/A assert(pc >= (char*)_reserved.start() &&
0N/A pc < (char*)_reserved.end(),
0N/A "p not in range.");
0N/A size_t delta = pointer_delta(pc, _reserved.start(), sizeof(char));
367N/A size_t result = delta >> LogN;
367N/A assert(result < _vs.committed_size(), "bad index from address");
367N/A return result;
367N/A}
367N/A
0N/Ainline HeapWord* BlockOffsetSharedArray::address_for_index(size_t index) const {
367N/A assert(index < _vs.committed_size(), "bad index");
367N/A HeapWord* result = _reserved.start() + (index << LogN_words);
0N/A assert(result >= _reserved.start() && result < _reserved.end(),
0N/A "bad address from index");
0N/A return result;
0N/A}
0N/A
0N/Ainline void BlockOffsetSharedArray::check_reducing_assertion(bool reducing) {
0N/A assert(reducing || !SafepointSynchronize::is_at_safepoint() || init_to_zero() ||
0N/A Thread::current()->is_VM_thread() ||
0N/A Thread::current()->is_ConcurrentGC_thread() ||
0N/A ((!Thread::current()->is_ConcurrentGC_thread()) &&
0N/A ParGCRareEvent_lock->owned_by_self()), "Crack");
0N/A}
0N/A
0N/A//////////////////////////////////////////////////////////////////////////
0N/A// BlockOffsetArrayNonContigSpace inlines
0N/A//////////////////////////////////////////////////////////////////////////
0N/Ainline void BlockOffsetArrayNonContigSpace::freed(HeapWord* blk,
0N/A size_t size) {
0N/A freed(blk, blk + size);
0N/A}
0N/A
0N/Ainline void BlockOffsetArrayNonContigSpace::freed(HeapWord* blk_start,
0N/A HeapWord* blk_end) {
0N/A // Verify that the BOT shows [blk_start, blk_end) to be one block.
367N/A verify_single_block(blk_start, blk_end);
0N/A // adjust _unallocated_block upward or downward
0N/A // as appropriate
0N/A if (BlockOffsetArrayUseUnallocatedBlock) {
0N/A assert(_unallocated_block <= _end,
0N/A "Inconsistent value for _unallocated_block");
0N/A if (blk_end >= _unallocated_block && blk_start <= _unallocated_block) {
0N/A // CMS-specific note: a block abutting _unallocated_block to
0N/A // its left is being freed, a new block is being added or
0N/A // we are resetting following a compaction
0N/A _unallocated_block = blk_start;
0N/A }
0N/A }
0N/A}
0N/A