8023597: Optimize G1 barriers code for unsafe load_store

Avoid loading old values in G1 pre-barriers for inlined unsafe load_store nodes.

Reviewed-by: kvn, tonyp
This commit is contained in:
Martin Doerr 2013-08-28 11:22:43 +02:00 committed by Vladimir Kozlov
parent e789f19ac1
commit c678f0173a
3 changed files with 64 additions and 10 deletions

View file

@ -1501,6 +1501,25 @@ void GraphKit::pre_barrier(bool do_load,
}
}
bool GraphKit::can_move_pre_barrier() const {
BarrierSet* bs = Universe::heap()->barrier_set();
switch (bs->kind()) {
case BarrierSet::G1SATBCT:
case BarrierSet::G1SATBCTLogging:
return true; // Can move it if no safepoint
case BarrierSet::CardTableModRef:
case BarrierSet::CardTableExtension:
case BarrierSet::ModRef:
return true; // There is no pre-barrier
case BarrierSet::Other:
default :
ShouldNotReachHere();
}
return false;
}
void GraphKit::post_barrier(Node* ctl,
Node* store,
Node* obj,
@ -3551,6 +3570,8 @@ void GraphKit::g1_write_barrier_pre(bool do_load,
} else {
// In this case both val_type and alias_idx are unused.
assert(pre_val != NULL, "must be loaded already");
// Nothing to be done if pre_val is null.
if (pre_val->bottom_type() == TypePtr::NULL_PTR) return;
assert(pre_val->bottom_type()->basic_type() == T_OBJECT, "or we shouldn't be here");
}
assert(bt == T_OBJECT, "or we shouldn't be here");