Bug Summary

File:jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp
Warning:line 256, column 3
Value stored to 'index' is never read

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -triple x86_64-pc-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name g1BlockOffsetTable.cpp -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -mthread-model posix -fno-delete-null-pointer-checks -mframe-pointer=all -relaxed-aliasing -fmath-errno -fno-rounding-math -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -dwarf-column-info -fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir /usr/lib/llvm-10/lib/clang/10.0.0 -I /home/daniel/Projects/java/jdk/build/linux-x86_64-server-fastdebug/hotspot/variant-server/libjvm/objs/precompiled -D __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -D __STDC_CONSTANT_MACROS -D _GNU_SOURCE -D _REENTRANT -D LIBC=gnu -D LINUX -D VM_LITTLE_ENDIAN -D _LP64=1 -D ASSERT -D CHECK_UNHANDLED_OOPS -D TARGET_ARCH_x86 -D INCLUDE_SUFFIX_OS=_linux -D INCLUDE_SUFFIX_CPU=_x86 -D INCLUDE_SUFFIX_COMPILER=_gcc -D TARGET_COMPILER_gcc -D AMD64 -D HOTSPOT_LIB_ARCH="amd64" -D COMPILER1 -D COMPILER2 -I /home/daniel/Projects/java/jdk/build/linux-x86_64-server-fastdebug/hotspot/variant-server/gensrc/adfiles -I /home/daniel/Projects/java/jdk/src/hotspot/share -I /home/daniel/Projects/java/jdk/src/hotspot/os/linux -I /home/daniel/Projects/java/jdk/src/hotspot/os/posix -I /home/daniel/Projects/java/jdk/src/hotspot/cpu/x86 -I /home/daniel/Projects/java/jdk/src/hotspot/os_cpu/linux_x86 -I /home/daniel/Projects/java/jdk/build/linux-x86_64-server-fastdebug/hotspot/variant-server/gensrc -I /home/daniel/Projects/java/jdk/src/hotspot/share/precompiled -I /home/daniel/Projects/java/jdk/src/hotspot/share/include -I /home/daniel/Projects/java/jdk/src/hotspot/os/posix/include -I /home/daniel/Projects/java/jdk/build/linux-x86_64-server-fastdebug/support/modules_include/java.base -I /home/daniel/Projects/java/jdk/build/linux-x86_64-server-fastdebug/support/modules_include/java.base/linux -I /home/daniel/Projects/java/jdk/src/java.base/share/native/libjimage -I /home/daniel/Projects/java/jdk/build/linux-x86_64-server-fastdebug/hotspot/variant-server/gensrc/adfiles -I /home/daniel/Projects/java/jdk/src/hotspot/share -I /home/daniel/Projects/java/jdk/src/hotspot/os/linux -I /home/daniel/Projects/java/jdk/src/hotspot/os/posix -I /home/daniel/Projects/java/jdk/src/hotspot/cpu/x86 -I /home/daniel/Projects/java/jdk/src/hotspot/os_cpu/linux_x86 -I /home/daniel/Projects/java/jdk/build/linux-x86_64-server-fastdebug/hotspot/variant-server/gensrc -D _FORTIFY_SOURCE=2 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/x86_64-linux-gnu/c++/7.5.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/x86_64-linux-gnu/c++/7.5.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/backward -internal-isystem /usr/local/include -internal-isystem /usr/lib/llvm-10/lib/clang/10.0.0/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O3 -Wno-format-zero-length -Wno-unused-parameter -Wno-unused -Wno-parentheses -Wno-comment -Wno-unknown-pragmas -Wno-address -Wno-delete-non-virtual-dtor -Wno-char-subscripts -Wno-array-bounds -Wno-int-in-bool-context -Wno-ignored-qualifiers -Wno-missing-field-initializers -Wno-implicit-fallthrough -Wno-empty-body -Wno-strict-overflow -Wno-sequence-point -Wno-maybe-uninitialized -Wno-misleading-indentation -Wno-cast-function-type -Wno-shift-negative-value -std=c++14 -fdeprecated-macro -fdebug-compilation-dir /home/daniel/Projects/java/jdk/make/hotspot -ferror-limit 19 -fmessage-length 0 -fvisibility hidden -stack-protector 1 -fno-rtti -fgnuc-version=4.2.1 -fobjc-runtime=gcc -fdiagnostics-show-option -vectorize-loops -vectorize-slp -analyzer-output=html -faddrsig -o /home/daniel/Projects/java/scan/2021-12-21-193737-8510-1 -x c++ /home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp
1/*
2 * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25#include "precompiled.hpp"
26#include "gc/g1/g1BlockOffsetTable.inline.hpp"
27#include "gc/g1/g1CollectedHeap.inline.hpp"
28#include "gc/g1/heapRegion.inline.hpp"
29#include "logging/log.hpp"
30#include "oops/oop.inline.hpp"
31#include "runtime/java.hpp"
32#include "services/memTracker.hpp"
33
34
35
36//////////////////////////////////////////////////////////////////////
37// G1BlockOffsetTable
38//////////////////////////////////////////////////////////////////////
39
40G1BlockOffsetTable::G1BlockOffsetTable(MemRegion heap, G1RegionToSpaceMapper* storage) :
41 _reserved(heap), _offset_array(NULL__null) {
42
43 MemRegion bot_reserved = storage->reserved();
44
45 _offset_array = (u_char*)bot_reserved.start();
46
47 log_trace(gc, bot)(!(LogImpl<(LogTag::_gc), (LogTag::_bot), (LogTag::__NO_TAG
), (LogTag::__NO_TAG), (LogTag::__NO_TAG), (LogTag::__NO_TAG)
>::is_level(LogLevel::Trace))) ? (void)0 : LogImpl<(LogTag
::_gc), (LogTag::_bot), (LogTag::__NO_TAG), (LogTag::__NO_TAG
), (LogTag::__NO_TAG), (LogTag::__NO_TAG)>::write<LogLevel
::Trace>
("G1BlockOffsetTable::G1BlockOffsetTable: ");
48 log_trace(gc, bot)(!(LogImpl<(LogTag::_gc), (LogTag::_bot), (LogTag::__NO_TAG
), (LogTag::__NO_TAG), (LogTag::__NO_TAG), (LogTag::__NO_TAG)
>::is_level(LogLevel::Trace))) ? (void)0 : LogImpl<(LogTag
::_gc), (LogTag::_bot), (LogTag::__NO_TAG), (LogTag::__NO_TAG
), (LogTag::__NO_TAG), (LogTag::__NO_TAG)>::write<LogLevel
::Trace>
(" rs.base(): " PTR_FORMAT"0x%016" "l" "x" " rs.size(): " SIZE_FORMAT"%" "l" "u" " rs end(): " PTR_FORMAT"0x%016" "l" "x",
49 p2i(bot_reserved.start()), bot_reserved.byte_size(), p2i(bot_reserved.end()));
50}
51
52bool G1BlockOffsetTable::is_card_boundary(HeapWord* p) const {
53 assert(p >= _reserved.start(), "just checking")do { if (!(p >= _reserved.start())) { (*g_assert_poison) =
'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 53, "assert(" "p >= _reserved.start()" ") failed", "just checking"
); ::breakpoint(); } } while (0)
;
54 size_t delta = pointer_delta(p, _reserved.start());
55 return (delta & right_n_bits((int)BOTConstants::log_card_size_in_words())(((((int)BOTConstants::log_card_size_in_words()) >= BitsPerWord
) ? 0 : (OneBit << ((int)BOTConstants::log_card_size_in_words
()))) - 1)
) == (size_t)NoBits;
56}
57
58#ifdef ASSERT1
59void G1BlockOffsetTable::check_index(size_t index, const char* msg) const {
60 assert((index) < (_reserved.word_size() >> BOTConstants::log_card_size_in_words()),do { if (!((index) < (_reserved.word_size() >> BOTConstants
::log_card_size_in_words()))) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 62, "assert(" "(index) < (_reserved.word_size() >> BOTConstants::log_card_size_in_words())"
") failed", "%s - index: " "%" "l" "u" ", _vs.committed_size: "
"%" "l" "u", msg, (index), (_reserved.word_size() >> BOTConstants
::log_card_size_in_words())); ::breakpoint(); } } while (0)
61 "%s - index: " SIZE_FORMAT ", _vs.committed_size: " SIZE_FORMAT,do { if (!((index) < (_reserved.word_size() >> BOTConstants
::log_card_size_in_words()))) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 62, "assert(" "(index) < (_reserved.word_size() >> BOTConstants::log_card_size_in_words())"
") failed", "%s - index: " "%" "l" "u" ", _vs.committed_size: "
"%" "l" "u", msg, (index), (_reserved.word_size() >> BOTConstants
::log_card_size_in_words())); ::breakpoint(); } } while (0)
62 msg, (index), (_reserved.word_size() >> BOTConstants::log_card_size_in_words()))do { if (!((index) < (_reserved.word_size() >> BOTConstants
::log_card_size_in_words()))) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 62, "assert(" "(index) < (_reserved.word_size() >> BOTConstants::log_card_size_in_words())"
") failed", "%s - index: " "%" "l" "u" ", _vs.committed_size: "
"%" "l" "u", msg, (index), (_reserved.word_size() >> BOTConstants
::log_card_size_in_words())); ::breakpoint(); } } while (0)
;
63 assert(G1CollectedHeap::heap()->is_in(address_for_index_raw(index)),do { if (!(G1CollectedHeap::heap()->is_in(address_for_index_raw
(index)))) { (*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 68, "assert(" "G1CollectedHeap::heap()->is_in(address_for_index_raw(index))"
") failed", "Index " "%" "l" "u" " corresponding to " "0x%016"
"l" "x" " (%u) is not in committed area.", (index), p2i(address_for_index_raw
(index)), G1CollectedHeap::heap()->addr_to_region(address_for_index_raw
(index))); ::breakpoint(); } } while (0)
64 "Index " SIZE_FORMAT " corresponding to " PTR_FORMATdo { if (!(G1CollectedHeap::heap()->is_in(address_for_index_raw
(index)))) { (*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 68, "assert(" "G1CollectedHeap::heap()->is_in(address_for_index_raw(index))"
") failed", "Index " "%" "l" "u" " corresponding to " "0x%016"
"l" "x" " (%u) is not in committed area.", (index), p2i(address_for_index_raw
(index)), G1CollectedHeap::heap()->addr_to_region(address_for_index_raw
(index))); ::breakpoint(); } } while (0)
65 " (%u) is not in committed area.",do { if (!(G1CollectedHeap::heap()->is_in(address_for_index_raw
(index)))) { (*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 68, "assert(" "G1CollectedHeap::heap()->is_in(address_for_index_raw(index))"
") failed", "Index " "%" "l" "u" " corresponding to " "0x%016"
"l" "x" " (%u) is not in committed area.", (index), p2i(address_for_index_raw
(index)), G1CollectedHeap::heap()->addr_to_region(address_for_index_raw
(index))); ::breakpoint(); } } while (0)
66 (index),do { if (!(G1CollectedHeap::heap()->is_in(address_for_index_raw
(index)))) { (*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 68, "assert(" "G1CollectedHeap::heap()->is_in(address_for_index_raw(index))"
") failed", "Index " "%" "l" "u" " corresponding to " "0x%016"
"l" "x" " (%u) is not in committed area.", (index), p2i(address_for_index_raw
(index)), G1CollectedHeap::heap()->addr_to_region(address_for_index_raw
(index))); ::breakpoint(); } } while (0)
67 p2i(address_for_index_raw(index)),do { if (!(G1CollectedHeap::heap()->is_in(address_for_index_raw
(index)))) { (*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 68, "assert(" "G1CollectedHeap::heap()->is_in(address_for_index_raw(index))"
") failed", "Index " "%" "l" "u" " corresponding to " "0x%016"
"l" "x" " (%u) is not in committed area.", (index), p2i(address_for_index_raw
(index)), G1CollectedHeap::heap()->addr_to_region(address_for_index_raw
(index))); ::breakpoint(); } } while (0)
68 G1CollectedHeap::heap()->addr_to_region(address_for_index_raw(index)))do { if (!(G1CollectedHeap::heap()->is_in(address_for_index_raw
(index)))) { (*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 68, "assert(" "G1CollectedHeap::heap()->is_in(address_for_index_raw(index))"
") failed", "Index " "%" "l" "u" " corresponding to " "0x%016"
"l" "x" " (%u) is not in committed area.", (index), p2i(address_for_index_raw
(index)), G1CollectedHeap::heap()->addr_to_region(address_for_index_raw
(index))); ::breakpoint(); } } while (0)
;
69}
70#endif // ASSERT
71
72//////////////////////////////////////////////////////////////////////
73// G1BlockOffsetTablePart
74//////////////////////////////////////////////////////////////////////
75
76G1BlockOffsetTablePart::G1BlockOffsetTablePart(G1BlockOffsetTable* array, HeapRegion* hr) :
77 _next_offset_threshold(NULL__null),
78 _bot(array),
79 _hr(hr)
80{
81}
82
83void G1BlockOffsetTablePart::update() {
84 HeapWord* next_addr = _hr->bottom();
85 HeapWord* const limit = _hr->top();
86
87 HeapWord* prev_addr;
88 while (next_addr < limit) {
89 prev_addr = next_addr;
90 next_addr = prev_addr + block_size(prev_addr);
91 alloc_block(prev_addr, next_addr);
92 }
93 assert(next_addr == limit, "Should stop the scan at the limit.")do { if (!(next_addr == limit)) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 93, "assert(" "next_addr == limit" ") failed", "Should stop the scan at the limit."
); ::breakpoint(); } } while (0)
;
94}
95
96// The arguments follow the normal convention of denoting
97// a right-open interval: [start, end)
98void G1BlockOffsetTablePart:: set_remainder_to_point_to_start(HeapWord* start, HeapWord* end) {
99 assert(start < end, "precondition")do { if (!(start < end)) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 99, "assert(" "start < end" ") failed", "precondition");
::breakpoint(); } } while (0)
;
100 // Write the backskip value for each region.
101 //
102 // offset
103 // card 2nd 3rd
104 // | +- 1st | |
105 // v v v v
106 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-
107 // |x|0|0|0|0|0|0|0|1|1|1|1|1|1| ... |1|1|1|1|2|2|2|2|2|2| ...
108 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-
109 // 11 19 75
110 // 12
111 //
112 // offset card is the card that points to the start of an object
113 // x - offset value of offset card
114 // 1st - start of first logarithmic region
115 // 0 corresponds to logarithmic value N_words + 0 and 2**(3 * 0) = 1
116 // 2nd - start of second logarithmic region
117 // 1 corresponds to logarithmic value N_words + 1 and 2**(3 * 1) = 8
118 // 3rd - start of third logarithmic region
119 // 2 corresponds to logarithmic value N_words + 2 and 2**(3 * 2) = 64
120 //
121 // integer below the block offset entry is an example of
122 // the index of the entry
123 //
124 // Given an address,
125 // Find the index for the address
126 // Find the block offset table entry
127 // Convert the entry to a back slide
128 // (e.g., with today's, offset = 0x81 =>
129 // back slip = 2**(3*(0x81 - N_words)) = 2**3) = 8
130 // Move back N (e.g., 8) entries and repeat with the
131 // value of the new entry
132 //
133 size_t start_card = _bot->index_for(start);
134 size_t end_card = _bot->index_for(end-1);
135 assert(start ==_bot->address_for_index(start_card), "Precondition")do { if (!(start ==_bot->address_for_index(start_card))) {
(*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 135, "assert(" "start ==_bot->address_for_index(start_card)"
") failed", "Precondition"); ::breakpoint(); } } while (0)
;
136 assert(end ==_bot->address_for_index(end_card)+BOTConstants::card_size_in_words(), "Precondition")do { if (!(end ==_bot->address_for_index(end_card)+BOTConstants
::card_size_in_words())) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 136, "assert(" "end ==_bot->address_for_index(end_card)+BOTConstants::card_size_in_words()"
") failed", "Precondition"); ::breakpoint(); } } while (0)
;
137 set_remainder_to_point_to_start_incl(start_card, end_card); // closed interval
138}
139
140// Unlike the normal convention in this code, the argument here denotes
141// a closed, inclusive interval: [start_card, end_card], cf set_remainder_to_point_to_start()
142// above.
143void G1BlockOffsetTablePart::set_remainder_to_point_to_start_incl(size_t start_card, size_t end_card) {
144 assert(start_card <= end_card, "precondition")do { if (!(start_card <= end_card)) { (*g_assert_poison) =
'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 144, "assert(" "start_card <= end_card" ") failed", "precondition"
); ::breakpoint(); } } while (0)
;
145 assert(start_card > _bot->index_for(_hr->bottom()), "Cannot be first card")do { if (!(start_card > _bot->index_for(_hr->bottom(
)))) { (*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 145, "assert(" "start_card > _bot->index_for(_hr->bottom())"
") failed", "Cannot be first card"); ::breakpoint(); } } while
(0)
;
146 assert(_bot->offset_array(start_card-1) <= BOTConstants::card_size_in_words(),do { if (!(_bot->offset_array(start_card-1) <= BOTConstants
::card_size_in_words())) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 147, "assert(" "_bot->offset_array(start_card-1) <= BOTConstants::card_size_in_words()"
") failed", "Offset card has an unexpected value"); ::breakpoint
(); } } while (0)
147 "Offset card has an unexpected value")do { if (!(_bot->offset_array(start_card-1) <= BOTConstants
::card_size_in_words())) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 147, "assert(" "_bot->offset_array(start_card-1) <= BOTConstants::card_size_in_words()"
") failed", "Offset card has an unexpected value"); ::breakpoint
(); } } while (0)
;
148 size_t start_card_for_region = start_card;
149 u_char offset = max_jubyte;
150 for (uint i = 0; i < BOTConstants::N_powers; i++) {
151 // -1 so that the the card with the actual offset is counted. Another -1
152 // so that the reach ends in this region and not at the start
153 // of the next.
154 size_t reach = start_card - 1 + (BOTConstants::power_to_cards_back(i+1) - 1);
155 offset = BOTConstants::card_size_in_words() + i;
156 if (reach >= end_card) {
157 _bot->set_offset_array(start_card_for_region, end_card, offset);
158 start_card_for_region = reach + 1;
159 break;
160 }
161 _bot->set_offset_array(start_card_for_region, reach, offset);
162 start_card_for_region = reach + 1;
163 }
164 assert(start_card_for_region > end_card, "Sanity check")do { if (!(start_card_for_region > end_card)) { (*g_assert_poison
) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 164, "assert(" "start_card_for_region > end_card" ") failed"
, "Sanity check"); ::breakpoint(); } } while (0)
;
165 DEBUG_ONLY(check_all_cards(start_card, end_card);)check_all_cards(start_card, end_card);
166}
167
168// The card-interval [start_card, end_card] is a closed interval; this
169// is an expensive check -- use with care and only under protection of
170// suitable flag.
171void G1BlockOffsetTablePart::check_all_cards(size_t start_card, size_t end_card) const {
172
173 if (end_card < start_card) {
174 return;
175 }
176 guarantee(_bot->offset_array(start_card) == BOTConstants::card_size_in_words(), "Wrong value in second card")do { if (!(_bot->offset_array(start_card) == BOTConstants::
card_size_in_words())) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 176, "guarantee(" "_bot->offset_array(start_card) == BOTConstants::card_size_in_words()"
") failed", "Wrong value in second card"); ::breakpoint(); }
} while (0)
;
177 for (size_t c = start_card + 1; c <= end_card; c++ /* yeah! */) {
178 u_char entry = _bot->offset_array(c);
179 if (c - start_card > BOTConstants::power_to_cards_back(1)) {
180 guarantee(entry > BOTConstants::card_size_in_words(),do { if (!(entry > BOTConstants::card_size_in_words())) { (
*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 185, "guarantee(" "entry > BOTConstants::card_size_in_words()"
") failed", "Should be in logarithmic region - " "entry: %u, "
"_array->offset_array(c): %u, " "N_words: %u", (uint)entry
, (uint)_bot->offset_array(c), BOTConstants::card_size_in_words
()); ::breakpoint(); } } while (0)
181 "Should be in logarithmic region - "do { if (!(entry > BOTConstants::card_size_in_words())) { (
*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 185, "guarantee(" "entry > BOTConstants::card_size_in_words()"
") failed", "Should be in logarithmic region - " "entry: %u, "
"_array->offset_array(c): %u, " "N_words: %u", (uint)entry
, (uint)_bot->offset_array(c), BOTConstants::card_size_in_words
()); ::breakpoint(); } } while (0)
182 "entry: %u, "do { if (!(entry > BOTConstants::card_size_in_words())) { (
*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 185, "guarantee(" "entry > BOTConstants::card_size_in_words()"
") failed", "Should be in logarithmic region - " "entry: %u, "
"_array->offset_array(c): %u, " "N_words: %u", (uint)entry
, (uint)_bot->offset_array(c), BOTConstants::card_size_in_words
()); ::breakpoint(); } } while (0)
183 "_array->offset_array(c): %u, "do { if (!(entry > BOTConstants::card_size_in_words())) { (
*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 185, "guarantee(" "entry > BOTConstants::card_size_in_words()"
") failed", "Should be in logarithmic region - " "entry: %u, "
"_array->offset_array(c): %u, " "N_words: %u", (uint)entry
, (uint)_bot->offset_array(c), BOTConstants::card_size_in_words
()); ::breakpoint(); } } while (0)
184 "N_words: %u",do { if (!(entry > BOTConstants::card_size_in_words())) { (
*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 185, "guarantee(" "entry > BOTConstants::card_size_in_words()"
") failed", "Should be in logarithmic region - " "entry: %u, "
"_array->offset_array(c): %u, " "N_words: %u", (uint)entry
, (uint)_bot->offset_array(c), BOTConstants::card_size_in_words
()); ::breakpoint(); } } while (0)
185 (uint)entry, (uint)_bot->offset_array(c), BOTConstants::card_size_in_words())do { if (!(entry > BOTConstants::card_size_in_words())) { (
*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 185, "guarantee(" "entry > BOTConstants::card_size_in_words()"
") failed", "Should be in logarithmic region - " "entry: %u, "
"_array->offset_array(c): %u, " "N_words: %u", (uint)entry
, (uint)_bot->offset_array(c), BOTConstants::card_size_in_words
()); ::breakpoint(); } } while (0)
;
186 }
187 size_t backskip = BOTConstants::entry_to_cards_back(entry);
188 size_t landing_card = c - backskip;
189 guarantee(landing_card >= (start_card - 1), "Inv")do { if (!(landing_card >= (start_card - 1))) { (*g_assert_poison
) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 189, "guarantee(" "landing_card >= (start_card - 1)" ") failed"
, "Inv"); ::breakpoint(); } } while (0)
;
190 if (landing_card >= start_card) {
191 guarantee(_bot->offset_array(landing_card) <= entry,do { if (!(_bot->offset_array(landing_card) <= entry)) {
(*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 194, "guarantee(" "_bot->offset_array(landing_card) <= entry"
") failed", "Monotonicity - landing_card offset: %u, " "entry: %u"
, (uint)_bot->offset_array(landing_card), (uint)entry); ::
breakpoint(); } } while (0)
192 "Monotonicity - landing_card offset: %u, "do { if (!(_bot->offset_array(landing_card) <= entry)) {
(*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 194, "guarantee(" "_bot->offset_array(landing_card) <= entry"
") failed", "Monotonicity - landing_card offset: %u, " "entry: %u"
, (uint)_bot->offset_array(landing_card), (uint)entry); ::
breakpoint(); } } while (0)
193 "entry: %u",do { if (!(_bot->offset_array(landing_card) <= entry)) {
(*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 194, "guarantee(" "_bot->offset_array(landing_card) <= entry"
") failed", "Monotonicity - landing_card offset: %u, " "entry: %u"
, (uint)_bot->offset_array(landing_card), (uint)entry); ::
breakpoint(); } } while (0)
194 (uint)_bot->offset_array(landing_card), (uint)entry)do { if (!(_bot->offset_array(landing_card) <= entry)) {
(*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 194, "guarantee(" "_bot->offset_array(landing_card) <= entry"
") failed", "Monotonicity - landing_card offset: %u, " "entry: %u"
, (uint)_bot->offset_array(landing_card), (uint)entry); ::
breakpoint(); } } while (0)
;
195 } else {
196 guarantee(landing_card == start_card - 1, "Tautology")do { if (!(landing_card == start_card - 1)) { (*g_assert_poison
) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 196, "guarantee(" "landing_card == start_card - 1" ") failed"
, "Tautology"); ::breakpoint(); } } while (0)
;
197 // Note that N_words is the maximum offset value
198 guarantee(_bot->offset_array(landing_card) <= BOTConstants::card_size_in_words(),do { if (!(_bot->offset_array(landing_card) <= BOTConstants
::card_size_in_words())) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 201, "guarantee(" "_bot->offset_array(landing_card) <= BOTConstants::card_size_in_words()"
") failed", "landing card offset: %u, " "N_words: %u", (uint
)_bot->offset_array(landing_card), (uint)BOTConstants::card_size_in_words
()); ::breakpoint(); } } while (0)
199 "landing card offset: %u, "do { if (!(_bot->offset_array(landing_card) <= BOTConstants
::card_size_in_words())) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 201, "guarantee(" "_bot->offset_array(landing_card) <= BOTConstants::card_size_in_words()"
") failed", "landing card offset: %u, " "N_words: %u", (uint
)_bot->offset_array(landing_card), (uint)BOTConstants::card_size_in_words
()); ::breakpoint(); } } while (0)
200 "N_words: %u",do { if (!(_bot->offset_array(landing_card) <= BOTConstants
::card_size_in_words())) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 201, "guarantee(" "_bot->offset_array(landing_card) <= BOTConstants::card_size_in_words()"
") failed", "landing card offset: %u, " "N_words: %u", (uint
)_bot->offset_array(landing_card), (uint)BOTConstants::card_size_in_words
()); ::breakpoint(); } } while (0)
201 (uint)_bot->offset_array(landing_card), (uint)BOTConstants::card_size_in_words())do { if (!(_bot->offset_array(landing_card) <= BOTConstants
::card_size_in_words())) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 201, "guarantee(" "_bot->offset_array(landing_card) <= BOTConstants::card_size_in_words()"
") failed", "landing card offset: %u, " "N_words: %u", (uint
)_bot->offset_array(landing_card), (uint)BOTConstants::card_size_in_words
()); ::breakpoint(); } } while (0)
;
202 }
203 }
204}
205
206//
207// threshold_
208// | _index_
209// v v
210// +-------+-------+-------+-------+-------+
211// | i-1 | i | i+1 | i+2 | i+3 |
212// +-------+-------+-------+-------+-------+
213// ( ^ ]
214// block-start
215//
216void G1BlockOffsetTablePart::alloc_block_work(HeapWord** threshold_, HeapWord* blk_start,
217 HeapWord* blk_end) {
218 // For efficiency, do copy-in/copy-out.
219 HeapWord* threshold = *threshold_;
220 size_t index = _bot->index_for_raw(threshold);
221
222 assert(blk_start != NULL && blk_end > blk_start,do { if (!(blk_start != __null && blk_end > blk_start
)) { (*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 223, "assert(" "blk_start != __null && blk_end > blk_start"
") failed", "phantom block"); ::breakpoint(); } } while (0)
223 "phantom block")do { if (!(blk_start != __null && blk_end > blk_start
)) { (*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 223, "assert(" "blk_start != __null && blk_end > blk_start"
") failed", "phantom block"); ::breakpoint(); } } while (0)
;
224 assert(blk_end > threshold, "should be past threshold")do { if (!(blk_end > threshold)) { (*g_assert_poison) = 'X'
;; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 224, "assert(" "blk_end > threshold" ") failed", "should be past threshold"
); ::breakpoint(); } } while (0)
;
225 assert(blk_start <= threshold, "blk_start should be at or before threshold")do { if (!(blk_start <= threshold)) { (*g_assert_poison) =
'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 225, "assert(" "blk_start <= threshold" ") failed", "blk_start should be at or before threshold"
); ::breakpoint(); } } while (0)
;
226 assert(pointer_delta(threshold, blk_start) <= BOTConstants::card_size_in_words(),do { if (!(pointer_delta(threshold, blk_start) <= BOTConstants
::card_size_in_words())) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 227, "assert(" "pointer_delta(threshold, blk_start) <= BOTConstants::card_size_in_words()"
") failed", "offset should be <= BlockOffsetSharedArray::N"
); ::breakpoint(); } } while (0)
227 "offset should be <= BlockOffsetSharedArray::N")do { if (!(pointer_delta(threshold, blk_start) <= BOTConstants
::card_size_in_words())) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 227, "assert(" "pointer_delta(threshold, blk_start) <= BOTConstants::card_size_in_words()"
") failed", "offset should be <= BlockOffsetSharedArray::N"
); ::breakpoint(); } } while (0)
;
228 assert(G1CollectedHeap::heap()->is_in_reserved(blk_start),do { if (!(G1CollectedHeap::heap()->is_in_reserved(blk_start
))) { (*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 229, "assert(" "G1CollectedHeap::heap()->is_in_reserved(blk_start)"
") failed", "reference must be into the heap"); ::breakpoint
(); } } while (0)
229 "reference must be into the heap")do { if (!(G1CollectedHeap::heap()->is_in_reserved(blk_start
))) { (*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 229, "assert(" "G1CollectedHeap::heap()->is_in_reserved(blk_start)"
") failed", "reference must be into the heap"); ::breakpoint
(); } } while (0)
;
230 assert(G1CollectedHeap::heap()->is_in_reserved(blk_end-1),do { if (!(G1CollectedHeap::heap()->is_in_reserved(blk_end
-1))) { (*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 231, "assert(" "G1CollectedHeap::heap()->is_in_reserved(blk_end-1)"
") failed", "limit must be within the heap"); ::breakpoint()
; } } while (0)
231 "limit must be within the heap")do { if (!(G1CollectedHeap::heap()->is_in_reserved(blk_end
-1))) { (*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 231, "assert(" "G1CollectedHeap::heap()->is_in_reserved(blk_end-1)"
") failed", "limit must be within the heap"); ::breakpoint()
; } } while (0)
;
232 assert(threshold == _bot->_reserved.start() + index*BOTConstants::card_size_in_words(),do { if (!(threshold == _bot->_reserved.start() + index*BOTConstants
::card_size_in_words())) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 233, "assert(" "threshold == _bot->_reserved.start() + index*BOTConstants::card_size_in_words()"
") failed", "index must agree with threshold"); ::breakpoint
(); } } while (0)
233 "index must agree with threshold")do { if (!(threshold == _bot->_reserved.start() + index*BOTConstants
::card_size_in_words())) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 233, "assert(" "threshold == _bot->_reserved.start() + index*BOTConstants::card_size_in_words()"
") failed", "index must agree with threshold"); ::breakpoint
(); } } while (0)
;
234
235 DEBUG_ONLY(size_t orig_index = index;)size_t orig_index = index;
236
237 // Mark the card that holds the offset into the block. Note
238 // that _next_offset_threshold is not updated until the end
239 // of this method.
240 _bot->set_offset_array(index, threshold, blk_start);
241
242 // We need to now mark the subsequent cards that this blk spans.
243
244 // Index of card on which blk ends.
245 size_t end_index = _bot->index_for(blk_end - 1);
246
247 // Are there more cards left to be updated?
248 if (index + 1 <= end_index) {
249 HeapWord* rem_st = _bot->address_for_index(index + 1);
250 // Calculate rem_end this way because end_index
251 // may be the last valid index in the covered region.
252 HeapWord* rem_end = _bot->address_for_index(end_index) + BOTConstants::card_size_in_words();
253 set_remainder_to_point_to_start(rem_st, rem_end);
254 }
255
256 index = end_index + 1;
Value stored to 'index' is never read
257 // Calculate threshold_ this way because end_index
258 // may be the last valid index in the covered region.
259 threshold = _bot->address_for_index(end_index) + BOTConstants::card_size_in_words();
260 assert(threshold >= blk_end, "Incorrect offset threshold")do { if (!(threshold >= blk_end)) { (*g_assert_poison) = 'X'
;; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 260, "assert(" "threshold >= blk_end" ") failed", "Incorrect offset threshold"
); ::breakpoint(); } } while (0)
;
261
262 *threshold_ = threshold;
263
264#ifdef ASSERT1
265 // The offset can be 0 if the block starts on a boundary. That
266 // is checked by an assertion above.
267 size_t start_index = _bot->index_for(blk_start);
268 HeapWord* boundary = _bot->address_for_index(start_index);
269 assert((_bot->offset_array(orig_index) == 0 && blk_start == boundary) ||do { if (!((_bot->offset_array(orig_index) == 0 &&
blk_start == boundary) || (_bot->offset_array(orig_index)
> 0 && _bot->offset_array(orig_index) <= BOTConstants
::card_size_in_words()))) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 276, "assert(" "(_bot->offset_array(orig_index) == 0 && blk_start == boundary) || (_bot->offset_array(orig_index) > 0 && _bot->offset_array(orig_index) <= BOTConstants::card_size_in_words())"
") failed", "offset array should have been set - " "orig_index offset: %u, "
"blk_start: " "0x%016" "l" "x" ", " "boundary: " "0x%016" "l"
"x", (uint)_bot->offset_array(orig_index), p2i(blk_start)
, p2i(boundary)); ::breakpoint(); } } while (0)
270 (_bot->offset_array(orig_index) > 0 && _bot->offset_array(orig_index) <= BOTConstants::card_size_in_words()),do { if (!((_bot->offset_array(orig_index) == 0 &&
blk_start == boundary) || (_bot->offset_array(orig_index)
> 0 && _bot->offset_array(orig_index) <= BOTConstants
::card_size_in_words()))) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 276, "assert(" "(_bot->offset_array(orig_index) == 0 && blk_start == boundary) || (_bot->offset_array(orig_index) > 0 && _bot->offset_array(orig_index) <= BOTConstants::card_size_in_words())"
") failed", "offset array should have been set - " "orig_index offset: %u, "
"blk_start: " "0x%016" "l" "x" ", " "boundary: " "0x%016" "l"
"x", (uint)_bot->offset_array(orig_index), p2i(blk_start)
, p2i(boundary)); ::breakpoint(); } } while (0)
271 "offset array should have been set - "do { if (!((_bot->offset_array(orig_index) == 0 &&
blk_start == boundary) || (_bot->offset_array(orig_index)
> 0 && _bot->offset_array(orig_index) <= BOTConstants
::card_size_in_words()))) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 276, "assert(" "(_bot->offset_array(orig_index) == 0 && blk_start == boundary) || (_bot->offset_array(orig_index) > 0 && _bot->offset_array(orig_index) <= BOTConstants::card_size_in_words())"
") failed", "offset array should have been set - " "orig_index offset: %u, "
"blk_start: " "0x%016" "l" "x" ", " "boundary: " "0x%016" "l"
"x", (uint)_bot->offset_array(orig_index), p2i(blk_start)
, p2i(boundary)); ::breakpoint(); } } while (0)
272 "orig_index offset: %u, "do { if (!((_bot->offset_array(orig_index) == 0 &&
blk_start == boundary) || (_bot->offset_array(orig_index)
> 0 && _bot->offset_array(orig_index) <= BOTConstants
::card_size_in_words()))) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 276, "assert(" "(_bot->offset_array(orig_index) == 0 && blk_start == boundary) || (_bot->offset_array(orig_index) > 0 && _bot->offset_array(orig_index) <= BOTConstants::card_size_in_words())"
") failed", "offset array should have been set - " "orig_index offset: %u, "
"blk_start: " "0x%016" "l" "x" ", " "boundary: " "0x%016" "l"
"x", (uint)_bot->offset_array(orig_index), p2i(blk_start)
, p2i(boundary)); ::breakpoint(); } } while (0)
273 "blk_start: " PTR_FORMAT ", "do { if (!((_bot->offset_array(orig_index) == 0 &&
blk_start == boundary) || (_bot->offset_array(orig_index)
> 0 && _bot->offset_array(orig_index) <= BOTConstants
::card_size_in_words()))) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 276, "assert(" "(_bot->offset_array(orig_index) == 0 && blk_start == boundary) || (_bot->offset_array(orig_index) > 0 && _bot->offset_array(orig_index) <= BOTConstants::card_size_in_words())"
") failed", "offset array should have been set - " "orig_index offset: %u, "
"blk_start: " "0x%016" "l" "x" ", " "boundary: " "0x%016" "l"
"x", (uint)_bot->offset_array(orig_index), p2i(blk_start)
, p2i(boundary)); ::breakpoint(); } } while (0)
274 "boundary: " PTR_FORMAT,do { if (!((_bot->offset_array(orig_index) == 0 &&
blk_start == boundary) || (_bot->offset_array(orig_index)
> 0 && _bot->offset_array(orig_index) <= BOTConstants
::card_size_in_words()))) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 276, "assert(" "(_bot->offset_array(orig_index) == 0 && blk_start == boundary) || (_bot->offset_array(orig_index) > 0 && _bot->offset_array(orig_index) <= BOTConstants::card_size_in_words())"
") failed", "offset array should have been set - " "orig_index offset: %u, "
"blk_start: " "0x%016" "l" "x" ", " "boundary: " "0x%016" "l"
"x", (uint)_bot->offset_array(orig_index), p2i(blk_start)
, p2i(boundary)); ::breakpoint(); } } while (0)
275 (uint)_bot->offset_array(orig_index),do { if (!((_bot->offset_array(orig_index) == 0 &&
blk_start == boundary) || (_bot->offset_array(orig_index)
> 0 && _bot->offset_array(orig_index) <= BOTConstants
::card_size_in_words()))) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 276, "assert(" "(_bot->offset_array(orig_index) == 0 && blk_start == boundary) || (_bot->offset_array(orig_index) > 0 && _bot->offset_array(orig_index) <= BOTConstants::card_size_in_words())"
") failed", "offset array should have been set - " "orig_index offset: %u, "
"blk_start: " "0x%016" "l" "x" ", " "boundary: " "0x%016" "l"
"x", (uint)_bot->offset_array(orig_index), p2i(blk_start)
, p2i(boundary)); ::breakpoint(); } } while (0)
276 p2i(blk_start), p2i(boundary))do { if (!((_bot->offset_array(orig_index) == 0 &&
blk_start == boundary) || (_bot->offset_array(orig_index)
> 0 && _bot->offset_array(orig_index) <= BOTConstants
::card_size_in_words()))) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 276, "assert(" "(_bot->offset_array(orig_index) == 0 && blk_start == boundary) || (_bot->offset_array(orig_index) > 0 && _bot->offset_array(orig_index) <= BOTConstants::card_size_in_words())"
") failed", "offset array should have been set - " "orig_index offset: %u, "
"blk_start: " "0x%016" "l" "x" ", " "boundary: " "0x%016" "l"
"x", (uint)_bot->offset_array(orig_index), p2i(blk_start)
, p2i(boundary)); ::breakpoint(); } } while (0)
;
277 for (size_t j = orig_index + 1; j <= end_index; j++) {
278 assert(_bot->offset_array(j) > 0 &&do { if (!(_bot->offset_array(j) > 0 && _bot->
offset_array(j) <= (u_char) (BOTConstants::card_size_in_words
()+BOTConstants::N_powers-1))) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 285, "assert(" "_bot->offset_array(j) > 0 && _bot->offset_array(j) <= (u_char) (BOTConstants::card_size_in_words()+BOTConstants::N_powers-1)"
") failed", "offset array should have been set - " "%u not > 0 OR %u not <= %u"
, (uint) _bot->offset_array(j), (uint) _bot->offset_array
(j), (uint) (BOTConstants::card_size_in_words() + BOTConstants
::N_powers - 1)); ::breakpoint(); } } while (0)
279 _bot->offset_array(j) <=do { if (!(_bot->offset_array(j) > 0 && _bot->
offset_array(j) <= (u_char) (BOTConstants::card_size_in_words
()+BOTConstants::N_powers-1))) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 285, "assert(" "_bot->offset_array(j) > 0 && _bot->offset_array(j) <= (u_char) (BOTConstants::card_size_in_words()+BOTConstants::N_powers-1)"
") failed", "offset array should have been set - " "%u not > 0 OR %u not <= %u"
, (uint) _bot->offset_array(j), (uint) _bot->offset_array
(j), (uint) (BOTConstants::card_size_in_words() + BOTConstants
::N_powers - 1)); ::breakpoint(); } } while (0)
280 (u_char) (BOTConstants::card_size_in_words()+BOTConstants::N_powers-1),do { if (!(_bot->offset_array(j) > 0 && _bot->
offset_array(j) <= (u_char) (BOTConstants::card_size_in_words
()+BOTConstants::N_powers-1))) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 285, "assert(" "_bot->offset_array(j) > 0 && _bot->offset_array(j) <= (u_char) (BOTConstants::card_size_in_words()+BOTConstants::N_powers-1)"
") failed", "offset array should have been set - " "%u not > 0 OR %u not <= %u"
, (uint) _bot->offset_array(j), (uint) _bot->offset_array
(j), (uint) (BOTConstants::card_size_in_words() + BOTConstants
::N_powers - 1)); ::breakpoint(); } } while (0)
281 "offset array should have been set - "do { if (!(_bot->offset_array(j) > 0 && _bot->
offset_array(j) <= (u_char) (BOTConstants::card_size_in_words
()+BOTConstants::N_powers-1))) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 285, "assert(" "_bot->offset_array(j) > 0 && _bot->offset_array(j) <= (u_char) (BOTConstants::card_size_in_words()+BOTConstants::N_powers-1)"
") failed", "offset array should have been set - " "%u not > 0 OR %u not <= %u"
, (uint) _bot->offset_array(j), (uint) _bot->offset_array
(j), (uint) (BOTConstants::card_size_in_words() + BOTConstants
::N_powers - 1)); ::breakpoint(); } } while (0)
282 "%u not > 0 OR %u not <= %u",do { if (!(_bot->offset_array(j) > 0 && _bot->
offset_array(j) <= (u_char) (BOTConstants::card_size_in_words
()+BOTConstants::N_powers-1))) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 285, "assert(" "_bot->offset_array(j) > 0 && _bot->offset_array(j) <= (u_char) (BOTConstants::card_size_in_words()+BOTConstants::N_powers-1)"
") failed", "offset array should have been set - " "%u not > 0 OR %u not <= %u"
, (uint) _bot->offset_array(j), (uint) _bot->offset_array
(j), (uint) (BOTConstants::card_size_in_words() + BOTConstants
::N_powers - 1)); ::breakpoint(); } } while (0)
283 (uint) _bot->offset_array(j),do { if (!(_bot->offset_array(j) > 0 && _bot->
offset_array(j) <= (u_char) (BOTConstants::card_size_in_words
()+BOTConstants::N_powers-1))) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 285, "assert(" "_bot->offset_array(j) > 0 && _bot->offset_array(j) <= (u_char) (BOTConstants::card_size_in_words()+BOTConstants::N_powers-1)"
") failed", "offset array should have been set - " "%u not > 0 OR %u not <= %u"
, (uint) _bot->offset_array(j), (uint) _bot->offset_array
(j), (uint) (BOTConstants::card_size_in_words() + BOTConstants
::N_powers - 1)); ::breakpoint(); } } while (0)
284 (uint) _bot->offset_array(j),do { if (!(_bot->offset_array(j) > 0 && _bot->
offset_array(j) <= (u_char) (BOTConstants::card_size_in_words
()+BOTConstants::N_powers-1))) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 285, "assert(" "_bot->offset_array(j) > 0 && _bot->offset_array(j) <= (u_char) (BOTConstants::card_size_in_words()+BOTConstants::N_powers-1)"
") failed", "offset array should have been set - " "%u not > 0 OR %u not <= %u"
, (uint) _bot->offset_array(j), (uint) _bot->offset_array
(j), (uint) (BOTConstants::card_size_in_words() + BOTConstants
::N_powers - 1)); ::breakpoint(); } } while (0)
285 (uint) (BOTConstants::card_size_in_words() + BOTConstants::N_powers - 1))do { if (!(_bot->offset_array(j) > 0 && _bot->
offset_array(j) <= (u_char) (BOTConstants::card_size_in_words
()+BOTConstants::N_powers-1))) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 285, "assert(" "_bot->offset_array(j) > 0 && _bot->offset_array(j) <= (u_char) (BOTConstants::card_size_in_words()+BOTConstants::N_powers-1)"
") failed", "offset array should have been set - " "%u not > 0 OR %u not <= %u"
, (uint) _bot->offset_array(j), (uint) _bot->offset_array
(j), (uint) (BOTConstants::card_size_in_words() + BOTConstants
::N_powers - 1)); ::breakpoint(); } } while (0)
;
286 }
287#endif
288}
289
290void G1BlockOffsetTablePart::verify() const {
291 assert(_hr->bottom() < _hr->top(), "Only non-empty regions should be verified.")do { if (!(_hr->bottom() < _hr->top())) { (*g_assert_poison
) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 291, "assert(" "_hr->bottom() < _hr->top()" ") failed"
, "Only non-empty regions should be verified."); ::breakpoint
(); } } while (0)
;
292 size_t start_card = _bot->index_for(_hr->bottom());
293 // Do not verify beyond the BOT allocation threshold.
294 assert(_hr->top() <= _next_offset_threshold, "invariant")do { if (!(_hr->top() <= _next_offset_threshold)) { (*g_assert_poison
) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 294, "assert(" "_hr->top() <= _next_offset_threshold"
") failed", "invariant"); ::breakpoint(); } } while (0)
;
295 size_t end_card = _bot->index_for(_hr->top() - 1);
296
297 for (size_t current_card = start_card; current_card < end_card; current_card++) {
298 u_char entry = _bot->offset_array(current_card);
299 if (entry < BOTConstants::card_size_in_words()) {
300 // The entry should point to an object before the current card. Verify that
301 // it is possible to walk from that object in to the current card by just
302 // iterating over the objects following it.
303 HeapWord* card_address = _bot->address_for_index(current_card);
304 HeapWord* obj_end = card_address - entry;
305 while (obj_end < card_address) {
306 HeapWord* obj = obj_end;
307 size_t obj_size = block_size(obj);
308 obj_end = obj + obj_size;
309 guarantee(obj_end > obj && obj_end <= _hr->top(),do { if (!(obj_end > obj && obj_end <= _hr->
top())) { (*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 311, "guarantee(" "obj_end > obj && obj_end <= _hr->top()"
") failed", "Invalid object end. obj: " "0x%016" "l" "x" " obj_size: "
"%" "l" "u" " obj_end: " "0x%016" "l" "x" " top: " "0x%016" "l"
"x", p2i(obj), obj_size, p2i(obj_end), p2i(_hr->top())); ::
breakpoint(); } } while (0)
310 "Invalid object end. obj: " PTR_FORMAT " obj_size: " SIZE_FORMAT " obj_end: " PTR_FORMAT " top: " PTR_FORMAT,do { if (!(obj_end > obj && obj_end <= _hr->
top())) { (*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 311, "guarantee(" "obj_end > obj && obj_end <= _hr->top()"
") failed", "Invalid object end. obj: " "0x%016" "l" "x" " obj_size: "
"%" "l" "u" " obj_end: " "0x%016" "l" "x" " top: " "0x%016" "l"
"x", p2i(obj), obj_size, p2i(obj_end), p2i(_hr->top())); ::
breakpoint(); } } while (0)
311 p2i(obj), obj_size, p2i(obj_end), p2i(_hr->top()))do { if (!(obj_end > obj && obj_end <= _hr->
top())) { (*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 311, "guarantee(" "obj_end > obj && obj_end <= _hr->top()"
") failed", "Invalid object end. obj: " "0x%016" "l" "x" " obj_size: "
"%" "l" "u" " obj_end: " "0x%016" "l" "x" " top: " "0x%016" "l"
"x", p2i(obj), obj_size, p2i(obj_end), p2i(_hr->top())); ::
breakpoint(); } } while (0)
;
312 }
313 } else {
314 // Because we refine the BOT based on which cards are dirty there is not much we can verify here.
315 // We need to make sure that we are going backwards and that we don't pass the start of the
316 // corresponding heap region. But that is about all we can verify.
317 size_t backskip = BOTConstants::entry_to_cards_back(entry);
318 guarantee(backskip >= 1, "Must be going back at least one card.")do { if (!(backskip >= 1)) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 318, "guarantee(" "backskip >= 1" ") failed", "Must be going back at least one card."
); ::breakpoint(); } } while (0)
;
319
320 size_t max_backskip = current_card - start_card;
321 guarantee(backskip <= max_backskip,do { if (!(backskip <= max_backskip)) { (*g_assert_poison)
= 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 323, "guarantee(" "backskip <= max_backskip" ") failed",
"Going backwards beyond the start_card. start_card: " "%" "l"
"u" " current_card: " "%" "l" "u" " backskip: " "%" "l" "u",
start_card, current_card, backskip); ::breakpoint(); } } while
(0)
322 "Going backwards beyond the start_card. start_card: " SIZE_FORMAT " current_card: " SIZE_FORMAT " backskip: " SIZE_FORMAT,do { if (!(backskip <= max_backskip)) { (*g_assert_poison)
= 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 323, "guarantee(" "backskip <= max_backskip" ") failed",
"Going backwards beyond the start_card. start_card: " "%" "l"
"u" " current_card: " "%" "l" "u" " backskip: " "%" "l" "u",
start_card, current_card, backskip); ::breakpoint(); } } while
(0)
323 start_card, current_card, backskip)do { if (!(backskip <= max_backskip)) { (*g_assert_poison)
= 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 323, "guarantee(" "backskip <= max_backskip" ") failed",
"Going backwards beyond the start_card. start_card: " "%" "l"
"u" " current_card: " "%" "l" "u" " backskip: " "%" "l" "u",
start_card, current_card, backskip); ::breakpoint(); } } while
(0)
;
324
325 HeapWord* backskip_address = _bot->address_for_index(current_card - backskip);
326 guarantee(backskip_address >= _hr->bottom(),do { if (!(backskip_address >= _hr->bottom())) { (*g_assert_poison
) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 328, "guarantee(" "backskip_address >= _hr->bottom()"
") failed", "Going backwards beyond bottom of the region: bottom: "
"0x%016" "l" "x" ", backskip_address: " "0x%016" "l" "x", p2i
(_hr->bottom()), p2i(backskip_address)); ::breakpoint(); }
} while (0)
327 "Going backwards beyond bottom of the region: bottom: " PTR_FORMAT ", backskip_address: " PTR_FORMAT,do { if (!(backskip_address >= _hr->bottom())) { (*g_assert_poison
) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 328, "guarantee(" "backskip_address >= _hr->bottom()"
") failed", "Going backwards beyond bottom of the region: bottom: "
"0x%016" "l" "x" ", backskip_address: " "0x%016" "l" "x", p2i
(_hr->bottom()), p2i(backskip_address)); ::breakpoint(); }
} while (0)
328 p2i(_hr->bottom()), p2i(backskip_address))do { if (!(backskip_address >= _hr->bottom())) { (*g_assert_poison
) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 328, "guarantee(" "backskip_address >= _hr->bottom()"
") failed", "Going backwards beyond bottom of the region: bottom: "
"0x%016" "l" "x" ", backskip_address: " "0x%016" "l" "x", p2i
(_hr->bottom()), p2i(backskip_address)); ::breakpoint(); }
} while (0)
;
329 }
330 }
331}
332
333#ifndef PRODUCT
334void G1BlockOffsetTablePart::print_on(outputStream* out) {
335 size_t from_index = _bot->index_for(_hr->bottom());
336 size_t to_index = _bot->index_for(_hr->end());
337 out->print_cr(">> BOT for area [" PTR_FORMAT"0x%016" "l" "x" "," PTR_FORMAT"0x%016" "l" "x" ") "
338 "cards [" SIZE_FORMAT"%" "l" "u" "," SIZE_FORMAT"%" "l" "u" ")",
339 p2i(_hr->bottom()), p2i(_hr->end()), from_index, to_index);
340 for (size_t i = from_index; i < to_index; ++i) {
341 out->print_cr(" entry " SIZE_FORMAT_W(8)"%" "8" "l" "u" " | " PTR_FORMAT"0x%016" "l" "x" " : %3u",
342 i, p2i(_bot->address_for_index(i)),
343 (uint) _bot->offset_array(i));
344 }
345 out->print_cr(" next offset threshold: " PTR_FORMAT"0x%016" "l" "x", p2i(_next_offset_threshold));
346}
347#endif // !PRODUCT
348
349void G1BlockOffsetTablePart::zero_bottom_entry_raw() {
350 size_t bottom_index = _bot->index_for_raw(_hr->bottom());
351 assert(_bot->address_for_index_raw(bottom_index) == _hr->bottom(),do { if (!(_bot->address_for_index_raw(bottom_index) == _hr
->bottom())) { (*g_assert_poison) = 'X';; report_vm_error(
"/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 352, "assert(" "_bot->address_for_index_raw(bottom_index) == _hr->bottom()"
") failed", "Precondition of call"); ::breakpoint(); } } while
(0)
352 "Precondition of call")do { if (!(_bot->address_for_index_raw(bottom_index) == _hr
->bottom())) { (*g_assert_poison) = 'X';; report_vm_error(
"/home/daniel/Projects/java/jdk/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp"
, 352, "assert(" "_bot->address_for_index_raw(bottom_index) == _hr->bottom()"
") failed", "Precondition of call"); ::breakpoint(); } } while
(0)
;
353 _bot->set_offset_array_raw(bottom_index, 0);
354}
355
356void G1BlockOffsetTablePart::initialize_threshold() {
357 _next_offset_threshold = _hr->bottom() + BOTConstants::card_size_in_words();
358}
359
360void G1BlockOffsetTablePart::set_for_starts_humongous(HeapWord* obj_top, size_t fill_size) {
361 // The first BOT entry should have offset 0.
362 reset_bot();
363 alloc_block(_hr->bottom(), obj_top);
364 if (fill_size > 0) {
365 alloc_block(obj_top, fill_size);
366 }
367}