RFR: 8319716: RISC-V: Add SHA-2 [v4]

Robbin Ehn rehn at openjdk.org
Fri Dec 15 14:10:44 UTC 2023


On Fri, 15 Dec 2023 11:11:59 GMT, Robbin Ehn <rehn at openjdk.org> wrote:

>> Robbin Ehn has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains seven additional commits since the last revision:
>> 
>>  - Merge branch 'master' into sha256
>>  - Materialize constants address once
>>  - Removed template
>>  - Flag fixes
>>  - Merge branch 'master' into sha256
>>  - Share code
>>  - SHA-2
>
> Hi all, I have address all comments.
> 
> The only code change I didn't do was register caching of constants.
> This is because I don't have access to sha2 in performance simulator.
> Without it 256 and 512 have 'identical' path.
> I'll create a jira for that, so I can revisit it once I have access.
> I hope that is okay @RealFYang ? (i.e. ship this and do a follow-up)
> 
> Also @VladimirKempik the flag issue is not resolved.
> For now we use this experimental flag which is inline with the other flags.
> 
> Any other things to address, new or that I missed?
> 
> (passes compiler/intrinsics/sha/)
> 
> REF: https://bugs.openjdk.org/browse/JDK-8322177

> @robehn : Thanks for the update. I am OK to leave aside caching of constants for some while when we can compare the numbers. I think I can take another look early next week. But I doubt about the need of saving & restoring of `t2` in the latest version. According to the ABI, `t2` is a caller-save register and is supposed to be saved by the call is it is alive. Also, the vector registers used in this stub are also caller-save registers.
> 
> (BTW: Seems this file should not be there in this PR: src/hotspot/cpu/riscv/.macroAssembler_riscv.cpp.swp)

This stubroutine should be inlined via "LibraryCallKit::try_to_inline", meaning there is no call here.
Hence why you need to use "enter" to setup a frame.
If there is no call, nothing is caller saved, AFAICT we pass in live registers via the Nodes. (no argument passing)


 ciMethod* callee = kit.callee();
  const int bci    = kit.bci();
  // Try to inline the intrinsic.
  if (callee->check_intrinsic_candidate() &&
      kit.try_to_inline(_last_predicate)) {


Correct me if I'm wrong?

(and if there is no call CR must be kept alive, which is a bit scary, e.g. must spill t1 to make sure we don't kill CR)

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

PR Comment: https://git.openjdk.org/jdk/pull/16562#issuecomment-1857940451


More information about the hotspot-dev mailing list