--- old/src/share/vm/gc/g1/g1BlockOffsetTable.cpp 2017-02-22 14:36:33.571816035 +0100 +++ new/src/share/vm/gc/g1/g1BlockOffsetTable.cpp 2017-02-22 14:36:33.447811212 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2017, 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 @@ -79,7 +79,9 @@ _space(gsp), _next_offset_threshold(NULL), _next_offset_index(0) -{ } +{ + debug_only(_object_can_span = false;) +} // The arguments follow the normal convention of denoting // a right-open interval: [start, end) @@ -365,6 +367,10 @@ } #ifndef PRODUCT +void G1BlockOffsetTablePart::set_object_can_span(bool can_span) { + _object_can_span = can_span; +} + void G1BlockOffsetTablePart::print_on(outputStream* out) { size_t from_index = _bot->index_for(_space->bottom()); --- old/src/share/vm/gc/g1/g1BlockOffsetTable.hpp 2017-02-22 14:36:34.191840150 +0100 +++ new/src/share/vm/gc/g1/g1BlockOffsetTable.hpp 2017-02-22 14:36:34.063835171 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2017, 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 @@ -117,6 +117,9 @@ HeapWord* _next_offset_threshold; size_t _next_offset_index; // index corresponding to that boundary + // Indicates if an object can span into this G1BlockOffsetTablePart. + debug_only(bool _object_can_span;) + // This is the global BlockOffsetTable. G1BlockOffsetTable* _bot; @@ -224,6 +227,7 @@ } void set_for_starts_humongous(HeapWord* obj_top, size_t fill_size); + void set_object_can_span(bool can_span) PRODUCT_RETURN; void print_on(outputStream* out) PRODUCT_RETURN; }; --- old/src/share/vm/gc/g1/g1BlockOffsetTable.inline.hpp 2017-02-22 14:36:34.803863954 +0100 +++ new/src/share/vm/gc/g1/g1BlockOffsetTable.inline.hpp 2017-02-22 14:36:34.679859131 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2017, 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 @@ -107,7 +107,9 @@ inline HeapWord* G1BlockOffsetTablePart::block_at_or_preceding(const void* addr, bool has_max_index, size_t max_index) const { - assert(_bot->offset_array(0) == 0, "objects can't cross covered areas"); + assert(_object_can_span || _bot->offset_array(_bot->index_for(_space->bottom())) == 0, + "Object crossed region boundary, found offset %u instead of 0", + (uint) _bot->offset_array(_bot->index_for(_space->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. --- old/src/share/vm/gc/g1/heapRegion.cpp 2017-02-22 14:36:35.415887758 +0100 +++ new/src/share/vm/gc/g1/heapRegion.cpp 2017-02-22 14:36:35.267882001 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2017, 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 @@ -267,6 +267,8 @@ report_region_type_change(G1HeapRegionTraceType::ContinuesHumongous); _type.set_continues_humongous(); _humongous_start_region = first_hr; + + _bot_part.set_object_can_span(true); } void HeapRegion::clear_humongous() { @@ -274,6 +276,8 @@ assert(capacity() == HeapRegion::GrainBytes, "pre-condition"); _humongous_start_region = NULL; + + _bot_part.set_object_can_span(false); } HeapRegion::HeapRegion(uint hrm_index,