[riscv-port] RFR: 8277391: riscv: implement tls function MacroAssembler::get_thread() by using tls.gd [v2]
fyang at openjdk.java.net
Tue Nov 23 07:56:27 UTC 2021
On Mon, 22 Nov 2021 02:46:03 GMT, zhengxiaolinX <duke at openjdk.java.net> wrote:
>> Hi team,
>> This patch fixes the unimplemented assembly version of `__ get_thread()`, bringing some performance improvement by directly using the x4 register to refer to the variable `Thread::_thr_current`. Tested tests under hotspot/ and jdk/. [Original patch](https://github.com/riscv-collab/riscv-openjdk/pull/4)
> zhengxiaolinX has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains one commit:
> Implement tls function MacroAssembler::get_thread() using tls.gd
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.
More information about the riscv-port-dev