< prev index next >
src/hotspot/share/opto/valuetypenode.cpp
Print this page
*** 394,403 ****
--- 394,410 ----
kit->kill_dead_locals();
ciValueKlass* vk = value_klass();
Node* klass_node = kit->makecon(TypeKlassPtr::make(vk));
Node* alloc_oop = kit->new_instance(klass_node, NULL, NULL, /* deoptimize_on_exception */ true, this);
store(kit, alloc_oop, alloc_oop, vk, 0);
+
+ // Do not let stores that initialize this buffer be reordered with a subsequent
+ // store that would make this buffer accessible by other threads.
+ AllocateNode* alloc = AllocateNode::Ideal_allocation(alloc_oop, &kit->gvn());
+ assert(alloc != NULL, "must have an allocation node");
+ kit->insert_mem_bar(Op_MemBarStoreStore, alloc->proj_out_or_null(AllocateNode::RawAddress));
+
region->init_req(2, kit->control());
oop ->init_req(2, alloc_oop);
io ->init_req(2, kit->i_o());
mem ->init_req(2, kit->merged_memory());
}
*** 417,426 ****
--- 424,434 ----
vt->set_oop(res_oop);
vt = kit->gvn().transform(vt)->as_ValueTypeBase();
if (safe_for_replace) {
kit->replace_in_map(this, vt);
}
+ assert(vt->is_allocated(&kit->gvn()), "must be allocated");
return vt;
}
bool ValueTypeBaseNode::is_allocated(PhaseGVN* phase) const {
Node* oop = get_oop();
*** 606,625 ****
--- 614,640 ----
store(kit, alloc_oop, alloc_oop, vk, 0);
res->set_oop(alloc_oop);
}
res->set_type(TypeValueType::make(vk, true));
res = kit->gvn().transform(res)->as_ValueType();
+ assert(!allocate || res->is_allocated(&kit->gvn()), "must be allocated");
return res;
}
ValueTypeNode* ValueTypeNode::finish_larval(GraphKit* kit) const {
Node* obj = get_oop();
Node* mark_addr = kit->basic_plus_adr(obj, oopDesc::mark_offset_in_bytes());
Node* mark = kit->make_load(NULL, mark_addr, TypeX_X, TypeX_X->basic_type(), MemNode::unordered);
mark = kit->gvn().transform(new AndXNode(mark, kit->MakeConX(~markWord::larval_mask_in_place)));
kit->store_to_memory(kit->control(), mark_addr, mark, TypeX_X->basic_type(), kit->gvn().type(mark_addr)->is_ptr(), MemNode::unordered);
+ // Do not let stores that initialize this buffer be reordered with a subsequent
+ // store that would make this buffer accessible by other threads.
+ AllocateNode* alloc = AllocateNode::Ideal_allocation(obj, &kit->gvn());
+ assert(alloc != NULL, "must have an allocation node");
+ kit->insert_mem_bar(Op_MemBarStoreStore, alloc->proj_out_or_null(AllocateNode::RawAddress));
+
ciValueKlass* vk = value_klass();
ValueTypeNode* res = clone()->as_ValueType();
res->set_type(TypeValueType::make(vk, false));
res = kit->gvn().transform(res)->as_ValueType();
return res;
< prev index next >