1814 |
1814 |
1815 // The memory projection from a lock/unlock is RawMem |
1815 // The memory projection from a lock/unlock is RawMem |
1816 // The input to a Lock is merged memory, so extract its RawMem input |
1816 // The input to a Lock is merged memory, so extract its RawMem input |
1817 // (unless the MergeMem has been optimized away.) |
1817 // (unless the MergeMem has been optimized away.) |
1818 if (alock->is_Lock()) { |
1818 if (alock->is_Lock()) { |
1819 // Seach for MemBarAcquire node and delete it also. |
1819 // Seach for MemBarAcquireLock node and delete it also. |
1820 MemBarNode* membar = fallthroughproj->unique_ctrl_out()->as_MemBar(); |
1820 MemBarNode* membar = fallthroughproj->unique_ctrl_out()->as_MemBar(); |
1821 assert(membar != NULL && membar->Opcode() == Op_MemBarAcquire, ""); |
1821 assert(membar != NULL && membar->Opcode() == Op_MemBarAcquireLock, ""); |
1822 Node* ctrlproj = membar->proj_out(TypeFunc::Control); |
1822 Node* ctrlproj = membar->proj_out(TypeFunc::Control); |
1823 Node* memproj = membar->proj_out(TypeFunc::Memory); |
1823 Node* memproj = membar->proj_out(TypeFunc::Memory); |
1824 _igvn.replace_node(ctrlproj, fallthroughproj); |
1824 _igvn.replace_node(ctrlproj, fallthroughproj); |
1825 _igvn.replace_node(memproj, memproj_fallthrough); |
1825 _igvn.replace_node(memproj, memproj_fallthrough); |
1826 |
1826 |
1831 assert(flock->unique_out() == alock, "sanity"); |
1831 assert(flock->unique_out() == alock, "sanity"); |
1832 _igvn.replace_node(flock, top()); |
1832 _igvn.replace_node(flock, top()); |
1833 } |
1833 } |
1834 } |
1834 } |
1835 |
1835 |
1836 // Seach for MemBarRelease node and delete it also. |
1836 // Seach for MemBarReleaseLock node and delete it also. |
1837 if (alock->is_Unlock() && ctrl != NULL && ctrl->is_Proj() && |
1837 if (alock->is_Unlock() && ctrl != NULL && ctrl->is_Proj() && |
1838 ctrl->in(0)->is_MemBar()) { |
1838 ctrl->in(0)->is_MemBar()) { |
1839 MemBarNode* membar = ctrl->in(0)->as_MemBar(); |
1839 MemBarNode* membar = ctrl->in(0)->as_MemBar(); |
1840 assert(membar->Opcode() == Op_MemBarRelease && |
1840 assert(membar->Opcode() == Op_MemBarReleaseLock && |
1841 mem->is_Proj() && membar == mem->in(0), ""); |
1841 mem->is_Proj() && membar == mem->in(0), ""); |
1842 _igvn.replace_node(fallthroughproj, ctrl); |
1842 _igvn.replace_node(fallthroughproj, ctrl); |
1843 _igvn.replace_node(memproj_fallthrough, mem); |
1843 _igvn.replace_node(memproj_fallthrough, mem); |
1844 fallthroughproj = ctrl; |
1844 fallthroughproj = ctrl; |
1845 memproj_fallthrough = mem; |
1845 memproj_fallthrough = mem; |