Package com.oracle.truffle.api.library
package com.oracle.truffle.api.library
Truffle Libraries allow language implementations to use polymorphic dispatch for receiver types
with support for implementation specific caching/profiling and customization of the dispatch.
Libraries enable modularity and encapsulation for representation types in language
implementations.
Before reading the javadoc make sure you have read the tutorial .
Start learning Truffle Libraries by reading the following articles:
Libraries
specify the set of available messages i.e. the protocol.Exports
implement a library for a receiver type.- Automatic dispatching using
@CachedLibrary allows to call library
messages with concrete receiver and parameters from nodes using the
specialization
DSL. - Manual dispatching using the LibraryFactory allows to perform slow-path calls and custom inline cache implementations.
Advanced Features:
- The
ReflectionLibrary
allows to reflectively export and call messages without binary dependency to a library. It also allows to implement library agnostic proxies. - The
DynamicDispatchLibrary
allows to implement receivers that dynamically dispatch to exported message implementations.
- Since:
- 19.0
- See Also:
-
ClassDescriptionThe cached library annotation allows to use
Truffle Libraries
conveniently inspecializations
orexported messages
.A library that allows to dynamically dispatch to export library classes.Allows to export messages of Truffle libraries.Repeat annotation forExportLibrary
.Exports the annotated method or class as library message.Explicitly ignores warning messages originating from theExportLibrary
annotation.Libraries are specified withpublic
andabstract
Java classes that extend the Library class and are annotated by@GenerateLibrary
.Makes a library message abstract, but allows to keep a default implementation.Specifieslibrary
implementations provided by default as a fallback.Base class for all Truffle library specifications.LibraryExport<T extends Library>Base class for generated export classes.Internal interface for generated code only.LibraryFactory<T extends Library>Library factories allow to create instances of libraries used to call library messages.Represents a description of library message.The reflection library allows to send to and proxy messages of receivers.