Annotation Interface TruffleRunner.Warmup

Enclosing class:
TruffleRunner

@Retention(RUNTIME) @Target(METHOD) public static @interface TruffleRunner.Warmup
A test method can be annotated with TruffleRunner.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(java.lang.Object...) invocation will run in the interpreter, simply calling the RootNode.execute(com.oracle.truffle.api.frame.VirtualFrame) 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.

Since:
0.25
See Also:
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    int
    The number of warmup iterations to run before a test is compiled.
  • Element Details

    • value

      int value
      The number of warmup iterations to run before a test is compiled.
      Since:
      0.25