Skip to content

Allow bytecode version to be open-ended#9444

Merged
headius merged 2 commits into
jruby-9.4from
headius-patch-1
May 15, 2026
Merged

Allow bytecode version to be open-ended#9444
headius merged 2 commits into
jruby-9.4from
headius-patch-1

Conversation

@headius

@headius headius commented May 14, 2026

Copy link
Copy Markdown
Member

The ASM library hard codes a set of known bytecode versions, which frequently forces us to select an earlier version than the JVM we are running on. This change makes that byte code version open-ended, decoupling us from the ASM supported bytecode versions.

This is somewhat experimental, since we do not know how ASM will react if the JDK version is much newer than it's known byte code versions. If this patch does not work, we will fall back on updating ASM to latest and dealing with and updating our version calculation in the future.

Fixes #9443

Update: as suspected, ASM will not permit us to use bytecode versions newer than it supports, so I have made an additional change to limit the open-endedness of this to just the values the current ASM version supports.

@headius headius added this to the JRuby 9.4.15.0 milestone May 14, 2026
@headius

headius commented May 14, 2026

Copy link
Copy Markdown
Member Author

As I feared, if ASM doesn't know about the bytecode version, it will not allow it. I will investigate if there is a way to programmatically determine the highest version it supports because I really want to eliminate this manual code.

@headius

headius commented May 14, 2026

Copy link
Copy Markdown
Member Author

Latest changes seem to work but I want to add a test to verify that it is picking the latest version.

The ASM library hard codes a set of known bytecode versions, which
can only be programmatically queried with reflection. This change
uses reflection to pick the correct bytecode version for the JVM we
are running on, falling back on the highest version supported by
ASM if the JVM version is newer than that.

Fixes #9443
@headius
headius force-pushed the headius-patch-1 branch 2 times, most recently from cb8db4b to af0ddc4 Compare May 15, 2026 16:01
@headius
headius force-pushed the headius-patch-1 branch from af0ddc4 to c0cbf97 Compare May 15, 2026 16:09
@headius
headius merged commit 167fb70 into jruby-9.4 May 15, 2026
388 of 392 checks passed
@headius headius linked an issue May 15, 2026 that may be closed by this pull request
chadlwilson added a commit to jruby/warbler that referenced this pull request Jun 9, 2026
…bytecode.version=8)

See jruby/jruby#9444 - likely unintentionally removed the mapping for `8`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JRuby 9.4 does not generate bytecode for newer JDK versions

1 participant