RFR: 8376174: [IR Framework] Refactor Test VM socket communication

Christian Hagedorn chagedorn at openjdk.org
Mon Jan 26 17:32:56 UTC 2026


On Mon, 26 Jan 2026 17:11:03 GMT, Christian Hagedorn <chagedorn at openjdk.org> wrote:

> This is the next patch in the series to replace the hotspot-pid-file-based IR dumps with socket communication (see [JDK-8375271](https://bugs.openjdk.org/browse/JDK-8375271)).
> 
> This patch cleans up the current socket communication implementation without changing the semantics. We still process the messages in the same way but I refactored the logic into separate classes instead of having everything in the `TestFrameworkSocket` class.
> 
> This patch addresses the following (also see GitHub code comments):
> - Changes to `TestFrameworkSocket`:
>   - Split logic to send messages from Test VM into separate `TestVmSocket` class.
>   - Move message tags from `TestFrameworkSocket` to new `MessageTag` class.
>   - Introduce new `JavaMessages` class to wrap the sent messages. This will later be further expanded. Note that I choose the name "Java" to later distinguish between messages sent by C2.
>   - Introduce new `TestVmMessageReader` to parse the received messages. This will later be further expanded.
> - Introduce new `TestVMData` class to hold all interesting information received from the Test VM. This class will also be further expanded later.
> 
> Thanks,
> Christian

test/hotspot/jtreg/compiler/lib/ir_framework/driver/TestVMProcess.java line 183:

> 181:      * represent the Applicable IR Rules used for IR matching later.
> 182:      */
> 183:     private void processSocketOutput(TestFrameworkSocket socket) {

Moved to `TestVmData::processOutput()`.

test/hotspot/jtreg/compiler/lib/ir_framework/shared/TestFrameworkSocket.java line 47:

> 45:     public static final String DEFAULT_REGEX_TAG = "[DEFAULT_REGEX]";
> 46:     public static final String PRINT_TIMES_TAG = "[PRINT_TIMES]";
> 47:     public static final String NOT_COMPILABLE_TAG = "[NOT_COMPILABLE]";

Dropped `DEFAULT_REGEX_TAG` and `NOT_COMPILABLE` - I'm not sure they really add more benefit since the messages themselves already explain what they are about. Additionally, there were already some messages sent without tags before. So, I think it's fine to reduce on the number of tags.

test/hotspot/jtreg/compiler/lib/ir_framework/test/TestVM.java line 162:

> 160:     public static void main(String[] args) {
> 161:         try {
> 162:             TestVmSocket.connect();

I now just unconditionally connect which I think is negligible. When IR matching, we will always use the socket. This makes the handling easier.

test/hotspot/jtreg/compiler/lib/ir_framework/test/TestVM.java line 863:

> 861:             }
> 862:             if (testFilterPresent) {
> 863:                 TestVmSocket.send(MessageTag.TEST_LIST + "Run " + test.toString());

This does not look very nice to use by appending the message tag to the actual message before calling `send()`. But I will later refactor this again, so this is only a temporary state.

test/hotspot/jtreg/compiler/lib/ir_framework/test/network/TestVmSocket.java line 63:

> 61:     }
> 62: 
> 63:     public static void connect() {

Now that we unconditionally connect, we can have the old exception code from `TestFrameworkSocket::write()` here.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/29426#discussion_r2728495108
PR Review Comment: https://git.openjdk.org/jdk/pull/29426#discussion_r2728500824
PR Review Comment: https://git.openjdk.org/jdk/pull/29426#discussion_r2728513598
PR Review Comment: https://git.openjdk.org/jdk/pull/29426#discussion_r2728530905
PR Review Comment: https://git.openjdk.org/jdk/pull/29426#discussion_r2728521230


More information about the hotspot-compiler-dev mailing list