8171221: Remove -XX:+CheckMemoryInitialization
Reviewed-by: ayang, shade
This commit is contained in:
parent
2d4d850813
commit
65c8dbe693
src/hotspot/share
test/hotspot/jtreg/gc
@ -400,17 +400,6 @@ void CollectedHeap::set_gc_cause(GCCause::Cause v) {
|
||||
_gc_cause = v;
|
||||
}
|
||||
|
||||
#ifndef PRODUCT
|
||||
void CollectedHeap::check_for_non_bad_heap_word_value(HeapWord* addr, size_t size) {
|
||||
if (CheckMemoryInitialization && ZapUnusedHeapArea) {
|
||||
// please note mismatch between size (in 32/64 bit words), and ju_addr that always point to a 32 bit word
|
||||
for (juint* ju_addr = reinterpret_cast<juint*>(addr); ju_addr < reinterpret_cast<juint*>(addr + size); ++ju_addr) {
|
||||
assert(*ju_addr == badHeapWordVal, "Found non badHeapWordValue in pre-allocation check");
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // PRODUCT
|
||||
|
||||
size_t CollectedHeap::max_tlab_size() const {
|
||||
// TLABs can't be bigger than we can fill with a int[Integer.MAX_VALUE].
|
||||
// This restriction could be removed by enabling filling with multiple arrays.
|
||||
|
@ -181,8 +181,6 @@ class CollectedHeap : public CHeapObj<mtGC> {
|
||||
virtual void trace_heap(GCWhen::Type when, const GCTracer* tracer);
|
||||
|
||||
// Verification functions
|
||||
virtual void check_for_non_bad_heap_word_value(HeapWord* addr, size_t size)
|
||||
PRODUCT_RETURN;
|
||||
debug_only(static void check_for_valid_allocation_state();)
|
||||
|
||||
public:
|
||||
|
@ -61,7 +61,6 @@ class MemAllocator::Allocation: StackObj {
|
||||
void notify_allocation_low_memory_detector();
|
||||
void notify_allocation_jfr_sampler();
|
||||
void notify_allocation_dtrace_sampler(JavaThread* thread);
|
||||
void check_for_bad_heap_word_value() const;
|
||||
#ifdef ASSERT
|
||||
void check_for_valid_allocation_state() const;
|
||||
#endif
|
||||
@ -83,7 +82,6 @@ public:
|
||||
|
||||
~Allocation() {
|
||||
if (!check_out_of_memory()) {
|
||||
verify_after();
|
||||
notify_allocation(_thread);
|
||||
}
|
||||
}
|
||||
@ -150,22 +148,6 @@ void MemAllocator::Allocation::verify_before() {
|
||||
assert(!Universe::heap()->is_gc_active(), "Allocation during gc not allowed");
|
||||
}
|
||||
|
||||
void MemAllocator::Allocation::verify_after() {
|
||||
NOT_PRODUCT(check_for_bad_heap_word_value();)
|
||||
}
|
||||
|
||||
void MemAllocator::Allocation::check_for_bad_heap_word_value() const {
|
||||
MemRegion obj_range = _allocator.obj_memory_range(obj());
|
||||
HeapWord* addr = obj_range.start();
|
||||
size_t size = obj_range.word_size();
|
||||
if (CheckMemoryInitialization && ZapUnusedHeapArea) {
|
||||
for (size_t slot = 0; slot < size; slot += 1) {
|
||||
assert((*(intptr_t*) (addr + slot)) != ((intptr_t) badHeapWordVal),
|
||||
"Found badHeapWordValue in post-allocation check");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef ASSERT
|
||||
void MemAllocator::Allocation::check_for_valid_allocation_state() const {
|
||||
// How to choose between a pending exception and a potential
|
||||
@ -260,7 +242,6 @@ HeapWord* MemAllocator::mem_allocate_outside_tlab(Allocation& allocation) const
|
||||
return mem;
|
||||
}
|
||||
|
||||
NOT_PRODUCT(Universe::heap()->check_for_non_bad_heap_word_value(mem, _word_size));
|
||||
size_t size_in_bytes = _word_size * HeapWordSize;
|
||||
_thread->incr_allocated_bytes(size_in_bytes);
|
||||
|
||||
|
@ -887,10 +887,6 @@ const int ObjectAlignmentInBytes = 8;
|
||||
develop(bool, FLSVerifyDictionary, false, \
|
||||
"Do lots of (expensive) FLS dictionary verification") \
|
||||
\
|
||||
\
|
||||
notproduct(bool, CheckMemoryInitialization, false, \
|
||||
"Check memory initialization") \
|
||||
\
|
||||
product(uintx, ProcessDistributionStride, 4, \
|
||||
"Stride through processors when distributing processes") \
|
||||
range(0, max_juint) \
|
||||
|
@ -1,48 +0,0 @@
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002, 2019, 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
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package gc;
|
||||
|
||||
/*
|
||||
* test TestMemoryInitialization
|
||||
* bug 4668531
|
||||
* Simple test for -XX:+CheckMemoryInitialization doesn't crash VM
|
||||
*/
|
||||
|
||||
public class TestMemoryInitialization {
|
||||
final static int LOOP_LENGTH = 10;
|
||||
final static int CHUNK_SIZE = 1500000;
|
||||
|
||||
public static byte[] buffer;
|
||||
|
||||
public static void main(String args[]) {
|
||||
|
||||
for (int i = 0; i < LOOP_LENGTH; i++) {
|
||||
for (int j = 0; j < LOOP_LENGTH; j++) {
|
||||
buffer = new byte[CHUNK_SIZE];
|
||||
buffer = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002, 2020, 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
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package gc;
|
||||
|
||||
/*
|
||||
* @test TestMemoryInitializationWithSerial
|
||||
* @bug 4668531
|
||||
* @library /
|
||||
* @requires vm.debug & vm.gc.Serial
|
||||
* @summary Simple test for -XX:+CheckMemoryInitialization doesn't crash VM
|
||||
* @run main/othervm -XX:+UseSerialGC -XX:+CheckMemoryInitialization gc.TestMemoryInitializationWithSerial
|
||||
*/
|
||||
|
||||
public class TestMemoryInitializationWithSerial {
|
||||
|
||||
public static void main(String args[]) {
|
||||
TestMemoryInitialization.main(args);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user