mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 12:09:14 +00:00
8264419: Remove has_max_index argument from G1BlockOffsetTablePart::block_at_or_preceding
Reviewed-by: ayang, tschatzl
This commit is contained in:
parent
4a7ccf36e9
commit
b6d765386e
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -142,11 +142,7 @@ private:
|
||||
inline size_t block_size(const HeapWord* p) const;
|
||||
|
||||
// Returns the address of a block whose start is at most "addr".
|
||||
// If "has_max_index" is true, "assumes "max_index" is the last valid one
|
||||
// in the array.
|
||||
inline HeapWord* block_at_or_preceding(const void* addr,
|
||||
bool has_max_index,
|
||||
size_t max_index) const;
|
||||
inline HeapWord* block_at_or_preceding(const void* addr) const;
|
||||
|
||||
// "q" is a block boundary that is <= "addr"; "n" is the address of the
|
||||
// next block (or the end of the space.) Return the address of the
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -33,7 +33,7 @@
|
||||
|
||||
inline HeapWord* G1BlockOffsetTablePart::block_start(const void* addr) {
|
||||
if (addr >= _hr->bottom() && addr < _hr->end()) {
|
||||
HeapWord* q = block_at_or_preceding(addr, true, _next_offset_index-1);
|
||||
HeapWord* q = block_at_or_preceding(addr);
|
||||
return forward_to_block_containing_addr(q, addr);
|
||||
} else {
|
||||
return NULL;
|
||||
@ -42,7 +42,7 @@ inline HeapWord* G1BlockOffsetTablePart::block_start(const void* addr) {
|
||||
|
||||
inline HeapWord* G1BlockOffsetTablePart::block_start_const(const void* addr) const {
|
||||
if (addr >= _hr->bottom() && addr < _hr->end()) {
|
||||
HeapWord* q = block_at_or_preceding(addr, true, _next_offset_index-1);
|
||||
HeapWord* q = block_at_or_preceding(addr);
|
||||
HeapWord* n = q + block_size(q);
|
||||
return forward_to_block_containing_addr_const(q, n, addr);
|
||||
} else {
|
||||
@ -110,18 +110,15 @@ inline size_t G1BlockOffsetTablePart::block_size(const HeapWord* p) const {
|
||||
return _hr->block_size(p);
|
||||
}
|
||||
|
||||
inline HeapWord* G1BlockOffsetTablePart::block_at_or_preceding(const void* addr,
|
||||
bool has_max_index,
|
||||
size_t max_index) const {
|
||||
inline HeapWord* G1BlockOffsetTablePart::block_at_or_preceding(const void* addr) const {
|
||||
assert(_object_can_span || _bot->offset_array(_bot->index_for(_hr->bottom())) == 0,
|
||||
"Object crossed region boundary, found offset %u instead of 0",
|
||||
(uint) _bot->offset_array(_bot->index_for(_hr->bottom())));
|
||||
size_t index = _bot->index_for(addr);
|
||||
// We must make sure that the offset table entry we use is valid. If
|
||||
// "addr" is past the end, start at the last known one and go forward.
|
||||
if (has_max_index) {
|
||||
index = MIN2(index, max_index);
|
||||
}
|
||||
// "addr" is past the end, start at the last valid index.
|
||||
index = MIN2(index, _next_offset_index - 1);
|
||||
|
||||
HeapWord* q = _bot->address_for_index(index);
|
||||
|
||||
uint offset = _bot->offset_array(index); // Extend u_char to uint.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user