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

Sun, 01 Apr 2012 17:04:26 -0400

author
acorn
date
Sun, 01 Apr 2012 17:04:26 -0400
changeset 3686
749b1464aa81
parent 2314
f95d63e2154a
child 4037
da91efe96a93
permissions
-rw-r--r--

Merge

duke@435 1 /*
ysr@2071 2 * Copyright (c) 2000, 2010, Oracle and/or its affiliates. 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 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
duke@435 22 *
duke@435 23 */
duke@435 24
stefank@2314 25 #ifndef SHARE_VM_MEMORY_BLOCKOFFSETTABLE_INLINE_HPP
stefank@2314 26 #define SHARE_VM_MEMORY_BLOCKOFFSETTABLE_INLINE_HPP
stefank@2314 27
stefank@2314 28 #include "memory/blockOffsetTable.hpp"
stefank@2314 29 #include "memory/space.hpp"
stefank@2314 30 #include "runtime/safepoint.hpp"
stefank@2314 31 #ifndef SERIALGC
stefank@2314 32 #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp"
stefank@2314 33 #endif
stefank@2314 34
duke@435 35 //////////////////////////////////////////////////////////////////////////
duke@435 36 // BlockOffsetTable inlines
duke@435 37 //////////////////////////////////////////////////////////////////////////
duke@435 38 inline HeapWord* BlockOffsetTable::block_start(const void* addr) const {
duke@435 39 if (addr >= _bottom && addr < _end) {
duke@435 40 return block_start_unsafe(addr);
duke@435 41 } else {
duke@435 42 return NULL;
duke@435 43 }
duke@435 44 }
duke@435 45
duke@435 46 //////////////////////////////////////////////////////////////////////////
duke@435 47 // BlockOffsetSharedArray inlines
duke@435 48 //////////////////////////////////////////////////////////////////////////
duke@435 49 inline size_t BlockOffsetSharedArray::index_for(const void* p) const {
duke@435 50 char* pc = (char*)p;
duke@435 51 assert(pc >= (char*)_reserved.start() &&
duke@435 52 pc < (char*)_reserved.end(),
duke@435 53 "p not in range.");
duke@435 54 size_t delta = pointer_delta(pc, _reserved.start(), sizeof(char));
duke@435 55 size_t result = delta >> LogN;
duke@435 56 assert(result < _vs.committed_size(), "bad index from address");
duke@435 57 return result;
duke@435 58 }
duke@435 59
duke@435 60 inline HeapWord* BlockOffsetSharedArray::address_for_index(size_t index) const {
duke@435 61 assert(index < _vs.committed_size(), "bad index");
duke@435 62 HeapWord* result = _reserved.start() + (index << LogN_words);
duke@435 63 assert(result >= _reserved.start() && result < _reserved.end(),
duke@435 64 "bad address from index");
duke@435 65 return result;
duke@435 66 }
duke@435 67
ysr@2071 68 inline void BlockOffsetSharedArray::check_reducing_assertion(bool reducing) {
ysr@2071 69 assert(reducing || !SafepointSynchronize::is_at_safepoint() || init_to_zero() ||
ysr@2071 70 Thread::current()->is_VM_thread() ||
ysr@2071 71 Thread::current()->is_ConcurrentGC_thread() ||
ysr@2071 72 ((!Thread::current()->is_ConcurrentGC_thread()) &&
ysr@2071 73 ParGCRareEvent_lock->owned_by_self()), "Crack");
ysr@2071 74 }
duke@435 75
duke@435 76 //////////////////////////////////////////////////////////////////////////
duke@435 77 // BlockOffsetArrayNonContigSpace inlines
duke@435 78 //////////////////////////////////////////////////////////////////////////
ysr@2071 79 inline void BlockOffsetArrayNonContigSpace::freed(HeapWord* blk,
ysr@2071 80 size_t size) {
ysr@2071 81 freed(blk, blk + size);
ysr@2071 82 }
ysr@2071 83
duke@435 84 inline void BlockOffsetArrayNonContigSpace::freed(HeapWord* blk_start,
duke@435 85 HeapWord* blk_end) {
duke@435 86 // Verify that the BOT shows [blk_start, blk_end) to be one block.
duke@435 87 verify_single_block(blk_start, blk_end);
duke@435 88 // adjust _unallocated_block upward or downward
duke@435 89 // as appropriate
duke@435 90 if (BlockOffsetArrayUseUnallocatedBlock) {
duke@435 91 assert(_unallocated_block <= _end,
duke@435 92 "Inconsistent value for _unallocated_block");
duke@435 93 if (blk_end >= _unallocated_block && blk_start <= _unallocated_block) {
duke@435 94 // CMS-specific note: a block abutting _unallocated_block to
duke@435 95 // its left is being freed, a new block is being added or
duke@435 96 // we are resetting following a compaction
duke@435 97 _unallocated_block = blk_start;
duke@435 98 }
duke@435 99 }
duke@435 100 }
stefank@2314 101
stefank@2314 102 #endif // SHARE_VM_MEMORY_BLOCKOFFSETTABLE_INLINE_HPP

mercurial