RFR: JDK-8331732 :[PPC64] Unify and optimize code which converts != 0 to 1

Suchismith Roy sroy at openjdk.org
Wed Jun 26 07:01:37 UTC 2024


[JDK-8331732](https://bugs.openjdk.org/browse/JDK-8331732)
The template interpreter contains branch-free conversion code for T_BOOLEAN (TemplateInterpreterGenerator::generate_result_handler_for).

SharedRuntime::generate_native_wrapper uses unoptimized code to "Unpack the native result" for T_BOOLEAN.
Power10 has the "setbc" / "setbcr" instruction.

We could create a new function for the conversion and use "setbc" on Power10 (determined by VM_Version::has_brw()) and otherwise the branch-free implementation. We should have a function for 32 and one for 64 bit operations (or one with supports both).

The new code for MacroAssembler::verify_secondary_supers_table should also use the new function.

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

Commit messages:
 - include the function
 - Use non branch code to normalize bool

Changes: https://git.openjdk.org/jdk/pull/19886/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19886&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8331732
  Stats: 45 lines in 7 files changed: 34 ins; 8 del; 3 mod
  Patch: https://git.openjdk.org/jdk/pull/19886.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/19886/head:pull/19886

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


More information about the hotspot-dev mailing list