RFR (S): 8067014: LinearScan::is_sorted significantly slows down fastdebug builds' performance
filipp.zhinkin at gmail.com
Fri Mar 6 11:33:38 UTC 2015
please review a fix for 8067014.
In certain cases (like -client -Xcomp) C1 compilation is very slow w/
A place where we spent enormous amount of time is LinearScan::is_sorted method,
which simply verifies that a list that should be sorted is actually
sorted and that
both sorted and unsorted lists contains same intervals.
Unfortunately, to perform that check is_sorted iterates over a sorted
list for each
interval from an unsorted list and then iterates the unsorted list for
from then sorted one.
However, the sorted list may not contain NULL values , so we have to check
only that the sorted list contains all intervals from the unsorted
list and that sorted list's
length equals to count of non-NULL elements in unsorted list.
And as long as the sorted list does not contain NULLs we can use
binary search to
speed up LinearScan::is_sorted.
I've executed CTW with different JVM configs (-client -Xcomp, -server -Xcomp,
-server -Xcomp -XX:TieredStopAtLevel=3) to check that the fix will
actually speed up
LinearScan::is_sorted and linear scan time reduced twice, while total
C1 comp time
reduced by ~ 30%.
// I've also checked the case w/o a loop in lines 1462-1470, but also
w/ linear search
// and performance was somewhere between current implementation's
// performance of suggested fix.
Bug id: https://bugs.openjdk.java.net/browse/JDK-8067014
Testing: JTreg hotspot/test and jdk/test/java/lang/invoke tests, CTW
More information about the hotspot-compiler-dev