[riscv-port] RFR: 8277391: riscv: implement tls function MacroAssembler::get_thread() by using tls.gd [v2]

zhengxiaolinX duke at openjdk.java.net
Tue Nov 23 08:42:34 UTC 2021


On Tue, 23 Nov 2021 07:53:46 GMT, Fei Yang <fyang at openjdk.org> wrote:

> After some reconsideration, I think we can go one step further: simply keep the changes in file src/hotspot/share/utilities/globalDefinitions_gcc.hpp and remote all other changes in this PR.
> 
> Then USE_LIBRARY_BASED_TLS_ONLY macro won't be defined and Thread::current() will return '_ZN6Thread12_thr_currentE' in that case. This will be the same in functionality as the newly add assembly function '_ZN10JavaThread25riscv64_get_thread_helperEv'.
> 
> I have checked with Yadong, the reason for defining USE_LIBRARY_BASED_TLS_ONLY macro is to workaround some host compiler bug when accessing TLS variables in the very early days. This should not affect us now.

I think I get your point - I wonder if that `remote` should actually be a `revert`?
If it is - that's great - I think this is a pretty and concise solution if we need to clobber all volatile registers anyway. Let me revise this patch and change the titles.
But calling a `call_VM_leaf_base()` is a bit duplicated because this function would save another bunch of registers like x5 and x31 again, so I would recommend directly using a pair of `movptr_with_offset` and `jalr` - though it might be insignificant.

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

PR: https://git.openjdk.java.net/riscv-port/pull/7


More information about the riscv-port-dev mailing list