RFR: 8253757: Add LLVM-based backend for hsdis
Andrew Haley
aph at openjdk.java.net
Wed Oct 13 15:58:47 UTC 2021
On Wed, 13 Oct 2021 13:55:04 GMT, Andrew Haley <aph at openjdk.org> wrote:
>> This patch expands the newly added system for hsdis backends to include LLVM.
>>
>> The actual code in hsdis-llvm.cpp is based heavily on the work by @luhenry, as published in the never integrated PR https://github.com/openjdk/jdk/pull/392. (I have basically just ripped out the binutils-based part of it.)
>>
>> Unfortunately I have not been able to make this work properly on Windows. With some additional flags I made it compile without complaints, but it caused hotspot to segfault in `LoadLibrary` (!) in `os::dll_load` when I tried to load the library. This is somewhat ironic, since the initial implementation was created by Ludovic for the very purpose of using it on Windows.
>>
>> The lack of Windows support in this patch does not mean it is impossible to get it to work, just that I need to co-operate with someone who has more experience of compiling LLVM on Windows, and/or are more eager to get this combination to work.
>
>> This patch expands the newly added system for hsdis backends to include LLVM.
>>
>> The actual code in hsdis-llvm.cpp is based heavily on the work by @luhenry, as published in the never integrated PR #392. (I have basically just ripped out the binutils-based part of it.)
>>
>> Unfortunately I have not been able to make this work properly on Windows.
>
> What is it for, then?
>
> hsdis builds on AArch64-MacOS-LLVM with
>
>
> cd src/utils/hsdis
> mkdir build
> cd build
> git clone https://github.com/bminor/binutils-gdb
> ln -s binutils-gdb binutils
> cd ..
> make
> @theRealAph As you might be aware, the licensing criteria for binutils makes it impossible to distribute a binutils-based hsdis with the JDK. While IANAL, my understanding is that the LLVM license is less problematic in that way.
>
> Also, this is to allow a bit of freedom of choice. If you prefer the LLVM backend (I've been told that it generates better disassembly in some case) you should be able to select it.
>
> And finally, I do think that the LLVM backend should be able to work on Windows, too. It's just that this is tricky enough to motivate doing this in a separate, later, step.
OK, but how do you build it? I have applied this patch, and the instructions in `hsdis/README` don't mention LLVM, just binutils. Shouldn't the instructions have been updated?
-------------
PR: https://git.openjdk.java.net/jdk/pull/5920
More information about the hotspot-compiler-dev
mailing list