src/share/vm/opto/graphKit.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Cdiff src/share/vm/opto/graphKit.cpp

src/share/vm/opto/graphKit.cpp

Print this page
rev 10072 : 8087341: C2 doesn't optimize redundant memory operations with G1
Summary: effect of memory barrier in post barrier is too wide
Reviewed-by:

*** 3147,3156 **** --- 3147,3169 ---- set_memory(_gvn.transform(new ProjNode(membar, TypeFunc::Memory)),alias_idx); } 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) { // bci is either a monitorenter bc or InvocationEntryBci // %%% SynchronizationEntryBCI is redundant; use InvocationEntryBci in interfaces
*** 3838,3848 **** int adr_type = Compile::AliasIdxRaw; Node* zero = __ ConI(0); // Dirty card value BasicType bt = T_BYTE; if (UseConcMarkSweepGC && UseCondCardMark) { ! insert_mem_bar(Op_MemBarVolatile); // StoreLoad barrier __ sync_kit(this); } if (UseCondCardMark) { // The classic GC reference write barrier is typically implemented --- 3851,3861 ---- int adr_type = Compile::AliasIdxRaw; Node* zero = __ ConI(0); // Dirty card value BasicType bt = T_BYTE; if (UseConcMarkSweepGC && UseCondCardMark) { ! insert_store_load_for_barrier(); __ sync_kit(this); } if (UseCondCardMark) { // The classic GC reference write barrier is typically implemented
*** 4278,4289 **** // load the original value of the card Node* card_val = __ load(__ ctrl(), card_adr, TypeInt::INT, T_BYTE, Compile::AliasIdxRaw); __ 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); __ sync_kit(this); Node* card_val_reload = __ load(__ ctrl(), card_adr, TypeInt::INT, T_BYTE, Compile::AliasIdxRaw); __ if_then(card_val_reload, BoolTest::ne, dirty_card); { g1_mark_card(ideal, card_adr, oop_store, alias_idx, index, index_adr, buffer, tf); --- 4291,4301 ---- // load the original value of the card Node* card_val = __ load(__ ctrl(), card_adr, TypeInt::INT, T_BYTE, Compile::AliasIdxRaw); __ if_then(card_val, BoolTest::ne, young_card); { sync_kit(ideal); ! insert_store_load_for_barrier(); __ sync_kit(this); Node* card_val_reload = __ load(__ ctrl(), card_adr, TypeInt::INT, T_BYTE, Compile::AliasIdxRaw); __ if_then(card_val_reload, BoolTest::ne, dirty_card); { g1_mark_card(ideal, card_adr, oop_store, alias_idx, index, index_adr, buffer, tf);
src/share/vm/opto/graphKit.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File