RFR: 8297444: Refactor the javacserver build tool
Magnus Ihse Bursie
ihse at openjdk.org
Tue Nov 22 20:05:38 UTC 2022
On Tue, 22 Nov 2022 19:54:51 GMT, Magnus Ihse Bursie <ihse at openjdk.org> wrote:
> Now that the javacserver no longer has any ambitions outside being a buildtool customized for the JDK build process, a lot of abstractions and generalizations can be removed.
>
> This will allow the actual behavior to be more clearly visible, and will help debugging the issues we are still seeing (most likely race conditions), and to convert the tool to use the ToolProvider API in the future.
I realize this PR can be a bit of a challenge to review. I'll explain the changes I have done.
The "actual" changes I have made is to how the javacserver tool is called from the makefiles, and how the client starts the server.
The client now takes a `--conf=<conf file>` argument, instead of `--server:conf=<conf file>`. This argument has to be the first argument; the rest of the argument line is passed on to javac in the server. This allowed me to remove all the complex option processing stuff. Also, the client cannot any longer be called in "stand-alone" mode where no server is used (basically a complex version of plain `javac`).
Secondly, the server is now started with a separate main method in the Server class. This means the entry point need not determine if it is being called as a client or a server, simplifying further. The server takes exactly one argument, the path of the port file. That means the last of the option processing could go.
Third, the configuration file has changed slightly. Instead of a `servercmd` there is now a `javacmd`, which tells the client how to start java (suitable path to the java executable, and proper flags) when launching the server. The actual class used to launch the server is known by the client and does not have to be provided by the makefile. This change made new configuration files incompatible with old files; it turned out make had a bit of a problem of recognizing the file needed to be updated, so I chose a slightly different name for the configuration file, to avoid strange recompilation errors when this patch gets integrated.
-------------
PR: https://git.openjdk.org/jdk/pull/11298
More information about the compiler-dev
mailing list