0N/A/*
1636N/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#ifndef SHARE_VM_MEMORY_BLOCKOFFSETTABLE_HPP
1879N/A#define SHARE_VM_MEMORY_BLOCKOFFSETTABLE_HPP
1879N/A
1879N/A#include "memory/memRegion.hpp"
1879N/A#include "runtime/virtualspace.hpp"
1879N/A#include "utilities/globalDefinitions.hpp"
1879N/A
0N/A// The CollectedHeap type requires subtypes to implement a method
0N/A// "block_start". For some subtypes, notably generational
0N/A// systems using card-table-based write barriers, the efficiency of this
0N/A// operation may be important. Implementations of the "BlockOffsetArray"
0N/A// class may be useful in providing such efficient implementations.
0N/A//
0N/A// BlockOffsetTable (abstract)
0N/A// - BlockOffsetArray (abstract)
0N/A// - BlockOffsetArrayNonContigSpace
0N/A// - BlockOffsetArrayContigSpace
0N/A//
0N/A
0N/Aclass ContiguousSpace;
0N/Aclass SerializeOopClosure;
0N/A
0N/A//////////////////////////////////////////////////////////////////////////
0N/A// The BlockOffsetTable "interface"
0N/A//////////////////////////////////////////////////////////////////////////
0N/Aclass BlockOffsetTable VALUE_OBJ_CLASS_SPEC {
0N/A friend class VMStructs;
0N/Aprotected:
0N/A // These members describe the region covered by the table.
0N/A
0N/A // The space this table is covering.
0N/A HeapWord* _bottom; // == reserved.start
0N/A HeapWord* _end; // End of currently allocated region.
0N/A
0N/Apublic:
0N/A // Initialize the table to cover the given space.
0N/A // The contents of the initial table are undefined.
0N/A BlockOffsetTable(HeapWord* bottom, HeapWord* end):
0N/A _bottom(bottom), _end(end) {
0N/A assert(_bottom <= _end, "arguments out of order");
0N/A }
0N/A
0N/A // Note that the committed size of the covered space may have changed,
0N/A // so the table size might also wish to change.
0N/A virtual void resize(size_t new_word_size) = 0;
0N/A
0N/A virtual void set_bottom(HeapWord* new_bottom) {
0N/A assert(new_bottom <= _end, "new_bottom > _end");
0N/A _bottom = new_bottom;
0N/A resize(pointer_delta(_end, _bottom));
0N/A }
0N/A
0N/A // Requires "addr" to be contained by a block, and returns the address of
0N/A // the start of that block.
0N/A virtual HeapWord* block_start_unsafe(const void* addr) const = 0;
0N/A
0N/A // Returns the address of the start of the block containing "addr", or
0N/A // else "null" if it is covered by no block.
0N/A HeapWord* block_start(const void* addr) const;
0N/A};
0N/A
0N/A//////////////////////////////////////////////////////////////////////////
0N/A// One implementation of "BlockOffsetTable," the BlockOffsetArray,
0N/A// divides the covered region into "N"-word subregions (where
0N/A// "N" = 2^"LogN". An array with an entry for each such subregion
0N/A// indicates how far back one must go to find the start of the
0N/A// chunk that includes the first word of the subregion.
0N/A//
0N/A// Each BlockOffsetArray is owned by a Space. However, the actual array
0N/A// may be shared by several BlockOffsetArrays; this is useful
0N/A// when a single resizable area (such as a generation) is divided up into
0N/A// several spaces in which contiguous allocation takes place. (Consider,
0N/A// for example, the garbage-first generation.)
0N/A
0N/A// Here is the shared array type.
0N/A//////////////////////////////////////////////////////////////////////////
0N/A// BlockOffsetSharedArray
0N/A//////////////////////////////////////////////////////////////////////////
3863N/Aclass BlockOffsetSharedArray: public CHeapObj<mtGC> {
0N/A friend class BlockOffsetArray;
0N/A friend class BlockOffsetArrayNonContigSpace;
0N/A friend class BlockOffsetArrayContigSpace;
0N/A friend class VMStructs;
0N/A
0N/A private:
0N/A enum SomePrivateConstants {
0N/A LogN = 9,
0N/A LogN_words = LogN - LogHeapWordSize,
0N/A N_bytes = 1 << LogN,
0N/A N_words = 1 << LogN_words
0N/A };
0N/A
1636N/A bool _init_to_zero;
1636N/A
0N/A // The reserved region covered by the shared array.
0N/A MemRegion _reserved;
0N/A
0N/A // End of the current committed region.
0N/A HeapWord* _end;
0N/A
0N/A // Array for keeping offsets for retrieving object start fast given an
0N/A // address.
0N/A VirtualSpace _vs;
0N/A u_char* _offset_array; // byte array keeping backwards offsets
0N/A
0N/A protected:
0N/A // Bounds checking accessors:
0N/A // For performance these have to devolve to array accesses in product builds.
0N/A u_char offset_array(size_t index) const {
0N/A assert(index < _vs.committed_size(), "index out of range");
0N/A return _offset_array[index];
0N/A }
1636N/A // An assertion-checking helper method for the set_offset_array() methods below.
1636N/A void check_reducing_assertion(bool reducing);
1636N/A
1636N/A void set_offset_array(size_t index, u_char offset, bool reducing = false) {
1636N/A check_reducing_assertion(reducing);
0N/A assert(index < _vs.committed_size(), "index out of range");
1636N/A assert(!reducing || _offset_array[index] >= offset, "Not reducing");
0N/A _offset_array[index] = offset;
0N/A }
1636N/A
1636N/A void set_offset_array(size_t index, HeapWord* high, HeapWord* low, bool reducing = false) {
1636N/A check_reducing_assertion(reducing);
0N/A assert(index < _vs.committed_size(), "index out of range");
0N/A assert(high >= low, "addresses out of order");
0N/A assert(pointer_delta(high, low) <= N_words, "offset too large");
1636N/A assert(!reducing || _offset_array[index] >= (u_char)pointer_delta(high, low),
1636N/A "Not reducing");
0N/A _offset_array[index] = (u_char)pointer_delta(high, low);
0N/A }
1636N/A
1636N/A void set_offset_array(HeapWord* left, HeapWord* right, u_char offset, bool reducing = false) {
1636N/A check_reducing_assertion(reducing);
0N/A assert(index_for(right - 1) < _vs.committed_size(),
0N/A "right address out of range");
0N/A assert(left < right, "Heap addresses out of order");
0N/A size_t num_cards = pointer_delta(right, left) >> LogN_words;
1438N/A
1438N/A // Below, we may use an explicit loop instead of memset()
1438N/A // because on certain platforms memset() can give concurrent
1438N/A // readers "out-of-thin-air," phantom zeros; see 6948537.
1438N/A if (UseMemSetInBOT) {
1438N/A memset(&_offset_array[index_for(left)], offset, num_cards);
1438N/A } else {
1438N/A size_t i = index_for(left);
1438N/A const size_t end = i + num_cards;
1438N/A for (; i < end; i++) {
1652N/A // Elided until CR 6977974 is fixed properly.
1652N/A // assert(!reducing || _offset_array[i] >= offset, "Not reducing");
1438N/A _offset_array[i] = offset;
1438N/A }
1438N/A }
0N/A }
0N/A
1636N/A void set_offset_array(size_t left, size_t right, u_char offset, bool reducing = false) {
1636N/A check_reducing_assertion(reducing);
0N/A assert(right < _vs.committed_size(), "right address out of range");
0N/A assert(left <= right, "indexes out of order");
0N/A size_t num_cards = right - left + 1;
1438N/A
1438N/A // Below, we may use an explicit loop instead of memset
1438N/A // because on certain platforms memset() can give concurrent
1438N/A // readers "out-of-thin-air," phantom zeros; see 6948537.
1438N/A if (UseMemSetInBOT) {
1438N/A memset(&_offset_array[left], offset, num_cards);
1438N/A } else {
1438N/A size_t i = left;
1438N/A const size_t end = i + num_cards;
1438N/A for (; i < end; i++) {
1652N/A // Elided until CR 6977974 is fixed properly.
1652N/A // assert(!reducing || _offset_array[i] >= offset, "Not reducing");
1438N/A _offset_array[i] = offset;
1438N/A }
1438N/A }
0N/A }
0N/A
0N/A void check_offset_array(size_t index, HeapWord* high, HeapWord* low) const {
0N/A assert(index < _vs.committed_size(), "index out of range");
0N/A assert(high >= low, "addresses out of order");
0N/A assert(pointer_delta(high, low) <= N_words, "offset too large");
0N/A assert(_offset_array[index] == pointer_delta(high, low),
0N/A "Wrong offset");
0N/A }
0N/A
0N/A bool is_card_boundary(HeapWord* p) const;
0N/A
0N/A // Return the number of slots needed for an offset array
0N/A // that covers mem_region_words words.
0N/A // We always add an extra slot because if an object
0N/A // ends on a card boundary we put a 0 in the next
0N/A // offset array slot, so we want that slot always
0N/A // to be reserved.
0N/A
0N/A size_t compute_size(size_t mem_region_words) {
0N/A size_t number_of_slots = (mem_region_words / N_words) + 1;
0N/A return ReservedSpace::allocation_align_size_up(number_of_slots);
0N/A }
0N/A
0N/Apublic:
0N/A // Initialize the table to cover from "base" to (at least)
0N/A // "base + init_word_size". In the future, the table may be expanded
0N/A // (see "resize" below) up to the size of "_reserved" (which must be at
0N/A // least "init_word_size".) The contents of the initial table are
0N/A // undefined; it is the responsibility of the constituent
0N/A // BlockOffsetTable(s) to initialize cards.
0N/A BlockOffsetSharedArray(MemRegion reserved, size_t init_word_size);
0N/A
0N/A // Notes a change in the committed size of the region covered by the
0N/A // table. The "new_word_size" may not be larger than the size of the
0N/A // reserved region this table covers.
0N/A void resize(size_t new_word_size);
0N/A
0N/A void set_bottom(HeapWord* new_bottom);
0N/A
1636N/A // Whether entries should be initialized to zero. Used currently only for
1636N/A // error checking.
1636N/A void set_init_to_zero(bool val) { _init_to_zero = val; }
1636N/A bool init_to_zero() { return _init_to_zero; }
1636N/A
0N/A // Updates all the BlockOffsetArray's sharing this shared array to
0N/A // reflect the current "top"'s of their spaces.
0N/A void update_offset_arrays(); // Not yet implemented!
0N/A
0N/A // Return the appropriate index into "_offset_array" for "p".
0N/A size_t index_for(const void* p) const;
0N/A
0N/A // Return the address indicating the start of the region corresponding to
0N/A // "index" in "_offset_array".
0N/A HeapWord* address_for_index(size_t index) const;
0N/A
301N/A // Return the address "p" incremented by the size of
301N/A // a region. This method does not align the address
301N/A // returned to the start of a region. It is a simple
301N/A // primitive.
301N/A HeapWord* inc_by_region_size(HeapWord* p) const { return p + N_words; }
301N/A
0N/A // Shared space support
0N/A void serialize(SerializeOopClosure* soc, HeapWord* start, HeapWord* end);
0N/A};
0N/A
0N/A//////////////////////////////////////////////////////////////////////////
0N/A// The BlockOffsetArray whose subtypes use the BlockOffsetSharedArray.
0N/A//////////////////////////////////////////////////////////////////////////
0N/Aclass BlockOffsetArray: public BlockOffsetTable {
0N/A friend class VMStructs;
342N/A friend class G1BlockOffsetArray; // temp. until we restructure and cleanup
0N/A protected:
0N/A // The following enums are used by do_block_internal() below
0N/A enum Action {
0N/A Action_single, // BOT records a single block (see single_block())
0N/A Action_mark, // BOT marks the start of a block (see mark_block())
0N/A Action_check // Check that BOT records block correctly
0N/A // (see verify_single_block()).
0N/A };
0N/A
0N/A enum SomePrivateConstants {
0N/A N_words = BlockOffsetSharedArray::N_words,
0N/A LogN = BlockOffsetSharedArray::LogN,
0N/A // entries "e" of at least N_words mean "go back by Base^(e-N_words)."
0N/A // All entries are less than "N_words + N_powers".
0N/A LogBase = 4,
0N/A Base = (1 << LogBase),
0N/A N_powers = 14
0N/A };
0N/A
0N/A static size_t power_to_cards_back(uint i) {
3996N/A return (size_t)1 << (LogBase * i);
0N/A }
0N/A static size_t power_to_words_back(uint i) {
0N/A return power_to_cards_back(i) * N_words;
0N/A }
0N/A static size_t entry_to_cards_back(u_char entry) {
0N/A assert(entry >= N_words, "Precondition");
0N/A return power_to_cards_back(entry - N_words);
0N/A }
0N/A static size_t entry_to_words_back(u_char entry) {
0N/A assert(entry >= N_words, "Precondition");
0N/A return power_to_words_back(entry - N_words);
0N/A }
0N/A
0N/A // The shared array, which is shared with other BlockOffsetArray's
0N/A // corresponding to different spaces within a generation or span of
0N/A // memory.
0N/A BlockOffsetSharedArray* _array;
0N/A
0N/A // The space that owns this subregion.
0N/A Space* _sp;
0N/A
0N/A // If true, array entries are initialized to 0; otherwise, they are
0N/A // initialized to point backwards to the beginning of the covered region.
0N/A bool _init_to_zero;
0N/A
1636N/A // An assertion-checking helper method for the set_remainder*() methods below.
1636N/A void check_reducing_assertion(bool reducing) { _array->check_reducing_assertion(reducing); }
1636N/A
0N/A // Sets the entries
0N/A // corresponding to the cards starting at "start" and ending at "end"
0N/A // to point back to the card before "start": the interval [start, end)
1636N/A // is right-open. The last parameter, reducing, indicates whether the
1636N/A // updates to individual entries always reduce the entry from a higher
1636N/A // to a lower value. (For example this would hold true during a temporal
1636N/A // regime during which only block splits were updating the BOT.
1636N/A void set_remainder_to_point_to_start(HeapWord* start, HeapWord* end, bool reducing = false);
0N/A // Same as above, except that the args here are a card _index_ interval
0N/A // that is closed: [start_index, end_index]
1636N/A void set_remainder_to_point_to_start_incl(size_t start, size_t end, bool reducing = false);
0N/A
0N/A // A helper function for BOT adjustment/verification work
1636N/A void do_block_internal(HeapWord* blk_start, HeapWord* blk_end, Action action, bool reducing = false);
0N/A
0N/A public:
0N/A // The space may not have its bottom and top set yet, which is why the
0N/A // region is passed as a parameter. If "init_to_zero" is true, the
0N/A // elements of the array are initialized to zero. Otherwise, they are
0N/A // initialized to point backwards to the beginning.
0N/A BlockOffsetArray(BlockOffsetSharedArray* array, MemRegion mr,
1636N/A bool init_to_zero_);
0N/A
0N/A // Note: this ought to be part of the constructor, but that would require
0N/A // "this" to be passed as a parameter to a member constructor for
0N/A // the containing concrete subtype of Space.
0N/A // This would be legal C++, but MS VC++ doesn't allow it.
0N/A void set_space(Space* sp) { _sp = sp; }
0N/A
0N/A // Resets the covered region to the given "mr".
0N/A void set_region(MemRegion mr) {
0N/A _bottom = mr.start();
0N/A _end = mr.end();
0N/A }
0N/A
0N/A // Note that the committed size of the covered space may have changed,
0N/A // so the table size might also wish to change.
0N/A virtual void resize(size_t new_word_size) {
0N/A HeapWord* new_end = _bottom + new_word_size;
0N/A if (_end < new_end && !init_to_zero()) {
0N/A // verify that the old and new boundaries are also card boundaries
0N/A assert(_array->is_card_boundary(_end),
0N/A "_end not a card boundary");
0N/A assert(_array->is_card_boundary(new_end),
0N/A "new _end would not be a card boundary");
0N/A // set all the newly added cards
0N/A _array->set_offset_array(_end, new_end, N_words);
0N/A }
0N/A _end = new_end; // update _end
0N/A }
0N/A
0N/A // Adjust the BOT to show that it has a single block in the
0N/A // range [blk_start, blk_start + size). All necessary BOT
0N/A // cards are adjusted, but _unallocated_block isn't.
0N/A void single_block(HeapWord* blk_start, HeapWord* blk_end);
0N/A void single_block(HeapWord* blk, size_t size) {
0N/A single_block(blk, blk + size);
0N/A }
0N/A
0N/A // When the alloc_block() call returns, the block offset table should
0N/A // have enough information such that any subsequent block_start() call
0N/A // with an argument equal to an address that is within the range
0N/A // [blk_start, blk_end) would return the value blk_start, provided
0N/A // there have been no calls in between that reset this information
0N/A // (e.g. see BlockOffsetArrayNonContigSpace::single_block() call
0N/A // for an appropriate range covering the said interval).
0N/A // These methods expect to be called with [blk_start, blk_end)
0N/A // representing a block of memory in the heap.
0N/A virtual void alloc_block(HeapWord* blk_start, HeapWord* blk_end);
0N/A void alloc_block(HeapWord* blk, size_t size) {
0N/A alloc_block(blk, blk + size);
0N/A }
0N/A
0N/A // If true, initialize array slots with no allocated blocks to zero.
0N/A // Otherwise, make them point back to the front.
0N/A bool init_to_zero() { return _init_to_zero; }
1636N/A // Corresponding setter
1636N/A void set_init_to_zero(bool val) {
1636N/A _init_to_zero = val;
1636N/A assert(_array != NULL, "_array should be non-NULL");
1636N/A _array->set_init_to_zero(val);
1636N/A }
0N/A
0N/A // Debugging
0N/A // Return the index of the last entry in the "active" region.
0N/A virtual size_t last_active_index() const = 0;
0N/A // Verify the block offset table
0N/A void verify() const;
0N/A void check_all_cards(size_t left_card, size_t right_card) const;
0N/A};
0N/A
0N/A////////////////////////////////////////////////////////////////////////////
0N/A// A subtype of BlockOffsetArray that takes advantage of the fact
0N/A// that its underlying space is a NonContiguousSpace, so that some
0N/A// specialized interfaces can be made available for spaces that
0N/A// manipulate the table.
0N/A////////////////////////////////////////////////////////////////////////////
0N/Aclass BlockOffsetArrayNonContigSpace: public BlockOffsetArray {
0N/A friend class VMStructs;
0N/A private:
0N/A // The portion [_unallocated_block, _sp.end()) of the space that
0N/A // is a single block known not to contain any objects.
0N/A // NOTE: See BlockOffsetArrayUseUnallocatedBlock flag.
0N/A HeapWord* _unallocated_block;
0N/A
0N/A public:
0N/A BlockOffsetArrayNonContigSpace(BlockOffsetSharedArray* array, MemRegion mr):
0N/A BlockOffsetArray(array, mr, false),
0N/A _unallocated_block(_bottom) { }
0N/A
0N/A // accessor
0N/A HeapWord* unallocated_block() const {
0N/A assert(BlockOffsetArrayUseUnallocatedBlock,
0N/A "_unallocated_block is not being maintained");
0N/A return _unallocated_block;
0N/A }
0N/A
0N/A void set_unallocated_block(HeapWord* block) {
0N/A assert(BlockOffsetArrayUseUnallocatedBlock,
0N/A "_unallocated_block is not being maintained");
0N/A assert(block >= _bottom && block <= _end, "out of range");
0N/A _unallocated_block = block;
0N/A }
0N/A
0N/A // These methods expect to be called with [blk_start, blk_end)
0N/A // representing a block of memory in the heap.
0N/A void alloc_block(HeapWord* blk_start, HeapWord* blk_end);
0N/A void alloc_block(HeapWord* blk, size_t size) {
0N/A alloc_block(blk, blk + size);
0N/A }
0N/A
0N/A // The following methods are useful and optimized for a
0N/A // non-contiguous space.
0N/A
0N/A // Given a block [blk_start, blk_start + full_blk_size), and
0N/A // a left_blk_size < full_blk_size, adjust the BOT to show two
0N/A // blocks [blk_start, blk_start + left_blk_size) and
0N/A // [blk_start + left_blk_size, blk_start + full_blk_size).
0N/A // It is assumed (and verified in the non-product VM) that the
0N/A // BOT was correct for the original block.
0N/A void split_block(HeapWord* blk_start, size_t full_blk_size,
0N/A size_t left_blk_size);
0N/A
0N/A // Adjust BOT to show that it has a block in the range
0N/A // [blk_start, blk_start + size). Only the first card
0N/A // of BOT is touched. It is assumed (and verified in the
0N/A // non-product VM) that the remaining cards of the block
0N/A // are correct.
1636N/A void mark_block(HeapWord* blk_start, HeapWord* blk_end, bool reducing = false);
1636N/A void mark_block(HeapWord* blk, size_t size, bool reducing = false) {
1636N/A mark_block(blk, blk + size, reducing);
0N/A }
0N/A
0N/A // Adjust _unallocated_block to indicate that a particular
0N/A // block has been newly allocated or freed. It is assumed (and
0N/A // verified in the non-product VM) that the BOT is correct for
0N/A // the given block.
1636N/A void allocated(HeapWord* blk_start, HeapWord* blk_end, bool reducing = false) {
0N/A // Verify that the BOT shows [blk, blk + blk_size) to be one block.
0N/A verify_single_block(blk_start, blk_end);
0N/A if (BlockOffsetArrayUseUnallocatedBlock) {
0N/A _unallocated_block = MAX2(_unallocated_block, blk_end);
0N/A }
0N/A }
0N/A
1636N/A void allocated(HeapWord* blk, size_t size, bool reducing = false) {
1636N/A allocated(blk, blk + size, reducing);
0N/A }
0N/A
0N/A void freed(HeapWord* blk_start, HeapWord* blk_end);
1636N/A void freed(HeapWord* blk, size_t size);
0N/A
0N/A HeapWord* block_start_unsafe(const void* addr) const;
0N/A
0N/A // Requires "addr" to be the start of a card and returns the
0N/A // start of the block that contains the given address.
0N/A HeapWord* block_start_careful(const void* addr) const;
0N/A
0N/A // Verification & debugging: ensure that the offset table reflects
0N/A // the fact that the block [blk_start, blk_end) or [blk, blk + size)
0N/A // is a single block of storage. NOTE: can't const this because of
0N/A // call to non-const do_block_internal() below.
0N/A void verify_single_block(HeapWord* blk_start, HeapWord* blk_end)
0N/A PRODUCT_RETURN;
0N/A void verify_single_block(HeapWord* blk, size_t size) PRODUCT_RETURN;
0N/A
0N/A // Verify that the given block is before _unallocated_block
0N/A void verify_not_unallocated(HeapWord* blk_start, HeapWord* blk_end)
0N/A const PRODUCT_RETURN;
0N/A void verify_not_unallocated(HeapWord* blk, size_t size)
0N/A const PRODUCT_RETURN;
0N/A
0N/A // Debugging support
0N/A virtual size_t last_active_index() const;
0N/A};
0N/A
0N/A////////////////////////////////////////////////////////////////////////////
0N/A// A subtype of BlockOffsetArray that takes advantage of the fact
0N/A// that its underlying space is a ContiguousSpace, so that its "active"
0N/A// region can be more efficiently tracked (than for a non-contiguous space).
0N/A////////////////////////////////////////////////////////////////////////////
0N/Aclass BlockOffsetArrayContigSpace: public BlockOffsetArray {
0N/A friend class VMStructs;
0N/A private:
0N/A // allocation boundary at which offset array must be updated
0N/A HeapWord* _next_offset_threshold;
0N/A size_t _next_offset_index; // index corresponding to that boundary
0N/A
0N/A // Work function when allocation start crosses threshold.
0N/A void alloc_block_work(HeapWord* blk_start, HeapWord* blk_end);
0N/A
0N/A public:
0N/A BlockOffsetArrayContigSpace(BlockOffsetSharedArray* array, MemRegion mr):
0N/A BlockOffsetArray(array, mr, true) {
0N/A _next_offset_threshold = NULL;
0N/A _next_offset_index = 0;
0N/A }
0N/A
0N/A void set_contig_space(ContiguousSpace* sp) { set_space((Space*)sp); }
0N/A
0N/A // Initialize the threshold for an empty heap.
0N/A HeapWord* initialize_threshold();
0N/A // Zero out the entry for _bottom (offset will be zero)
0N/A void zero_bottom_entry();
0N/A
0N/A // Return the next threshold, the point at which the table should be
0N/A // updated.
0N/A HeapWord* threshold() const { return _next_offset_threshold; }
0N/A
0N/A // In general, these methods expect to be called with
0N/A // [blk_start, blk_end) representing a block of memory in the heap.
0N/A // In this implementation, however, we are OK even if blk_start and/or
0N/A // blk_end are NULL because NULL is represented as 0, and thus
0N/A // never exceeds the "_next_offset_threshold".
0N/A void alloc_block(HeapWord* blk_start, HeapWord* blk_end) {
0N/A if (blk_end > _next_offset_threshold) {
0N/A alloc_block_work(blk_start, blk_end);
0N/A }
0N/A }
0N/A void alloc_block(HeapWord* blk, size_t size) {
0N/A alloc_block(blk, blk + size);
0N/A }
0N/A
0N/A HeapWord* block_start_unsafe(const void* addr) const;
0N/A
0N/A void serialize(SerializeOopClosure* soc);
0N/A
0N/A // Debugging support
0N/A virtual size_t last_active_index() const;
0N/A};
1879N/A
1879N/A#endif // SHARE_VM_MEMORY_BLOCKOFFSETTABLE_HPP