mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-22 03:54:33 +02:00
6888898: CMS: ReduceInitialCardMarks unsafe in the presence of cms precleaning
6889757: G1: enable card mark elision for initializing writes from compiled code (ReduceInitialCardMarks) Defer the (compiler-elided) card-mark upon a slow-path allocation until after the store and before the next subsequent safepoint; G1 now answers yes to can_elide_tlab_write_barriers(). Reviewed-by: jcoomes, kvn, never
This commit is contained in:
parent
a67426faf8
commit
928ac69fcd
13 changed files with 209 additions and 73 deletions
|
@ -314,41 +314,6 @@ bool ParallelScavengeHeap::is_in_reserved(const void* p) const {
|
|||
return false;
|
||||
}
|
||||
|
||||
// Static method
|
||||
bool ParallelScavengeHeap::is_in_young(oop* p) {
|
||||
ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap();
|
||||
assert(heap->kind() == CollectedHeap::ParallelScavengeHeap,
|
||||
"Must be ParallelScavengeHeap");
|
||||
|
||||
PSYoungGen* young_gen = heap->young_gen();
|
||||
|
||||
if (young_gen->is_in_reserved(p)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Static method
|
||||
bool ParallelScavengeHeap::is_in_old_or_perm(oop* p) {
|
||||
ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap();
|
||||
assert(heap->kind() == CollectedHeap::ParallelScavengeHeap,
|
||||
"Must be ParallelScavengeHeap");
|
||||
|
||||
PSOldGen* old_gen = heap->old_gen();
|
||||
PSPermGen* perm_gen = heap->perm_gen();
|
||||
|
||||
if (old_gen->is_in_reserved(p)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (perm_gen->is_in_reserved(p)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// There are two levels of allocation policy here.
|
||||
//
|
||||
// When an allocation request fails, the requesting thread must invoke a VM
|
||||
|
@ -764,6 +729,13 @@ void ParallelScavengeHeap::resize_all_tlabs() {
|
|||
CollectedHeap::resize_all_tlabs();
|
||||
}
|
||||
|
||||
bool ParallelScavengeHeap::can_elide_initializing_store_barrier(oop new_obj) {
|
||||
// We don't need barriers for stores to objects in the
|
||||
// young gen and, a fortiori, for initializing stores to
|
||||
// objects therein.
|
||||
return is_in_young(new_obj);
|
||||
}
|
||||
|
||||
// This method is used by System.gc() and JVMTI.
|
||||
void ParallelScavengeHeap::collect(GCCause::Cause cause) {
|
||||
assert(!Heap_lock->owned_by_self(),
|
||||
|
|
|
@ -129,8 +129,8 @@ class ParallelScavengeHeap : public CollectedHeap {
|
|||
return perm_gen()->is_in(p);
|
||||
}
|
||||
|
||||
static bool is_in_young(oop *p); // reserved part
|
||||
static bool is_in_old_or_perm(oop *p); // reserved part
|
||||
inline bool is_in_young(oop p); // reserved part
|
||||
inline bool is_in_old_or_perm(oop p); // reserved part
|
||||
|
||||
// Memory allocation. "gc_time_limit_was_exceeded" will
|
||||
// be set to true if the adaptive size policy determine that
|
||||
|
@ -191,6 +191,10 @@ class ParallelScavengeHeap : public CollectedHeap {
|
|||
return true;
|
||||
}
|
||||
|
||||
// Return true if we don't we need a store barrier for
|
||||
// initializing stores to an object at this address.
|
||||
virtual bool can_elide_initializing_store_barrier(oop new_obj);
|
||||
|
||||
// Can a compiler elide a store barrier when it writes
|
||||
// a permanent oop into the heap? Applies when the compiler
|
||||
// is storing x to the heap, where x->is_perm() is true.
|
||||
|
|
|
@ -41,3 +41,11 @@ inline void ParallelScavengeHeap::invoke_full_gc(bool maximum_compaction)
|
|||
PSMarkSweep::invoke(maximum_compaction);
|
||||
}
|
||||
}
|
||||
|
||||
inline bool ParallelScavengeHeap::is_in_young(oop p) {
|
||||
return young_gen()->is_in_reserved(p);
|
||||
}
|
||||
|
||||
inline bool ParallelScavengeHeap::is_in_old_or_perm(oop p) {
|
||||
return old_gen()->is_in_reserved(p) || perm_gen()->is_in_reserved(p);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue