RFR: 8344148: Add an explicit compiler phase for warning generation
Archie Cobbs
acobbs at openjdk.org
Thu Nov 14 20:48:25 UTC 2024
On Thu, 14 Nov 2024 19:27:45 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
> I think it would be worth starting with a simple design (e.g. one visitor per analysis first), but then try to implement a certain number of them (say 4-5) and see whether e.g. compiling something big (like the JDK) suffers from the number of extra passes.
FWIW I built a very simple version of that idea:
for i in 1 2 3 4 5; do
echo =========== RUN $i;
make clean
find src -name '*.java' -print | xargs touch
make interim-langtools
time make
done
and ran that under two scenarios on my MacBook (Apple M1 Pro 32GB):
* Scenario 1: The version of the JDK in this PR
* Scenario 2: The version of the JDK in this PR + the following patch:
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/WarningAnalyzer.java
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/WarningAnalyzer.java
@@ -58,6 +58,7 @@ protected WarningAnalyzer(Context context) {
}
public void analyzeTree(Env<AttrContext> env) {
- thisEscapeAnalyzer.analyzeTree(env);
+ for (int i = 0; i < 25; i++)
+ thisEscapeAnalyzer.analyzeTree(env);
}
}
Note that most, but not all, of the JDK (51 out of 70 modules) is built with `this-escape` enabled.
The difference was beneath the noise level, which is somewhat promising:
---------------------
TEST: NORMAL COMPILER
---------------------
=========== RUN 1
real 2m28.721s
user 14m21.497s
sys 2m55.992s
=========== RUN 2
real 2m26.708s
user 14m17.562s
sys 2m52.912s
=========== RUN 3
real 2m32.698s
user 14m25.495s
sys 2m58.030s
=========== RUN 4
real 2m29.797s
user 14m25.312s
sys 2m56.253s
=========== RUN 5
real 2m26.124s
user 14m18.213s
sys 2m51.032s
---------------------
TEST: LOOP 25 TIMES
-------------------
=========== RUN 1
real 2m27.971s
user 14m21.692s
sys 2m54.486s
=========== RUN 2
real 2m28.259s
user 14m19.175s
sys 2m52.646s
=========== RUN 3
real 2m27.913s
user 14m19.559s
sys 2m52.708s
=========== RUN 4
real 2m28.897s
user 14m23.295s
sys 2m55.207s
=========== RUN 5
real 2m26.768s
user 14m20.362s
sys 2m53.447s
-------------
PR Comment: https://git.openjdk.org/jdk/pull/22088#issuecomment-2477376400
More information about the compiler-dev
mailing list