RFR: 8299518: HotSpotVirtualMachine shared code across different platforms [v2]
David Holmes
dholmes at openjdk.org
Thu Jan 5 03:08:53 UTC 2023
On Thu, 5 Jan 2023 02:50:49 GMT, Yi Yang <yyang at openjdk.org> wrote:
>> src/jdk.attach/share/classes/sun/tools/attach/HotSpotVirtualMachine.java line 425:
>>
>>> 423:
>>> 424: protected abstract int readImpl(long fd, byte[] bs, int off, int len) throws IOException;
>>> 425: protected abstract void closeImpl(long fd) throws IOException;
>>
>> If the subclasses all override these in exactly the same way then these do not need to be abstract and can simply delegate to VirtualMachineImpl.xxx
>
> All Posix OS platforms call the same VirtualMachineImpl.read/write/etc, but Windows is an unusual guy, it calls VirtualMachineImpl.readPipe/writePipe/etc
That is a shame, though perhaps we could just rename those methods on Windows?
This also raises the obvious question can we in fact reduce this to just a Windows and Posix version, or are there other differences between Linux, macOS etc that have to be accounted for? Though in that case we could introduce a shared superclass for the Posix platforms. Next steps perhaps?
-------------
PR: https://git.openjdk.org/jdk/pull/11823
More information about the serviceability-dev
mailing list