< prev index next >

src/share/vm/gc/shared/blockOffsetTable.hpp

Print this page

        

*** 44,53 **** --- 44,81 ---- // - BlockOffsetArrayContigSpace // class ContiguousSpace; + class BOTConstants : public AllStatic { + public: + static const uint LogN = 9; + static const uint LogN_words = LogN - LogHeapWordSize; + static const uint N_bytes = 1 << LogN; + static const uint N_words = 1 << LogN_words; + // entries "e" of at least N_words mean "go back by Base^(e-N_words)." + // All entries are less than "N_words + N_powers". + static const uint LogBase = 4; + static const uint Base = (1 << LogBase); + static const uint N_powers = 14; + + static size_t power_to_cards_back(uint i) { + return (size_t)1 << (LogBase * i); + } + static size_t power_to_words_back(uint i) { + return power_to_cards_back(i) * N_words; + } + static size_t entry_to_cards_back(u_char entry) { + assert(entry >= N_words, "Precondition"); + return power_to_cards_back(entry - N_words); + } + static size_t entry_to_words_back(u_char entry) { + assert(entry >= N_words, "Precondition"); + return power_to_words_back(entry - N_words); + } + }; + ////////////////////////////////////////////////////////////////////////// // The BlockOffsetTable "interface" ////////////////////////////////////////////////////////////////////////// class BlockOffsetTable VALUE_OBJ_CLASS_SPEC { friend class VMStructs;
*** 107,123 **** friend class BlockOffsetArrayNonContigSpace; friend class BlockOffsetArrayContigSpace; friend class VMStructs; private: - enum SomePrivateConstants { - LogN = 9, - LogN_words = LogN - LogHeapWordSize, - N_bytes = 1 << LogN, - N_words = 1 << LogN_words - }; - bool _init_to_zero; // The reserved region covered by the shared array. MemRegion _reserved; --- 135,144 ----
*** 161,182 **** void set_offset_array(size_t index, HeapWord* high, HeapWord* low, bool reducing = false) { check_reducing_assertion(reducing); assert(index < _vs.committed_size(), "index out of range"); assert(high >= low, "addresses out of order"); ! assert(pointer_delta(high, low) <= N_words, "offset too large"); assert(!reducing || _offset_array[index] >= (u_char)pointer_delta(high, low), "Not reducing"); _offset_array[index] = (u_char)pointer_delta(high, low); } void set_offset_array(HeapWord* left, HeapWord* right, u_char offset, bool reducing = false) { check_reducing_assertion(reducing); assert(index_for(right - 1) < _vs.committed_size(), "right address out of range"); assert(left < right, "Heap addresses out of order"); ! size_t num_cards = pointer_delta(right, left) >> LogN_words; fill_range(index_for(left), num_cards, offset); } void set_offset_array(size_t left, size_t right, u_char offset, bool reducing = false) { --- 182,203 ---- void set_offset_array(size_t index, HeapWord* high, HeapWord* low, bool reducing = false) { check_reducing_assertion(reducing); assert(index < _vs.committed_size(), "index out of range"); assert(high >= low, "addresses out of order"); ! assert(pointer_delta(high, low) <= BOTConstants::N_words, "offset too large"); assert(!reducing || _offset_array[index] >= (u_char)pointer_delta(high, low), "Not reducing"); _offset_array[index] = (u_char)pointer_delta(high, low); } void set_offset_array(HeapWord* left, HeapWord* right, u_char offset, bool reducing = false) { check_reducing_assertion(reducing); assert(index_for(right - 1) < _vs.committed_size(), "right address out of range"); assert(left < right, "Heap addresses out of order"); ! size_t num_cards = pointer_delta(right, left) >> BOTConstants::LogN_words; fill_range(index_for(left), num_cards, offset); } void set_offset_array(size_t left, size_t right, u_char offset, bool reducing = false) {
*** 189,199 **** } void check_offset_array(size_t index, HeapWord* high, HeapWord* low) const { assert(index < _vs.committed_size(), "index out of range"); assert(high >= low, "addresses out of order"); ! assert(pointer_delta(high, low) <= N_words, "offset too large"); assert(_offset_array[index] == pointer_delta(high, low), "Wrong offset"); } bool is_card_boundary(HeapWord* p) const; --- 210,220 ---- } void check_offset_array(size_t index, HeapWord* high, HeapWord* low) const { assert(index < _vs.committed_size(), "index out of range"); assert(high >= low, "addresses out of order"); ! assert(pointer_delta(high, low) <= BOTConstants::N_words, "offset too large"); assert(_offset_array[index] == pointer_delta(high, low), "Wrong offset"); } bool is_card_boundary(HeapWord* p) const;
*** 204,214 **** // ends on a card boundary we put a 0 in the next // offset array slot, so we want that slot always // to be reserved. size_t compute_size(size_t mem_region_words) { ! size_t number_of_slots = (mem_region_words / N_words) + 1; return ReservedSpace::allocation_align_size_up(number_of_slots); } public: // Initialize the table to cover from "base" to (at least) --- 225,235 ---- // ends on a card boundary we put a 0 in the next // offset array slot, so we want that slot always // to be reserved. size_t compute_size(size_t mem_region_words) { ! size_t number_of_slots = (mem_region_words / BOTConstants::N_words) + 1; return ReservedSpace::allocation_align_size_up(number_of_slots); } public: // Initialize the table to cover from "base" to (at least)
*** 246,290 **** ////////////////////////////////////////////////////////////////////////// // The BlockOffsetArray whose subtypes use the BlockOffsetSharedArray. ////////////////////////////////////////////////////////////////////////// class BlockOffsetArray: public BlockOffsetTable { friend class VMStructs; - friend class G1BlockOffsetTablePart; // temp. until we restructure and cleanup protected: // The following enums are used by do_block_internal() below enum Action { Action_single, // BOT records a single block (see single_block()) Action_mark, // BOT marks the start of a block (see mark_block()) Action_check // Check that BOT records block correctly // (see verify_single_block()). }; - enum SomePrivateConstants { - N_words = BlockOffsetSharedArray::N_words, - LogN = BlockOffsetSharedArray::LogN, - // entries "e" of at least N_words mean "go back by Base^(e-N_words)." - // All entries are less than "N_words + N_powers". - LogBase = 4, - Base = (1 << LogBase), - N_powers = 14 - }; - - static size_t power_to_cards_back(uint i) { - return (size_t)1 << (LogBase * i); - } - static size_t power_to_words_back(uint i) { - return power_to_cards_back(i) * N_words; - } - static size_t entry_to_cards_back(u_char entry) { - assert(entry >= N_words, "Precondition"); - return power_to_cards_back(entry - N_words); - } - static size_t entry_to_words_back(u_char entry) { - assert(entry >= N_words, "Precondition"); - return power_to_words_back(entry - N_words); - } - // The shared array, which is shared with other BlockOffsetArray's // corresponding to different spaces within a generation or span of // memory. BlockOffsetSharedArray* _array; --- 267,285 ----
*** 342,352 **** assert(_array->is_card_boundary(_end), "_end not a card boundary"); assert(_array->is_card_boundary(new_end), "new _end would not be a card boundary"); // set all the newly added cards ! _array->set_offset_array(_end, new_end, N_words); } _end = new_end; // update _end } // Adjust the BOT to show that it has a single block in the --- 337,347 ---- assert(_array->is_card_boundary(_end), "_end not a card boundary"); assert(_array->is_card_boundary(new_end), "new _end would not be a card boundary"); // set all the newly added cards ! _array->set_offset_array(_end, new_end, BOTConstants::N_words); } _end = new_end; // update _end } // Adjust the BOT to show that it has a single block in the
< prev index next >