6902115: G1:assert(ignore_max_completed||thread->is_Java_thread()||SafepointSynchronize::is_at_safepoint())
Remove invalid assert and mangle filler objects in TLABs that are being retired. Reviewed-by: ysr, jmasa
This commit is contained in:
parent
c0174fb200
commit
0917ad432e
@ -241,9 +241,9 @@ void CollectedHeap::fill_args_check(HeapWord* start, size_t words)
|
|||||||
assert(Universe::heap()->is_in_reserved(start + words - 1), "not in heap");
|
assert(Universe::heap()->is_in_reserved(start + words - 1), "not in heap");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CollectedHeap::zap_filler_array(HeapWord* start, size_t words)
|
void CollectedHeap::zap_filler_array(HeapWord* start, size_t words, bool zap)
|
||||||
{
|
{
|
||||||
if (ZapFillerObjects) {
|
if (ZapFillerObjects && zap) {
|
||||||
Copy::fill_to_words(start + filler_array_hdr_size(),
|
Copy::fill_to_words(start + filler_array_hdr_size(),
|
||||||
words - filler_array_hdr_size(), 0XDEAFBABE);
|
words - filler_array_hdr_size(), 0XDEAFBABE);
|
||||||
}
|
}
|
||||||
@ -251,7 +251,7 @@ void CollectedHeap::zap_filler_array(HeapWord* start, size_t words)
|
|||||||
#endif // ASSERT
|
#endif // ASSERT
|
||||||
|
|
||||||
void
|
void
|
||||||
CollectedHeap::fill_with_array(HeapWord* start, size_t words)
|
CollectedHeap::fill_with_array(HeapWord* start, size_t words, bool zap)
|
||||||
{
|
{
|
||||||
assert(words >= filler_array_min_size(), "too small for an array");
|
assert(words >= filler_array_min_size(), "too small for an array");
|
||||||
assert(words <= filler_array_max_size(), "too big for a single object");
|
assert(words <= filler_array_max_size(), "too big for a single object");
|
||||||
@ -262,16 +262,16 @@ CollectedHeap::fill_with_array(HeapWord* start, size_t words)
|
|||||||
// Set the length first for concurrent GC.
|
// Set the length first for concurrent GC.
|
||||||
((arrayOop)start)->set_length((int)len);
|
((arrayOop)start)->set_length((int)len);
|
||||||
post_allocation_setup_common(Universe::intArrayKlassObj(), start, words);
|
post_allocation_setup_common(Universe::intArrayKlassObj(), start, words);
|
||||||
DEBUG_ONLY(zap_filler_array(start, words);)
|
DEBUG_ONLY(zap_filler_array(start, words, zap);)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CollectedHeap::fill_with_object_impl(HeapWord* start, size_t words)
|
CollectedHeap::fill_with_object_impl(HeapWord* start, size_t words, bool zap)
|
||||||
{
|
{
|
||||||
assert(words <= filler_array_max_size(), "too big for a single object");
|
assert(words <= filler_array_max_size(), "too big for a single object");
|
||||||
|
|
||||||
if (words >= filler_array_min_size()) {
|
if (words >= filler_array_min_size()) {
|
||||||
fill_with_array(start, words);
|
fill_with_array(start, words, zap);
|
||||||
} else if (words > 0) {
|
} else if (words > 0) {
|
||||||
assert(words == min_fill_size(), "unaligned size");
|
assert(words == min_fill_size(), "unaligned size");
|
||||||
post_allocation_setup_common(SystemDictionary::Object_klass(), start,
|
post_allocation_setup_common(SystemDictionary::Object_klass(), start,
|
||||||
@ -279,14 +279,14 @@ CollectedHeap::fill_with_object_impl(HeapWord* start, size_t words)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CollectedHeap::fill_with_object(HeapWord* start, size_t words)
|
void CollectedHeap::fill_with_object(HeapWord* start, size_t words, bool zap)
|
||||||
{
|
{
|
||||||
DEBUG_ONLY(fill_args_check(start, words);)
|
DEBUG_ONLY(fill_args_check(start, words);)
|
||||||
HandleMark hm; // Free handles before leaving.
|
HandleMark hm; // Free handles before leaving.
|
||||||
fill_with_object_impl(start, words);
|
fill_with_object_impl(start, words, zap);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CollectedHeap::fill_with_objects(HeapWord* start, size_t words)
|
void CollectedHeap::fill_with_objects(HeapWord* start, size_t words, bool zap)
|
||||||
{
|
{
|
||||||
DEBUG_ONLY(fill_args_check(start, words);)
|
DEBUG_ONLY(fill_args_check(start, words);)
|
||||||
HandleMark hm; // Free handles before leaving.
|
HandleMark hm; // Free handles before leaving.
|
||||||
@ -299,13 +299,13 @@ void CollectedHeap::fill_with_objects(HeapWord* start, size_t words)
|
|||||||
const size_t max = filler_array_max_size();
|
const size_t max = filler_array_max_size();
|
||||||
while (words > max) {
|
while (words > max) {
|
||||||
const size_t cur = words - max >= min ? max : max - min;
|
const size_t cur = words - max >= min ? max : max - min;
|
||||||
fill_with_array(start, cur);
|
fill_with_array(start, cur, zap);
|
||||||
start += cur;
|
start += cur;
|
||||||
words -= cur;
|
words -= cur;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
fill_with_object_impl(start, words);
|
fill_with_object_impl(start, words, zap);
|
||||||
}
|
}
|
||||||
|
|
||||||
HeapWord* CollectedHeap::allocate_new_tlab(size_t size) {
|
HeapWord* CollectedHeap::allocate_new_tlab(size_t size) {
|
||||||
|
@ -127,14 +127,14 @@ class CollectedHeap : public CHeapObj {
|
|||||||
static inline size_t filler_array_max_size();
|
static inline size_t filler_array_max_size();
|
||||||
|
|
||||||
DEBUG_ONLY(static void fill_args_check(HeapWord* start, size_t words);)
|
DEBUG_ONLY(static void fill_args_check(HeapWord* start, size_t words);)
|
||||||
DEBUG_ONLY(static void zap_filler_array(HeapWord* start, size_t words);)
|
DEBUG_ONLY(static void zap_filler_array(HeapWord* start, size_t words, bool zap = true);)
|
||||||
|
|
||||||
// Fill with a single array; caller must ensure filler_array_min_size() <=
|
// Fill with a single array; caller must ensure filler_array_min_size() <=
|
||||||
// words <= filler_array_max_size().
|
// words <= filler_array_max_size().
|
||||||
static inline void fill_with_array(HeapWord* start, size_t words);
|
static inline void fill_with_array(HeapWord* start, size_t words, bool zap = true);
|
||||||
|
|
||||||
// Fill with a single object (either an int array or a java.lang.Object).
|
// Fill with a single object (either an int array or a java.lang.Object).
|
||||||
static inline void fill_with_object_impl(HeapWord* start, size_t words);
|
static inline void fill_with_object_impl(HeapWord* start, size_t words, bool zap = true);
|
||||||
|
|
||||||
// Verification functions
|
// Verification functions
|
||||||
virtual void check_for_bad_heap_word_value(HeapWord* addr, size_t size)
|
virtual void check_for_bad_heap_word_value(HeapWord* addr, size_t size)
|
||||||
@ -338,14 +338,14 @@ class CollectedHeap : public CHeapObj {
|
|||||||
return size_t(align_object_size(oopDesc::header_size()));
|
return size_t(align_object_size(oopDesc::header_size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void fill_with_objects(HeapWord* start, size_t words);
|
static void fill_with_objects(HeapWord* start, size_t words, bool zap = true);
|
||||||
|
|
||||||
static void fill_with_object(HeapWord* start, size_t words);
|
static void fill_with_object(HeapWord* start, size_t words, bool zap = true);
|
||||||
static void fill_with_object(MemRegion region) {
|
static void fill_with_object(MemRegion region, bool zap = true) {
|
||||||
fill_with_object(region.start(), region.word_size());
|
fill_with_object(region.start(), region.word_size(), zap);
|
||||||
}
|
}
|
||||||
static void fill_with_object(HeapWord* start, HeapWord* end) {
|
static void fill_with_object(HeapWord* start, HeapWord* end, bool zap = true) {
|
||||||
fill_with_object(start, pointer_delta(end, start));
|
fill_with_object(start, pointer_delta(end, start), zap);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Some heaps may offer a contiguous region for shared non-blocking
|
// Some heaps may offer a contiguous region for shared non-blocking
|
||||||
|
@ -100,7 +100,7 @@ void ThreadLocalAllocBuffer::accumulate_statistics() {
|
|||||||
void ThreadLocalAllocBuffer::make_parsable(bool retire) {
|
void ThreadLocalAllocBuffer::make_parsable(bool retire) {
|
||||||
if (end() != NULL) {
|
if (end() != NULL) {
|
||||||
invariants();
|
invariants();
|
||||||
CollectedHeap::fill_with_object(top(), hard_end());
|
CollectedHeap::fill_with_object(top(), hard_end(), retire);
|
||||||
|
|
||||||
if (retire || ZeroTLAB) { // "Reset" the TLAB
|
if (retire || ZeroTLAB) { // "Reset" the TLAB
|
||||||
set_start(NULL);
|
set_start(NULL);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 1999-2007 Sun Microsystems, Inc. All Rights Reserved.
|
* Copyright 1999-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -27,8 +27,13 @@ inline HeapWord* ThreadLocalAllocBuffer::allocate(size_t size) {
|
|||||||
HeapWord* obj = top();
|
HeapWord* obj = top();
|
||||||
if (pointer_delta(end(), obj) >= size) {
|
if (pointer_delta(end(), obj) >= size) {
|
||||||
// successful thread-local allocation
|
// successful thread-local allocation
|
||||||
|
#ifdef ASSERT
|
||||||
DEBUG_ONLY(Copy::fill_to_words(obj, size, badHeapWordVal));
|
// Skip mangling the space corresponding to the object header to
|
||||||
|
// ensure that the returned space is not considered parsable by
|
||||||
|
// any concurrent GC thread.
|
||||||
|
size_t hdr_size = CollectedHeap::min_fill_size();
|
||||||
|
Copy::fill_to_words(obj + hdr_size, size - hdr_size, badHeapWordVal);
|
||||||
|
#endif // ASSERT
|
||||||
// This addition is safe because we know that top is
|
// This addition is safe because we know that top is
|
||||||
// at least size below end, so the add can't wrap.
|
// at least size below end, so the add can't wrap.
|
||||||
set_top(obj + size);
|
set_top(obj + size);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user