2016-01-26 15:28:31 +01:00
|
|
|
/*
|
2018-03-26 12:44:39 +02:00
|
|
|
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
2016-01-26 15:28:31 +01:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
|
|
*
|
|
|
|
* This code is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License version 2 only, as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* version 2 for more details (a copy is included in the LICENSE file that
|
|
|
|
* accompanied this code).
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License version
|
|
|
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*
|
|
|
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
|
|
* or visit www.oracle.com if you need additional information or have any
|
|
|
|
* questions.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SHARE_VM_GC_G1_G1HEAPVERIFIER_HPP
|
|
|
|
#define SHARE_VM_GC_G1_G1HEAPVERIFIER_HPP
|
|
|
|
|
|
|
|
#include "gc/g1/heapRegionSet.hpp"
|
|
|
|
#include "memory/allocation.hpp"
|
|
|
|
#include "memory/universe.hpp"
|
2018-04-09 20:36:04 -04:00
|
|
|
#include "utilities/macros.hpp"
|
2016-01-26 15:28:31 +01:00
|
|
|
|
|
|
|
class G1CollectedHeap;
|
|
|
|
|
|
|
|
class G1HeapVerifier : public CHeapObj<mtGC> {
|
|
|
|
private:
|
2018-03-26 12:44:39 +02:00
|
|
|
static int _enabled_verification_types;
|
|
|
|
|
2016-01-26 15:28:31 +01:00
|
|
|
G1CollectedHeap* _g1h;
|
|
|
|
|
|
|
|
void verify_region_sets();
|
|
|
|
|
|
|
|
public:
|
2017-12-01 08:56:22 +01:00
|
|
|
enum G1VerifyType {
|
2018-06-26 11:09:42 +02:00
|
|
|
G1VerifyYoungNormal = 1, // -XX:VerifyGCType=young-normal
|
|
|
|
G1VerifyConcurrentStart = 2, // -XX:VerifyGCType=concurrent-start
|
|
|
|
G1VerifyMixed = 4, // -XX:VerifyGCType=mixed
|
|
|
|
G1VerifyRemark = 8, // -XX:VerifyGCType=remark
|
|
|
|
G1VerifyCleanup = 16, // -XX:VerifyGCType=cleanup
|
|
|
|
G1VerifyFull = 32, // -XX:VerifyGCType=full
|
|
|
|
G1VerifyAll = -1
|
2017-12-01 08:56:22 +01:00
|
|
|
};
|
2016-01-26 15:28:31 +01:00
|
|
|
|
2018-03-26 12:44:39 +02:00
|
|
|
G1HeapVerifier(G1CollectedHeap* heap) : _g1h(heap) {}
|
2017-12-01 08:56:22 +01:00
|
|
|
|
2018-03-26 12:44:39 +02:00
|
|
|
static void enable_verification_type(G1VerifyType type);
|
|
|
|
static bool should_verify(G1VerifyType type);
|
2016-01-26 15:28:31 +01:00
|
|
|
|
|
|
|
// Perform verification.
|
|
|
|
|
2017-11-14 11:33:23 +01:00
|
|
|
// vo == UsePrevMarking -> use "prev" marking information,
|
2016-01-26 15:28:31 +01:00
|
|
|
// vo == UseNextMarking -> use "next" marking information
|
2017-11-14 11:33:23 +01:00
|
|
|
// vo == UseFullMarking -> use "next" marking bitmap but no TAMS
|
2016-01-26 15:28:31 +01:00
|
|
|
//
|
|
|
|
// NOTE: Only the "prev" marking information is guaranteed to be
|
|
|
|
// consistent most of the time, so most calls to this should use
|
|
|
|
// vo == UsePrevMarking.
|
|
|
|
// Currently, there is only one case where this is called with
|
|
|
|
// vo == UseNextMarking, which is to verify the "next" marking
|
|
|
|
// information at the end of remark.
|
|
|
|
// Currently there is only one place where this is called with
|
2017-11-14 11:33:23 +01:00
|
|
|
// vo == UseFullMarking, which is to verify the marking during a
|
2016-01-26 15:28:31 +01:00
|
|
|
// full GC.
|
|
|
|
void verify(VerifyOption vo);
|
|
|
|
|
|
|
|
// verify_region_sets_optional() is planted in the code for
|
2018-04-09 20:36:04 -04:00
|
|
|
// list verification in debug builds.
|
|
|
|
void verify_region_sets_optional() { DEBUG_ONLY(verify_region_sets();) }
|
2016-01-26 15:28:31 +01:00
|
|
|
|
|
|
|
void prepare_for_verify();
|
2017-12-01 08:56:22 +01:00
|
|
|
double verify(G1VerifyType type, VerifyOption vo, const char* msg);
|
|
|
|
void verify_before_gc(G1VerifyType type);
|
|
|
|
void verify_after_gc(G1VerifyType type);
|
2016-01-26 15:28:31 +01:00
|
|
|
|
|
|
|
#ifndef PRODUCT
|
|
|
|
// Make sure that the given bitmap has no marked objects in the
|
|
|
|
// range [from,limit). If it does, print an error message and return
|
|
|
|
// false. Otherwise, just return true. bitmap_name should be "prev"
|
|
|
|
// or "next".
|
2017-08-04 14:15:42 +02:00
|
|
|
bool verify_no_bits_over_tams(const char* bitmap_name, const G1CMBitMap* const bitmap,
|
2016-01-26 15:28:31 +01:00
|
|
|
HeapWord* from, HeapWord* limit);
|
|
|
|
|
|
|
|
// Verify that the prev / next bitmap range [tams,end) for the given
|
|
|
|
// region has no marks. Return true if all is well, false if errors
|
|
|
|
// are detected.
|
|
|
|
bool verify_bitmaps(const char* caller, HeapRegion* hr);
|
|
|
|
#endif // PRODUCT
|
|
|
|
|
|
|
|
// If G1VerifyBitmaps is set, verify that the marking bitmaps for
|
|
|
|
// the given region do not have any spurious marks. If errors are
|
|
|
|
// detected, print appropriate error messages and crash.
|
|
|
|
void check_bitmaps(const char* caller, HeapRegion* hr) PRODUCT_RETURN;
|
|
|
|
|
|
|
|
// If G1VerifyBitmaps is set, verify that the marking bitmaps do not
|
|
|
|
// have any spurious marks. If errors are detected, print
|
|
|
|
// appropriate error messages and crash.
|
|
|
|
void check_bitmaps(const char* caller) PRODUCT_RETURN;
|
|
|
|
|
|
|
|
// Do sanity check on the contents of the in-cset fast test table.
|
|
|
|
bool check_cset_fast_test() PRODUCT_RETURN_( return true; );
|
|
|
|
|
|
|
|
void verify_card_table_cleanup() PRODUCT_RETURN;
|
|
|
|
|
|
|
|
void verify_not_dirty_region(HeapRegion* hr) PRODUCT_RETURN;
|
|
|
|
void verify_dirty_region(HeapRegion* hr) PRODUCT_RETURN;
|
|
|
|
void verify_dirty_young_regions() PRODUCT_RETURN;
|
2017-08-14 14:32:17 -04:00
|
|
|
|
2018-12-03 22:27:24 -08:00
|
|
|
static void verify_ready_for_archiving();
|
2017-08-14 14:32:17 -04:00
|
|
|
static void verify_archive_regions();
|
2016-01-26 15:28:31 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // SHARE_VM_GC_G1_G1HEAPVERIFIER_HPP
|