RFR: 8370983: Add methods for primitive operators to support method handles

Hannes Greule hgreule at openjdk.org
Fri Oct 31 16:45:17 UTC 2025


On Fri, 31 Oct 2025 04:55:31 GMT, Joe Darcy <darcy at openjdk.org> wrote:

> Initial draft of a partial set of methods wrapping primitive operators to get feedback on the class providing this functionality.

I definitely like to see easier ways to construct method handles for specific operators, mainly the mathematical ones.

Some you've currently included are already present in `MethodHandles`, e.g., `arrayElementGetter` and `arrayElementSetter` for the array store and load bytecodes. `throwException` exists as well. You could also argue that `zero(void.class)` can be used as a nop.

The increment and decrement bytecodes are also somewhat weird, because you can't really observe them this way.

The conversion opcodes (x2y) can also be represented using `identity(x)` + `asType((x)y)`, but more explicit representation of that might be interesting.

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

PR Comment: https://git.openjdk.org/jdk/pull/28081#issuecomment-3473950733


More information about the core-libs-dev mailing list