Bytecode DSL root fails Tier-2 runtime compilation in Native Image with FrameWithoutBoxing materialization
Bytecode DSL root fails Tier-2 runtime compilation in Native Image with FrameWithoutBoxing materialization
Describe GraalVM and your environment
Primary released reproduction:
GraalVM CE 25.3.4.1+1.1
JDK 25.0.4.1
JVMCI 25.3-b22
Linux x86_64
Oracle Linux Server 10.2java -Xinternalversion:
OpenJDK 64-Bit Server VM (25.0.4.1+1-jvmci-25.3-b22) for linux-amd64 JRE
(25.0.4.1+1-jvmci-25.3-b22), built on 2026-08-19T00:46:28Z with gcc 14.2.0Latest snapshot verification:
GraalVM CE 25.5.5-dev+1.1
JDK 25.0.4.1.1
JVMCI 25.4-b23
Truffle/Graal Maven plane 25.5.5-SNAPSHOT
Developer build 25.5.5-dev-20260930_0129
oracle/graal 11b21fb2e5691e49d46525dac7b87ef33aeafe82Snapshot java -Xinternalversion:
OpenJDK 64-Bit Server VM (25.0.4.1.1+1-jvmci-25.4-b23) for linux-amd64 JRE
(25.0.4.1.1+1-jvmci-25.4-b23), built on 2026-08-20T10:07:39Z with gcc 14.2.0Have you verified this issue still happens when using the latest snapshot?
Yes.
I reproduced it with GraalVM CE developer build 25.5.5-dev-20260930_0129, based on oracle/graal@11b21fb2e5691e49d46525dac7b87ef33aeafe82, using the matching 25.5.5-SNAPSHOT Truffle/Graal Maven plane.
Describe the issue
A minimal generated Bytecode DSL root compiles successfully at Tier 2 on the JVM, but the same root fails Truffle Tier-2 runtime compilation when executed inside a Native Image.
The minimum root:
- uses
@GenerateBytecode(enableYield = false); - declares no custom operations;
- has no locals, loops, or yields;
- only returns the constant
1.
The Native runtime compiler reports:
Object of type Lcom/oracle/truffle/api/impl/FrameWithoutBoxing;
should not be materialized
(must not pass virtual object into an invoke that cannot be inlined)The guest result is still 1 because CompilationFailureAction=Print reports the bailout and execution falls back to the interpreter. The issue is the failed Tier-2 compilation, not an incorrect guest result.
On the same 25.5.5-SNAPSHOT plane, the JVM compiles the same MiniPlainRootGen successfully at Tier 2.
Code snippet or code repository that reproduces the issue
The root itself is:
@GenerateBytecode(
languageClass = MiniLanguage.class,
enableYield = false)
public abstract class MiniPlainRoot extends RootNode implements BytecodeRootNode {
protected MiniPlainRoot(
MiniLanguage language,
FrameDescriptor frameDescriptor) {
super(language, frameDescriptor);
}
}The builder only emits:
BytecodeRootNodes<MiniPlainRoot> roots =
MiniPlainRootGen.create(
null,
BytecodeConfig.DEFAULT,
b -> {
b.beginRoot();
b.beginReturn();
b.emitLoadConstant(1L);
b.endReturn();
b.endRoot();
});
MiniPlainRoot root = roots.getNode(0);
root.getBytecodeNode().setUncachedThreshold(0);
RootCallTarget target = root.getCallTarget();
for (int i = 0; i < 64; i++) {
target.call();
}Attached: upstream004-oracle-graal-reproducer.tar.gz
The attached archive is a complete standalone Maven reproducer and contains no application-specific code required to trigger the failure.
SHA-256:
d02b26d8c90a095d4e0d41718889d7e7f654493862c57369adcb38b177289e5eSteps to reproduce the issue
The easiest released reproduction uses GraalVM CE 25.3.4.1 and Maven Central:
JAVA_HOME=/path/to/graalvm-community-25.3.4.1+1.1
PATH="$JAVA_HOME/bin:$PATH"
mvn -Dgraalvm.version=25.3.4.1 -Pnative -DskipTests clean package
./target/native/bug013-min-repro -Dpolyglot.engine.AllowExperimentalOptions=true -Dpolyglot.engine.BackgroundCompilation=false -Dpolyglot.engine.CompileImmediately=true -Dpolyglot.engine.TraceCompilation=true -Dpolyglot.engine.CompilationFailureAction=Print plainObserved:
[engine] opt failed ... MiniPlainRootGen ... |Tier 2| ...
Object of type Lcom/oracle/truffle/api/impl/FrameWithoutBoxing;
should not be materialized
REPRO_RESULT=1I then repeated the same reproduction using developer build 25.5.5-dev-20260930_0129 and its matching Maven resource bundle / 25.5.5-SNAPSHOT dependencies. The same Native bailout occurs.
As a control, running the same MiniPlainRootGen on the JVM with that same snapshot dependency plane produces:
[engine] opt done ... MiniPlainRootGen ... |Tier 2| ...
[engine] opt done ... MiniPlainRootGen ... |Tier 2| ...
REPRO_RESULT=1Expected behavior
The generated Bytecode DSL root should be able to complete Truffle Tier-2 runtime compilation inside Native Image, as the same root does on the JVM, or otherwise avoid forcing the virtual FrameWithoutBoxing to materialize across the generated interpreter path.
Additional context
The generated MiniPlainRootGen from the tested snapshot contains:
@Override
public Object execute(VirtualFrame frame) {
return continueAt(bytecode, 0, stackBase, (FrameWithoutBoxing) frame);
}
private Object continueAt(
AbstractBytecodeNode bc,
long bci,
long sp,
FrameWithoutBoxing frame) {
...
state = bc.continueAt(this, frame, state);
...
}The cached generated interpreter implementation is annotated with @BytecodeInterpreterSwitch, @ExplodeLoop(MERGE_EXPLODE), and @EarlyEscapeAnalysis.
The Native stack trace reaches:
EnsureVirtualizedNode.ensureVirtualFailure
CommitAllocationNode.lower
...
TruffleCompilerImpl.compilePEGraph
TruffleCompilerImpl.compileAST
...
IsolateAwareTruffleCompiler.doCompile0Because the minimum reproducer uses enableYield=false, yield/continuation support is not required for the failure.
I found the older #1463 and #1445 reports with the same general FrameWithoutBoxing should not be materialized diagnostic, but those are 2019 reports in different instrumentation/high-load contexts. This reproducer is a current Bytecode DSL root, is Native-runtime-compilation-specific, and still reproduces on the current developer snapshot.
Disclosure: This report was prepared with AI assistance. I personally ran and verified the reproducer, commands, logs, and conclusions, and I take responsibility for the submission.
Source: oracle/graal