提交 b1ece422 编写于 作者: K kvn

7054211: No loop unrolling done in jdk7b144 for a test update() while loop

Summary: restore unrolling code for CaffeineMark.
Reviewed-by: never
上级 ee88ae68
...@@ -709,10 +709,13 @@ bool IdealLoopTree::policy_unroll( PhaseIdealLoop *phase ) const { ...@@ -709,10 +709,13 @@ bool IdealLoopTree::policy_unroll( PhaseIdealLoop *phase ) const {
// Adjust body_size to determine if we unroll or not // Adjust body_size to determine if we unroll or not
uint body_size = _body.size(); uint body_size = _body.size();
// Key test to unroll loop in CRC32 java code
int xors_in_loop = 0;
// Also count ModL, DivL and MulL which expand mightly // Also count ModL, DivL and MulL which expand mightly
for (uint k = 0; k < _body.size(); k++) { for (uint k = 0; k < _body.size(); k++) {
Node* n = _body.at(k); Node* n = _body.at(k);
switch (n->Opcode()) { switch (n->Opcode()) {
case Op_XorI: xors_in_loop++; break; // CRC32 java code
case Op_ModL: body_size += 30; break; case Op_ModL: body_size += 30; break;
case Op_DivL: body_size += 30; break; case Op_DivL: body_size += 30; break;
case Op_MulL: body_size += 10; break; case Op_MulL: body_size += 10; break;
...@@ -729,6 +732,7 @@ bool IdealLoopTree::policy_unroll( PhaseIdealLoop *phase ) const { ...@@ -729,6 +732,7 @@ bool IdealLoopTree::policy_unroll( PhaseIdealLoop *phase ) const {
// Check for being too big // Check for being too big
if (body_size > (uint)LoopUnrollLimit) { if (body_size > (uint)LoopUnrollLimit) {
if (xors_in_loop >= 4 && body_size < (uint)LoopUnrollLimit*4) return true;
// Normal case: loop too big // Normal case: loop too big
return false; return false;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册