Skip to content

Commit b6d7653

Browse files
author
Ivan Walulya
committed
8264419: Remove has_max_index argument from G1BlockOffsetTablePart::block_at_or_preceding
Reviewed-by: ayang, tschatzl
1 parent 4a7ccf3 commit b6d7653

File tree

2 files changed

+9
-16
lines changed

2 files changed

+9
-16
lines changed

src/hotspot/share/gc/g1/g1BlockOffsetTable.hpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -142,11 +142,7 @@ class G1BlockOffsetTablePart {
142142
inline size_t block_size(const HeapWord* p) const;
143143

144144
// Returns the address of a block whose start is at most "addr".
145-
// If "has_max_index" is true, "assumes "max_index" is the last valid one
146-
// in the array.
147-
inline HeapWord* block_at_or_preceding(const void* addr,
148-
bool has_max_index,
149-
size_t max_index) const;
145+
inline HeapWord* block_at_or_preceding(const void* addr) const;
150146

151147
// "q" is a block boundary that is <= "addr"; "n" is the address of the
152148
// next block (or the end of the space.) Return the address of the

src/hotspot/share/gc/g1/g1BlockOffsetTable.inline.hpp

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -33,7 +33,7 @@
3333

3434
inline HeapWord* G1BlockOffsetTablePart::block_start(const void* addr) {
3535
if (addr >= _hr->bottom() && addr < _hr->end()) {
36-
HeapWord* q = block_at_or_preceding(addr, true, _next_offset_index-1);
36+
HeapWord* q = block_at_or_preceding(addr);
3737
return forward_to_block_containing_addr(q, addr);
3838
} else {
3939
return NULL;
@@ -42,7 +42,7 @@ inline HeapWord* G1BlockOffsetTablePart::block_start(const void* addr) {
4242

4343
inline HeapWord* G1BlockOffsetTablePart::block_start_const(const void* addr) const {
4444
if (addr >= _hr->bottom() && addr < _hr->end()) {
45-
HeapWord* q = block_at_or_preceding(addr, true, _next_offset_index-1);
45+
HeapWord* q = block_at_or_preceding(addr);
4646
HeapWord* n = q + block_size(q);
4747
return forward_to_block_containing_addr_const(q, n, addr);
4848
} else {
@@ -110,18 +110,15 @@ inline size_t G1BlockOffsetTablePart::block_size(const HeapWord* p) const {
110110
return _hr->block_size(p);
111111
}
112112

113-
inline HeapWord* G1BlockOffsetTablePart::block_at_or_preceding(const void* addr,
114-
bool has_max_index,
115-
size_t max_index) const {
113+
inline HeapWord* G1BlockOffsetTablePart::block_at_or_preceding(const void* addr) const {
116114
assert(_object_can_span || _bot->offset_array(_bot->index_for(_hr->bottom())) == 0,
117115
"Object crossed region boundary, found offset %u instead of 0",
118116
(uint) _bot->offset_array(_bot->index_for(_hr->bottom())));
119117
size_t index = _bot->index_for(addr);
120118
// We must make sure that the offset table entry we use is valid. If
121-
// "addr" is past the end, start at the last known one and go forward.
122-
if (has_max_index) {
123-
index = MIN2(index, max_index);
124-
}
119+
// "addr" is past the end, start at the last valid index.
120+
index = MIN2(index, _next_offset_index - 1);
121+
125122
HeapWord* q = _bot->address_for_index(index);
126123

127124
uint offset = _bot->offset_array(index); // Extend u_char to uint.

0 commit comments

Comments
 (0)