mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-24 13:04:33 +02:00
8087341: C2 doesn't optimize redundant memory operations with G1
Effect of memory barrier in post barrier is too wide Reviewed-by: kvn, aph
This commit is contained in:
parent
4c22e8e014
commit
78d37841ef
3 changed files with 533 additions and 648 deletions
File diff suppressed because it is too large
Load diff
|
@ -3149,6 +3149,19 @@ Node* GraphKit::insert_mem_bar_volatile(int opcode, int alias_idx, Node* precede
|
|||
return membar;
|
||||
}
|
||||
|
||||
void GraphKit::insert_store_load_for_barrier() {
|
||||
Node* mem = reset_memory();
|
||||
MemBarNode* mb = MemBarNode::make(C, Op_MemBarVolatile, Compile::AliasIdxBot);
|
||||
mb->init_req(TypeFunc::Control, control());
|
||||
mb->init_req(TypeFunc::Memory, mem);
|
||||
Node* membar = _gvn.transform(mb);
|
||||
set_control(_gvn.transform(new ProjNode(membar, TypeFunc::Control)));
|
||||
Node* newmem = _gvn.transform(new ProjNode(membar, TypeFunc::Memory));
|
||||
set_all_memory(mem);
|
||||
set_memory(newmem, Compile::AliasIdxRaw);
|
||||
}
|
||||
|
||||
|
||||
//------------------------------shared_lock------------------------------------
|
||||
// Emit locking code.
|
||||
FastLockNode* GraphKit::shared_lock(Node* obj) {
|
||||
|
@ -3840,7 +3853,7 @@ void GraphKit::write_barrier_post(Node* oop_store,
|
|||
BasicType bt = T_BYTE;
|
||||
|
||||
if (UseConcMarkSweepGC && UseCondCardMark) {
|
||||
insert_mem_bar(Op_MemBarVolatile); // StoreLoad barrier
|
||||
insert_store_load_for_barrier();
|
||||
__ sync_kit(this);
|
||||
}
|
||||
|
||||
|
@ -4280,8 +4293,7 @@ void GraphKit::g1_write_barrier_post(Node* oop_store,
|
|||
|
||||
__ if_then(card_val, BoolTest::ne, young_card); {
|
||||
sync_kit(ideal);
|
||||
// Use Op_MemBarVolatile to achieve the effect of a StoreLoad barrier.
|
||||
insert_mem_bar(Op_MemBarVolatile, oop_store);
|
||||
insert_store_load_for_barrier();
|
||||
__ sync_kit(this);
|
||||
|
||||
Node* card_val_reload = __ load(__ ctrl(), card_adr, TypeInt::INT, T_BYTE, Compile::AliasIdxRaw);
|
||||
|
|
|
@ -834,6 +834,7 @@ class GraphKit : public Phase {
|
|||
int next_monitor();
|
||||
Node* insert_mem_bar(int opcode, Node* precedent = NULL);
|
||||
Node* insert_mem_bar_volatile(int opcode, int alias_idx, Node* precedent = NULL);
|
||||
void insert_store_load_for_barrier();
|
||||
// Optional 'precedent' is appended as an extra edge, to force ordering.
|
||||
FastLockNode* shared_lock(Node* obj);
|
||||
void shared_unlock(Node* box, Node* obj);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue