< prev index next >
src/share/vm/opto/macroArrayCopy.cpp
Print this page
*** 29,39 ****
#include "opto/graphKit.hpp"
#include "opto/macro.hpp"
#include "opto/runtime.hpp"
! void PhaseMacroExpand::insert_mem_bar(Node** ctrl, Node** mem, int opcode, Node* precedent) {
MemBarNode* mb = MemBarNode::make(C, opcode, Compile::AliasIdxBot, precedent);
mb->init_req(TypeFunc::Control, *ctrl);
mb->init_req(TypeFunc::Memory, *mem);
transform_later(mb);
*ctrl = new ProjNode(mb,TypeFunc::Control);
--- 29,39 ----
#include "opto/graphKit.hpp"
#include "opto/macro.hpp"
#include "opto/runtime.hpp"
! void PhaseMacroExpand::insert_mem_bar(Node** ctrl, Node** mem, Opcodes opcode, Node* precedent) {
MemBarNode* mb = MemBarNode::make(C, opcode, Compile::AliasIdxBot, precedent);
mb->init_req(TypeFunc::Control, *ctrl);
mb->init_req(TypeFunc::Memory, *mem);
transform_later(mb);
*ctrl = new ProjNode(mb,TypeFunc::Control);
*** 388,398 ****
intcon(0), NULL,
alloc->in(AllocateNode::AllocSize));
// Use a secondary InitializeNode as raw memory barrier.
// Currently it is needed only on this path since other
// paths have stub or runtime calls as raw memory barriers.
! MemBarNode* mb = MemBarNode::make(C, Op_Initialize,
Compile::AliasIdxRaw,
top());
transform_later(mb);
mb->set_req(TypeFunc::Control,local_ctrl);
mb->set_req(TypeFunc::Memory, local_mem->memory_at(Compile::AliasIdxRaw));
--- 388,398 ----
intcon(0), NULL,
alloc->in(AllocateNode::AllocSize));
// Use a secondary InitializeNode as raw memory barrier.
// Currently it is needed only on this path since other
// paths have stub or runtime calls as raw memory barriers.
! MemBarNode* mb = MemBarNode::make(C, Opcodes::Op_Initialize,
Compile::AliasIdxRaw,
top());
transform_later(mb);
mb->set_req(TypeFunc::Control,local_ctrl);
mb->set_req(TypeFunc::Memory, local_mem->memory_at(Compile::AliasIdxRaw));
*** 707,719 ****
// Do not let reads from the cloned object float above the arraycopy.
if (alloc != NULL && !alloc->initialization()->does_not_escape()) {
// Do not let stores that initialize this object be reordered with
// a subsequent store that would make this object accessible by
// other threads.
! insert_mem_bar(ctrl, &out_mem, Op_MemBarStoreStore);
} else if (InsertMemBarAfterArraycopy) {
! insert_mem_bar(ctrl, &out_mem, Op_MemBarCPUOrder);
}
_igvn.replace_node(_memproj_fallthrough, out_mem);
_igvn.replace_node(_ioproj_fallthrough, *io);
_igvn.replace_node(_fallthroughcatchproj, *ctrl);
--- 707,719 ----
// Do not let reads from the cloned object float above the arraycopy.
if (alloc != NULL && !alloc->initialization()->does_not_escape()) {
// Do not let stores that initialize this object be reordered with
// a subsequent store that would make this object accessible by
// other threads.
! insert_mem_bar(ctrl, &out_mem, Opcodes::Op_MemBarStoreStore);
} else if (InsertMemBarAfterArraycopy) {
! insert_mem_bar(ctrl, &out_mem, Opcodes::Op_MemBarCPUOrder);
}
_igvn.replace_node(_memproj_fallthrough, out_mem);
_igvn.replace_node(_ioproj_fallthrough, *io);
_igvn.replace_node(_fallthroughcatchproj, *ctrl);
*** 1143,1153 ****
top_dest == NULL || top_dest->klass() == NULL) {
// Conservatively insert a memory barrier on all memory slices.
// Do not let writes into the source float below the arraycopy.
{
Node* mem = ac->in(TypeFunc::Memory);
! insert_mem_bar(&ctrl, &mem, Op_MemBarCPUOrder);
merge_mem = MergeMemNode::make(mem);
transform_later(merge_mem);
}
--- 1143,1153 ----
top_dest == NULL || top_dest->klass() == NULL) {
// Conservatively insert a memory barrier on all memory slices.
// Do not let writes into the source float below the arraycopy.
{
Node* mem = ac->in(TypeFunc::Memory);
! insert_mem_bar(&ctrl, &mem, Opcodes::Op_MemBarCPUOrder);
merge_mem = MergeMemNode::make(mem);
transform_later(merge_mem);
}
*** 1160,1170 ****
// Since we cannot type the arrays, we don't know which slices
// might be affected. We could restrict this barrier only to those
// memory slices which pertain to array elements--but don't bother.
if (!InsertMemBarAfterArraycopy) {
// (If InsertMemBarAfterArraycopy, there is already one in place.)
! insert_mem_bar(&ctrl, &mem, Op_MemBarCPUOrder);
}
return;
}
// (2) src and dest arrays must have elements of the same BasicType
// Figure out the size and type of the elements we will be copying.
--- 1160,1170 ----
// Since we cannot type the arrays, we don't know which slices
// might be affected. We could restrict this barrier only to those
// memory slices which pertain to array elements--but don't bother.
if (!InsertMemBarAfterArraycopy) {
// (If InsertMemBarAfterArraycopy, there is already one in place.)
! insert_mem_bar(&ctrl, &mem, Opcodes::Op_MemBarCPUOrder);
}
return;
}
// (2) src and dest arrays must have elements of the same BasicType
// Figure out the size and type of the elements we will be copying.
< prev index next >