# HG changeset patch # User pliden # Date 1430817432 -7200 # Tue May 05 11:17:12 2015 +0200 # Node ID 614472fa7dc0a0ee9b657338e9416ec14ee06f3b # Parent e35e4cd5e4e16dd0753e326f1e806adc5239a1a9 8079330: Circular dependency between G1CollectedHeap and G1BlockOffsetSharedArray Reviewed-by: diff --git a/src/share/vm/gc_implementation/g1/g1Allocator.cpp b/src/share/vm/gc_implementation/g1/g1Allocator.cpp --- a/src/share/vm/gc_implementation/g1/g1Allocator.cpp +++ b/src/share/vm/gc_implementation/g1/g1Allocator.cpp @@ -24,7 +24,7 @@ #include "precompiled.hpp" #include "gc_implementation/g1/g1Allocator.hpp" -#include "gc_implementation/g1/g1CollectedHeap.hpp" +#include "gc_implementation/g1/g1CollectedHeap.inline.hpp" #include "gc_implementation/g1/g1CollectorPolicy.hpp" #include "gc_implementation/g1/heapRegion.inline.hpp" #include "gc_implementation/g1/heapRegionSet.inline.hpp" diff --git a/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp b/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp --- a/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp +++ b/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp @@ -23,8 +23,8 @@ */ #include "precompiled.hpp" -#include "gc_implementation/g1/g1CollectedHeap.hpp" #include "gc_implementation/g1/g1BlockOffsetTable.inline.hpp" +#include "gc_implementation/g1/g1CollectedHeap.inline.hpp" #include "gc_implementation/g1/heapRegion.hpp" #include "memory/space.hpp" #include "oops/oop.inline.hpp" @@ -66,6 +66,20 @@ return (delta & right_n_bits(LogN_words)) == (size_t)NoBits; } +#ifdef ASSERT +void G1BlockOffsetSharedArray::check_index(size_t index, const char* msg) const { + assert((index) < (_reserved.word_size() >> LogN_words), + err_msg("%s - index: "SIZE_FORMAT", _vs.committed_size: "SIZE_FORMAT, + msg, (index), (_reserved.word_size() >> LogN_words))); + assert(G1CollectedHeap::heap()->is_in_exact(address_for_index_raw(index)), + err_msg("Index "SIZE_FORMAT" corresponding to "PTR_FORMAT + " (%u) is not in committed area.", + (index), + p2i(address_for_index_raw(index)), + G1CollectedHeap::heap()->addr_to_region(address_for_index_raw(index)))); +} +#endif // ASSERT + ////////////////////////////////////////////////////////////////////// // G1BlockOffsetArray ////////////////////////////////////////////////////////////////////// diff --git a/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.hpp b/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.hpp --- a/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.hpp +++ b/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.hpp @@ -170,6 +170,8 @@ bool is_card_boundary(HeapWord* p) const; + void check_index(size_t index, const char* msg) const NOT_DEBUG_RETURN; + public: // Return the number of slots needed for an offset array diff --git a/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.inline.hpp b/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.inline.hpp --- a/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.inline.hpp +++ b/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2015, 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 @@ -26,7 +26,6 @@ #define SHARE_VM_GC_IMPLEMENTATION_G1_G1BLOCKOFFSETTABLE_INLINE_HPP #include "gc_implementation/g1/g1BlockOffsetTable.hpp" -#include "gc_implementation/g1/g1CollectedHeap.inline.hpp" #include "gc_implementation/g1/heapRegion.inline.hpp" #include "memory/space.hpp" @@ -47,17 +46,6 @@ } } -#define check_index(index, msg) \ - assert((index) < (_reserved.word_size() >> LogN_words), \ - err_msg("%s - index: "SIZE_FORMAT", _vs.committed_size: "SIZE_FORMAT, \ - msg, (index), (_reserved.word_size() >> LogN_words))); \ - assert(G1CollectedHeap::heap()->is_in_exact(address_for_index_raw(index)), \ - err_msg("Index "SIZE_FORMAT" corresponding to "PTR_FORMAT \ - " (%u) is not in committed area.", \ - (index), \ - p2i(address_for_index_raw(index)), \ - G1CollectedHeap::heap()->addr_to_region(address_for_index_raw(index)))); - u_char G1BlockOffsetSharedArray::offset_array(size_t index) const { check_index(index, "index out of range"); return _offset_array[index]; @@ -119,8 +107,6 @@ return result; } -#undef check_index - inline size_t G1BlockOffsetArray::block_size(const HeapWord* p) const { return gsp()->block_size(p);