Allows nodes with specializations to be prepared for AOT. The annotation is automatically
inherited by all subclasses. Specializations of annotated nodes will be validated for their
suitability for AOT preparation. By default all specializations that are not
by an AOT capable specializations are included for AOT
validation and preparation. If a specialization is not suitable a compilation error will be
The following properties make a specialization incapable of being used for AOT preparation:
- Dynamic parameters bound in cached initializers. At AOT preparation time no dynamic
parameters are available, therefore the the caches not be initialized. Values read from the node
instance are supported.
- If a Truffle library is used that is automatically dispatched or where the expression
initializer is bound to a dynamic parameter value.
- If a cached node is created that does not itself support
Additionally, to resolve compilation errors related to AOT the following resolutions may be
- Exclude this specialization from AOT with
GenerateAOT.Exclude, if it is acceptable to deoptimize
for this specialization in AOT compiled code.
- Configure the specialization to be
Specialization.replaces() with a more generic
After a node generates code for AOT preparation
AOTSupport.prepareForAOT(RootNode) may be
used to prepare a root node in
This annotation can also be used for classes annotated with Truffle library declarations and
exports. The same rules, as described here, for specializations declared in exported libraries
apply. Multiple AOT exports may be specified for each library, but there must be at least one,
IllegalStateException is thrown at runtime when AOT is prepared.
See also the usage
tutorial on the website.