RFR: 8337396: Cleanup usage of ExternalAddess [v2]

Vladimir Kozlov kvn at openjdk.org
Thu Aug 1 15:58:33 UTC 2024


On Thu, 1 Aug 2024 15:20:50 GMT, Andrew Dinn <adinn at openjdk.org> wrote:

>> Vladimir Kozlov has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Add missed ExternalAddress changes
>
> I think I found a few more places in aarch64 and x86 where we need to use RuntimeAddress. There may be similar problems in the other arch implementations:
> 
>     diff --git a/src/hotspot/cpu/aarch64/interpreterRT_aarch64.cpp b/src/hotspot/cpu/aarch64/interpreterRT_aarch64.cpp
>     index 90c7ca6f08a..c6b078c3c7d 100644
>     --- a/src/hotspot/cpu/aarch64/interpreterRT_aarch64.cpp
>     +++ b/src/hotspot/cpu/aarch64/interpreterRT_aarch64.cpp
>     @@ -179,7 +179,7 @@ void InterpreterRuntime::SignatureHandlerGenerator::generate(uint64_t fingerprin
>        iterate(fingerprint);
>      
>        // return result handler
>     -  __ lea(r0, ExternalAddress(Interpreter::result_handler(method()->result_type())));
>     +  __ lea(r0, RuntimeAddress(Interpreter::result_handler(method()->result_type())));
>        __ ret(lr);
>      
>        __ flush();
>     diff --git a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp
>     index f90aefc8fd3..73da947c318 100644
>     --- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp
>     +++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp
>     @@ -1879,7 +1879,7 @@ void MacroAssembler::_verify_oop(Register reg, const char* s, const char* file,
>        movptr(rscratch1, (uintptr_t)(address)b);
>      
>        // call indirectly to solve generation ordering problem
>     -  lea(rscratch2, ExternalAddress(StubRoutines::verify_oop_subroutine_entry_address()));
>     +  lea(rscratch2, RuntimeAddress(StubRoutines::verify_oop_subroutine_entry_address()));
>        ldr(rscratch2, Address(rscratch2));
>        blr(rscratch2);
>      
>     @@ -1918,7 +1918,7 @@ void MacroAssembler::_verify_oop_addr(Address addr, const char* s, const char* f
>        movptr(rscratch1, (uintptr_t)(address)b);
>      
>        // call indirectly to solve generation ordering problem
>     -  lea(rscratch2, ExternalAddress(StubRoutines::verify_oop_subroutine_entry_address()));
>     +  lea(rscratch2, RuntimeAddress(StubRoutines::verify_oop_subroutine_entry_address()));
>        ldr(rscratch2, Address(rscratch2));
>        blr(rscratch2);
>      
>     diff --git a/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp b/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp
>     index 89f5fbd281b..215f1b6453b 100644
>     --- a/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp
>     +++ b/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp
>     @@ -1337,7 +1337,7 @@ address TemplateInterpreterGenerator::generate_native...

@adinn  Can you explain aarch64 code?
Why we  use`mov(r, addr); blr(r);` instead of `bl(adr)`?
And why use `lea(r1, addr); ldr(r, r1)` instead of `mov(r, addr)`?

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

PR Comment: https://git.openjdk.org/jdk/pull/20412#issuecomment-2263413640


More information about the hotspot-dev mailing list