On Wed, 13 Oct 2021 00:00:22 GMT, Magnus Ihse Bursie <i...@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.

On 10/16/21 09:13, Magnus Ihse Bursie wrote:
> @theRealAph We should not push broken code, and we should not break the 
> existing build of hsdis. I fully agree with this. I will not push this patch 
> until all reviewers are happy, so you don't need to worry about that. :)
> 
> My initial plan was to get the unix platforms working in this push, and 
> tackle Windows later on, but it seems now that it's better to keep this PR 
> around for a bit longer instead, and fold Windows support into it as well. 
> (Which means I'll wait for Monica to return and being able to test and help 
> out.)
> 
> I need to understand better why things are failing for you. Can you describe 
> a reproducer?

Sure. Create a .hotspot_compiler file containing

   print java.lang.String::checkIndex

then

   ./build/macosx-aarch64-server-fastdebug/jdk/bin/java -XX:+PrintAssembly 
-version

GNU disassembly of java.lang.String::isLatin1 prints in full, ending thusly

   [Exception Handler]
   0x000000010a72c340:   mov     x19, #0xdead                    // #57005
                                                             ;   {no_reloc}
   0x000000010a72c344:   mov     x2, #0xa                        // #10
   0x000000010a72c348:   mov     x4, #0xdead                     // #57005
   0x000000010a72c34c:   mov     x5, #0xdead                     // #57005
   0x000000010a72c350:   adrp    x8, 0x000000010a1c3000      ;   {runtime_call 
handle_exception_from_callee Runtime1 stub}
   0x000000010a72c354:   add     x8, x8, #0x1c0
   0x000000010a72c358:   blr     x8
   0x000000010a72c35c:   dcps1   #0xdeae
   0x000000010a72c360:   .inst   0x0995f68e ; undefined
   0x000000010a72c364:   udf     #1
[Deopt Handler Code]
   0x000000010a72c368:   adr     x30, 0x000000010a72c368
   0x000000010a72c36c:   adrp    x8, 0x000000010a26c000      ;   {runtime_call 
DeoptimizationBlob}
   0x000000010a72c370:   add     x8, x8, #0xbc0
   0x000000010a72c374:   br      x8
--------------------------------------------------------------------------------

LLVM disassembly dies at

[Exception Handler]
   0x000000010672c340:           mov     x19, #0xdead        ;   {no_reloc}
   0x000000010672c344:           mov     x2, #0xa
   0x000000010672c348:           mov     x4, #0xdead
   0x000000010672c34c:           mov     x5, #0xdead
   0x000000010672c350:           adrp    x8, #-5672960       ;   {runtime_call 
handle_exception_from_callee Runtime1 stub}
   0x000000010672c354:           add     x8, x8, #0x1c0
   0x000000010672c358:           blr     x8
   0x000000010672c35c:           dcps1   #0xdeae
   0x000000010672c360:   
--------------------------------------------------------------------------------

This is llvm 12.0.1 from homebrew.

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

PR: https://git.openjdk.java.net/jdk/pull/5920

Reply via email to