Annotation Interface NonIdempotent

@Retention(CLASS) @Target(METHOD) public @interface NonIdempotent
Methods annotated with NonIdempotent must be methods that may cause side effects but may not always cause the same side effects for repeated invocations with the same parameters. From this follows that an non-idempotent method may return different results for consecutive invocations given the same parameters.

Truffle DSL uses this property to execute guards where all bound methods are idempotent once on the slow-path, during specialization, and never on the fast-path. By default, all methods that do not bind dynamic parameters are interpreted as idempotent for compatibility reasons. The DSL emits warnings whenever a method should be annotated either with Idempotent or NonIdempotent. Note that guards that bind dynamic parameters will never be idempotent in the fast-path, so the DSL will not require annotations for such guards.

Examples for non-idempotent methods are:

Examples for idempotent methods are:

Note that usages may assume that the current language instance never changes for a given Node. Therefore it is safe to assume language reference accesses idempotent.

See Also: