RFR: 8293474: RISC-V: Unify the way of moving function pointer

Fei Yang fyang at openjdk.org
Wed Sep 7 08:44:37 UTC 2022


Currently, there are two different ways of moving function pointer on riscv with either 'li' or 'mv' assembler functions.
For example, in file shenandoahBarrierSetAssembler_riscv.cpp, we use 'li' function:
  li(ra, (int64_t)(uintptr_t)ShenandoahRuntime::load_reference_barrier_strong_narrow)

But in file templateInterpreterGenerator_riscv.cpp, we use 'mv' function:
  mv(t1, CAST_FROM_FN_PTR(address, JavaThread::check_special_condition_for_native_trans))

Use of 'mv' here calls 'movptr' and will emits fixed length instruction sequence, which is neither necessary nor optimal compared with use of 'li'. This changes to use 'li' instead of 'movptr' to implement 'mv' thus unifying the way of moving function pointer.

Testing: Passed Tier1 test on Linux-riscv64 SiFive Unmatched board.

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

Commit messages:
 - 8293474: RISC-V: Unify the way of moving function pointer

Changes: https://git.openjdk.org/jdk/pull/10194/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=10194&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8293474
  Stats: 31 lines in 3 files changed: 2 ins; 10 del; 19 mod
  Patch: https://git.openjdk.org/jdk/pull/10194.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/10194/head:pull/10194

PR: https://git.openjdk.org/jdk/pull/10194


More information about the shenandoah-dev mailing list