src/share/vm/opto/output.cpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File
JDK-8022284 Cdiff src/share/vm/opto/output.cpp
src/share/vm/opto/output.cpp
Print this page
*** 66,86 ****
C->inner_loops()*(OptoLoopAlignment-1)),
"out of nodes before code generation" ) ) {
return;
}
// Make sure I can find the Start Node
- Block_Array& bbs = _cfg->_bbs;
Block *entry = _cfg->_blocks[1];
Block *broot = _cfg->_broot;
const StartNode *start = entry->_nodes[0]->as_Start();
// Replace StartNode with prolog
MachPrologNode *prolog = new (this) MachPrologNode();
entry->_nodes.map( 0, prolog );
! bbs.map( prolog->_idx, entry );
! bbs.map( start->_idx, NULL ); // start is no longer in any block
// Virtual methods need an unverified entry point
if( is_osr_compilation() ) {
if( PoisonOSREntry ) {
--- 66,85 ----
C->inner_loops()*(OptoLoopAlignment-1)),
"out of nodes before code generation" ) ) {
return;
}
// Make sure I can find the Start Node
Block *entry = _cfg->_blocks[1];
Block *broot = _cfg->_broot;
const StartNode *start = entry->_nodes[0]->as_Start();
// Replace StartNode with prolog
MachPrologNode *prolog = new (this) MachPrologNode();
entry->_nodes.map( 0, prolog );
! _cfg->map_node_to_block(prolog, entry);
! _cfg->unmap_node_from_block(start); // start is no longer in any block
// Virtual methods need an unverified entry point
if( is_osr_compilation() ) {
if( PoisonOSREntry ) {
*** 115,126 ****
if( !b->is_connector() && b->non_connector_successor(0) == _cfg->_broot ) { // Found a program exit point?
Node *m = b->end();
if( m->is_Mach() && m->as_Mach()->ideal_Opcode() != Op_Halt ) {
MachEpilogNode *epilog = new (this) MachEpilogNode(m->as_Mach()->ideal_Opcode() == Op_Return);
b->add_inst( epilog );
! bbs.map(epilog->_idx, b);
! //_regalloc->set_bad(epilog->_idx); // Already initialized this way.
}
}
}
# ifdef ENABLE_ZAP_DEAD_LOCALS
--- 114,124 ----
if( !b->is_connector() && b->non_connector_successor(0) == _cfg->_broot ) { // Found a program exit point?
Node *m = b->end();
if( m->is_Mach() && m->as_Mach()->ideal_Opcode() != Op_Halt ) {
MachEpilogNode *epilog = new (this) MachEpilogNode(m->as_Mach()->ideal_Opcode() == Op_Return);
b->add_inst( epilog );
! _cfg->map_node_to_block(epilog, b);
}
}
}
# ifdef ENABLE_ZAP_DEAD_LOCALS
*** 250,260 ****
}
}
if (insert) {
Node *zap = call_zap_node(n->as_MachSafePoint(), i);
b->_nodes.insert( j, zap );
! _cfg->_bbs.map( zap->_idx, b );
++j;
}
}
}
}
--- 248,258 ----
}
}
if (insert) {
Node *zap = call_zap_node(n->as_MachSafePoint(), i);
b->_nodes.insert( j, zap );
! _cfg->map_node_to_block(zap, b);
++j;
}
}
}
}
*** 1232,1242 ****
cb->flush_bundle(true);
#ifdef ASSERT
if (!b->is_connector()) {
stringStream st;
! b->dump_head(&_cfg->_bbs, &st);
MacroAssembler(cb).block_comment(st.as_string());
}
jmp_target[i] = 0;
jmp_offset[i] = 0;
jmp_size[i] = 0;
--- 1230,1240 ----
cb->flush_bundle(true);
#ifdef ASSERT
if (!b->is_connector()) {
stringStream st;
! b->dump_head(_cfg, &st);
MacroAssembler(cb).block_comment(st.as_string());
}
jmp_target[i] = 0;
jmp_offset[i] = 0;
jmp_size[i] = 0;
*** 1308,1318 ****
assert((padding % nop_size) == 0, "padding is not a multiple of NOP size");
int nops_cnt = padding / nop_size;
MachNode *nop = new (this) MachNopNode(nops_cnt);
b->_nodes.insert(j++, nop);
last_inst++;
! _cfg->_bbs.map( nop->_idx, b );
nop->emit(*cb, _regalloc);
cb->flush_bundle(true);
current_offset = cb->insts_size();
}
--- 1306,1316 ----
assert((padding % nop_size) == 0, "padding is not a multiple of NOP size");
int nops_cnt = padding / nop_size;
MachNode *nop = new (this) MachNopNode(nops_cnt);
b->_nodes.insert(j++, nop);
last_inst++;
! _cfg->map_node_to_block(nop, b);
nop->emit(*cb, _regalloc);
cb->flush_bundle(true);
current_offset = cb->insts_size();
}
*** 1393,1403 ****
assert((br_size - new_size) >= (int)nop_size, "short_branch size should be smaller");
// Insert padding between avoid_back_to_back branches.
if (needs_padding && replacement->avoid_back_to_back()) {
MachNode *nop = new (this) MachNopNode();
b->_nodes.insert(j++, nop);
! _cfg->_bbs.map(nop->_idx, b);
last_inst++;
nop->emit(*cb, _regalloc);
cb->flush_bundle(true);
current_offset = cb->insts_size();
}
--- 1391,1401 ----
assert((br_size - new_size) >= (int)nop_size, "short_branch size should be smaller");
// Insert padding between avoid_back_to_back branches.
if (needs_padding && replacement->avoid_back_to_back()) {
MachNode *nop = new (this) MachNopNode();
b->_nodes.insert(j++, nop);
! _cfg->map_node_to_block(nop, b);
last_inst++;
nop->emit(*cb, _regalloc);
cb->flush_bundle(true);
current_offset = cb->insts_size();
}
*** 1547,1557 ****
Block *nb = _cfg->_blocks[i+1];
int padding = nb->alignment_padding(current_offset);
if( padding > 0 ) {
MachNode *nop = new (this) MachNopNode(padding / nop_size);
b->_nodes.insert( b->_nodes.size(), nop );
! _cfg->_bbs.map( nop->_idx, b );
nop->emit(*cb, _regalloc);
current_offset = cb->insts_size();
}
}
// Verify that the distance for generated before forward
--- 1545,1555 ----
Block *nb = _cfg->_blocks[i+1];
int padding = nb->alignment_padding(current_offset);
if( padding > 0 ) {
MachNode *nop = new (this) MachNopNode(padding / nop_size);
b->_nodes.insert( b->_nodes.size(), nop );
! _cfg->map_node_to_block(nop, b);
nop->emit(*cb, _regalloc);
current_offset = cb->insts_size();
}
}
// Verify that the distance for generated before forward
*** 1735,1745 ****
// Initializer for class Scheduling
Scheduling::Scheduling(Arena *arena, Compile &compile)
: _arena(arena),
_cfg(compile.cfg()),
- _bbs(compile.cfg()->_bbs),
_regalloc(compile.regalloc()),
_reg_node(arena),
_bundle_instr_count(0),
_bundle_cycle_number(0),
_scheduled(arena),
--- 1733,1742 ----
*** 2083,2094 ****
Node *def = n->in(i);
if (!def) continue;
if( def->is_Proj() ) // If this is a machine projection, then
def = def->in(0); // propagate usage thru to the base instruction
! if( _bbs[def->_idx] != bb ) // Ignore if not block-local
continue;
// Compute the latency
uint l = _bundle_cycle_number + n->latency(i);
if (_current_latency[def->_idx] < l)
_current_latency[def->_idx] = l;
--- 2080,2092 ----
Node *def = n->in(i);
if (!def) continue;
if( def->is_Proj() ) // If this is a machine projection, then
def = def->in(0); // propagate usage thru to the base instruction
! if(_cfg->get_block_for_node(def) != bb) { // Ignore if not block-local
continue;
+ }
// Compute the latency
uint l = _bundle_cycle_number + n->latency(i);
if (_current_latency[def->_idx] < l)
_current_latency[def->_idx] = l;
*** 2356,2368 ****
// Account for all uses
for ( uint k = 0; k < n->len(); k++ ) {
Node *inp = n->in(k);
if (!inp) continue;
assert(inp != n, "no cycles allowed" );
! if( _bbs[inp->_idx] == bb ) { // Block-local use?
! if( inp->is_Proj() ) // Skip through Proj's
inp = inp->in(0);
++_uses[inp->_idx]; // Count 1 block-local use
}
}
// If this instruction has a 0 use count, then it is available
--- 2354,2367 ----
// Account for all uses
for ( uint k = 0; k < n->len(); k++ ) {
Node *inp = n->in(k);
if (!inp) continue;
assert(inp != n, "no cycles allowed" );
! if (_cfg->get_block_for_node(inp) == bb) { // Block-local use?
! if (inp->is_Proj()) { // Skip through Proj's
inp = inp->in(0);
+ }
++_uses[inp->_idx]; // Count 1 block-local use
}
}
// If this instruction has a 0 use count, then it is available
*** 2641,2651 ****
void Scheduling::anti_do_def( Block *b, Node *def, OptoReg::Name def_reg, int is_def ) {
if( !OptoReg::is_valid(def_reg) ) // Ignore stores & control flow
return;
Node *pinch = _reg_node[def_reg]; // Get pinch point
! if( !pinch || _bbs[pinch->_idx] != b || // No pinch-point yet?
is_def ) { // Check for a true def (not a kill)
_reg_node.map(def_reg,def); // Record def/kill as the optimistic pinch-point
return;
}
--- 2640,2650 ----
void Scheduling::anti_do_def( Block *b, Node *def, OptoReg::Name def_reg, int is_def ) {
if( !OptoReg::is_valid(def_reg) ) // Ignore stores & control flow
return;
Node *pinch = _reg_node[def_reg]; // Get pinch point
! if( !pinch || _cfg->get_block_for_node(pinch) != b || // No pinch-point yet?
is_def ) { // Check for a true def (not a kill)
_reg_node.map(def_reg,def); // Record def/kill as the optimistic pinch-point
return;
}
*** 2667,2677 ****
}
if (pinch->_idx >= _regalloc->node_regs_max_index()) {
_cfg->C->record_method_not_compilable("too many D-U pinch points");
return;
}
! _bbs.map(pinch->_idx,b); // Pretend it's valid in this block (lazy init)
_reg_node.map(def_reg,pinch); // Record pinch-point
//_regalloc->set_bad(pinch->_idx); // Already initialized this way.
if( later_def->outcnt() == 0 || later_def->ideal_reg() == MachProjNode::fat_proj ) { // Distinguish def from kill
pinch->init_req(0, _cfg->C->top()); // set not NULL for the next call
add_prec_edge_from_to(later_def,pinch); // Add edge from kill to pinch
--- 2666,2676 ----
}
if (pinch->_idx >= _regalloc->node_regs_max_index()) {
_cfg->C->record_method_not_compilable("too many D-U pinch points");
return;
}
! _cfg->map_node_to_block(pinch, b); // Pretend it's valid in this block (lazy init)
_reg_node.map(def_reg,pinch); // Record pinch-point
//_regalloc->set_bad(pinch->_idx); // Already initialized this way.
if( later_def->outcnt() == 0 || later_def->ideal_reg() == MachProjNode::fat_proj ) { // Distinguish def from kill
pinch->init_req(0, _cfg->C->top()); // set not NULL for the next call
add_prec_edge_from_to(later_def,pinch); // Add edge from kill to pinch
*** 2711,2723 ****
void Scheduling::anti_do_use( Block *b, Node *use, OptoReg::Name use_reg ) {
if( !OptoReg::is_valid(use_reg) ) // Ignore stores & control flow
return;
Node *pinch = _reg_node[use_reg]; // Get pinch point
// Check for no later def_reg/kill in block
! if( pinch && _bbs[pinch->_idx] == b &&
// Use has to be block-local as well
! _bbs[use->_idx] == b ) {
if( pinch->Opcode() == Op_Node && // Real pinch-point (not optimistic?)
pinch->req() == 1 ) { // pinch not yet in block?
pinch->del_req(0); // yank pointer to later-def, also set flag
// Insert the pinch-point in the block just after the last use
b->_nodes.insert(b->find_node(use)+1,pinch);
--- 2710,2722 ----
void Scheduling::anti_do_use( Block *b, Node *use, OptoReg::Name use_reg ) {
if( !OptoReg::is_valid(use_reg) ) // Ignore stores & control flow
return;
Node *pinch = _reg_node[use_reg]; // Get pinch point
// Check for no later def_reg/kill in block
! if( pinch && _cfg->get_block_for_node(pinch) == b &&
// Use has to be block-local as well
! _cfg->get_block_for_node(use) == b) {
if( pinch->Opcode() == Op_Node && // Real pinch-point (not optimistic?)
pinch->req() == 1 ) { // pinch not yet in block?
pinch->del_req(0); // yank pointer to later-def, also set flag
// Insert the pinch-point in the block just after the last use
b->_nodes.insert(b->find_node(use)+1,pinch);
src/share/vm/opto/output.cpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File