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
3333
3434inline 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
4343inline 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