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: