< prev index next >
src/share/vm/opto/graphKit.cpp
Print this page
*** 1265,1275 ****
// At this point we want to scan up the CFG to see if we can
// find an identical test (and so avoid this test altogether).
Node *cfg = control();
int depth = 0;
while( depth < 16 ) { // Limit search depth for speed
! if( cfg->Opcode() == Op_IfTrue &&
cfg->in(0)->in(1) == tst ) {
// Found prior test. Use "cast_not_null" to construct an identical
// CastPP (and hence hash to) as already exists for the prior test.
// Return that casted value.
if (assert_null) {
--- 1265,1275 ----
// At this point we want to scan up the CFG to see if we can
// find an identical test (and so avoid this test altogether).
Node *cfg = control();
int depth = 0;
while( depth < 16 ) { // Limit search depth for speed
! if( cfg->Opcode() == Opcodes::Op_IfTrue &&
cfg->in(0)->in(1) == tst ) {
// Found prior test. Use "cast_not_null" to construct an identical
// CastPP (and hence hash to) as already exists for the prior test.
// Return that casted value.
if (assert_null) {
*** 2032,2042 ****
// Make sure any guarding test views this path as very unlikely
Node *i0 = control()->in(0);
if (i0 != NULL && i0->is_If()) { // Found a guarding if test?
IfNode *iff = i0->as_If();
float f = iff->_prob; // Get prob
! if (control()->Opcode() == Op_IfTrue) {
if (f > PROB_UNLIKELY_MAG(4))
iff->_prob = PROB_MIN;
} else {
if (f < PROB_LIKELY_MAG(4))
iff->_prob = PROB_MAX;
--- 2032,2042 ----
// Make sure any guarding test views this path as very unlikely
Node *i0 = control()->in(0);
if (i0 != NULL && i0->is_If()) { // Found a guarding if test?
IfNode *iff = i0->as_If();
float f = iff->_prob; // Get prob
! if (control()->Opcode() == Opcodes::Op_IfTrue) {
if (f > PROB_UNLIKELY_MAG(4))
iff->_prob = PROB_MIN;
} else {
if (f < PROB_LIKELY_MAG(4))
iff->_prob = PROB_MAX;
*** 3108,3118 ****
}
//------------------------------insert_mem_bar---------------------------------
// Memory barrier to avoid floating things around
// The membar serves as a pinch point between both control and all memory slices.
! Node* GraphKit::insert_mem_bar(int opcode, Node* precedent) {
MemBarNode* mb = MemBarNode::make(C, opcode, Compile::AliasIdxBot, precedent);
mb->init_req(TypeFunc::Control, control());
mb->init_req(TypeFunc::Memory, reset_memory());
Node* membar = _gvn.transform(mb);
set_control(_gvn.transform(new ProjNode(membar, TypeFunc::Control)));
--- 3108,3118 ----
}
//------------------------------insert_mem_bar---------------------------------
// Memory barrier to avoid floating things around
// The membar serves as a pinch point between both control and all memory slices.
! Node* GraphKit::insert_mem_bar(Opcodes opcode, Node* precedent) {
MemBarNode* mb = MemBarNode::make(C, opcode, Compile::AliasIdxBot, precedent);
mb->init_req(TypeFunc::Control, control());
mb->init_req(TypeFunc::Memory, reset_memory());
Node* membar = _gvn.transform(mb);
set_control(_gvn.transform(new ProjNode(membar, TypeFunc::Control)));
*** 3123,3133 ****
//-------------------------insert_mem_bar_volatile----------------------------
// Memory barrier to avoid floating things around
// The membar serves as a pinch point between both control and memory(alias_idx).
// If you want to make a pinch point on all memory slices, do not use this
// function (even with AliasIdxBot); use insert_mem_bar() instead.
! Node* GraphKit::insert_mem_bar_volatile(int opcode, int alias_idx, Node* precedent) {
// When Parse::do_put_xxx updates a volatile field, it appends a series
// of MemBarVolatile nodes, one for *each* volatile field alias category.
// The first membar is on the same memory slice as the field store opcode.
// This forces the membar to follow the store. (Bug 6500685 broke this.)
// All the other membars (for other volatile slices, including AliasIdxBot,
--- 3123,3133 ----
//-------------------------insert_mem_bar_volatile----------------------------
// Memory barrier to avoid floating things around
// The membar serves as a pinch point between both control and memory(alias_idx).
// If you want to make a pinch point on all memory slices, do not use this
// function (even with AliasIdxBot); use insert_mem_bar() instead.
! Node* GraphKit::insert_mem_bar_volatile(Opcodes opcode, int alias_idx, Node* precedent) {
// When Parse::do_put_xxx updates a volatile field, it appends a series
// of MemBarVolatile nodes, one for *each* volatile field alias category.
// The first membar is on the same memory slice as the field store opcode.
// This forces the membar to follow the store. (Bug 6500685 broke this.)
// All the other membars (for other volatile slices, including AliasIdxBot,
*** 3138,3148 ****
MemBarNode* mb = MemBarNode::make(C, opcode, alias_idx, precedent);
mb->set_req(TypeFunc::Control,control());
if (alias_idx == Compile::AliasIdxBot) {
mb->set_req(TypeFunc::Memory, merged_memory()->base_memory());
} else {
! assert(!(opcode == Op_Initialize && alias_idx != Compile::AliasIdxRaw), "fix caller");
mb->set_req(TypeFunc::Memory, memory(alias_idx));
}
Node* membar = _gvn.transform(mb);
set_control(_gvn.transform(new ProjNode(membar, TypeFunc::Control)));
if (alias_idx == Compile::AliasIdxBot) {
--- 3138,3148 ----
MemBarNode* mb = MemBarNode::make(C, opcode, alias_idx, precedent);
mb->set_req(TypeFunc::Control,control());
if (alias_idx == Compile::AliasIdxBot) {
mb->set_req(TypeFunc::Memory, merged_memory()->base_memory());
} else {
! assert(!(opcode == Opcodes::Op_Initialize && alias_idx != Compile::AliasIdxRaw), "fix caller");
mb->set_req(TypeFunc::Memory, memory(alias_idx));
}
Node* membar = _gvn.transform(mb);
set_control(_gvn.transform(new ProjNode(membar, TypeFunc::Control)));
if (alias_idx == Compile::AliasIdxBot) {
*** 3153,3163 ****
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));
--- 3153,3163 ----
return membar;
}
void GraphKit::insert_store_load_for_barrier() {
Node* mem = reset_memory();
! MemBarNode* mb = MemBarNode::make(C, Opcodes::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));
*** 3214,3224 ****
lock = _gvn.transform( lock )->as_Lock();
// lock has no side-effects, sets few values
set_predefined_output_for_runtime_call(lock, mem, TypeRawPtr::BOTTOM);
! insert_mem_bar(Op_MemBarAcquireLock);
// Add this to the worklist so that the lock can be eliminated
record_for_igvn(lock);
#ifndef PRODUCT
--- 3214,3224 ----
lock = _gvn.transform( lock )->as_Lock();
// lock has no side-effects, sets few values
set_predefined_output_for_runtime_call(lock, mem, TypeRawPtr::BOTTOM);
! insert_mem_bar(Opcodes::Op_MemBarAcquireLock);
// Add this to the worklist so that the lock can be eliminated
record_for_igvn(lock);
#ifndef PRODUCT
*** 3247,3257 ****
map()->pop_monitor(); // Kill monitor from debug info
return;
}
// Memory barrier to avoid floating things down past the locked region
! insert_mem_bar(Op_MemBarReleaseLock);
const TypeFunc *tf = OptoRuntime::complete_monitor_exit_Type();
UnlockNode *unlock = new UnlockNode(C, tf);
#ifdef ASSERT
unlock->set_dbg_jvms(sync_jvms());
--- 3247,3257 ----
map()->pop_monitor(); // Kill monitor from debug info
return;
}
// Memory barrier to avoid floating things down past the locked region
! insert_mem_bar(Opcodes::Op_MemBarReleaseLock);
const TypeFunc *tf = OptoRuntime::complete_monitor_exit_Type();
UnlockNode *unlock = new UnlockNode(C, tf);
#ifdef ASSERT
unlock->set_dbg_jvms(sync_jvms());
*** 3335,3345 ****
// we create a separate i_o projection for the normal control path
set_i_o(_gvn.transform( new ProjNode(allocx, TypeFunc::I_O, false) ) );
Node* rawoop = _gvn.transform( new ProjNode(allocx, TypeFunc::Parms) );
// put in an initialization barrier
! InitializeNode* init = insert_mem_bar_volatile(Op_Initialize, rawidx,
rawoop)->as_Initialize();
assert(alloc->initialization() == init, "2-way macro link must work");
assert(init ->allocation() == alloc, "2-way macro link must work");
{
// Extract memory strands which may participate in the new object's
--- 3335,3345 ----
// we create a separate i_o projection for the normal control path
set_i_o(_gvn.transform( new ProjNode(allocx, TypeFunc::I_O, false) ) );
Node* rawoop = _gvn.transform( new ProjNode(allocx, TypeFunc::Parms) );
// put in an initialization barrier
! InitializeNode* init = insert_mem_bar_volatile(Opcodes::Op_Initialize, rawidx,
rawoop)->as_Initialize();
assert(alloc->initialization() == init, "2-way macro link must work");
assert(init ->allocation() == alloc, "2-way macro link must work");
{
// Extract memory strands which may participate in the new object's
*** 4398,4408 ****
merge->set_memory_at(dst_idx, memory(dst_idx));
return merge;
}
Node* GraphKit::compress_string(Node* src, const TypeAryPtr* src_type, Node* dst, Node* count) {
! assert(Matcher::match_rule_supported(Op_StrCompressedCopy), "Intrinsic not supported");
assert(src_type == TypeAryPtr::BYTES || src_type == TypeAryPtr::CHARS, "invalid source type");
// If input and output memory types differ, capture both states to preserve
// the dependency between preceding and subsequent loads/stores.
// For example, the following program:
// StoreB
--- 4398,4408 ----
merge->set_memory_at(dst_idx, memory(dst_idx));
return merge;
}
Node* GraphKit::compress_string(Node* src, const TypeAryPtr* src_type, Node* dst, Node* count) {
! assert(Matcher::match_rule_supported(Opcodes::Op_StrCompressedCopy), "Intrinsic not supported");
assert(src_type == TypeAryPtr::BYTES || src_type == TypeAryPtr::CHARS, "invalid source type");
// If input and output memory types differ, capture both states to preserve
// the dependency between preceding and subsequent loads/stores.
// For example, the following program:
// StoreB
*** 4421,4431 ****
set_memory(res_mem, TypeAryPtr::BYTES);
return str;
}
void GraphKit::inflate_string(Node* src, Node* dst, const TypeAryPtr* dst_type, Node* count) {
! assert(Matcher::match_rule_supported(Op_StrInflatedCopy), "Intrinsic not supported");
assert(dst_type == TypeAryPtr::BYTES || dst_type == TypeAryPtr::CHARS, "invalid dest type");
// Capture src and dst memory (see comment in 'compress_string').
Node* mem = capture_memory(TypeAryPtr::BYTES, dst_type);
StrInflatedCopyNode* str = new StrInflatedCopyNode(control(), mem, src, dst, count);
set_memory(_gvn.transform(str), dst_type);
--- 4421,4431 ----
set_memory(res_mem, TypeAryPtr::BYTES);
return str;
}
void GraphKit::inflate_string(Node* src, Node* dst, const TypeAryPtr* dst_type, Node* count) {
! assert(Matcher::match_rule_supported(Opcodes::Op_StrInflatedCopy), "Intrinsic not supported");
assert(dst_type == TypeAryPtr::BYTES || dst_type == TypeAryPtr::CHARS, "invalid dest type");
// Capture src and dst memory (see comment in 'compress_string').
Node* mem = capture_memory(TypeAryPtr::BYTES, dst_type);
StrInflatedCopyNode* str = new StrInflatedCopyNode(control(), mem, src, dst, count);
set_memory(_gvn.transform(str), dst_type);
< prev index next >