src/share/vm/opto/output.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File
*** old/src/share/vm/opto/output.cpp	Thu Feb 20 15:52:40 2014
--- new/src/share/vm/opto/output.cpp	Thu Feb 20 15:52:40 2014

*** 497,509 **** --- 497,521 ---- uint bnum = block->non_connector_successor(0)->_pre_order; int offset = blk_starts[bnum] - br_offs; if (bnum > i) { // adjust following block's offset offset -= adjust_block_start; } + + // This block can be a loop header, account for the padding + // in the previous block. + int prev_block_loop_pad = block->code_alignment() - relocInfo::addr_unit(); + if (i > 0 && prev_block_loop_pad > 0) { + assert(br_offs >= prev_block_loop_pad, "Should have at least a padding on top"); + } else { + // First block or not a loop + prev_block_loop_pad = 0; + } // In the following code a nop could be inserted before // the branch which will increase the backward distance. ! bool needs_padding = ((uint)(br_offs - prev_block_loop_pad) == last_may_be_short_branch_adr); + assert(!needs_padding || jmp_offset[i] == 0, "padding only branches at the beginning of block"); + if (needs_padding && offset <= 0) offset -= nop_size; if (_matcher->is_short_branch_offset(mach->rule(), br_size, offset)) { // We've got a winner. Replace this branch.

src/share/vm/opto/output.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File