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

RepeatingNode

Javainterfacein com.oracle.truffle.api.nodessince 0.8 or earlier

public interface RepeatingNode extends NodeInterface
Extends

A node that is repeatedly invoked as part of a Truffle loop control structure. Repeating nodes must extend Node or a subclass of Node. Repeating nodes are intended to be implemented by guest language implementations. For a full usage example please see LoopNode. Note: The result of shouldContinue( executeRepeatingWithValue()) is automatically profiled by the loop node, so the repeating node should not use a loop condition profile.

Fields2

Object CONTINUE_LOOP_STATUS

CONTINUE_LOOP_STATUS

since 19.3
Object CONTINUE_LOOP_STATUS

A value indicating that the loop should be repeated.

Object BREAK_LOOP_STATUS

BREAK_LOOP_STATUS

since 19.3
Object BREAK_LOOP_STATUS

A value indicating that the loop should not be repeated. Any other value different than CONTINUE_LOOP_STATUS can also be used to indicate that the loop should not be repeated.

Methods4

boolean executeRepeating(VirtualFrame)

executeRepeating

since 0.8 or earlier
boolean executeRepeating(VirtualFrame frame)

Repeatedly invoked by a loop node implementation until the method returns false or throws an exception.

Parameters

frameVirtualFrame
the current execution frame passed through the interpreter

Returns

boolean
true if the method should be executed again to complete the loop and false if it must not.
Object executeRepeatingWithValue(VirtualFrame)

executeRepeatingWithValue

defaultsince 19.3
default Object executeRepeatingWithValue(VirtualFrame frame)

Repeatedly invoked by a loop node implementation, but allows returning a language-specific loop exit status. Only languages that need to return custom loop statuses should override this method.

Parameters

frameVirtualFrame
the current execution frame passed through the interpreter

Returns

Object
a value v satisfying shouldContinue(v) == true if the method should be executed again to complete the loop and any other value if it must not.
Object initialLoopStatus()

initialLoopStatus

defaultsince 20.3
default Object initialLoopStatus()

Returns a placeholder loop status used internally before the first iteration.

Returns

Object
a value satisfying shouldContinue(initialLoopStatus(v)) == true
boolean shouldContinue(Object)

shouldContinue

defaultsince 20.3
default boolean shouldContinue(Object returnValue)

Predicate called on values returned by executeRepeatingWithValue().

Parameters

returnValueObject
a value returned by executeRepeatingWithValue()

Returns

boolean
true if the loop should continue executing or false otherwise