Skip to content

Support compressed references #912

@manofthepeace

Description

@manofthepeace

Is your feature request related to a problem? Please describe.
I got curious with this when playing with https://openjdk.org/jeps/519.

I wanted to see that mechanism in native-image, and saw there was a sort of equivalent when using -H:+UseCompressedReferences

I tested this java code with pure jvm, and both native-image from mandrel and graalVM

Temurin 25.0.1

~/Desktop/javatest
❯ java ObjectSize
Object allocation test completed: -314639644
Thread allocated 251658592 bytes

~/Desktop/javatest
❯ java -XX:+UseCompactObjectHeaders ObjectSize
Object allocation test completed: -314639644
Thread allocated 150995256 bytes

Mandrel 25

~/Desktop/javatest
❯ ./objectsize
Object allocation test completed: 1288973542
Thread allocated 402653240 bytes

❯ native-image -H:+UseCompressedReferences ObjectSize
Error: Unrecognized option '-H:+UseCompressedReferences' from command line. Use '--expert-options' (see also '--help-extra') to list all available options.

GraalVM 25

~/Desktop/javatest
❯ ./objectsize
Object allocation test completed: -524878109
Thread allocated 150994976 bytes

❯ graalvm-jdk-25.0.1+8.1/Contents/Home/bin/native-image -H:-UseCompressedReferences ObjectSize
❯ ./objectsize
Object allocation test completed: 222572497
Thread allocated 402653240 bytes

Describe the solution you'd like
In GraalVM not only UseCompressedReferences works, but it is the default. In Mandrel, the option is not available at all. Allocation is much higher than jvm without using JEP 519.

Describe alternatives you've considered
I was using GraalVm instead of mandrel in quarkus for a long time, and this get me tempted to swtich back as I feel this is a pretty significant "difference"

Additional context
I wonder since JEP519 is available if mandrel could use that directly somehow.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions