Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions src/hotspot/share/gc/g1/g1BlockOffsetTable.hpp
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -142,11 +142,7 @@ class G1BlockOffsetTablePart {
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
Expand Down
17 changes: 7 additions & 10 deletions src/hotspot/share/gc/g1/g1BlockOffsetTable.inline.hpp
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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;
Expand All @@ -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 {
Expand Down Expand Up @@ -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.
Expand Down