JDK-8341581 : Optimize BytecodeHelpers validate slot
  • Type: Sub-task
  • Component: core-libs
  • Sub-Component: java.lang.classfile
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2024-10-05
  • Updated: 2024-10-14
  • Resolved: 2024-10-07
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 24
24 b19Fixed
Description
Use slot & ~0xFF == 0 instead of (slot & 0xFF) == slot to reduce codeSize.

The following is a comparison of the bytecode before and after the modification. It can be seen that using slot & ~0xFF == 0 will reduce one iload operation.

// (slot & 0xFF) == slot
56: iload_0
57: sipush        255
60: iand
61: iload_0
62: if_icmpne     71

// slot & ~0xFF == 0
56: iload_0
57: sipush        -256
60: iand
61: ifne          70
Comments
Changeset: d996ca86 Branch: master Author: Shaojin Wen <swen@openjdk.org> Date: 2024-10-07 23:30:06 +0000 URL: https://git.openjdk.org/jdk/commit/d996ca863deef50ba7c1c8878cc4c202fa1a9d6b
07-10-2024

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/21367 Date: 2024-10-04 23:49:42 +0000
05-10-2024