src/share/vm/opto/output.cpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File
hs-comp-shorten-branches Cdiff src/share/vm/opto/output.cpp
src/share/vm/opto/output.cpp
Print this page
*** 497,509 ****
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;
}
// In the following code a nop could be inserted before
// the branch which will increase the backward distance.
! bool needs_padding = ((uint)br_offs == last_may_be_short_branch_adr);
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.
--- 497,519 ----
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);
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