Skip to content

OpenJDK: Fix long array creation in JVM_NewMultiArray - #21

Merged
guillerodriguez merged 1 commit into
masterfrom
fix/openjdk-newmultiarray
Aug 20, 2026
Merged

OpenJDK: Fix long array creation in JVM_NewMultiArray#21
guillerodriguez merged 1 commit into
masterfrom
fix/openjdk-newmultiarray

Conversation

@guillerodriguez

Copy link
Copy Markdown
Contributor

When JamVM is built for OpenJDK, Array.newInstance(Class, int[]) is mapped to the internal function JVM_NewMultiArray.

JVM_NewMultiArray constructs an array class descriptor from a local primitive-type table. The table incorrectly maps long to 'L' instead of 'J'. As a result, the generated array class name (e.g. "[[L") is invalid, and the VM may crash while resolving it.

Fix by replacing the table in JVM_NewMultiArray with a call to the existing primClass2TypeChar() helper, which has the correct mapping.

When JamVM is built for OpenJDK, Array.newInstance(Class, int[]) is
mapped to the internal function JVM_NewMultiArray.

JVM_NewMultiArray constructs an array class descriptor from a local
primitive-type table. The table incorrectly maps long to 'L' instead
of 'J'. As a result, the generated array class name (e.g. "[[L") is
invalid, and the VM may crash while resolving it.

Fix by replacing the table in JVM_NewMultiArray with a call to the
existing primClass2TypeChar() helper, which has the correct mapping.

Signed-off-by: Guillermo Rodríguez <grodriguez@ingelabs.com>
@guillerodriguez
guillerodriguez requested a review from phvega August 17, 2026 12:51
@guillerodriguez
guillerodriguez merged commit 207558c into master Aug 20, 2026
5 checks passed
@guillerodriguez
guillerodriguez deleted the fix/openjdk-newmultiarray branch August 20, 2026 11:54
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.

2 participants