comparison src/share/vm/opto/output.cpp @ 859:ea3f9723b5cf

6860599: nodes limit could be reached during Output phase Summary: Bailout compilation if nodes limit could be reached during Output phase. Reviewed-by: never, twisti
author kvn
date Thu, 23 Jul 2009 14:53:56 -0700
parents 4ec1257180ec
children 18f526145aea 9987d9d5eb0e
comparison
equal deleted inserted replaced
858:5314d85ffd54 859:ea3f9723b5cf
48 // Initialize the space for the BufferBlob used to find and verify 48 // Initialize the space for the BufferBlob used to find and verify
49 // instruction size in MachNode::emit_size() 49 // instruction size in MachNode::emit_size()
50 init_scratch_buffer_blob(); 50 init_scratch_buffer_blob();
51 if (failing()) return; // Out of memory 51 if (failing()) return; // Out of memory
52 52
53 // The number of new nodes (mostly MachNop) is proportional to
54 // the number of java calls and inner loops which are aligned.
55 if ( C->check_node_count((NodeLimitFudgeFactor + C->java_calls()*3 +
56 C->inner_loops()*(OptoLoopAlignment-1)),
57 "out of nodes before code generation" ) ) {
58 return;
59 }
53 // Make sure I can find the Start Node 60 // Make sure I can find the Start Node
54 Block_Array& bbs = _cfg->_bbs; 61 Block_Array& bbs = _cfg->_bbs;
55 Block *entry = _cfg->_blocks[1]; 62 Block *entry = _cfg->_blocks[1];
56 Block *broot = _cfg->_broot; 63 Block *broot = _cfg->_broot;
57 64
1103 1110
1104 // Count and start of calls 1111 // Count and start of calls
1105 uint *call_returns = NEW_RESOURCE_ARRAY(uint, _cfg->_num_blocks+1); 1112 uint *call_returns = NEW_RESOURCE_ARRAY(uint, _cfg->_num_blocks+1);
1106 1113
1107 uint return_offset = 0; 1114 uint return_offset = 0;
1108 MachNode *nop = new (this) MachNopNode(); 1115 int nop_size = (new (this) MachNopNode())->size(_regalloc);
1109 1116
1110 int previous_offset = 0; 1117 int previous_offset = 0;
1111 int current_offset = 0; 1118 int current_offset = 0;
1112 int last_call_offset = -1; 1119 int last_call_offset = -1;
1113 1120
1186 cb->flush_bundle(true); 1193 cb->flush_bundle(true);
1187 current_offset = cb->code_size(); 1194 current_offset = cb->code_size();
1188 } 1195 }
1189 1196
1190 // align the instruction if necessary 1197 // align the instruction if necessary
1191 int nop_size = nop->size(_regalloc);
1192 int padding = mach->compute_padding(current_offset); 1198 int padding = mach->compute_padding(current_offset);
1193 // Make sure safepoint node for polling is distinct from a call's 1199 // Make sure safepoint node for polling is distinct from a call's
1194 // return by adding a nop if needed. 1200 // return by adding a nop if needed.
1195 if (is_sfn && !is_mcall && padding == 0 && current_offset == last_call_offset ) { 1201 if (is_sfn && !is_mcall && padding == 0 && current_offset == last_call_offset ) {
1196 padding = nop_size; 1202 padding = nop_size;
1370 1376
1371 } // End for all instructions in block 1377 } // End for all instructions in block
1372 1378
1373 // If the next block is the top of a loop, pad this block out to align 1379 // If the next block is the top of a loop, pad this block out to align
1374 // the loop top a little. Helps prevent pipe stalls at loop back branches. 1380 // the loop top a little. Helps prevent pipe stalls at loop back branches.
1375 int nop_size = (new (this) MachNopNode())->size(_regalloc);
1376 if( i<_cfg->_num_blocks-1 ) { 1381 if( i<_cfg->_num_blocks-1 ) {
1377 Block *nb = _cfg->_blocks[i+1]; 1382 Block *nb = _cfg->_blocks[i+1];
1378 uint padding = nb->alignment_padding(current_offset); 1383 uint padding = nb->alignment_padding(current_offset);
1379 if( padding > 0 ) { 1384 if( padding > 0 ) {
1380 MachNode *nop = new (this) MachNopNode(padding / nop_size); 1385 MachNode *nop = new (this) MachNopNode(padding / nop_size);