< prev index next >

src/share/vm/opto/graphKit.cpp

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

*** 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);
< prev index next >