8154135: Loop alignment may be added inside the loop body

Reviewed-by: kvn, vlivanov
This commit is contained in:
Roland Westrelin 2016-04-18 20:57:27 +03:00
parent c05dd2fdca
commit e08e2ac711
3 changed files with 11 additions and 5 deletions

View File

@ -73,7 +73,7 @@ void Block_List::print() {
}
#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 @@ bool Trace::backedge(CFGEdge *e) {
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;

View File

@ -197,7 +197,7 @@ public:
// 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.

View File

@ -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 " \