Elide GraalVM25.6.0-elide.4
All types
Versions and modules

TruffleRunner.Warmup

Javaannotation interfacein com.oracle.truffle.tcksince 0.25

@Retention(RUNTIME)
@Target({METHOD})
public @interface TruffleRunner.Warmup
Enclosing type
TruffleRunner

A test method can be annotated with Warmup to specify how many warmup iterations of a test should be done before the Truffle tree is compiled. If this annotation is missing, the default value of 3 is used.

@Test
@Warmup(5)
public void warmupTest(@Inject(TestExecuteNode.class) CallTarget target) {
    TruffleObject receiver = prepareArgumentValue();
    Object ret = target.call(receiver);
    Assert.assertEquals(expectedRetValue(), ret);
}

In this example, the test code will in total be run 6 times. The first 5 iterations are warmup. The CallTarget.call invocation will run in the interpreter, simply calling the RootNode.execute method. This allows the AST to specialize itself before it is compiled.

After warmup, the resulting specialized AST is compiled, and in the final iteration the CallTarget represents the resulting compiled code.

Elements1

int value()

value

since 0.25
int value()

The number of warmup iterations to run before a test is compiled.

Returns

int
No description.