While looking at another bug I was reading the PrintOptoAssembly from the test case and noticed quite a few empty blocks which ended up only containing jumps. This resulted in a quite a few cases where the code jumped away and then jumped back for no purpose. The blocks apparently contains at least some memory merge state so they aren't trivially removeable but they should be removeable somehow, even by simply fixing the block layout to avoid the jump. I don't know what impact these extra blocks have on real programs but they seem to occur fairly often so it's worth investigating more closely. The following awk script will detect them in opto assembly output.
/::/ && $NF ~ /bytes\)/ {
method = $(NF-2);
}
$2 ~ "B[0-9][0-9]*:" {
block = $0;
getline;
if ($3 == "BA") {
branch = $0;
getline;
if (NF == 1) {
if (method != lastmethod) {
print "found " count;
print "";
print method;
lastmethod = method;
count = 0;
}
print block;
print branch;
count++;
jtoj++;
}
}
next;
}
END {
print jtoj " jump to jumps found in total";
}
For a specjvm98 -Xmixed run with -m1 -M1 it found 1634 of these jump to jump blocks.
The top 20 method in terms of empty blocks found are:
spec.benchmarks._228_jack.Jack_the_Parser_Generator::_Jack3regular_expression found 118
spec.benchmarks._228_jack.Jack_the_Parser_Generator::_Jack3complex_regular_expression_unit found 100
spec.benchmarks._228_jack.Jack_the_Parser_Generator::_Jack3expansion_unit found 80
spec.benchmarks._228_jack.ParseGen::buildPhase3Routine found 43
spec.benchmarks._228_jack.ParseGen::phase1ExpansionGen found 34
spec.benchmarks._228_jack.NfaState::GenerateCode found 34
spec.benchmarks._213_javac.Parser::parseExpression found 31
spec.benchmarks._213_javac.Parser::parseStatement found 30
spec.benchmarks._228_jack.Jack_the_Parser_Generator::_Jack3character_list found 27
spec.benchmarks._213_javac.Parser::parseTerm found 27
spec.benchmarks._213_javac.ConvertExpression::simplify found 26
spec.benchmarks._213_javac.Parser::parseTerm found 25
spec.benchmarks._213_javac.Parser::parseStatement found 25
spec.benchmarks._213_javac.Instruction::balance found 25
spec.benchmarks._213_javac.Instruction::balance found 25
spec.benchmarks._213_javac.Parser::parseTerm found 23
spec.benchmarks._213_javac.SourceClass::compileClass found 21
spec.benchmarks._213_javac.Expression::codeConversion found 21
spec.benchmarks._213_javac.MethodExpression::checkValue found 19
spec.benchmarks._202_jess.jess.Node2::CallNode found 16
/::/ && $NF ~ /bytes\)/ {
method = $(NF-2);
}
$2 ~ "B[0-9][0-9]*:" {
block = $0;
getline;
if ($3 == "BA") {
branch = $0;
getline;
if (NF == 1) {
if (method != lastmethod) {
print "found " count;
print "";
print method;
lastmethod = method;
count = 0;
}
print block;
print branch;
count++;
jtoj++;
}
}
next;
}
END {
print jtoj " jump to jumps found in total";
}
For a specjvm98 -Xmixed run with -m1 -M1 it found 1634 of these jump to jump blocks.
The top 20 method in terms of empty blocks found are:
spec.benchmarks._228_jack.Jack_the_Parser_Generator::_Jack3regular_expression found 118
spec.benchmarks._228_jack.Jack_the_Parser_Generator::_Jack3complex_regular_expression_unit found 100
spec.benchmarks._228_jack.Jack_the_Parser_Generator::_Jack3expansion_unit found 80
spec.benchmarks._228_jack.ParseGen::buildPhase3Routine found 43
spec.benchmarks._228_jack.ParseGen::phase1ExpansionGen found 34
spec.benchmarks._228_jack.NfaState::GenerateCode found 34
spec.benchmarks._213_javac.Parser::parseExpression found 31
spec.benchmarks._213_javac.Parser::parseStatement found 30
spec.benchmarks._228_jack.Jack_the_Parser_Generator::_Jack3character_list found 27
spec.benchmarks._213_javac.Parser::parseTerm found 27
spec.benchmarks._213_javac.ConvertExpression::simplify found 26
spec.benchmarks._213_javac.Parser::parseTerm found 25
spec.benchmarks._213_javac.Parser::parseStatement found 25
spec.benchmarks._213_javac.Instruction::balance found 25
spec.benchmarks._213_javac.Instruction::balance found 25
spec.benchmarks._213_javac.Parser::parseTerm found 23
spec.benchmarks._213_javac.SourceClass::compileClass found 21
spec.benchmarks._213_javac.Expression::codeConversion found 21
spec.benchmarks._213_javac.MethodExpression::checkValue found 19
spec.benchmarks._202_jess.jess.Node2::CallNode found 16
- relates to
-
JDK-6433580 performance regression due to poor block placement
-
- Resolved
-
-
JDK-6212007 low frequency basic blocks are not moved out of line
-
- Resolved
-
-
JDK-6305266 SEGV in output.cpp
-
- Resolved
-