Integrated: 8341581: Optimize BytecodeHelpers validate slot

Shaojin Wen swen at openjdk.org
Mon Oct 7 23:33:01 UTC 2024


On Fri, 4 Oct 2024 23:49:42 GMT, Shaojin Wen <swen at openjdk.org> wrote:

> 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

This pull request has now been integrated.

Changeset: d996ca86
Author:    Shaojin Wen <swen at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/d996ca863deef50ba7c1c8878cc4c202fa1a9d6b
Stats:     26 lines in 1 file changed: 0 ins; 0 del; 26 mod

8341581: Optimize BytecodeHelpers validate slot

Reviewed-by: liach

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

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


More information about the core-libs-dev mailing list