OpenJDK / amber / amber
changeset 38046:f8383064eaa2
8154135: Loop alignment may be added inside the loop body
Reviewed-by: kvn, vlivanov
author | roland |
---|---|
date | Mon, 18 Apr 2016 20:57:27 +0300 |
parents | 808cbf1958ce |
children | 21720d6174a2 |
files | hotspot/src/share/vm/opto/block.cpp hotspot/src/share/vm/opto/block.hpp hotspot/src/share/vm/opto/c2_globals.hpp |
diffstat | 3 files changed, 11 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/hotspot/src/share/vm/opto/block.cpp Mon Apr 18 11:22:51 2016 +0200 +++ b/hotspot/src/share/vm/opto/block.cpp Mon Apr 18 20:57:27 2016 +0300 @@ -73,7 +73,7 @@ } #endif -uint Block::code_alignment() { +uint Block::code_alignment() const { // Check for Root block if (_pre_order == 0) return CodeEntryAlignment; // Check for Start block @@ -1727,8 +1727,14 @@ first_block()->set_loop_alignment(targ_block); } else { - // Backbranch into the middle of a trace - targ_block->set_loop_alignment(targ_block); + // That loop may already have a loop top (we're reaching it again + // through the backedge of an outer loop) + Block* b = prev(targ_block); + bool has_top = targ_block->head()->is_Loop() && b->has_loop_alignment() && !b->head()->is_Loop(); + if (!has_top) { + // Backbranch into the middle of a trace + targ_block->set_loop_alignment(targ_block); + } } return loop_rotated;
--- a/hotspot/src/share/vm/opto/block.hpp Mon Apr 18 11:22:51 2016 +0200 +++ b/hotspot/src/share/vm/opto/block.hpp Mon Apr 18 20:57:27 2016 +0300 @@ -197,7 +197,7 @@ // Report the alignment required by this block. Must be a power of 2. // The previous block will insert nops to get this alignment. - uint code_alignment(); + uint code_alignment() const; uint compute_loop_alignment(); // BLOCK_FREQUENCY is a sentinel to mark uses of constant block frequencies.
--- a/hotspot/src/share/vm/opto/c2_globals.hpp Mon Apr 18 11:22:51 2016 +0200 +++ b/hotspot/src/share/vm/opto/c2_globals.hpp Mon Apr 18 20:57:27 2016 +0300 @@ -587,7 +587,7 @@ range(0, 100) \ \ product(bool, BlockLayoutRotateLoops, true, \ - "Allow back branches to be fall throughs in the block layour") \ + "Allow back branches to be fall throughs in the block layout") \ \ develop(bool, InlineReflectionGetCallerClass, true, \ "inline sun.reflect.Reflection.getCallerClass(), known to be " \