8264513: Cleanup CardTableBarrierSetC2::post_barrier
Reviewed-by: tschatzl
This commit is contained in:
parent
666fd62ee8
commit
1c6b1134d0
@ -58,22 +58,18 @@ void CardTableBarrierSetC2::post_barrier(GraphKit* kit,
|
|||||||
Node* val,
|
Node* val,
|
||||||
BasicType bt,
|
BasicType bt,
|
||||||
bool use_precise) const {
|
bool use_precise) const {
|
||||||
// No store check needed if we're storing a NULL or an old object
|
// No store check needed if we're storing a NULL.
|
||||||
// (latter case is probably a string constant). The concurrent
|
|
||||||
// mark sweep garbage collector, however, needs to have all nonNull
|
|
||||||
// oop updates flagged via card-marks.
|
|
||||||
if (val != NULL && val->is_Con()) {
|
if (val != NULL && val->is_Con()) {
|
||||||
// must be either an oop or NULL
|
|
||||||
const Type* t = val->bottom_type();
|
const Type* t = val->bottom_type();
|
||||||
if (t == TypePtr::NULL_PTR || t == Type::TOP)
|
if (t == TypePtr::NULL_PTR || t == Type::TOP) {
|
||||||
// stores of null never (?) need barriers
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (use_ReduceInitialCardMarks()
|
if (use_ReduceInitialCardMarks()
|
||||||
&& obj == kit->just_allocated_object(kit->control())) {
|
&& obj == kit->just_allocated_object(kit->control())) {
|
||||||
// We can skip marks on a freshly-allocated object in Eden.
|
// We can skip marks on a freshly-allocated object in Eden.
|
||||||
// Keep this code in sync with new_deferred_store_barrier() in runtime.cpp.
|
// Keep this code in sync with CardTableBarrierSet::on_slowpath_allocation_exit.
|
||||||
// That routine informs GC to take appropriate compensating steps,
|
// That routine informs GC to take appropriate compensating steps,
|
||||||
// upon a slow-path allocation, so as to make this card-mark
|
// upon a slow-path allocation, so as to make this card-mark
|
||||||
// elision safe.
|
// elision safe.
|
||||||
@ -83,8 +79,10 @@ void CardTableBarrierSetC2::post_barrier(GraphKit* kit,
|
|||||||
if (!use_precise) {
|
if (!use_precise) {
|
||||||
// All card marks for a (non-array) instance are in one place:
|
// All card marks for a (non-array) instance are in one place:
|
||||||
adr = obj;
|
adr = obj;
|
||||||
|
} else {
|
||||||
|
// Else it's an array (or unknown), and we want more precise card marks.
|
||||||
}
|
}
|
||||||
// (Else it's an array (or unknown), and we want more precise card marks.)
|
|
||||||
assert(adr != NULL, "");
|
assert(adr != NULL, "");
|
||||||
|
|
||||||
IdealKit ideal(kit, true);
|
IdealKit ideal(kit, true);
|
||||||
@ -100,7 +98,9 @@ void CardTableBarrierSetC2::post_barrier(GraphKit* kit,
|
|||||||
|
|
||||||
// Get the alias_index for raw card-mark memory
|
// Get the alias_index for raw card-mark memory
|
||||||
int adr_type = Compile::AliasIdxRaw;
|
int adr_type = Compile::AliasIdxRaw;
|
||||||
Node* zero = __ ConI(0); // Dirty card value
|
|
||||||
|
// Dirty card value to store
|
||||||
|
Node* dirty = __ ConI(CardTable::dirty_card_val());
|
||||||
|
|
||||||
if (UseCondCardMark) {
|
if (UseCondCardMark) {
|
||||||
// The classic GC reference write barrier is typically implemented
|
// The classic GC reference write barrier is typically implemented
|
||||||
@ -111,11 +111,11 @@ void CardTableBarrierSetC2::post_barrier(GraphKit* kit,
|
|||||||
// stores. In theory we could relax the load from ctrl() to
|
// stores. In theory we could relax the load from ctrl() to
|
||||||
// no_ctrl, but that doesn't buy much latitude.
|
// no_ctrl, but that doesn't buy much latitude.
|
||||||
Node* card_val = __ load( __ ctrl(), card_adr, TypeInt::BYTE, T_BYTE, adr_type);
|
Node* card_val = __ load( __ ctrl(), card_adr, TypeInt::BYTE, T_BYTE, adr_type);
|
||||||
__ if_then(card_val, BoolTest::ne, zero);
|
__ if_then(card_val, BoolTest::ne, dirty);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Smash zero into card
|
// Smash dirty value into card
|
||||||
__ store(__ ctrl(), card_adr, zero, T_BYTE, adr_type, MemNode::unordered);
|
__ store(__ ctrl(), card_adr, dirty, T_BYTE, adr_type, MemNode::unordered);
|
||||||
|
|
||||||
if (UseCondCardMark) {
|
if (UseCondCardMark) {
|
||||||
__ end_if();
|
__ end_if();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user