提交 3e778c27 编写于 作者: K kvn

6810845: Performance regression in mpegaudio on x64

Summary: Used the outer loop frequency in frequencies checks in RA.
Reviewed-by: never, twisti
上级 26009950
......@@ -371,6 +371,7 @@ class PhaseCFG : public Phase {
Block *_broot; // Basic block of root
uint _rpo_ctr;
CFGLoop* _root_loop;
float _outer_loop_freq; // Outmost loop frequency
// Per node latency estimation, valid only during GCM
GrowableArray<uint> _node_latency;
......@@ -537,6 +538,7 @@ class CFGLoop : public CFGElement {
void compute_loop_depth(int depth);
void compute_freq(); // compute frequency with loop assuming head freq 1.0f
void scale_freq(); // scale frequency by loop trip count (including outer loops)
float outer_loop_freq() const; // frequency of outer loop
bool in_loop_nest(Block* b);
float trip_count() const { return 1.0f / _exit_prob; }
virtual bool is_loop() { return true; }
......
......@@ -410,7 +410,7 @@
"Miniumum %% of a successor (predecessor) for which block layout "\
"a will allow a fork (join) in a single chain") \
\
product(bool, BlockLayoutRotateLoops, false, \
product(bool, BlockLayoutRotateLoops, true, \
"Allow back branches to be fall throughs in the block layour") \
C2_FLAGS(DECLARE_DEVELOPER_FLAG, DECLARE_PD_DEVELOPER_FLAG, DECLARE_PRODUCT_FLAG, DECLARE_PD_PRODUCT_FLAG, DECLARE_DIAGNOSTIC_FLAG, DECLARE_NOTPRODUCT_FLAG)
......@@ -149,6 +149,9 @@ PhaseChaitin::PhaseChaitin(uint unique, PhaseCFG &cfg, Matcher &matcher)
#endif
{
NOT_PRODUCT( Compile::TracePhase t3("ctorChaitin", &_t_ctorChaitin, TimeCompiler); )
_high_frequency_lrg = MIN2(float(OPTO_LRG_HIGH_FREQ), _cfg._outer_loop_freq);
uint i,j;
// Build a list of basic blocks, sorted by frequency
_blks = NEW_RESOURCE_ARRAY( Block *, _cfg._num_blocks );
......
......@@ -338,6 +338,8 @@ class PhaseChaitin : public PhaseRegAlloc {
Block **_blks; // Array of blocks sorted by frequency for coalescing
float _high_frequency_lrg; // Frequency at which LRG will be spilled for debug info
#ifndef PRODUCT
bool _trace_spilling;
#endif
......@@ -360,6 +362,8 @@ public:
uint n2lidx( const Node *n ) const { return _names[n->_idx]; }
float high_frequency_lrg() const { return _high_frequency_lrg; }
#ifndef PRODUCT
bool trace_spilling() const { return _trace_spilling; }
#endif
......
......@@ -473,7 +473,7 @@ void PhaseAggressiveCoalesce::insert_copies( Matcher &matcher ) {
} // End of is two-adr
// Insert a copy at a debug use for a lrg which has high frequency
if( (b->_freq < OPTO_DEBUG_SPLIT_FREQ) && n->is_MachSafePoint() ) {
if( b->_freq < OPTO_DEBUG_SPLIT_FREQ || b->is_uncommon(_phc._cfg._bbs) ) {
// Walk the debug inputs to the node and check for lrg freq
JVMState* jvms = n->jvms();
uint debug_start = jvms ? jvms->debug_start() : 999999;
......@@ -487,7 +487,7 @@ void PhaseAggressiveCoalesce::insert_copies( Matcher &matcher ) {
LRG &lrg = lrgs(nidx);
// If this lrg has a high frequency use/def
if( lrg._maxfreq >= OPTO_LRG_HIGH_FREQ ) {
if( lrg._maxfreq >= _phc.high_frequency_lrg() ) {
// If the live range is also live out of this block (like it
// would be for a fast/slow idiom), the normal spill mechanism
// does an excellent job. If it is not live out of this block
......
......@@ -1374,6 +1374,9 @@ void PhaseCFG::Estimate_Block_Frequency() {
_root_loop->_freq = 1.0;
_root_loop->scale_freq();
// Save outmost loop frequency for LRG frequency threshold
_outer_loop_freq = _root_loop->outer_loop_freq();
// force paths ending at uncommon traps to be infrequent
if (!C->do_freq_based_layout()) {
Block_List worklist;
......@@ -1898,6 +1901,7 @@ bool CFGLoop::in_loop_nest(Block* b) {
// Do a top down traversal of loop tree (visit outer loops first.)
void CFGLoop::scale_freq() {
float loop_freq = _freq * trip_count();
_freq = loop_freq;
for (int i = 0; i < _members.length(); i++) {
CFGElement* s = _members.at(i);
float block_freq = s->_freq * loop_freq;
......@@ -1912,6 +1916,14 @@ void CFGLoop::scale_freq() {
}
}
// Frequency of outer loop
float CFGLoop::outer_loop_freq() const {
if (_child != NULL) {
return _child->_freq;
}
return _freq;
}
#ifndef PRODUCT
//------------------------------dump_tree--------------------------------------
void CFGLoop::dump_tree() const {
......
......@@ -340,6 +340,10 @@ const class TypePtr *MachNode::adr_type() const {
if (base == NodeSentinel) return TypePtr::BOTTOM;
const Type* t = base->bottom_type();
if (UseCompressedOops && Universe::narrow_oop_shift() == 0) {
// 32-bit unscaled narrow oop can be the base of any address expression
t = t->make_ptr();
}
if (t->isa_intptr_t() && offset != 0 && offset != Type::OffsetBot) {
// We cannot assert that the offset does not look oop-ish here.
// Depending on the heap layout the cardmark base could land
......@@ -353,6 +357,7 @@ const class TypePtr *MachNode::adr_type() const {
// be conservative if we do not recognize the type
if (tp == NULL) {
assert(false, "this path may produce not optimal code");
return TypePtr::BOTTOM;
}
assert(tp->base() != Type::AnyPtr, "not a bare pointer");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册