Annotation Interface StoreBytecodeIndex


@Retention(SOURCE) @Target(METHOD) public @interface StoreBytecodeIndex
Can be applied to Specialization- or Fallback-annotated methods to specify whether they require a bytecode index update in the frame. This allows the DSL to update the bytecode index only for a given specialization instead of the entire operation. In practice, this means that the bytecode index is updated just before the specialization is executed.

This annotation only has an effect if GenerateBytecode.storeBytecodeIndexInFrame() is set to true or if the uncached interpreter tier is enabled and the parent operation has Operation.storeBytecodeIndex() set to false.

Usage example:

// Disable bytecode index updates at the operation level
@Operation(storeBytecodeIndex = false)
static final class Abs {

    @Specialization(guards = "v >= 0")
    public static long doGreaterZero(long v) {
        return v;
    }

    @Specialization(guards = "v < 0")
    public static long doLessThanZero(long v) {
        return -v;
    }

    // Update the bytecode index only for this specialization
    @Specialization
    @StoreBytecodeIndex
    public static long doCallAbs(DynamicObject v) {
        // ... guest language call ...
    }
}
Since:
25.1
See Also: