This changelog summarizes major changes between Truffle versions relevant to languages implementors building upon the Truffle framework. The main focus is on APIs exported by Truffle.
- GR-80168: Bytecode DSL: Added
BytecodeConfig.matchesto compare configurations for a particular interpreter. - GR-80168: Bytecode DSL: Added
serializeBuilderBytecode,deserializeBuilderBytecode,serializeExecutionBytecode, anddeserializeExecutionBytecodemethods. Execution bytecode can be loaded without reading or replaying builder calls. Deprecated the builder-onlyserializeanddeserializemethods.
- (breaking-change) GR-79412: Changed automatic splitting to clone marked direct-call targets during root compilation preparation instead of direct-call execution.
RootNode.cloneUninitializedis now invoked without an entered language context during automatic splitting; the root language remains entered, so implementations can still useLanguageReference. See Splitting for details. - GR-79412: Added
RootNode.visitCloneableNodesso roots can expose node trees stored outside ordinary child fields. - GR-79412: The root node's language is now entered during root and inline compilation preparation, allowing implementations of
RootNode.prepareForCompilationto useLanguageReference. - GR-80770: Added
TruffleOptions.DetailedAssertionsto opt into expensive assertions with-Dtruffle.DetailedAssertions=true, independently of inexpensive Java assertions. - GR-80881: Bytecode DSL:
FloatandDoubleconstants are now compared by their raw bits, so distinct NaN payloads no longer share a constant-pool slot. - GR-80881: Bytecode DSL:
FloatandDoubleconstants are now compared by their raw bits, so distinct NaN payloads no longer share a constant-pool slot. - GR-80844: Bytecode DSL: Constants used inside a
finallyhandler are now serialized once, in the outermost context that can decode them, and the handler refers to that entry. Replays of the handler and the enclosing code therefore share one deserialized instance. A constant that references a root node declared inside the handler stays in the handler's own table. Equality-based deduplication is unchanged. Previously serialized bytecode still deserializes. - GR-72833: Added
RootNode.call(Node, int, Object[])and root-aware direct/indirect call overloads to optimize interpreter calls when concrete root types are known. AddedRootNode.initializeCallTarget()for explicit initialization; root-based calls require an initialized call target and otherwise throwIllegalStateException. - GR-72833: Added explicit bytecode-index call overloads and support in
FrameInstanceand guest stack traces;-1retains implicit lookup. Recompiled varargs calls may select a new overload; pass guest arguments in oneObject[]to preserve their meaning. Existing binaries are unaffected. - GR-72833: Added an
AbstractTruffleExceptionconstructor overload andgetBytecodeIndex()for explicit exception locations. - GR-72833: Bytecode DSL: Added
BytecodeIndexMode(CACHED_NODE, the default;FRAME;MANUAL;NONE),BytecodeNode.getBytecodeIndex(Frame), andBytecodeNode.setBytecodeIndex(Frame, int). The existingstoreBytecodeIndexInFrame()option remains supported;trueis equivalent toFRAME. Illegal-local exception factories can accept the current bytecode index, or-1when unavailable. - GR-72833: Added
BytecodeNode.setBytecodeIndex(Node, Frame, int)to store or clear the current bytecode index from nested nodes, with an encapsulating-node fallback for uncached execution. - GR-72833: Bytecode DSL: Added execution-metadata options on
OperationProxy.Proxyable(bindFrame,bindBytecodeNode,bindBytecodeIndex) and@Bind("$bytecodeIndex"). AST indices default to-1unless explicitly bound. - GR-72833: Specialization DSL: Fixed empty variadic child validation when execute methods provide all evaluated operands.
- GR-81544: Bytecode DSL: Added
BytecodeRootNode.getInstrumentationNodeObject(TagTreeNode)to supply tag-specific metadata, including variable names for read/write instrumentation.
- GR-79534: Added
HostCompilerDirectives.BytecodeInterpreterHandlerConfig.enableTailDuplication()to opt threaded bytecode handlers into dispatch-tail duplication; disabled by default. - GR-71613: Added
CompilerDirectives.mergeExplodeKeymethod for explicitly marking a local variable as a key for@ExplodeLoop(MERGE_EXPLODE)methods. It is recommended to migrate all merge exploded loops to use this method to catch unintended graph size explosions. - GR-79855: Extended
HostCompilerDirectives.BytecodeInterpreterHandlerConfig.Argument.Field.templateVariable()to support per-field template variant counts for bytecode handler threading and added template-aware main dispatch from the switch loop. - GR-13989:
TruffleFile.newByteChannelnow returnsFileChannel, enabling file regions to be mapped toMemorySegmentinstances on JDK 22 and later. - GR-79068:
FileChannelinstances returned byTruffleFile.newByteChannelnow expose file locking through thelockandtryLockmethods when supported by the underlying file system. - GR-80089: Bytecode DSL: Made the ClearLocal builtin non-optional. Custom operations that conflict with this builtin should be renamed.
- GR-79950: Added
DynamicObject.SetAllPropertyFlagsNodefor updating flags of multiple existing properties without assigning their values. It supports uniform flags, per-key flags, and remove/add masks. - GR-80293: Added
HostCompilerDirectives.BytecodeInterpreterHandlerConfig.Argument.expandedType()to select an exact concrete class for virtual argument expansion. AddedArgument.Field.validWhen()andvalid()to control incoming field validity by template state. - GR-79562: Bytecode DSL: Added
GenerateBytecode.unwindExceptionsto select exceptions that run finally cleanup while bypassing guest catches and exception interception, preserving exception identity across suspension and resumption. - GR-80124: Added
PropertyGetter.getShape()to expose the shape accepted by a property getter.
- GR-77721: Removed Truffle Object APIs deprecated in 22.2 and no longer in use.
- GR-77721: Removed Truffle Strings methods deprecated in 23.0 or earlier.
- GR-77721: Removed
InteropException.initCause(Throwable), deprecated since 20.2. - GR-77721: Removed debugger APIs deprecated in 21.2 or earlier.
- GR-77721: Removed instrumentation APIs deprecated in 23.0 or earlier.
- GR-77721: Removed core Truffle APIs deprecated in 23.0 or earlier.
- GR-77721: Removed profile factory methods deprecated in 23.0.
- GR-79122: Added host interoperability for
java.time.OffsetDateTimeandjava.time.OffsetTime. - GR-79418: Guest-language inlining now uses Graal IR call-site frequencies instead of runtime direct-call counters. Language implementations should ensure that injected branch probabilities are accurate because inaccurate probabilities are likely to cause peak-performance regressions.
- GR-61178: Bytecode DSL: Added support for
StackValues, handles to temporary stack operands. Languages can useBindStackValueto obtain aStackValueand then access the current operand value withLoadStackValueandStoreStackValue. Stack values are useful for supporting common subexpressions/temporary values without using locals. - GR-72480: Bytecode DSL: Implemented compressed source information, configurable with
@GenerateBytecode(enableCompressedSources = true|false). Compression is enabled by default and reduces the source-table memory footprint, at the cost of slower decoding when source information is accessed.
- GR-57730: Improved descriptive
toString()output for Polyglot API objects and builders. - GR-73530: Added
StaticShape.Builder.safetyChecks(boolean)to let language implementations configure safety checks for individual static shapes. Addedengine.ForceStaticObjectSafetyChecksto enable safety checks for all static shapes, overriding the builder setting. - GR-54730: Setting
sandbox.MaxCPUTimeto a zero duration now disables the CPU time limit instead of enforcing a zero-duration limit. - GR-77584: Bytecode DSL:
SourceandSourceSectionare now metadata-only operations that do not affect the operation tree shape. The previous semantics, which treated source operations like regular sequencing operations, were unsound and could cause inconsistent behaviour between reparses. - GR-77584: Bytecode DSL: Improved generation of source section table entries. Entries covering empty bytecode ranges are no longer emitted, and entries covering consecutive ranges are only combined when they come from the same
SourceSectionoperation.
- GR-77583: Bytecode DSL: Added
BytecodeRootNode.interceptIncomingValue(Object)andBytecodeRootNode.interceptOutgoingValue(Object)to convert values exchanged with tag instrumentation. - GR-75459: Bytecode DSL: Added multi-operand support for
@Yieldoperations. - GR-75438: Bytecode DSL: Added
@Returnfor user-defined return operations that customize the value returned from a bytecode root node. - GR-77108: Added
HostCompilerDirectives.BytecodeInterpreterHandlerConfig#secondarySwitch()to prevent handler outlining when a secondary bytecode interpreter switch is compiled separately.
-
GR-76434: Added
engine.DynamicCompilationThresholdsHighLoadSlopeto tune dynamic compilation threshold scaling under high compilation queue load. The default value ofengine.DynamicCompilationThresholdsMinNormalLoadis now0, which disables low-load threshold reduction by default. -
GR-71645: Host adapter instances created with
TruffleLanguage.Env#createHostAdapternow delegate unresolved direct member operations to the original guest object, while Java host members and the specialsuperandthisadapter members take precedence. -
GR-75236: Added engine option
engine.CompilerThreadStackSizeto set the requested stack size of Truffle compiler threads. By default compiler threads use640KBstack space. The requested size is rounded up to implementation-specific minima and page sizes as needed. -
GR-73900: Added
Engine.persistCache(Engine.CancellationCallback)to persist the auxiliary engine cache into an in-memoryByteBufferwith callback-based cancellation support. -
GR-65048: Introduced
InternalResource.OS.UNSUPPORTEDandInternalResource.CPUArchitecture.UNSUPPORTEDto represent unsupported platforms. Execution on unsupported platforms must be explicitly enabled using the system property-Dpolyglot.engine.allowUnsupportedPlatform=true. If this property is not set, calls toOS.getCurrent()orCPUArchitecture.getCurrent()will throw anIllegalStateExceptionwhen running on an unsupported platform.InternalResourceimplementations should handle the unsupported platform and describe possible steps in the error message on how to proceed. -
GR-66839: Deprecate
Location#isFinal()as it always returns false. -
GR-67702: Specialization DSL: For nodes annotated with
@GenerateInline, inlining warnings emitted for@Cached SomeNode helperexpressions are now suppressed if the helper node class is explicitly annotated with@GenerateInline(false), or is not a DSL node. This avoids unnecessary warnings if inlining for a node was explicitly disabled, and makes it possible to remove@Cached(inline = false)in most cases. -
GR-68165:
DynamicObjectLibrary#setDynamicTypetransitions are now weak, likeDynamicObjectLibrary#putConstanttransitions. -
GR-67821:
TruffleLanguage.Env#createSystemThreadis now allowed to be be called from a system thread now without an explicitly entered context. -
GR-66310: Added support for passing arrays of primitive types to native code through the Truffle NFI Panama backend.
-
GR-61292: Specialization DSL: Single specialization nodes no longer specialize on first execution unless they use assumptions, cached state, or multiple instances. This was done to improve the interpreter performance and memory footprint of such nodes. As a result, these nodes no longer invalidate on first execution, which means they can no longer be used as an implicit branch profile. Language implementations are encouraged to check whether they are relying on this behavior and insert explicit branch profiles instead (see
BranchProfileorInlinedBranchProfile). -
GR-64005: Bytecode DSL:
@Operationannotated classes can now inherit specializations and methods from super classes which are also declared in the same bytecode root node class. Language implementations no longer need to use operation proxies to use specialization inheritance. -
GR-69188: Added
@HostCompilerDirectives.InliningRootto explicitly trigger host inlining for a method designed for partial evaluation. Note that on SubstrateVM, host inlining is automatically enabled for all runtime-compilable methods, while on HotSpot you must add either@HostCompilerDirectives.InliningRootor@HostCompilerDirectives.BytecodeInterpreterSwitchto enable it. Host inlining is only enabled if Graal is enabled as a Java host compiler. -
GR-67146: Specialization DSL: Added
@Bindsupport for frames (including materialized frames). -
GR-67146: Bytecode DSL: Added support for user-defined yield operations using
@Yield. These operations behave like the built-in yield but allow you to customize the yield result or perform custom logic on yield. -
GR-69495: Bytecode DSL: Added a new
storeBytecodeIndexattribute to all operation annotations to configure whether the bytecode index needs to be stored. When@GenerateBytecode(storeBytecodeIndexInFrame = true)is set and the attribute is left at its default, the DSL will emit a warning recommending explicit configuration. Additionally, introduced the@StoreBytecodeIndexannotation, which lets you specify bytecode index updates for individual specializations or fallbacks. -
GR-69853: TruffleStrings: Added explicit little-endian and big-endian methods to
ReadCharUTF16Node. -
GR-68916: Added
TruffleString.MaterializeLazySubstringNodeandTruffleString.MaterializeSubstringNode. Use these nodes to free any unnecessary memory held by lazy substrings. -
GR-8251: Added
DebuggerSession.disposeStepping(Thread)to the debugger API to allow disposal of any pending step on a thread. -
GR-8251: Pending steps are no longer removed when no debugging action is prepared on a
SuspendedEvent. In practice, this means that the lifecycle of steps is now independent of breakpoint hits. -
GR-8251:
DebuggerSession.resumeThread(Thread)no longer cancels ongoing step operations. Stepping is now independent of other debugger actions to enhance flexibility. -
GR-61293: Bytecode DSL: Specialization state is now inlined into the bytecode array, which reduces memory footprint and interpreter execution time.
-
GR-69649: Bytecode DSL now encodes primitive constant operands directly in the bytecode, reducing memory indirections in the interpreter. This optimization is enabled by default; you can configure it with
@GenerateBytecode(inlinePrimitiveConstants = true). -
GR-68993: Added
HostCompilerDirectives.markThreadedSwitch(int)to mark a switch statement within a loop as a candidate for threaded switch optimization. -
GR-68993: Bytecode DSL: All bytecode interpreters are now using the threaded switch optimization by default. This new optimization can be configured using
@GenerateBytecode(enableThreadedSwitch=true|false). -
GR-71030: Bytecode DSL now generates a new
MyBytecodeRootNodeGen.Bytecodeclass that can be accessed via theMyBytecodeRootNodeGen.BYTECODEsingleton. This class which extends the addedBytecodeDescriptorallows you to parse, serialize and deserialize bytecode nodes in addition to the already existing static methods in the generated code. -
GR-71030: Bytecode DSL now provides an
InstructionDescriptorgenerated implementation for the bytecode interpreter. The instructions can be accessed via the new BytecodeDescriptor like this:MyBytecodeRootNodeGen.BYTECODE.getInstructionDescriptors(). There is alsoMyBytecodeRootNodeGen.BYTECODE.dump()to produce a human-readable instruction format. -
GR-71031: Added new method
BytecodeDescriptor.update(MyLanguage, BytecodeConfig)to update the bytecode config for all current root nodes and root nodes created in the future of a language. -
GR-51945: Bytecode DSL, added
InstructionTracerwithonInstructionEnter(InstructionAccess, BytecodeNode, int, Frame). Tracers can be attached per root viaBytecodeRootNodes.addInstructionTracer(InstructionTracer)and per descriptor viaBytecodeDescriptor.addInstructionTracer(TruffleLanguage, InstructionTracer). Attaching a tracer invalidates affected roots and may trigger reparse and comes at a significant cost. -
GR-51945: Bytecode DSL: added instruction tracer reference implementations
PrintInstructionTracerandInstructionHistogramTracer. These are intended for diagnostics. -
GR-51945: Added option
engine.TraceBytecodeto enable printing each executed Bytecode DSL instruction. Use theengine.BytecodeMethodFilteroption to print instructions only for a given method. -
GR-51945: Added option
engine.BytecodeHistogramto enable printing a bytecode histogram on engine close. Useengine.BytecodeHistogramIntervalto configure the interval at which the histogram is reset and printed. -
GR-70086: Added
replacementOfandreplacementMethodattributes toGenerateLibrary.Abstractannotation. They enable automatic generation of legacy delegators during message library evolution, while allowing custom conversions when needed. -
GR-70086 Deprecated
Message.resolve(Class<?>, String). UseMessage.resolveExact(Class<?>, String, Class<?>...)with argument types instead. This deprecation was necessary as library messages are no longer unique by message name, if the previous message was deprecated. -
GR-71299 Improved the responsiveness of the Truffle compilation queue by refining the computation of the execution rate of compilation units in the queue.
- Added
engine.TraversingQueueRateHalfLifeto allow fine-tuning of the compilation queue responsiveness.
- Added
-
GR-71245: Exposed
ByteBufferDataInputas public and added apositionmethod that returns the underlying buffer's position. AddedSerializationUtils.createByteBufferDataInputfactory method and deprecatedSerializationUtils.createDataInput. -
GR-36894: Added
DynamicObjectnodes for dealing withDynamicObjectproperties and shapes, as a more lightweight replacement forDynamicObjectLibrary, including:DynamicObject.GetNode: gets the value of a property or a default value if absentDynamicObject.PutNode: adds a new property or sets the value of an existing propertyDynamicObject.ContainsKeyNode: checks if the object contains a specific propertyDynamicObject.RemoveKeyNode: removes a propertyDynamicObject.GetKeyArrayNode: gets an array of keys of all the object's propertiesDynamicObject.CopyPropertiesNode: copies all properties from one object to anotherDynamicObject.GetShapeFlagsNodeandSetShapeFlagsNode: gets and sets flags in the object's shape, respectivelyDynamicObject.GetDynamicTypeNodeandSetDynamicTypeNode: gets and sets the dynamic type id in the object's shape, respectively- See
DynamicObjectjavadoc for a complete list and more information. There's an equivalent for everyDynamicObjectLibrarymessage. - Note: Unlike
DynamicObjectLibrary, cached property keys are always compared by identity (==) rather than equality (equals). If you rely on key equality, cache the key using anequalsguard and pass the cached canonical key to the node.
-
GR-36894: Deprecated
DynamicObjectLibrary. UseDynamicObjectnodes instead. See the migration guide for an overview of the required changes. -
GR-66335: DynamicObject: Allow constant-folding of final property values of constant receivers (using
GetNode). -
GR-69861: Bytecode DSL: Added a
BytecodeFrameabstraction for capturing frame state and accessing frame data. This abstraction should be preferred overBytecodeNodeaccess methods because it captures the correct interpreter location data. -
GR-69861: Bytecode DSL: Added a
captureFramesForTraceparameter to@GenerateBytecodethat enables capturing of frames inTruffleStackTraceElements. Previously, frame data was unreliably available in stack traces; now, it is guaranteed to be available if requested. Languages must use theBytecodeFrameabstraction to access frame data fromTruffleStackTraceElements rather than access the frame directly. -
GR-69614: The methods
InteropLibrary#hasLanguageandInteropLibrary#getLanguagehave been replaced withInteropLibrary#hasLanguageIdandInteropLibrary#getLanguageId. Language implementers are encouraged to update their code to the new API. -
GR-69614: Added
TruffleInstrument.Env.getHostLanguage()returning the host language info. This allows instruments to lookup the top scope of the host language usingEnv.getScope(LanguageInfo). -
GR-71468: Significantly improve optimized performance of host proxy interfaces (
org.graalvm.polyglot.proxy.Proxy). -
GR-71088 Added
CompilerDirectives.EarlyInlineannotation that performs a conservative early inlining pass for methods before partial evaluation. This is intended to expose small branch/bytecode handlers and similar helpers to optimizations such as @ExplodeLoop, in particular for MERGE_EXPLODE bytecode interpreter loops. -
GR-71088 Added
CompilerDirectives.EarlyEscapeAnalysisannotation that runs partial escape analysis early before partial evaluation enabling partial-evaluation-constant scalar replacements. -
GR-71870 Truffle DSL no longer supports mixed exclusive and shared inlined caches. Sharing will now be disabled if mixing was used. To resolve the new warnings it is typically necessary to use either
@Exclusiveor@Sharedfor all caches. -
GR-71887: Bytecode DSL: Added a
ClearLocaloperation for fast clearing of local values. -
GR-71402: Added
InteropLibrary#isHostObjectandInteropLibrary#asHostObjectfor accessing the Java host-object representation of a Truffle guest object. DeprecatedEnv#isHostObject,Env#isHostException,Env#isHostFunction,Env#isHostSymbol,Env#asHostObject, andEnv#asHostExceptionin favor of the new InteropLibrary messages. -
GR-71402: Added
InteropLibrary#hasStaticScopeandInteropLibrary#getStaticScopereturning the static scope representing static or class-level members associated with the given meta object. -
GR-72022
AtomicLongFieldUpdater,AtomicIntegerFieldUpdaterandAtomicReferenceFieldUpdatercan now be used on partially evaluated code paths when the updater is a PE constant and the compiler can prove receiver and value correctness during partial evaluation, otherwise compilation permanently bails out. -
GR-44829: Added
TruffleString.CodePointAtIndexUTF32Nodefor better interpreter performance of UTF-32 strings. -
GR-44829:
TruffleStringnodes no longer profile theexpectedEncodingparameter for interpreter performance reasons. Languages with non-constant string encodings should profile the encoding before passing it toTruffleStringnodes. -
GR-75002: Specialization DSL: Handwritten
inline(InlineTarget)methods are now preferred over synthesized generated inline signatures when resolving inlined caches. Generated inline metadata now preserves public node subtypes forReferenceField-backed fields, while non-public or generated helper node types continue to use genericNode/Node[]types. If you need stable inline APIs, you can continue to pinReferenceFieldrequirements to a stable public supertype such asNodein a handwritteninlinemethod. -
GR-57579: Added
TruffleString.ByteIndexOfStringSetNodefor fast multi-string searches. -
GR-61161: Bytecode DSL: Added support for basic instruction rewriting. At bytecode build time, the builder can perform peephole optimization to remove redundant loads. This new optimization can be configured using
@GenerateBytecode(enableInstructionRewriting=true|false). -
GR-71765: Bytecode DSL: Added support for specifying an illegal local exception via
@GenerateBytecode(illegalLocalException=SomeException.class). This configures the interpreter to throw a custom exception when loading a cleared local, as an alternative to the default behaviour (throwing aFrameSlotTypeException). This option is mutually exclusive with the default local value option (@GenerateBytecode(defaultLocalValue = "someValue")). -
GR-69499 Added
HostCompilerDirectives.BytecodeInterpreterHandlerannotation, enabling one compilation per bytecode handler in the Truffle bytecode interpreter while maintaining performance statistics. Introduced support for tail call threading among bytecode handlers in native image. See the One Compilation per Bytecode Handler documentation for more details. -
GR-35913: Added
AbstractTruffleException#createGuestStackTrace(Throwable), which returns the default interop representation of a throwable’s stack trace. -
GR-35913: Added
InteropLibrary#hasByteCodeIndexandInteropLibrary#getByteCodeIndexto expose a bytecode index for interop objects representing stack trace elements. -
GR-35913: Added
InteropLibrary#isInternalto allow interop objects to be marked as internal. Stack trace element objects can be marked internal so they are omitted from stack trace printing. -
GR-72486: Bytecode DSL: Added support for all source section representations (e.g., line numbers). Builders now define different
beginSourceSectionandendSourceSectionoverloads for each source section representation. -
GR-71311:
TruffleString.FromNativePointerNodeandMutableTruffleString.FromNativePointerNodenow also accept boxed long values in place of their native pointer parameters. -
GR-44312: Added
TruffleString.FromByteArrayWithCompactionUTF32NodeandTruffleString.FromNativePointerWithCompactionUTF32Node, to allow creation of UTF-32 strings from existing compacted strings. -
GR-73519:
InteropLibrary#getExceptionCausemay return an interop null object if the exception supports a cause but the cause itself isnull. -
GR-44465: Added
TruffleString.FromZeroTerminatedNativePointerNodeto support creating TruffleStrings from zero-terminated native buffers. -
GR-72022: Added
@GenerateBytecode(enableTailCallHandlers=true)to enable the tail call bytecode handler annotations. -
GR-72022: Deprecated
BytecodeDebugListener.beforeInstructionExecute(...)andBytecodeDebugListener.afterInstructionExecute(...). Please use instrumentation based instruction tracing instead. -
GR-73953: Starting with Truffle 25.1, the optimizing runtime is supported only with GraalVM 25.1 or later, including Oracle GraalVM and GraalVM Community Edition. It is no longer supported with GraalVM 25.0 or earlier, or on plain OpenJDK or Oracle JDK via jargraal (
org.graalvm.compiler:compileron--upgrade-module-path). The fallback runtime remains supported on standard JDKs and remains backwards compatible down to JDK 21, but runs without runtime compilation. If you need the optimizing runtime on plain OpenJDK or Oracle JDK, continue using the 25.0 LTS release. -
GR-73707: Bytecode DSL: Added
BytecodeRootNode#traceTransition(BytecodeTransition, Frame), an optional hook invoked whenever the interpreter transitions between bytecode nodes due to deoptimization (isTransferToInterpreter()) or a bytecode update (isBytecodeUpdate()). Deoptimization events retain precise locations for compilation roots and continuation resumes, but deoptimization events in inlined root nodes may be associated with the compilation root instead. -
GR-73707: Added
CompilerDirectives.preserveFrameStateHere()to insert a state-split marker at a specific program point so deoptimization restores the precise frame state for that location. Use this in bytecode interpreters when transfer-to-interpreter transitions must be attributed reliably to the current bytecode location. -
GR-73707: Added engine option
engine.TraceBytecodeTransitionto log bytecode interpreter transition events engine-wide. Supported values aretrue(all kinds),transferToInterpreter,bytecode,tier,tag, andinstrumentation(comma-separated for combinations). Useengine.BytecodeMethodFilterandengine.BytecodeLanguageFilterto scope tracing. -
GR-72488: Bytecode DSL: Added support for lazy loading of source content using
@GenerateBytecode(sourceContentSupplier=...). This attribute allows to parse sources without content and only load source content upon request, reducing interpreter footprint when full source content is not needed. -
GR-74314: Bytecode DSL: Added generated
BytecodeRootNode#getSource()to return the source associated with a bytecode root node, ornullwhen no source information is available. -
GR-74761: Bytecode DSL: Tightened validation of invalid bytecode indices across Bytecode DSL APIs. Constructing a
BytecodeFrameorBytecodeLocationfrom aTruffleStackTraceElementwith illegal bytecode index now throws anIllegalArgumentException;BytecodeNode#getBytecodeLocation(Frame, Node)now reliably returnsnullwhen no valid bytecode index can be determined; otherBytecodeNodeAPIs that take abytecodeIndexorFrameInstancenow consistently assert that the bytecode index is valid. -
GR-74761: Bytecode DSL: Added
BytecodeFrame.getTop(...)andBytecodeFrame.iterateBytecodeFrames(...)helpers for accessing Bytecode DSL frames during stack walks. -
GR-73555: Bytecode DSL: Changed frame descriptor of
ContinuationRootNode. Continuations no longer have the sameFrameDescriptoras their source root nodes. -
GR-73872: Added support for constant options via the
constantattribute on@Option, together withConstantOptionKey<T>. When@Option(constant = true)is used on astatic final ConstantOptionKey<T>field, the option value is fixed before runtime initialization (from-Dpolyglot.<option-name>=<value>or the declared default) and cannot be changed at runtime. Calls toConstantOptionKey.getConstantValue()are partial-evaluation final, enabling dead-branch elimination in Truffle interpreters. In native image, these constants can be folded statically at image build time. On HotSpot, such static folding is not guaranteed due to class initialization timing. -
GR-73872: Added support for native-image preset options. Polyglot options provided during native-image build are captured as preset defaults at image build time, then applied at runtime as defaults.
-
GR-75360: Bytecode DSL: Generated root nodes now support delegation to parent implementations of
RootNode.isInstrumentable(),RootNode.prepareForCall(), andRootNode.prepareForInstrumentation(tags), when available. -
GR-76069: Added
ArrayUtils.arraycopy(int[], int, int[], int, int), a specialized variant ofSystem.arraycopy. -
GR-75854: Bytecode DSL:
@EpilogReturninstructions are now associated with the source sections and local scopes active at the return.
-
GR-31495 Added ability to specify language and instrument specific options using
Source.Builder.option(String, String). Languages may describe available source options by implementingTruffleLanguage.getSourceOptionDescriptors()andTruffleInstrument.getSourceOptionDescriptors()respectively. -
GR-61493 Added
RootNode.prepareForCallwhich allows root nodes to prepare themselves for use as a call target (or to validate whether they can be used as a call target). -
GR-57063 Bytecode DSL: Improved variadic support. Variadic operands compile and execute now more efficiently with fewer reallocations.
-
GR-57063 Bytecode DSL: Added an
startOffsetparameter to@Variadicwhich allows to reserve a fixed number of slots in the object array for custom use. -
GR-57063 Bytecode DSL: The
@Variadicannotation can now also be used on@Operationannotated classes to indicate that the operation produces a dynamic variadic return value. Dynamic variadic return values are efficiently flattened into the object array of a variadic operand. -
GR-57063 Bytecode DSL: Added a
variadicStackLimitparameter to@GenerateBytecodethat allows to specify how many variable arguments are stored on the stack before they are collapsed into an object array. -
GR-50017 TruffleStringIterator.NextNode and TruffleStringIterator.PreviousNode now require the iterated string's encoding as a parameter for performance reasons.
-
GR-63075 Java host interop again inherits public method methods from non-public base classes if public access is enabled. This was originally changed in 24.1.
-
GR-63201 Added
TruffleLanguage.Registration.optionalResourcesandTruffleInstrument.Registration.optionalResourcesattributes to support optional resources which implementations are not available at the runtime. Optional resources, if omitted at runtime, can still be used as long as their resource path is specified via thepolyglot.engine.resourcePath.<componentId>system property. -
GR-61282 Bytecode DSL: Bytecode builders now also allow emitting source sections using the start and length source indices in the end method in addition to the begin method. This was added to support linear parsing without look-ahead.
-
GR-61282 Bytecode DSL: (breaking) If multiple source sections were specified around root operations, only the innermost source section directly encapsulating the root will be accessible. Other encapsulating source sections will be discarded for outer most root operations.
-
GR-64533 By default every specialization is now included for {@link GenerateUncached}, except specializations that require a {@link Specialization#limit() limit} and are replaced, those are excluded by default. By setting
@Specialization(excludeForUncached=..)explicitly the default behavior can be overridden, e.g. to include or exclude a specialization for uncached. Specializations which are no longer compatible with uncached will produce a warning instead of an error for compatibility reasons until all languages are migrated. It is therefore expected that language implementations may see new warnings with this version. -
GR-64124 Added
BytecodeOSRNode.pollOSRBackEdge(BytecodeOSRNode, int)that supports batch polling for bytecode OSR. Using this method avoids checking for bytecode OSR on every loop backedge. -
GR-64124 Deprecated
BytecodeOSRNode.pollOSRBackEdge(BytecodeOSRNode). UseBytecodeOSRNode.pollOSRBackEdge(BytecodeOSRNode, int)instead. Please note that the old method did callTruffleSafepoint.poll(Node), but the the new method does not. Please double check that your bytecode interpreter polls Truffle safepoints at loop back-edges. -
GR-64086 Added extended Dynamic Object Model Layout that adds:
- A shape obsolescence strategy enabling optimistic type speculation for primitive property values with gradual migration to more general shapes on speculation failure (moving primitive slots to reference slots), eventually converging on a general enough shape tree. Reduces shape polymorphism by obsoleting and merging too specific shapes in favor of more general shapes.
- Automatic reference type tracking based on assumptions, eliminating redundant type checks.
- Automatic single-assignment tracking based on assumptions allowing languages to assume that a property is effectively final (i.e. stays unchanged after the initial assignment) as well as constant-fold values of a constant receiver with a known shape.
- You can still disable the new layout and switch back to the previous implementation using the system property:
-Dtruffle.object.LayoutFactory=com.oracle.truffle.api.object.CoreLayoutFactory.
-
GR-64488 Added
TruffleFile#getFileStoreInfo()providing access to disk-related metadata such as total size, usable space, unallocated space and block size. -
GR-43908 Added a deoptimization cycle detection to Truffle. This feature is enabled by default when running optimized on JDK 25 and later. Whenever a deoptimization cycle is detected, the compilation fails with a permanent bailout that contains the Java stack trace of the location. If this error is encountered too frequently it can be disabled by setting
compiler.DeoptCycleDetectionThresholdto-1. For further information, please see the extended deopt cycle detection guide.- Added
compiler.DeoptCycleDetectionThresholdandcompiler.DeoptCycleDetectionAllowedRepeatsoptions which allow to fine-tune the sensitivity of the deoptimization loop detection.
- Added
-
GR-64594 Bytecode DSL: Improved builder performance. Creating bytecode nodes with Bytecode DSL is now 40% faster and requires 5 times less temporary memory.
-
GR-64594 Bytecode DSL: Builder instances now have a
toString()implementation that prints current operations as well as the instructions that have been already emitted. This should make it easier to debug problems with builder usage. -
GR-64594 Bytecode DSL: Added
@GenerateBytecode(..., additionalAssertions=true)to enable additional assertions for Bytecode DSL implementation bugs. This feature can also be enabled with-A.truffle.dsl.AdditionalAssertions=trueat Java source compile time. These assertions are intentionally disabled by default, as they can lead to slow-downs even when assertions are disabled. -
GR-65428 JDK specific optimizations when building Truffle languages with native-image are now enabled by default, even if the truffle-enterprise.jar is not provided on the class or module-path.
-
GR-38296 Removed the deprecated
BytecodeOSRNode.copyIntoOSRFramehook that does not declare atargetMetadataparameter. -
GR-65616 Added
ExactMath.truncateToUnsignedInt(float)andExactMath.truncateToUnsignedLong(double)methods that remove the decimal part (round toward zero) of a floating point (float or double) value and convert it to a saturated unsigned integer (int or long) value. These methods are intrinsic candidates. -
GR-65616 Added
ExactMath.unsignedToFloat(long)andExactMath.unsignedToDouble(long)methods to convert an unsignedlongto the closestfloatanddoublevalue, respectively. These methods are intrinsic candidates.
- GR-60636 Truffle now stops compiling when the code cache fills up on HotSpot. A warning is printed when that happens.
- GR-57658 Added
TruffleLanguage.Env.getLanguageInfo(Class<? extends TruffleLanguage>)to lookup aLanguageInfoinstance for a language class returned byInteropLibrary.getLanguage(Object). - GR-57164 Added support for reading unaligned ints, shorts and long to
ByteArraySupport. - GR-57164
RootNode.translateStackTraceElement()is now always consulted for polyglot and debugger stack traces. Stack traces now use the source section, the executable name, the name of the declared meta-object to buildStackTraceElementinstances. - GR-57322 Added
TruffleLanguage.Env.getHostLanguage()returning the host language info. This allows languages to lookup the top scope of the host language usingEnv.getScopeInternal(LanguageInfo). - GR-57550 Added support for long-width dispatch targets to Bytecode OSR.
- PR-8266 Allow control of
throwDeniedThreadAccessviaTruffleContext.threadAccessDeniedHandler - GR-57817 Java Native access for JEP-472 is now automatically provided for all languages and tools by Truffle. For more information, refer to the GraalVM SDK Changelog.
- GR-46292 The deprecated
TruffleInstrument.ProviderandTruffleLanguage.Providerinterfaces, deprecated since version 23.1, have now been removed. They are replaced by thecom.oracle.truffle.api.provider.TruffleLanguageProviderandcom.oracle.truffle.api.instrumentation.provider.TruffleInstrumentProviderinterfaces. The implementations of these interfaces are automatically generated by the annotation processor and this change requires no source code modifications, only recompilation. - GR-46293 The deprecated
com.oracle.truffle.api.library.DefaultExportProviderandcom.oracle.truffle.api.library.EagerExportProviderinterfaces, deprecated since version 23.1, have now been removed. They are replaced by thecom.oracle.truffle.api.library.provider.DefaultExportProviderandcom.oracle.truffle.api.library.provider.EagerExportProviderinterfaces. The implementations of these interfaces are automatically generated by the annotation processor and this change requires no source code modifications, only recompilation. - GR-59640
InternalResource.versionHash(Env)may now throw anIOExceptionto indicate problems when reading the version from disk. - GR-54300 An inner context is now automatically closed when its corresponding creator
TruffleContextis no longer strongly reachable. A reachable APITruffleContextwill keep the associated creatorTruffleContextreachable. However, it is still recommended not to rely on garbage collection for closing. Instead, use the try-with-resources pattern for explicit context management. For more information, refer to the Automatic Close on GC documentation. - GR-30264
TruffleLanguage#initializeThread(Object, Thread)is now guaranteed to be executed on the thread that is being initialized. Additional changes:- Added
ThreadLocalAction#notifyBlocked(Access)andThreadLocalAction#notifyUnblocked(Access)to notify thread local actions that their processing has been blocked/unblocked due to a blocked call (seeThreadLocalActiondocumentation). TruffleSafepoint#poll(Node)does not require a non-null location anymore. However, it is still recommended to always pass a location node, if available.
- Added
- GR-59565 Added
RootNode.prepareForCompilationwhich allows root nodes to offload expensive computation to the compiler thread and to delay compilation if they are not yet fully profiled. - GR-55296 Added support for creation of strings from raw byte arrays and native memory using
Value.fromByteBasedString(...)Value.fromNativeString(...). AValue.StringEncodingmust be provided. - GR-55296 Added support to convert any string to a
byte[]with a givenValue.StringEncodingusingValue.asStringBytes(...). - GR-40323 Deprecated
Shape.Builder.layout(Class)for removal and added replacement APIShape.Builder.layout(Class, MethodHandles.Lookup). Replace usages with the new method, additionally providing aLookupthat has full privilege access to the layout class or the module in which it is declared, as obtained byMethodHandles.lookup(). See javadoc for the updated usage. - GR-55296 Added support for UTF-16 and UTF-32 in non-system-endianness without dependency on the JCodings library in TruffleString.
- GR-58550 Added
FrameDescriptor.Builder.illegalDefaultValue()which initializes all frame slots asFrameSlotKind.Illegalfor newly created frames. This is different from the default behavior, which initializes all frame slot kinds asFrameSlotKind.Object. This means that frame slots, when they are read before they were written, throw aFrameSlotTypeException, consistent with the behavior after clearing a frame slot. - GR-58550 Deprecated the default constructor for
FrameSlotTypeExceptionand replaced it withFrameSlotTypeException.create(...). Exceptions of this kind thrown by theFramenow contain the slot index and the expected and the actual frame slot kind which are accessible with the respective instance methods. - GR-58550 Fixed invalid
PolyglotException.getMessage()javadoc. A polyglot exception may in fact return anullmessage. - GR-58550 Added
FrameDescriptor.Builder.addSlots(int)which adds slots with the default Illegal tag. - GR-58550 Added
FrameDescriptor.Builder.useSlotKinds(boolean)which allows if disabled to not reserve space for tags in the frame descriptor. Disabling slot kinds is useful if a language manages its own cached tags, so no tag space is wasted. - GR-54760
RootNode.translateStackTraceElement()is now always consulted for polyglot and debugger stack traces. Stack traces now use the source section, the executable name, and the name of the declared meta-object to buildStackTraceElementinstances. - GR-32682 Added the Bytecode DSL, a new framework for implementing bytecode interpreters. The Bytecode DSL is considered experimental and we are actively working on stabilizing it. The Bytecode DSL automatically generates a complete bytecode interpreter from a set of user-specified operations. The generated interpreter defines all the necessary components of a bytecode interpreter, including an instruction set, a bytecode generator, and an optimizing interpreter. Bytecode DSL interpreters are designed to improve footprint and interpreter speed over AST interpreters without compromising peak performance. Bytecode DSL interpreters support a variety of features, including tiered interpretation, bytecode quickening and boxing elimination, continuations, and serialization. They also integrate with existing Truffle tooling for instrumentation and debugging. Please see the Introduction to Bytecode DSL to get started, or consult the User guide for more information.
- GR-32682 Added
@Bind.DefaultExpressionannotation. Default expressions allow you to omit an explicit expression when declaring a@Bindparameter (the default expression for the parameter's type is used). - GR-32682 Added
RootNode.findInstrumentableCallNode(...)that allows resolving the instrumentation location given a call node, frame and bytecode index. This allows to store instrumentable nodes in a side data structure for bytecode interpreters. Also addedTruffleStackTraceElement.getInstrumentableLocation()andFrameInstance.getInstrumentableCallNode()to access the resolved locations. Tools using the Truffle instrumentation framework are encouraged to use these APIs instead for the purpose of accessing node locations. - GR-32682 The method
Node.reportReplace(...)is now accessible to subclasses which allows to report replaces without performing a replace. Reporting a replace can be used to invalidate the optimized code of nodes compiled as part of other root nodes. - GR-32682 Added
RootNode.prepareForInstrumentation(...)which allows languages to get notified when new tags are materialized in the instrumentation framework. This allows to materialize instrumentable nodes contained in a root node lazily as this method is called prior to any instrumentation. - GR-32682 Added
Frame.expect{Type}methods to Truffle frames. These methods allow to speculatively read a tagged value from a frame and receive anUnexpectedResultExceptionif the tag does not match. - GR-32682 Added
Frame.copyTo(...)method to the frame for efficient copying from one frame to the other. - GR-32682 Added
AbstractTruffleException.getEncapsulatingSourceSection()method to the base guest exception method to access the top-most source section of the exception. - GR-32682 Added
InstrumentableNode.findProbe()to specify how an instrumentable node finds its associated probe. This is useful for bytecode interpreters to store the probe nodes in a separate data structure without associated wrapper nodes. - GR-32682 Added
InstrumentableNode.createProbe(SourceSection)method, which allows to create eager probe nodes for an instrumentable node. Eager probes do not wait for a probe to be inserted and for example all probes for statements can be inserted in a batch. Eager probes are typically used in combination with overriding theInstrumentableNode.findProbe()method. - GR-32682 Added detection of boxing overloads to support state sharing and better boxing elimination. See
Specialization#rewriteOnfor details.TruffleSafepoint#poll(Node)does not require a non-null location anymore. However, it is still recommended to always pass a location node, if available.
- GR-57838 Added
InternalResource#unpackResourceFiles(Path, Path, Path, Predicate)to allow filtering of resources to unpack.
- GR-43839 Added optional parameter to TruffleString.ByteIndexOfCodePointSetNode to choose whether the node may calculate the input string's precise code range.
- GR-51253 Extend allowed DynamicObject shape flags from 8 to 16 bits.
- GR-42882 Changed behavior: Java host interop no longer exposes bridge methods.
- GR-51385 Added an instrumentation filter to include available source sections only:
SourceSectionFilter.Builder#sourceSectionAvailableOnly(boolean) - GR-51385 Added a debugger filter to suspend in available source sections only:
SuspensionFilter.Builder#sourceSectionAvailableOnly(boolean). - GR-52443 Removed many deprecated
DynamicObjectAPIs, deprecated since 22.2 or earlier (Shapemethods:addProperty,defineProperty,removeProperty,replaceProperty,newInstance,createFactory,getObjectType,changeType,getLayout,getMutex,getParent,allocator, and related interfaces;Property.set*,*Locationmethods:getInternal,setInternal,set*,getType, andObjectLocation). - GR-51136 Uninitialized static slots of a
Framecan now be read, and returns the default value for the access kind. - GR-38322 Added
--engine.TraceMissingSafepointPollInterval=Nto show Java stacktraces when there are missingTruffleSafepoint.poll()calls. - GR-52644 Deprecated
TruffleLanguage.Registration.needsAllEncodings, no longer needs to be declared. It is sufficient for a language module to requireorg.graalvm.shadowed.jcodingsto enable all string encodings. - GR-51172 Add
CompilerDirectives.ensureAllocatedHereto mark an allocation as non-movable. This allows language developers to mark special allocations as non-optimizable to allow better control for allocations potentially throwing OutOfMemoryErrors. - GR-52799
DebuggerSession.suspend(Thread thread)now preserves ongoing stepping strategies. - GR-52799 Added
SuspendedEvent.isStep(),SuspendedEvent.isUnwind()andSuspendedEvent.isBreakpointHit()to allow debugger backends or languages to query reasons for the suspension. - GR-28103 Deprecated
com.oracle.truffle.api.utilities.JSONHelperas it is untested, and in its current state does not contain any special logic for dumping AST. JSON printing of AST nodes should be delegated to an external library if necessary. This class will be removed in a future version. - GR-54085 Added
MathUtilsAPI providing additional mathematical functions useful for language implementations, namely:asinh,acosh, andatanh. - GR-49484 Added
TruffleStackFrameElement.getBytecodeIndex()to access bytecode indices of a stack frame. Bytecode based languages should consider implementingRootNode#findBytecodeIndex(Node, Frame)to resolve the bytecode index. - GR-49484 Deprecated
RootNode.isCaptureFramesForTrace(). Implementers should useRootNode.isCaptureFramesForTrace(boolean)instead. - GR-28866 Added
TruffleLanguage.Env.getScopePublic(LanguageInfo)andTruffleLanguage.Env.getScopeInternal(LanguageInfo)to allow languages direct access to other language scopes to implement new polyglot builtins. - GR-28866 Deprecated
TruffleLanguage.Env.isPolyglotEvalAllowed(). Replace usages withTruffleLanguage.Env.isPolyglotEvalAllowed(LanguageInfo). Please see javadoc for the updated usage. - GR-52843 Deprecated
Node.getCost()and the associatedNodeCostclass without replacement. Truffle DSL no longer generates implementations of this method automatically and will therefore always returnNodeCost.MONOMORPHICby default. This is intended to reduce the binary footprint. - GR-52843 Added the
UnadoptableNodeinterface. This is interface should be preferred to overridingNode.isAdoptable()if the result is statically known. - GR-40931 Virtual threads with a polyglot context are now experimentally supported on HotSpot. Experimental because access to caller frames in write or materialize mode is not yet supported.
- GR-40931 Using virtual threads in a native-image will now emulate virtual threads using platform threads until Loom support for Truffle languages in native-image is implemented.
- GR-40931 Added
TruffleThreadBuilder#virtual()for languages to create virtual threads. - GR-53454 Added warning in the annotation processor when
@ReportPolymorphismis used incorrectly. - GR-54516 The
Futurereturned by submittingThreadLocalActionnow throwsCancellationExceptiononFuture#get()when the future is cancelled, as it should perFutureinterface semantics. - GR-54516 Synchronous
ThreadLocalActions which wait longer than--engine.SynchronousThreadLocalActionMaxWait(default 60) seconds for all threads to start executing that action now show a warning and are automatically cancelled to prevent applications to hang. - GR-49484 Deprecated
RootNode.isCaptureFramesForTrace(). Implementers should useRootNode.isCaptureFramesForTrace(Node)instead. - GR-52145 Added
InstrumentableNode#findProbeandInstrumentableNode.createProbeto allow customization of probe storage, e.g. eager insertion of probes without wrappers.
- GR-45863 Yield and resume events added to the instrumentation:
ExecutionEventListener.onYield()andExecutionEventNode.onYield()is invoked on a yield of the current threadExecutionEventListener.onResume()andExecutionEventNode.onResume()is invoked on a resume of the execution on the current thread after a yieldProbeNode.onYield()andProbeNode.onResume()GenerateWrapperhas newyieldExceptions()andresumeMethodPrefix()parameters to automatically call the newonYield()/onResume()methods from wrapper nodes.RootNode.isSameFrame()andTruffleInstrument.Env.isSameFrame()added to test if two frames are the same, to match the yielded and resumed execution.
- GR-45863 Adopted onYield() and onResume() instrumentation events in the debugger stepping logic.
- [GR-21361] Remove support for legacy
<language-id>.homesystem property. Onlyorg.graalvm.language.<language-id>.homewill be used. - GR-41302 Added the
--engine.AssertProbesoption, which asserts that enter and return are always called in pairs on ProbeNode, verifies correct behavior of wrapper nodes. Java asserts need to be turned on for this option to have an effect. - GR-48816 Added new interpreted performance warning to Truffle DSL.
- GR-44706 Relaxed
InteropLibraryinvariant assertions for side-effecting members (i.e.hasMemberReadSideEffectsorhasMemberWriteSideEffects) forreadMember,invokeMember,writeMember, andremoveMember, allowing them to succeed even ifisMemberReadable,isMemberInvocable,isMemberWritable, andisMemberRemovable, respectively, returnedfalsefor that member. This avoids spurious assertion failures for accessor and proxy members. - GR-49386 Added
InteropLibrary#readBuffer(long, byte[], int, int)to enable bulk reads of buffers into byte arrays. - [GR-50262] Added the system property
-Dtruffle.UseFallbackRuntime=true. This property is preferred over the usage of-Dtruffle.TruffleRuntime=com.oracle.truffle.api.impl.DefaultTruffleRuntime.
- GR-45123 Added
GenerateInline#inlineByDefaultto force usage of inlined node variant even when the node has also a cached variant (@GenerateCached(true)). - GR-45036 Improved IGV IR dumping. Dump folders for Truffle now include the compilation tier to differentiate compilations better. Inlined IR graphs are now additionally dumped in separate folders if dump level is >= 2.
- GR-45036 Improved IGV AST dumping. The Truffle AST is now dumped as part of the IR dump folder. The dumped AST tree now shows all inlined ASTS in a single tree. Individual functions can be grouped using the "Cluster nodes" function in IGV (top status bar). Root nodes now display their name e.g.
SLFunctionBody (root add). Every AST node now has a propertygraalIRNodethat allows to find the corresponding Graal IR constant if there is one. - GR-45284 Added Graal debug options
TruffleTrustedNonNullCastandTruffleTrustedTypeCastthat allow disabling trusted non-null and type casts in Truffle, respectively. Note that disabling trusted type casts effectively disables non-null casts, too. - GR-44211 Added
TruffleLanguage.Env#newTruffleThreadBuilder(Runnable)to create a builder for threads that have access to the appropriateTruffleContext. All existingTruffleLanguage.Env#createThreadmethods have been deprecated. On top of what the deprecated methods provided, the builder now allows to specifybeforeEnterandafterLeavecallbacks for the created threads. - GR-44211 Added
TruffleContext#leaveAndEnter(Node, Interrupter, InterruptibleFunction, Object)to be able to interrupt the function run when the context is not entered. The existing APITruffleContext#leaveAndEnter(Node, Supplier)is deprecated. - GR-44211 Removed the deprecated method
TruffleSafepoint#setBlocked(Node, Interrupter, Interruptible, Object, Runnable, Runnable). - GR-44211 Added
TruffleSafepoint#setBlocked(Node, Interrupter, Interruptible, Object, Runnable, Consumer). It replaces the methodTruffleSafepoint#setBlockedWithException(Node, Interrupter, Interruptible, Object, Runnable, Consumer)that is now deprecated. - GR-44211 Added
TruffleSafepoint#setBlockedFunction(Node, Interrupter, InterruptibleFunction, Object, Runnable, Consumer)to be able to return an object from the interruptible functional method. - GR-44211 Added
TruffleSafepoint#setBlockedThreadInterruptibleFunction(Node, InterruptibleFunction, Object)as a short-cut method to allow setting the blocked status for methods that throwInterruptedExceptionand support interrupting usingThread#interrupt(). - GR-44829 TruffleStrings: added specialized TruffleStringBuilder types for better performance on UTF encodings.
- GR-46146 Added
TruffleLanguage#ContextLocalProviderandTruffleInstrument#ContextLocalProvider, and deprecatedTruffleLanguage.createContextLocal,TruffleLanguage.createContextThreadLocal,TruffleInstrument.createContextLocalandTruffleInstrument.createContextThreadLocal. Starting with JDK 21, the deprecated methods trigger the new this-escape warning. The replacement API avoids the warning. - GR-44217 In the past, on a GraalVM JDK, languages or instruments could be provided using
-Dtruffle.class.path.append, but are now loaded from the application module path. The truffle class path is deprecated and should no longer be used, but remains functional. Languages are not picked up from the application class path, so the language first needs to be migrated. Truffle languages or instruments installed as a GraalVM component in the GraalVM JDK are still loaded in an unnamed module. However, GraalVM components will be deprecated, so languages and instruments should be migrated to the module path. - GR-46181
truffle-tck.jaris not included in GraalVM artifacts anymore. It is still available via Maven. - GR-46181
truffle-dsl-processor.jaris not included in GraalVM artifacts anymore. It is still available via Maven. - GR-44222 Deprecated several experimental engine options and moved them to use the
compilerprefix instead of theengineprefix. You can search for these options with this regexp:git grep -P '\bengine\.(EncodedGraphCache|ExcludeAssertions|FirstTierInliningPolicy|FirstTierUseEconomy|InlineAcrossTruffleBoundary|InlineOnly|Inlining|InliningExpansionBudget|InliningInliningBudget|InliningPolicy|InliningRecursionDepth|InliningUseSize|InstrumentBoundaries|InstrumentBoundariesPerInlineSite|InstrumentBranches|InstrumentBranchesPerInlineSite|InstrumentFilter|InstrumentationTableSize|IterativePartialEscape|MaximumGraalGraphSize|MethodExpansionStatistics|NodeExpansionStatistics|NodeSourcePositions|ParsePEGraphsWithAssumptions|TraceInlining|TraceInliningDetails|TraceMethodExpansion|TraceNodeExpansion|TracePerformanceWarnings|TraceStackTraceLimit|TreatPerformanceWarningsAsErrors)\b'. - GR-44222 The following deprecated debugging options were removed in this release:
engine.InvalidationReprofileCount: The option no longer has any effect. Remove the usage to migrate.engine.ReplaceReprofileCount: The option no longer has any effect. Remove the usage to migrate.engine.PerformanceWarningsAreFatal: Useengine.CompilationFailureAction=ExitVMandcompiler.TreatPerformanceWarningsAsErrors=<PerformanceWarningKinds>instead.engine.PrintExpansionHistogram: Superseded byengine.TraceMethodExpansion.engine.ForceFrameLivenessAnalysis: The option no longer has any effect. Remove the usage to migrate.engine.CompilationExceptionsArePrinted: Useengine.CompilationFailureAction=Printinstead.engine.CompilationExceptionsAreThrown: Useengine.CompilationFailureAction=Throwinstead.engine.CompilationExceptionsAreFatal: Useengine.CompilationFailureAction=ExitVMinstead.
- GR-44420 Added
TruffleLanguage.finalizeThread(Object, Thread)to allow languages run finalization hooks for initialized threads before the context is disposed. - GR-45923 Added
EventBinding.tryAttach()to try to attach a binding, if not disposed or attached already. - GR-20628 Added atomic byte-array operations to
ByteArraySupportand subclasses. - GR-39571 Added
TranscodingErrorHandlertoTruffleString.SwitchEncodingNode. - GR-46345 Added a support for the lazy unpacking of language and instrument resources necessary for execution. This support replaces the concept of language homes for Maven language and tool deployment. For a language or instrument that requires additional files to execute, it needs to follow these steps:
- Bundle the necessary files into a jar distribution.
- Implement the
InternalResourceinterface for handling the resource file unpacking. - Call the
Env#getInternalResourcewhen the language or instrument needs the bundled resource files. This method ensures that the requestedInternalResourceis unpacked and provides a directory containing the unpacked files. Since unpacking internal resources can be an expensive operation, the implementation ensures that internal resources are cached.
- GR-44464 Added
TruffleString.ToValidStringNodefor encoding-level string sanitization.
-
GR-38526 Added
TruffleLanguage.Env#isSocketIOAllowed(). The method returns true if access to network sockets is allowed. -
GR-41634 Added
TruffleLanguage.Env#isFileIOAllowed(). The method returns true if access to files is allowed. -
Deprecated
TruffleLanguage.Env#isIOAllowed(). To migrate, useTruffleLanguage.Env#isFileIOAllowed(). -
GR-41408 Added
Version.format(String), to support formatting the version using a custom format string, e.g. for use in URLs. -
GR-41408 Added
${graalvm-version}and${graalvm-website-version}substitutions for thewebsiteproperty of language and instrument registrations. -
GR-41034 Added
TruffleInstrument.Env.getTruffleFile(TruffleContext, ...)methods to allow reading a truffle file from a specific context without being entered. DeprecatedTruffleInstrument.Env.getTruffleFile(...)methods that do not take theTruffleContext. -
GR-42271 Native image build verifies that the context pre-initialization does not introduce absolute TruffleFiles into the image heap. The check can be disabled using the
-H:-TruffleCheckPreinitializedFilesnative image option. -
GR-41369 The icu4j language initializes charsets while building the native image. Languages depending on the icu4j language can no longer use
--initialize-at-run-time=com.ibm.icu. -
GR-40274 TruffleStrings: added AsNativeNode and GetStringCompactionLevelNode.
-
GR-39189 Added attach methods on the
Instrumenterclass, that takeNearestSectionFilteras a parameter. The newNearestSectionFilterclass can be used to instrument or detect nearest locations to a given source line and column. For example, this can be used to implement breakpoints, where the exact line or column is not always precise and the location needs to be updated when new code is loaded. -
GR-39189 Added
InstrumentableNode.findNearestNodeAt(int line, int column, ...)to find the nearest node to the given source line and column. This is an alternative to the existing method that takes character offset. -
GR-42674 It has been documented that methods
TruffleLanguage.Env#getPublicTruffleFile,TruffleLanguage.Env#getInternalTruffleFile,TruffleLanguage.Env#getTruffleFileInternalandTruffleInstrument.Env#getPublicTruffleFilecan throwIllegalArgumentExceptionwhen the path string cannot be converted to aPathor uri preconditions required by theFileSystemdo not hold. -
GR-31342 Implemented several new features for Truffle DSL and improved its performance:
- Added an
@GenerateInlineannotation that allows Truffle nodes to be object-inlined automatically. Object-inlined Truffle nodes become singletons and therefore reduce memory footprint. Please see the tutorial for further details. - Added an
@GenerateCachedannotation that allows users to control the generation of cached nodes. Use@GenerateCached(false)to disable cached node generation when all usages of nodes are object-inlined to save code footprint. - Updated Truffle DSL nodes no longer require the node lock during specialization, resulting in improved first execution performance. CAS-style inline cache updates are now used to avoid deadlocks when calling CallTarget.call(...) in guards. Inline caches continue to guarantee no duplicate values and are not affected by race conditions. Language implementations should be aware that the reduced contention may reveal other thread-safety issues in the language.
- Improved Truffle DSL node memory footprint by merging generated fields for state and exclude bit sets and improving specialization data class generation to consider activation probability. Specializations should be ordered by activation probability for optimal results.
- Improved memory footprint by automatically inlining cached parameter values of enum types into the state bitset
- Added
@Cached(neverDefault=true|false)option to indicate whether the cache initializer will ever return anullor primitive default value. Truffle DSL now emits a warning if it is beneficial to set this property. Alternatively, the new@NeverDefaultannotation may be used on the bound method or variable. The generated code layout can benefit from this information and reduce memory overhead. If never default is set totrue, then the DSL will now use the default value instead internally as a marker for uninitialized values. @Sharedcached values may now use primitive values. Also,@Sharedcan now be used for caches contained in specializations with multiple instances. This means that the shared cache will be used across all instances of a specialization.- Truffle DSL now generates many more Javadoc comments in the generated code that try to explain the decisions of the code generator.
- Added inlined variants for all Truffle profiles in
com.oracle.truffle.api.profiles. The DSL now emits recommendation warnings when inlined profiles should be used instead of the allocated ones. - Truffle DSL now emits many more warnings for recommendations. For example, it emits warnings for inlining opportunities, cached sharing or when a cache initializer should be designated as
@NeverDefault. To ease migration work, we added several new ways to suppress the warnings temporarily for a Java package. For a list of possible warnings and further usage instructions, see the new warnings page in the docs. - The DSL now produces warnings for specializations with multiple instances but an unspecified limit. The new warning can be resolved by specifying the desired limit (previously, default
"3"was assumed) - Added the capability to unroll specializations with multiple instances. Unrolling in combination with node object inlining may further reduce the memory footprint of a Truffle node. In particular, if all cached states can be encoded into the state bit set of the generated node. See
@Specialization(...unroll=2)for further details
- Added an
-
GR-31342 Deprecated
ConditionProfile.createBinaryProfile()andConditionProfile.createCountingProfile(). UseConditionProfile.create()andCountingConditionProfile.create()instead. -
GR-31342 Added
ValueProfile.create()that automatically creates an exact class value profile. This allows its usage in@Cachedwithout specifying a cached initializer. -
GR-31342 The node
insertmethod is now public instead of protected. This avoids the need to create cumbersome accessor methods when needed in corner-cases. -
GR-43599 Specifying the sharing group in
@Sharedis now optional for cached values. If not specified, the parameter name will be used as sharing group. For example,@Shared @Cached MyNode sharedNodewill get the sharing groupsharedNodeassigned. It is recommended to use the explicit sharing group still if it improves readability or if the parameter name cannot be changed. -
GR-43492
LanguageReference#get()is now always supported inside ofInstrumentableNode#materializeInstrumentableNodes(). -
GR-43944 Added
HostCompilerDirectives.inInterpreterFastPath()which allows to mark branches that should only be executed in the interpreter, but also optimized like fast-path code in the host compiler. -
GR-25539 Added
InteropLibrary#fitsInBigInteger()andInteropLibrary#asBigInteger()to access interop values that fit intojava.math.BigIntegerwithout loss of precision. A warning is produced for objects that export theisNumberinterop message and don't export the new big integer messages. -
GR-25539 Added
DebugValue#fitsInBigInteger()andDebugValue#asBigInteger(). -
GR-25539 Added
GenerateLibrary.Abstract#ifExportedAsWarning()to specify a library message to be abstract only if another message is exported. A warning is produced that prompts the user to export the message. -
GR-43903 Usages of
@Specialization(assumptions=...)that reach a@Fallbackspecialization now produce a suppressible warning. In most situations, such specializations should be migrated to use a regular guard instead. For example, instead of using@Specialization(assumptions = "assumption")you might need to be using@Specialization(guards = "assumption.isValid()"). -
GR-43903 Added
@Idempotentand@NonIdempotentDSL annotations useful for DSL guard optimizations. Guards that only bind idempotent methods and no dynamic values can always be assumedtrueafter they weretrueonce on the slow-path. The generated code leverages this information and asserts instead of executes the guard on the fast-path. The DSL now emits warnings with for all guards where specifying the annotations may be beneficial. Note that all guards that do not bind dynamic values are assumed idempotent by default for compatibility reasons. -
GR-43663 Added RootNode#computeSize as a way for languages to specify an approximate size of a RootNode when number of AST nodes cannot be used (e.g. for bytecode interpreters).
-
GR-42539 (change of behavior) Unclosed polyglot engines are no longer closed automatically on VM shutdown. They just die with the VM. As a result,
TruffleInstrument#onDisposeis not called for active instruments on unclosed engines in the event of VM shutdown. In case an instrument is supposed to do some specific action before its disposal, e.g. print some kind of summary, it should be done inTruffleInstrument#onFinalize. -
GR-42961 Added
TruffleString.ByteIndexOfCodePointSetNode, which allows fast searching for a given set of codepoints. -
GR-42961 Added
TruffleString.GetCodeRangeImpreciseNode, which allows querying the currently known code range without triggering a string scan. -
GR-42961
TruffleString.FromJavaStringNodeno longer eagerly scans strings for their code range. To still get eager scanning of constant strings, usefromConstant(String). -
GR-30473 Added support for sandbox policies. By default, languages and instruments support just the
TRUSTEDsandbox policy.- If a language wants to target a more restrictive sandbox policy, it must:
- Specify the most strict sandbox policy it satisfies using
TruffleLanguage.Registration#sandbox(). - For each option, the language must specify the most restrictive sandbox policy in which the option can be used via
Option#sandbox(). By default, options have aTRUSTEDsandbox policy. - If a language needs additional validation, it can use
TruffleLanguage.Env#getSandboxPolicy()to obtain the current context sandbox policy.
- Specify the most strict sandbox policy it satisfies using
- If an instrument wants to target a more restrictive sandbox policy, it must:
- Specify the most strict sandbox policy it satisfies using
TruffleInstrument.Registration#sandbox(). - For each option, the instrument must specify the most restrictive sandbox policy in which the option can be used via
Option#sandbox(). By default, options have aTRUSTEDsandbox policy. - If an instrument needs additional validation, it can use
TruffleInstrument.Env#getSandboxPolicy()to obtain the engine's sandbox policy.
- Specify the most strict sandbox policy it satisfies using
- Added
TruffleOptionDescriptorsextendingOptionDescriptorsby the ability to provide the option'sSandboxPolicy.
- If a language wants to target a more restrictive sandbox policy, it must:
-
GR-43818 Library messages annotated with
@Deprecatednow emit a warning when they are exported. It is now possible to overload a message method by adding, removing a parameter or making the parameter type more generic. Also addedMessage.isDeprecated()to find out whether a message was deprecated at runtime. -
GR-44053 (change of behavior) The default implementation of
InteropLibrary.getExceptionStackTrace()will now include host stack trace elements if public host access is allowed. -
GR-44053 (change of behavior) Truffle stack trace information is now attached to host and internal exceptions via suppressed exceptions. The cause of an exception is never modified anymore.
-
GR-44053 (change of behavior) A
StackOverflowErrororOutOfMemoryErrorcrossing a Truffle call boundary will not be injected guest stack trace information anymore. -
GR-44723
Truffle.getRuntime().getName()and consequentlyEngine.getImplementationName()have been adjusted to return "Oracle GraalVM" instead of "GraalVM EE". -
GR-44211 Added
TruffleLanguage.Env#newTruffleThreadBuilder(Runnable)to create a builder for threads that have access to the appropriateTruffleContext. All existingTruffleLanguage.Env#createThreadmethods have been deprecated. On top of what the deprecated methods provide, the builder allows specifyingbeforeEnterandafterLeavecallbacks for the created threads. -
GR-44211 Added
TruffleLanguage.Env#newTruffleThreadBuilder(Runnable)to create a builder for threads that have access to the appropriateTruffleContext. All existingTruffleLanguage.Env#createThreadmethods have been deprecated. On top of what the deprecated methods provided, the builder now allows to specifybeforeEnterandafterLeavecallbacks for the created threads.
- GR-40069 Added additional methods to the static frame API.
- Added
copyStaticto copy a static slot in cases where the underlying type is not known. - Added
clearStaticto clear a static slot in cases where the underlying type is not known. - Added
swap...Staticto swap slots of known (primitive or object) or unknown underlying type.
- Added
- GR-40103 Potentially breaking: Static frame access is now validated when assertions are enabled. Reading a slot with a different type than written to leads to an
AssertionError. - GR-40163 Deprecated
TruffleLanguage.Env.newContextBuilder()and replaced it with a new methodTruffleLanguage.Env.newInnerContextBuilder(String...). The new method does no longer inherit all privileges from the parent context and does no longer initialize the creator context by default. The new method also allows to set the permitted languages for the inner context similarly as in the polyglot embedding API. - GR-40163 Changed behavior: Inner contexts do no longer inherit application arguments from the outer context. It is now possible to set application arguments explicitly for inner contexts using
TruffleContext.Builder.arguments(String, String[]). - GR-40163 Changed behavior: Inner contexts do no longer use system exit on exit even if the polyglot embedder specified it with
Context.Builder.useSystemExit(boolean)for the outer context. - GR-40163 Added new capabilities to
TruffleContext:- Added
TruffleContext.Builder.out(OutputStream),TruffleContext.Builder.err(OutputStream)andTruffleContext.Builder.in(InputStream)to customize streams for inner contexts. - GR-35358 Added
TruffleContext.Builder.forceSharing(Boolean)to force or deny code sharing for inner contexts. - GR-36927 Added
TruffleContext.Builder.option(String, String)to override language options for inner contexts. This is currently only supported if all access privileges have been granted by the embedder. - Added
TruffleContext.Builder.inheritAllAccess(boolean)which allows to enable access privilege inheritance from the outer context. By default this flag isfalse. - Access privileges can now be individually granted or denied. Note that an inner context still cannot use any of the privileges that have not been granted to the outer context. For example, if the outer context has no access to IO then the inner context won't have access to IO even if the privilege is set for the inner context. The following new methods were added to configure privileges for inner contexts:
TruffleContext.Builder.allowCreateThreads(boolean)TruffleContext.Builder.allowNativeAccess(boolean)TruffleContext.Builder.allowIO(boolean)TruffleContext.Builder.allowHostClassLoading(boolean)TruffleContext.Builder.allowHostLookup(boolean)TruffleContext.Builder.allowCreateProcess(boolean)TruffleContext.Builder.allowPolyglotAccess(boolean)TruffleContext.Builder.allowInheritEnvironmentAccess(boolean)TruffleContext.Builder.allowInnerContextOptions(boolean)
- Added
- GR-40163 Added
TruffleContext.initializePublic(Node, String)andTruffleContext.initializeInternal(Node, String)to initialize a public or internal language of an inner context. - GR-39354 TruffleStrings: added ErrorHandling parameter to CreateForwardIteratorNode and CreateBackwardIteratorNode.
- GR-40062
String.indexOfmethods are no longer considered PE safe and using them will now fail the native-image block list check. UseTruffleStringinstead or put them behind a@TruffleBoundary. - GR-39354 TruffleStrings: added ErrorHandling parameter to ByteLengthOfCodePointNode, CodePointAtIndexNode and CodePointAtByteIndexNode.
- GR-39219 Removed several deprecated APIs:
- Removed deprecated
FrameSlotAPI. The API was deprecated in 22.0. - Removed deprecated
CompilerOptionsAPI. The API was deprecated in 22.1. - Removed deprecated
TruffleRuntime.createCallTargetandRootNode.setCallTargetAPI. The API was deprecated in 22.0. - Removed deprecated
TruffleContext.enterandTruffleContext.leaveAPI. The API was deprecated in 20.3. - Removed deprecated
MemoryFenceAPI. The API was deprecated in 22.1. - Removed deprecated
TruffleRuntime.getCallerFrameandTruffleRuntime.getCurrentFrameAPI. The API was deprecated in 22.1. - Removed deprecated
@CachedContextand@CachedLibraryAPI. The API was deprecated in 21.3. - Removed deprecated
get()method fromLanguageContextandContextReferenceAPI. The API was deprecated in 21.3. - Removed deprecated equality
ValueProfile. The API was deprecated in 21.2. - Removed deprecated
UnionAssumption,AlwaysValidAssumptionandNeverValidAssumption. The API was deprecated in 22.1.
- Removed deprecated
- GR-35797 The SnippetRun#getException() now provides an
IllegalArgumentExceptionthrown during the snippet execution. TheIllegalArgumentExceptionis converted to aPolyglotExceptionbefore it is returned. - Added the
@HostCompilerDirectives.InliningCutoffannotation that allows to manually tune inlining decisions for host inlining. - Tuned host inlining heuristic for reduced code size. A new host inlining tuning guide is available in the docs
- GR-35007 (EE-only) The Truffle sandboxing CPU time limits (
sandbox.MaxCPUTime) are also supported on the native image. - GR-24927 The Truffle annotation processor now emits an error for methods annotated by a
@TruffleBoundaryannotation and aFrameparameter. Previously, the processor only reported an error forVirtualFrameparameters. To resolve this, either change the parameter to aMaterializedFrame, remove the parameter or remove the@TruffleBoundary. - GR-24927 Truffle DSL now automatically materalizes frames when a
Frameparameter is used in an uncached instance of a@Specialization. For example, if it rewrites itself to an uncached version due to the usage of a@CachedLibrary. - GR-35007 (EE-only) The Truffle sandboxing CPU time limits (
sandbox.MaxCPUTime) are also supported on the native image. - GR-28705 Added
TruffleInstrument.Env#createSystemThreadto create a new thread designed to process instrument tasks in the background. - GR-28705 Added
TruffleLanguage.Env#createSystemThreadto create a new thread designed to process language internal tasks in the background. - GR-31304
Debugger.disableStepping()andDebugger.restoreStepping()added to disable/restore stepping on a dedicated thread on a specific code path. - GR-39415 Experimental options are on by default in the TCK test Context. Added
LanguageProviders.additionalOptions()which allows TCK providers to set their language's options in the test context (Attempts to set other languages' options will result in anIllegalArgumentExceptionwhile creation the context). - GR-38163 Introduced RootNode.getParentFrameDescriptor to support identifying lexical scope parents of hot methods and compiling them earlier.
- GR-33829 Added support on libgraal for caching encoded graphs across Truffle compilations to speedup partial evaluation. The cache is enabled by default and can be enabled/disabled with the
--engine.EncodedGraphCacheoption. - GR-38925 Added
InteropLibrary.hasMetaParents(Object)andInteropLibrary.getMetaParents(Object)that allow lookup of the hierarchy of parents for meta objects (e.g. super class or implemented interface of Java classes). - GR-36557 Deprecated
--engine.MaximumGraalNodeCountand introduced--engine.MaximumGraalGraphSizeto control the maximum graal graph size during partial evaluation. - GR-37493 Added
@DenyReplaceto deny replacement of final node types. - GR-37493 Potentially breaking: Disabled replace of all Truffle DSL generated uncached nodes. If you call
Node.replace()on an uncached version of a generated node or library it will now fail with anIllegalArgumentException. As a rule of thumb, uncached versions of nodes should not ever be stored in@Childfields. Instead, they should always be used as singletons. - GR-37493 Removed long time deprecated API
NodeFieldAccessorwithout replacement. Added a some utility methods inNodeUtilas a replacement for this API:NodeUtil.collectFieldNames(Class),NodeUtil.collectNodeChildren(Node)andNodeUtil.collectNodeProperties(Node). - GR-37100 Deprecated
BytecodeOSRNode.copyIntoOSRFrame(VirtualFrame, VirtualFrame, int), in favor ofBytecodeOSRNode.copyIntoOSRFrame(VirtualFrame, VirtualFrame, int, Object). - GR-36944 Added new static APIs to
com.oracle.truffle.api.frame.Frame:- Added new
Staticoption tocom.oracle.truffle.api.frame.FrameSlotKindfor index-based slots. Frame slots using this kind cannot be changed to another kind later on. Static frame slots can only hold either a primitive or anObjectvalue, never both at the same time. - Added new
get.../set...methods postfixed byStaticfor exclusively accessing static frame slots. - Added new
copy.../clear...methods postfixed byStaticfor exclusively copying and clearing static frame slots. - Static frame slots are intended for situations where the type of a variable in a frame slots is known ahead of time and does not need any type checks (e.g. in statically typed languages).
- Added new
- GR-36557 Introduced
--engine.InliningUseSizewhich changes the code size approximation during inlining to an approximation of the size of the graph rather than just the node count. This option is false by default. - GR-37310 Add
BytecodeOSRNode.storeParentFrameInArgumentsandBytecodeOSRNode.restoreParentFrameFromArgumentsto give languages more control over how frame arguments in bytecode OSR compilations are created. - GR-35280 Implemented new domain specific inlining phase for Truffle interpreter host compilation.
- In native image hosts the new optimizations is applied to all methods annotated with
@BytecodeInterpreterSwitchand methods which were detected to be used for runtime compilation. - On HotSpot hosts the new optimizations will be applied to methods annotated with
@BytecodeInterpreterSwitchonly. - The annotation
@BytecodeInterpreterSwitchBoundarywas deprecated. Boundaries for the compilation are now inferred from directives likeCompilerDirective.transferToInterpreter()and@TruffleBoundaryautomatically. - See the HostOptimization.md for further details.
- In native image hosts the new optimizations is applied to all methods annotated with
- GR-38387 Deterministic and declaration order of
InteropLibrary.getMembers()is now required. - GR-38110 Added option to use
longvalues as offsets for accessing memory throughByteArraySupport. - GR-39029 Fixed issue in
InteropLibrarythat requiredasDateto be implemented wheneverisTimeis exported; correct dependency is onisDate. - GR-38945 Truffle IGV dumping with log level 5 (e.g.
-Dgraal.Dump=Truffle:5) now dumps the graph after each method that was fully partially evaluated. This enables debugging of problems only visible during partial evaluation. - GR-34894 Removed deprecated
DynamicObjectAPIs:Shape:getKeyList(Pred),getPropertyList(Pred),Pred,getObjectType,getId,isRelated,createSeparateShape,append,reservePrimitiveExtensionArray,hasTransitionWithKeyDynamicObject: all deprecated constructors and methods (get,set,contains,define,delete,size,isEmpty,setShapeAndGrow,setShapeAndResize,updateShape,copy)ShapeListenerTypedLocationLayout.newInstance,Layout.createShapeProperty:copyWithRelocatable,copyWithFlags,isSame,relocate,set,setInternal,setGeneric.IncompatibleLocationException,FinalLocationExceptionconstructors
- GR-34894 Deprecated legacy and low-level
DynamicObjectAPIs:Shape:Allocator,allocator,createFactory,newInstance,defineProperty,addProperty,changeType,getMutexObjectLocation,BooleanLocation,DoubleLocation,IntLocation,LongLocationLocation:canSet,set,setInternal,get,getInternal,incompatibleLocation,finalLocationProperty:create,get,set,setSafe,setGeneric.ObjectTypeDynamicObjectFactory,LocationModifier,LocationFactory,LayoutFactoryIncompatibleLocationException,FinalLocationException
- GR-34894 Introduced
Location.isPrimitive(),Location.getConstantValue(), andShape.makePropertyGetter(Object). - GR-39058 The Static Object Model offers preliminary support for field-based storage also on Native Image.
- GR-35924 Context preinitialization in combination with auxiliary engine caching now preinitializes a context for each sharing layer with the common configuration of previously created contexts.
- Added TruffleStrings, a flexible string implementation for all Truffle languages.
- Added a
@GeneratePackagePrivateannotation to change the visibility of generated nodes to package-private even if the template node is public. - Changed the default
Objecttarget type mapping for values that have both array elements and members fromMaptoList. - GR-36425 Truffle DSL assumption expressions are now always executed instead of cached if their return value can be proven a partial evaluation constant. For example, if an assumption is read from a field in the declared node or a
@Cachedparameter then the expression can be always executed instead of being cached. This improves memory footprint of the generated code as no fields for the assumption cache needs to be generated. Language implementations are encouraged to check all usages of@Specialization(assumption=...)and verify whether they can be expressed as a PE constant. Ensure that all fields accessed in the expression are either final or annotated with@CompilationFinaland do not bind any dynamic parameter. Note that the DSL cannot infer PE constantness from method bodies and is therefore limited to field accesses. The resolution works through an arbitrary number of field accesses, e.g. through other Node classes, if they are visible in the expression (e.g.field1.field2.field3). - Added TruffleLanguage.Env#createHostAdapter accepting host symbols and host classes as the types to extend, replacing and deprecating the
java.lang.Class-based version. - GR-10128 Added the
websiteproperty to the TruffleLanguage.Registration and TruffleInstrument.Registration allowing language and instrument developers to specify a URL for a web site with further information about their language/tool. - GR-10128 Added the
usageSyntaxproperty to the Option allowing developers to specify the syntax their option expects. See the javadoc for more information. - Added
TruffleSafepoint.setAllowActionsto disable thread local actions temporarily for trusted internal guest code. Currently only allowed during the finalization of a context inTruffleLanguage.finalizeContext(Object). - Added
FrameDescriptor.getInfo()andFrameDescriptor.Builder.info()to associate a user-defined object with a frame descriptor. - GR-33851 Dropped Java 8 support.
- Deprecated
MemoryFence. Please useVarHandledirectly. - Deprecated
TruffleSafepoint.setBlocked, in favor ofTruffleSafepoint.setBlockedWithException, which allows interception and handling of safepoint-thrown exceptions. - GR-36525 Deprecated
CompilerOptions. They had no effect for several releases already. Deprecated for removal. - GR-22281 Deprecated
TruffleRuntime.getCurrentFrame()andTruffleRuntime.getCallerFrame(). They were encouraging unsafe use of theFrameInstanceclass. Note that aFrameInstanceinstance must not be escaped outside the scope of theFrameInstanceVisitor.visitFramemethod. Language implementers are encouraged to validate all usages ofTruffleRuntime.iterateFrames(...). We plan to enforce this rule in future versions of Truffle. - GR-22281 Added
TruffleRuntime.iterateFrames(FrameInstanceVisitor visitor, int skipFrames)that allows to efficiently skip a number of frames before the visitor is invoked. This was added to allow efficient migration of usages from the deprecatedTruffleRuntime.getCallerFrame()method. - Removed the deprecated
TruffleExceptionthat was deprecated in the GraalVM 20.3.0. TheAbstractTruffleExceptionno longer implementsTruffleException.AbstractTruffleExceptionmethods inherited from theTruffleExceptionhave been removed. As part of this removal, the recommendation for languages how to handle exceptions has been updated. - Added methods to TruffleContext.Builder that allow throwing custom guest exceptions when the new built context is cancelled, hard-exited, or closed and the corresponding exception is about to reach the outer context. In case the customization is not used and the new context is cancelled, hard-exited, or closed, Truffle newly throws an internal error.
- Added TruffleContext.Builder#onCancelled that allows throwing a custom guest exception when the new context is cancelled.
- Added TruffleContext.Builder#onExited that allows throwing a custom guest exception when the new context is hard-exited.
- Added TruffleContext.Builder#onClosed that allows throwing a custom guest exception when the new context is closed.
- GR-35093 Deprecated
UnionAssumption, use arrays of assumptions instead. DeprecatedNeverValidAssumptionandAlwaysValidAssumption, useAssumption.NEVER_VALIDandAssumption.ALWAYS_VALIDinstead. Language implementations should avoid customAssumptionsubclasses, they lead to performance degradation in the interpreter. - GR-35093 Added
create()constructor methods to profiles incom.oracle.truffle.api.profileswhere appropriate to simplify use with Truffle DSL.
-
Truffle DSL generated code now inherits all annotations on constructor parameters to the static create factory method.
-
Added a Message#getId() method returning a unique message id within a library.
-
Added a LibraryFactory#getMessages() method returning a list of messages that the library provides.
-
Changed behavior of
RootNode#getCallTarget()such that it lazily initializes its call target. This enforces a one-to-one relationship between root nodes and call targets, which avoids several problems, for example, with regard to instrumentation. As a consequence,RootNode.setCallTarget()andTruffleRuntime#createCallTarget()are deprecated now. Please useRootNode#getCallTarget()to access the call target of a root node from now on. -
In
TruffleLanguage.finalizeContext(Object), there is a new requirement for leaving all remaining unclosed inner contexts created by the language on all threads where the contexts are still active. No active inner context is allowed afterTruffleLanguage.finalizeContext(Object)returns. Not complying with this requirement will result in an internal error. Please note that inactive inner contexts are still closed implicitly by the parent context. -
Added
TruffleContext.closeExited(Node, int)to hard exit an entered truffle context. See the documentation. -
Added
TruffleLanguage.exitContext(Object, ExitMode, int)to allow languages perform actions before natural/hard context exit. Languages are encouraged to run all their shutdown hooks in exitContext instead of finalizeContext. -
Improved the output format for
engine.TraceCompilationandengine.TraceCompilationDetails. See Optimizing.md for details. -
Extended
HostObjectso that it exposes thelengthfield and theclone()method of Java arrays as interop members. This can be disabled withHostAccess.Builder.allowArrayAccess(false). -
Implicit cast checks are now generated in declaration order where the direct target type is always checked first. Languages implementations are encouraged to optimize their implicit cast declaration order by sorting them starting with the most frequently used type.
-
When using the Static Object Model, storage classes can have precise object field types, not just
java.lang.Object. -
Added
CompilerDirectives.hasNextTier()to allow language implementations to control profiling in intermediate compilation tiers. In particular,LoopNode.reportLoopCount()should also be called in intermediate tiers as part of bytecode interpreters to improve last tier compilation. -
Introduced sharing layers. A sharing layer is a set of language instances that share code within one or more polyglot contexts. In previous versions language instances were shared individually whenever a new language context was created. Instead language instances are now reused for a new context if and only if the entire layer can be shared. A layer can be shared if all initialized languages of a layer support the same context policy and their options are compatible. Please note the following changes on observable language behavior:
- For any executed Truffle node it can now be assumed that the current language instance will remain constant. This means that the language instance can always be safely stored in the AST even for nodes that are used through the interoperability protocol by other languages. It is still recommend to not store language instances in AST nodes, but use LanguageReferences instead to avoid additional memory footprint.
- The method LanguageReference.get(Node), if called with an adopted and compilation final node, is now guaranteed to fold to a constant value during compilation.
- TruffleLanguage.initializeMultipleContexts() is now guaranteed to be called prior to all created contexts of the same language instance. For existing languages this means that any assumption invalidated during initialization of multiple contexts can now become a regular boolean field. This should simplify language implementations as they no longer need to be able to change sharing mode after call targets were already loaded.
- Language initialization will now fail if new language context is initialized and the language is incompatible to the sharing layer of the current context. For example, if sharing is enabled with a shared language already initialized, any new language with unsupported sharing will now fail to initialize. The recommended solution is to specify all required languages when creating the context in
Context.newBuilder(String...). - The method
TruffleLanguage.areOptionsCompatible(OptionValues, OptionValues)is now also called before the initialization of the first context of a language if sharing is enabled. This allows languages to enable/disable sharing based on a language specific option, and not just statically. - Language instances are no longer shared for inner contexts if sharing is not enabled for a context, even if the language instance would support sharing in principle. This change was necessary to avoid the need to initialize sharing after the first context was created.
- More information on code sharing can be found in the javadoc.
-
Added the
--engine.TraceCodeSharingoption that allows to log debug information on code sharing. -
Added the
--engine.ForceCodeSharingand--engine.DisableCodeSharingoption that allows to force enable and force disable code sharing. This option is useful for testing to enable or disable sharing across all contexts of a process. -
Removed deprecated in
ArityException. -
Removed deprecated methods in
ArityException. -
Removed deprecated object DSL processor that was deprecated for several releases.
-
Removed deprecated encapsulating node accessor methods in
NodeUtil. -
Removed deprecated method
LoopNode.executeLoop. -
Removed many deprecated methods in
TruffleLanguage,TruffleLanguage.EnvandTruffleInstrument.Env. All of which were already deprecated for at least four releases. -
Removed deprecated
GraphPrintVisitor. -
Added new APIs to
com.oracle.truffle.api.frame.Frameandcom.oracle.truffle.api.frame.FrameDescriptor:- Added a new "namespace" of index-based slots in
Framethat is defined during construction of the frame descriptor and cannot be changed afterwards, and that is accessed usingintindexes instead ofFrameSlots. - Added a second new "namespace" of slots (called auxiliary slots) in
Framethat can be added to the frame descriptor dynamically (and which only supports "object" slots). - In addition to
get.../set...methods, the new API also supportscopyandswapof frame slots. - The
FrameSlot-based API methods inFrameandFrameDescriptorwere deprecated. FrameSlotTypeExceptionis now an unchecked exception, which simplifies many APIs and removes the need for theFrameUtilclass.
- Added a new "namespace" of index-based slots in
-
Changes to the way frame slots are handled during partial evaluation:
- Removed the
FrameClearPhase- now clearing the frame slots in the "clear" intrinsics instead. - Added a new
FrameAccessVerificationPhasethat detects improper pairing of frame slot types at merges, inserts deopts and outputs a performance warning: frame slots can now change type freely and will still be optimized by the frame intrinsics optimization, as long as the types are compatible at merges (whereas frame slots used to be restricted to one primitive type in the whole compilation unit).
- Removed the
-
Made conversion rules for passing values to native code through the Truffle NFI more lenient.
- Passing a
doubleto a parameter of typefloatis allowed, possibly losing precision. - Passing signed integers to parameters of type
uint*and unsigned integers to parameters of typesint*is allowed.
- Passing a
- Added a
@GenerateWrapper.Ignoreannotation to prevent methods from being instrumented in wrapper classes. - The native image
TruffleCheckBlackListedMethodsoption was deprecated and replaced by theTruffleCheckBlockListMethodsoption. - Added new Static Object Model APIs to represent the layout of objects that, once defined, do not change the number and the type of their properties. It is particularly well suited for, but not limited to, the implementation of the object model of static programming languages. For more information, read the Javadoc and the tutorial.
- Removed deprecated engine options:
engine.CompilationThresholdandengine.InliningTruffleTierOnExpand - Added
BytecodeOSRNodeinterface to support on-stack replacement (OSR) for bytecode interpreters. OSR can improve start-up performance by switching from interpreted code to compiled code in the middle of execution. It is especially effective for targets with long-running loops, which can get "stuck" running in the interpreter without OSR. Refer to the Javadoc and the OSR guide for more details. - Removed support to read language and instrument registrations from
META-INF/trufflefiles. Recompiling the TruffleLanguage or TruffleInstrument using the Truffle annotation processor automatically migrates the language or instrument to the new behavior. Languages are already migrated if they were compiled with a version later or equal than 19.3. - Added SourceSectionFilter#includes.
- Added FrameInstance#getCompilationTier and FrameInstancel#isCompilationRoot
- Added
InteropLibrary.isValidValue(Object)andInteropLibrary.isValidProtocolValue(Object). - Added
TruffleContext.evalPublic(Node, Source)andTruffleContext.evalInternal(Node, Source)that allow to evaluate sources in an inner context and access values of the inner context safely. - Added
TruffleContext.Builder.initializeCreatorContext(boolean)that allows to disable initialization of the language that created the inner context. - Added the ability to share values between contexts. Guest languages can now use values of the polyglot embedding API using host interop. This no longer leads to invalid sharing errors.
- Added
ReflectionLibrary.getUncachedmethod. - Removed deprecated
TruffleLanguage.Registration#mimeType(). Split up MIME types intoTruffleLanguage.Registration#characterMimeTypes()andTruffleLanguage.Registration#byteMimeTypes(). - Added a new and improved way to access the current language context and language instance of the thread.
- Language and context references can now be stored in static final fields. See the javadoc for the new intended usage.
- All thread local lookups have an efficient implementation on HotSpot and SubstrateVM, interpreted and compiled, eliminating the need to ever cache the value in the AST.
- Using a compilation final node passed as parameter, the context and language value can be constant folded if it is known that only one language or context instance can exist.
- Deprecated all other means of accessing the current context:
TruffleLanguage.getCurrentContext(Class),RootNode.getCurrentContext(Class),ContextReference.get(),Node.lookupContextReference(Class)and@CachedContext. - Deprecated all other means of accessing the current language:
TruffleLanguage.getCurrentLanguage(Class),LanguageReference.get(),Node.lookupLanguageReference(Class)and@CachedLanguage.
- Removed deprecated
TruffleLanguage.getContextReference(). - Added
--engine.TraceDeoptimizeFrameto trace frame deoptimizations due toFrameInstance#getFrame(READ_WRITE|MATERIALIZE). - Added loop condition profiling to
LoopNode, so theRepeatingNodeno longer needs to profile or inject the loop count. Language implementations should remove loop condition profiles from their repeating nodes since they are redundant now. - Added
ThreadLocalActionconstructor that allows to configure recurring thread local actions to be performed repeatedly. This allows to build debug tooling that need to gather information in every safepoint poll of a thread. - Added
ExecuteTracingSupportinterface that allows tracing the calls toexecutemethods of aNode. - Changed
--engine.InstrumentExceptionsAreThrownto true by default and deprecated EventContext#createError without replacement. Instrument exception are now thrown by default and observable by the guest language application. TruffleLanguage.Env#getPublicTruffleFile(URI)andTruffleLanguage.Env#getInternalTruffleFile(URI)have been fixed to behave as specified and throwUnsupportedOperationExceptioninstead ofFileSystemNotFoundException.- Added
LibraryFactory.getMessages()to allow to enumerate all messages of a library. - Added
Engine.newBuilder(String...)that also allows to restrict the permitted languages of an engine. The permitted languages of an engine are inherited by all created contexts.
- Added
TypeDescriptor.subtract(TypeDescriptor)creating a newTypeDescriptorby removing the given type from a union or intersection type. - Added
CompilerDirectives.blackhole(value)which can be helpful for benchmarking. - Added
TruffleLanguage#Env.registerOnDispose(Closeable)registeringCloseables for automatic close on context dispose. - Added
RootNode#countsTowardsStackTraceLimit(), replacingRootNode#isInternal()as the criterion that determines whether a frame with the given root node counts towards the stack trace limit. - Added
engine.UsePreInitializedContextoption which can be used to disable usage of pre-initialized context. - Added
MemoryFence: provides methods for fine-grained control of memory ordering. ValueProfile.createEqualityProfile()was deprecated without replacement.Object.equals(Object)cannot safely be used on compiled code paths. Use the Truffle Specialization DSL instead to implement caches with equality semantics. MakingObject.equals(Object)reachable as runtime compiled method will mark too many equals implementations reachable for runtime compilation in a native image.- Methods annotated with
@Fallbackof the Truffle specialization DSL now support@Cached,@CachedContext,@CachedLanguage,@Bindand dispatched@CachedLibraryparameters. - Deprecated and added methods to support expected arity ranges in
ArityExceptioninstances. Note that the replacement methods now include more strict validations. DebugValuemethodshashCode()andequals()provide result of the interopidentityHashCodeandisIdenticalcalls on the corresponding guest objects, respectively.- Enabled by default the traversing compilation queue with dynamic thresholds, see
--engine.TraversingCompilationQueue,--engine.DynamicCompilationThresholds,--engine.DynamicCompilerThresholdsMinScale,--engine.DynamicCompilerThresholdsMinNormalLoadand--engine.DynamicCompilerThresholdsMaxNormalLoad. - Added
LoopConditionProfile#create()as an alias ofcreateCountingProfile()so it can be used like@Cached LoopConditionProfile loopProfile. - Enabled by default the traversing compilation queue with dynamic thresholds. See the documentation for more information.
- Changed behavior of parameterized
Function<Object, Object>conversion such that anObject[]argument is passed through to the guest function as a single array argument. Both rawFunctionandFunction<Object[], Object>treat anObject[]as an array of arguments, like before. - Added
TruffleContext.pause()andTruffleContext.resume(Future<Void>)to pause and resume execution for a truffle context, respectively. - Added
DebuggerSession.createPrimitiveValue()to create aDebugValuefrom a primitive value. Use it instead ofDebugValue.set(primitiveValue)which is now deprecated. - Added support for iterators and hash maps to
DebugValue. The added methods wraps the respective methods ofInteropLibrary. - Added support for Truffle libraries to be prepared for AOT. See
ExportLibrary.useForAOTor theAOTTutorialjava class for further details. - The Specialization DSL now generates code to throw an
AssertionErrorif a@Sharedand@Cachedparameter returns a non-null value and is used in a guard. Thenullstate is reserved for the uninitialized state. - Changed
TruffleLanguage.disposeContext. In case the underlying polyglot context is being cancelled,TruffleLanguage.disposeContextis called even ifTruffleLanguage.finalizeContextthrows a TruffleException or a ThreadDeath exception.
- Added methods into
Instrumenterthat create bindings to be attached later on. AddedEventBinding.attach()method. - Added
TruffleContext.isCancelling()to check whether a truffle context is being cancelled. - Added
TruffleInstrument.Env.calculateContextHeapSize(TruffleContext, long, AtomicBoolean)to calculate the heap size retained by a a context. - Added
ContextsListener.onLanguageContextCreate,ContextsListener.onLanguageContextCreateFailed,ContextsListener.onLanguageContextInitialize, andContextsListener.onLanguageContextInitializeFailedto allow instruments to listen to language context creation start events, language context creation failure events, language context initialization start events, and language context initialization failure events, respectively. - Added
CompilerDirectives.isExact(Object, Class)to check whether a value is of an exact type. This method should be used instead of thevalue != null && value.getClass() == exactClasspattern. - Added
Frame.clear(FrameSlot). This allows the compiler to reason about the liveness of local variables. Languages are recommended to use it when applicable. - Added
@GenerateAOTto support preparation for AOT specializing nodes. Read the AOT tutorial to get started with Truffle and AOT compilation. - Profiles now can be disabled using
Profile.disable()and reset usingProfile.reset(). - Added
--engine.CompileAOTOnCreateoption to trigger AOT compilation on call target create. - Added new messages to
InteropLibraryfor interacting with buffer-like objects:- Added
hasBufferElements(Object)that returnstrueif this object supports buffer messages. - Added
isBufferWritable(Object)that returnstrueif this object supports writing buffer elements. - Added
getBufferSize(Object)to return the size of this buffer. - Added
readBufferByte(Object, long),readBufferShort(Object, ByteOrder, long),readBufferInt(Object, ByteOrder, long),readBufferLong(Object, ByteOrder, long),readBufferFloat(Object, ByteOrder, long)andreadBufferDouble(Object, ByteOrder, long)to read a primitive from this buffer at the given index. - Added
writeBufferByte(Object, long, byte),writeBufferShort(Object, ByteOrder, long, short),writeBufferInt(Object, ByteOrder, long, int),writeBufferLong(Object, ByteOrder, long, long),writeBufferFloat(Object, ByteOrder, long, float)andwriteBufferDouble(Object, ByteOrder, long, double)to write a primitive in this buffer at the given index (supported only ifisBufferWritable(Object)returnstrue).
- Added
- Added
Shape.getLayoutClass()as a replacement forShape.getLayout().getType(). Returns the DynamicObject subclass provided toShape.Builder.layout. - Changed the default value of
--engine.MultiTierfromfalsetotrue. This should significantly improve the warmup time of Truffle interpreters. - The native image build fails if a method known as not suitable for partial evaluation is reachable for runtime compilation. The check can be disabled by the
-H:-TruffleCheckBlackListedMethodsnative image option. - Added
ExactMath.truncate(float)andExactMath.truncate(double)methods to remove the decimal part (round toward zero) of a float or of a double respectively. These methods are intrinsified. - Added
SuspendedEvent.prepareUnwindFrame(DebugStackFrame, Object)to support forced early return values from a debugger. - Added
DebugScope.convertRawValue(Class<? extends TruffleLanguage<?>>, Object)to enable wrapping a raw guest language object into a DebugValue. - Added new messages to the
InteropLibraryto support iterables and iterators:- Added
hasIterator(Object)that allows to specify that the receiver is an iterable. - Added
getIterator(Object)to return the iterator for an iterable receiver. - Added
isIterator(Object)that allows to specify that the receiver is an iterator. - Added
hasIteratorNextElement(Object)that allows to specify that the iterator receiver has element(s) to return by calling thegetIteratorNextElement(Object)method. - Added
getIteratorNextElement(Object)to return the current iterator element.
- Added
- Added
TruffleContext.leaveAndEnter(Node, Supplier)to wait for another thread without triggering multithreading. - Removed deprecated
TruffleLanguage.Env.getTruffleFile(String),TruffleLanguage.Env.getTruffleFile(URI)methods. - Deprecated CompilationThreshold for preferred LastTierCompilationThreshold and SingleTierCompilationThreshold.
- Added new features to the DSL
@NodeChildannotation:- Added
implicitandimplicitCreateattributes to allow implicit creation of child nodes by the parent factory method. - Added
allowUncachedanduncachedattributes to allow using@NodeChildwith@GenerateUncached.
- Added
- Added
TruffleLanguage.Env#getTruffleFileInternal(String, Predicate<TruffleFile>)andTruffleLanguage.Env#getTruffleFileInternal(URI, Predicate<TruffleFile>)methods performing the guest language standard libraries check using a supplied predicate. These methods have a better performance compared to theTruffleLanguage.Env#getInternalTruffleFile(String)andTruffleLanguage.Env#getInternalTruffleFile(URI)as the guest language standard libraries check is performed only for files in the language home when IO is not enabled by the Context. - Added
TruffleLanguage.Env.getLogger(String)andTruffleLanguage.Env.getLogger(Class<?>)creating a context-bound logger. The returnedTruffleLoggeralways uses a logging handler and options from Env's context and does not depend on being entered on any thread. - Added new messages to the
InteropLibraryto support hash maps:- Added
hasHashEntries(Object)that allows to specify that the receiver provides hash entries. - Added
getHashSize(Object)to return hash entries count. - Added
isHashEntryReadable(Object, Object)that allows to specify that mapping for the given key exists and is readable. - Added
readHashValue(Object, Object)to read the value for the specified key. - Added
readHashValueOrDefault(Object, Object, Object)to read the value for the specified key or to return the default value when the mapping for the specified key does not exist. - Added
isHashEntryModifiable(Object, Object)that allows to specify that mapping for the specified key exists and is writable. - Added
isHashEntryInsertable(Object, Object)that allows to specify that mapping for the specified key does not exist and is writable. - Added
isHashEntryWritable(Object, Object)that allows to specify that mapping is either modifiable or insertable. - Added
writeHashEntry(Object, Object, Object)associating the specified value with the specified key. - Added
isHashEntryRemovable(Object, Object)that allows to specify that mapping for the specified key exists and is removable. - Added
removeHashEntry(Object, Object)removing the mapping for a given key. - Added
isHashEntryExisting(Object, Object)that allows to specify that that mapping for a given key is existing. - Added
getHashEntriesIterator(Object)to return the hash entries iterator. - Added
getHashKeysIterator(Object)to return the hash keys iterator. - Added
getHashValuesIterator(Object)to return the hash values iterator.
- Added
- Added
TypeDescriptor.HASHandTypeDescriptor.hash(TypeDescriptor, TypeDescriptor)representing hash map types in the TCK. - Added support for Truffle safepoints and thread local actions. See
TruffleSafepointandThreadLocalAction. There is also a tutorial that explains how to adopt and use in language or tool implementations. - Make the Truffle NFI more modular.
- Provide option
--language:nfi=nonefor disabling native access via the Truffle NFI in native-image even if the NFI is included in the image (e.g. as dependency of another language). - Moved
trufflenfi.hheader from the JDK root include directory into the NFI language home (languages/nfi/include).
- Provide option
- If an
AbstractTruffleExceptionis thrown from theContextLocalFactory,ContextThreadLocalFactoryor event listener, which is called during the context enter, the exception interop messages are executed without a context being entered. The event listeners called during the context enter are:ThreadsActivationListener.onEnterThread(TruffleContext)ThreadsListener.onThreadInitialized(TruffleContext, Thread)TruffleInstrument.onCreate(Env)TruffleLanguage.isThreadAccessAllowed(Thread, boolean)TruffleLanguage.initializeMultiThreading(Object)TruffleLanguage.initializeThread(Object, Thread)
- Added
HostCompilerDirectivesfor directives that guide the host compilations of Truffle interpreters.HostCompilerDirectives.BytecodeInterpreterSwitch- to denote methods that contain the instruction-dispatch switch in bytecode interpretersHostCompilerDirectives.BytecodeInterpreterSwitchBoundary- to denote methods that do not need to be inlined into the bytecode interpreter switch
- Truffle DSL generated nodes are no longer limited to 64 state bits. Use these state bits responsibly.
- Added support for explicitly selecting a host method overload using the signature in the form of comma-separated fully qualified parameter type names enclosed by parentheses (e.g.
methodName(f.q.TypeName,java.lang.String,int,int[])). - Changed the default value of
--engine.MultiTierfromfalsetotrue. This should significantly improve the warmup time of Truffle interpreters. - Deprecated and added methods to support expected arity ranges in
ArityExceptioninstances. Note that the replacement methods now include more strict validations.
- Added
RepeatingNode.initialLoopStatusandRepeatingNode.shouldContinueto allow defining a custom loop continuation condition. - Added new specialization utility to print detailed statistics about specialization instances and execution count. See Specialization Statistics Tutorial for details on how to use it.
- Added new specialization compilation mode that ignores "fast path" specializations and generates calls only to "slow path" specializations. This mode is intended for testing purposes to increase tests coverage. See Specialization testing documentation for more details.
- Added TruffleFile.readSymbolicLink method to read the symbolic link target.
- Added ReportPolymorphism.Megamorphic annotation for expressing the "report only megamorphic specializations" use case when reporting polymorphism.
- Added new flags to inspect expansion during partial evaluation:
--engine.TraceMethodExpansion=truffleTier,--engine.TraceNodeExpansion=truffleTier,--engine.MethodExpansionStatistics=truffleTierand--engine.NodeExpansionStatistics=truffleTier. Language implementations are encouraged to run with these flags enabled and investigate their output for unexpected results. See Optimizing.md for details. - Enabled by default the elastic allocation of Truffle compiler threads depending on the number of available processors, in both JVM and native modes. The old behavior, 1 or 2 compiler threads, can be explicitly enabled with
--engine.CompilerThreads=0. - Added
ThreadsActivationListenerto listen to thread enter and leave events in instruments. - Added
TruffleInstrument.Env.getOptions(TruffleContext)to retrieve context specific options for an instrument andTruffleInstrument.getContextOptions()to describe them. This is useful if an instrument wants to be configured per context. - Added
TruffleContext.isClosed()to check whether a truffle context is already closed. This is useful for instruments. - Added
TruffleContext.closeCancelledandTruffleContext.closeResourceExhaustedto allow instruments and language that create inner contexts to cancel the execution of a context. - Added
TruffleContext.isActivein addition toTruffleContext.isEnteredand improved their documentation to indicate the difference. - Added
ContextsListener.onContextResetLimitto allow instruments to listen to context limit reset events from the polyglot API. - All instances of
TruffleContextaccessible from instruments can now be closed by the instrument. Previously this was only possible for creators of the TruffleContext instance. - Added the ability to create context and context thread locals in languages and instruments. See ContextLocal and ContextThreadLocal for details.
- Removed the hard "maximum node count" splitting limit controlled by
TruffleSplittingMaxNumberOfSplitNodesas well as the option itself. - Removed polymorphism reporting from
DynamicObjectLibrary. If the language wants to report polymorphism for a property access, it should do so manually using a cached specialization. - The
iterationsforLoopNode.reportLoopCount(source, iterations)must now be >= 0. - Added NodeLibrary, which provides guest language information associated with a particular Node location, local scope mainly and TruffleLanguage.getScope and TruffleInstrument.Env.getScope, which provides top scope object of a guest language.
- Deprecated com.oracle.truffle.api.Scope class and methods in TruffleLanguage and TruffleInstrument.Env, which provide the scope information through that class.
- Added scope information into InteropLibrary: InteropLibrary.isScope, InteropLibrary.hasScopeParent and InteropLibrary.getScopeParent
- Added utility method to find an instrumentable parent node InstrumentableNode.findInstrumentableParent.
- Deprecated
DebugScope.getArguments()without replacement. This API was added without use-case. - Added the RootNode.isTrivial method, for specifying root nodes that are always more efficient to inline than not to.
- Added ByteArraySupport: a helper class providing safe multi-byte primitive type accesses from byte arrays.
- Added a new base class for Truffle exceptions, see AbstractTruffleException. The original
TruffleExceptionhas been deprecated. Added new interop messages for exception handling replacing the deprecatedTruffleExceptionmethods. - Added new messages to
InteropLibraryrelated to exception handling:- Added
getExceptionType(Object)that allows to specify the type of an exception, e.g. PARSE_ERROR. - Added
isExceptionIncompleteSource(Object)allows to specify whether the parse error contained unclosed brackets. - Added
getExceptionExitStatus(Object)allows to specify the exit status of an exception of type EXIT. - Added
hasExceptionCause(Object)andgetExceptionCause(Object)to return the cause of this error - Added
hasExceptionStackTrace(Object)andgetExceptionStackTrace(Object)to return the guest stack this of this error. - Added
hasExceptionMessage(Object)andgetExceptionMessage(Object)to provide an error message of the error. - Added
hasExecutableName(Object)andgetExecutableName(Object)to provide a method name similar to what was provided inRootNode.getName()but for executable objects. - Added
hasDeclaringMetaObject(Object)andgetDeclaringMetaObject(Object)to provide the meta object of the function.
- Added
- Language implementations are recommended to perform the following steps to upgrade their exception implementation:
- Convert non-internal guest language exceptions to
AbstractTruffleException, internal errors should be refactored to no longer implementTruffleException. - Export new interop messages directly on the
AbstractTruffleExceptionsubclass if necessary. Consider exportinggetExceptionType(Object),getExceptionExitStatus(Object)andisExceptionIncompleteSource(Object). For other interop messages the default implementation should be sufficient for most use-cases. Consider using@ExportLibrary(delegateTo=...)to forward to a guest object stored inside of the exception. - Rewrite interop capable guest language try-catch nodes to the new interop pattern for handling exceptions. See
InteropLibrary#isException(Object)for more information. - Implement the new method
RootNode.translateStackTraceElementwhich allows guest languages to transform stack trace elements to accessible guest objects for other languages. - Consider making executable interop objects of the guest language implement
InteropLibrary.hasExecutableName(Object)andInteropLibrary.hasDeclaringMetaObject(Object). - Make exception printing in the guest language use
InteropLibrary.getExceptionMessage(Object),InteropLibrary.getExceptionCause(Object)andInteropLibrary.getExceptionStackTrace(Object)for foreign exceptions to print them in the style of the language. - Make all exports of
InteropLibrary.throwException(Object)throw an instance ofAbstractTruffleException. This contract will be enforced in future versions whenTruffleExceptionwill be removed. - Attention: Since AbstractTruffleException is an abstract base class, not an interface, the exceptions the Truffle NFI throws do not extend UnsatisfiedLinkError anymore. This is an incompatible change for guest languages that relied on the exact exception class. The recommended fix is to catch AbstractTruffleException instead of UnsatisfiedLinkError.
- Convert non-internal guest language exceptions to
- Added TruffleInstrument.Env.getEnteredContext returning the entered
TruffleContext. - Added DebuggerSession.setShowHostStackFrames and host
DebugStackFrameandDebugStackTraceElement. This is useful for debugging of applications that use host interop. - All Truffle Graal runtime options (-Dgraal.) which were deprecated in GraalVM 20.1 are removed. The Truffle runtime options are no longer specified as Graal options (-Dgraal.). The Graal options must be replaced by corresponding engine options specified using polyglot API.
- Deprecated the
com.oracle.truffle.api.object.dslAPI without replacement. The migration path is to useDynamicObjectsubclasses with thecom.oracle.truffle.api.objectAPI. - A node parameter now needs to be provided to TruffleContext.enter() and TruffleContext.leave(Object). The overloads without node parameter are deprecated. This is useful to allow the runtime to compile the enter and leave code better if a node is passed as argument.
- Added DebuggerSession.suspendHere to suspend immediately at the current location of the current execution thread.
- Added RootNode.prepareForAOT that allows to initialize root nodes for compilation that were not yet executed.
- Removed deprecation for
RootNode.getLanguage(Class<?>), it is still useful to efficiently access the associated language of a root node. - Block node partial compilation is no longer eagerly triggered but only when the
--engine.MaximumGraalNodeCountlimit was reached once for a call target. - Lifted the restriction that the dynamic type of a
DynamicObjectneeds to be an instance ofObjectType, allowing any non-null object. DeprecatedShape.getObjectType()that has been replaced byShape.getDynamicType(). - Added TruffleLanguage.Env.createHostAdapterClass to allow extending a host class and/or interfaces with a guest object via a generated host adapter class (JVM only).
- Deprecated the old truffle-node-count based inlining heuristic and related options (namely InliningNodeBudget and LanguageAgnosticInlining).
- Added
@GenerateLibrary.pushEncapsulatingNode()that allows to configure whether encapsulating nodes are pushed or popped.
- Added new internal engine option
ShowInternalStackFramesto show internal frames specific to the language implementation in stack traces. - Added new identity APIs to
InteropLibrary:hasIdentity(Object receiver)to find out whether an object specifies identityisIdentical(Object receiver, Object other, InteropLibrary otherLib)to compare the identity of two objectisIdenticalOrUndefined(Object receiver, Object other)export to specify the identity of an object.identityHashCode(Object receiver)useful to implement maps that depend on identity.
- Added
TriStateutility class represents three states TRUE, FALSE and UNDEFINED. - Added
InteropLibrary.getUncached()andInteropLibrary.getUncached(Object)short-cut methods for convenience. - Enabled by default the new inlining heuristic in which inlining budgets are based on Graal IR node counts and not Truffle Node counts.
- Added
ConditionProfile#create()as an alias ofcreateBinaryProfile()so it can be used like@Cached ConditionProfile myProfile. - Improved
AssumedValueutility class: Code that reads the value but can not constant fold it does not need to deopt when the value changes. - A
TruffleFilefor an empty path is no more resolved to the current working directory. - Added
SourceBuilder.canonicalizePath(boolean)to control whether theSource#getPath()should be canonicalized. - Deprecated and renamed
TruffleFile.getMimeTypeto TruffleFile.detectMimeType. The new method no longer throwsIOExceptionbut returnsnullinstead. - The languages are responsible for stopping and joining the stopped
Threads in the TruffleLanguage.finalizeContext. - Added Truffle DSL
@Bindannotation to common out expression for use in guards and specialization methods. - Added the ability to disable adoption for DSL cached expressions with type node using
@Cached(value ="...", weak = true). - Added an option not to adopt the parameter annotated by @Cached, using
@Cached(value ="...", adopt = false). - Added
TruffleWeakReferenceutility to be used on partial evaluated code paths instead of the default JDKWeakReference. - Removed deprecated API in
com.oracle.truffle.api.source.Source. The APIs were deprecated in 19.0. - Added
CompilerDirectives.shouldNotReachHere()as a short-cut for languages to indicate that a path should not be reachable neither in compiled nor interpreted code paths. - All subclasses of
InteropExceptiondo no longer provide a Java stack trace. They are intended to be thrown, immediately caught by the caller and not re-thrown. As a result they can now be allocated on compiled code paths and do no longer require a@TruffleBoundaryortransferToInterpreterAndInvalidate()before use. Languages are encouraged to remove@TruffleBoundaryannotations or leadingtransferToInterpreterAndInvalidate()method calls before interop exceptions are thrown. - All
InteropExceptionsubclasses now offer a newcreatefactory method to provide a cause. This cause should only be used if user provided guest application code caused the problem. - The use of
InteropException.initCauseis now deprecated for performance reasons. Instead pass the cause when theInteropExceptionis constructed. The methodinitCausewill throwUnsupportedOperationExceptionin future versions. Please validate all calls toThrowable.initCausefor language or tool implementation code. - Added TruffleFile.isSameFile method to test if two
TruffleFiles refer to the same physical file. - Added new
EncapsulatingNodeReferenceclass to lookup read and write the current encapsulating node. Deprecated encapsulating node methods inNodeUtil. - Added support for subclassing
DynamicObjectso that guest languages can directly base their object class hierarchy on it, add fields, and use@ExportLibraryon subclasses. Guest language object classes should implementTruffleObject. - Added new DynamicObjectLibrary API for accessing and mutating properties and the shape of
DynamicObjectinstances. This is the recommended API from now on. Other, low-level property access APIs will be deprecated and removed in a future release.
- Added
@GenerateLibrary(dynamicDispatchEnabled = false)that allows to disable dynamic dispatch semantics for a library. The default istrue. - Added ability to load external default exports for libraries using a service provider. See
GenerateLibrary(defaultExportLookupEnabled = true). - The use of
@NodeFieldis now permitted in combination with@GenerateUncached, but it throws UnsupportedOperationException when it is used. - It is now possible to specify a setter with
@NodeField. The generated field then will be mutable. - Removed deprecated interoperability APIs that were deprecated in 19.0.0.
- Removed deprecated instrumentation APIs that were deprecated in 0.33
- The
PerformanceWarningsAreFatalandTracePerformanceWarningsengine options take a comma separated list of performance warning types. Allowed warning types arecallto enable virtual call warnings,instanceofto enable virtual instance of warnings andstoreto enables virtual store warnings. There are alsoallandnonetypes to enable (disable) all performance warnings. - Added DebugValue#getRawValue() for raw guest language object lookup from same language.
- Added DebugStackFrame#getRawNode() for root node lookup from same language.
- Added DebugException#getRawException() for raw guest language exception lookup from same language.
- Added DebugStackFrame#getRawFrame() for underlying frame lookup from same language.
- Added
TruffleInstrument.Env.getPolyglotBindings()that replaces now deprecatedTruffleInstrument.Env.getExportedSymbols(). - Added
@ExportLibrary(transitionLimit="3")that allows the accepts condition of exported libraries to transition from true to false for a library created for a receiver instance. This is for example useful to export messages for array strategies. - Added
CompilationFailureActionengine option which deprecatesCompilationExceptionsArePrinted,CompilationExceptionsAreThrown,CompilationExceptionsAreFatalandPerformanceWarningsAreFataloptions. - Added
TreatPerformanceWarningsAsErrorsengine option which deprecates thePerformanceWarningsAreFataloption. To replace thePerformanceWarningsAreFataloption use theTreatPerformanceWarningsAsErrorswithCompilationFailureActionset toExitVM. - Added
bailoutinto performance warning kinds used byTracePerformanceWarnings,PerformanceWarningsAreFatalandCompilationExceptionsAreFataloptions. - Added Option.deprecationMessage to set the option deprecation reason.
engine.Modeis now a supported option and no longer experimental.- Added new meta-data APIs to
InteropLibrary:has/getLanguage(Object receiver)to access the original language of an object.has/getSourceLocation(Object receiver)to access the source location of an object (e.g. of function or classes).toDisplayString(Object receiver, boolean allowsSideEffect)to produce a human readable string.has/getMetaObject(Object receiver)to access the meta-object of an object.isMetaObject(Object receiver)to find out whether an object is a meta-object (e.g. Java class)getMetaQualifiedName(Object receiver)to get the qualified name of the meta-objectgetMetaSimpleName(Object receiver)to get the simple name of a the meta-objectisMetaInstance(Object receiver, Object instance)to check whether an object is an instance of a meta-object.
- Added
TruffleLanguage.getLanguageViewthat allows to wrap values to add language specific information for primitive and foreign values. - Added
TruffleLanguage.getScopedViewthat allows to wrap values to add scoping and visibility to language values. - Added
TruffleInstrument.Env.getScopedViewandTruffleInstrument.Env.getLanguageViewto access language and scoped views from instruments. - Added
TruffleInstrument.Env.getLanguageInfoto convert language classes toLanguageInfo. - Deprecated
TruffleLanguage.findMetaObject,TruffleLanguage.findSourceLocation,TruffleLanguage.toStringandTruffleLanguage.isObjectOfLanguage. Use the new interop APIs and language views as replacement. - Added support for the value conversions of DebugValue that provide the same functionality as value conversions on Value.
- Added DebugValue#toDisplayString to convert the value to a language-specific string representation.
- Deprecated
DebugValue#as, other conversion methods should be used instead. - Clarify InteropLibrary javadoc documentation of message exceptions. UnsupportedMessageException is thrown when the operation is never supported for the given receiver type. In other cases UnknownIdentifierException or InvalidArrayIndexException are thrown.
- Added TruffleLanguage.Env.initializeLanguage method to force language initialization.
- Values of
NAMEproperties of ReadVariableTag and WriteVariableTag extended to allow an object or an array of objects with name and source location. - Added support for asynchronous stack traces: TruffleLanguage.Env.getAsynchronousStackDepth(), RootNode.findAsynchronousFrames(), TruffleInstrument.Env.setAsynchronousStackDepth(), TruffleStackTrace.getAsynchronousStackTrace(), DebuggerSession.setAsynchronousStackDepth(), SuspendedEvent.getAsynchronousStacks(), DebugException.getDebugAsynchronousStacks().
-
Add Layout#dispatch() to be able to generate override of
ObjectType#dispatch()method in the generated inner *Type class. -
Deprecated engine options engine.InvalidationReprofileCount and engine.ReplaceReprofileCount. They no longer have any effect. There is no longer reprofiling after compilation.
-
Added DebuggerSession.{suspend(), suspendAll,resume()} to allow suspending and resuming threads.
-
Add new loop explosion mode LoopExplosionKind#FULL_UNROLL_UNTIL_RETURN, which can be used to duplicate loop exits during unrolling until function returns.
-
The default LoopExplosionKind for
@ExplodeLoopchanged fromFULL_UNROLLtoFULL_UNROLL_UNTIL_RETURN, which we believe is more intuitive. We recommend reviewing your usages of@ExplodeLoop, especially those withreturn,breakandtry/catchin the loop body as those might duplicate more code than before. -
The
TruffleCheckNeverPartOfCompilationoption when building a native image is now enabled by default, ensuringneverPartOfCompilation()is not reachable for runtime compilation. UseCompilerDirectives.bailout()if you want to test when a compilation fails, otherwise avoidneverPartOfCompilation()in code reachable for runtime compilation (e.g., by using@TruffleBoundary). -
The
DirectoryStreamcreated by a relativeTruffleFilepasses relativeTruffleFiles into theFileVisitor, even when an explicit current working directory was set. -
Added
DebuggerTester.startExecute()that allows to execute an arbitrary sequence of commands on the background thread. -
Time specification in
InteropLibraryrelaxed to allow a fixed timezone when no date is present. -
TruffleLogger.getLoggerthrows anIllegalArgumentExceptionwhen givenidis not a valid language or instrument id. -
Node#getEncapsulatingSourceSection() is no longer a fast-path method, because
getSourceSection()is not fast-path. -
The algorithm used to generate a unique URI for a
Sourcebuilt without anURIwas changed to SHA-256. -
Added ExportLibrary.delegateTo attribute that allows to delegate all messages of a library to value of a final delegate field. This can be used in combination with
ReflectionLibraryto improve the ability to build wrappers. -
ReadVariableTagandWriteVariableTagadded to StandardTags. -
Truffle TCK now checks that instrumentable nodes are not used in the context of a Library.
-
Getter to check whether TruffleContext is activated or not.
-
All Truffle Graal runtime options (-Dgraal.) will be deprecated with 20.1. The Truffle runtime options are no longer specified as Graal options (-Dgraal.). The Graal options must be replaced by corresponding engine options specified using polyglot API. The
TRUFFLE_STRICT_OPTION_DEPRECATIONenvironment variable can be used to detect usages of deprecated Graal options. When theTRUFFLE_STRICT_OPTION_DEPRECATIONis set totrueand the deprecated Graal option is used the Truffle runtime throws an exception listing the used deprecated options and corresponding replacements.
- Added ability to obtain an Internal Truffle File. The internal file is located in the language home directories and it's readable even when IO is not allowed by the Context.
- Deprecated
TruffleLanguage.Env.getTruffleFileuse getInternalTruffleFile for language standard library files located in language home or getPublicTruffleFile for user files. - Added primitive specializations to
CompilerAsserts.partialEvaluationConstant(). - Added the new
executemethod toLoopNode, which allows loops to return values. - Added support for temporary files and directories.
- Threads created by the embedder may now be collected by the GC before they can be disposed. If languages hold onto thread objects exposed via
initializeThreadthey now need to do so withWeakReferenceto avoid leaking thread instances. - Support boolean literals in DSL expressions used in @Specialization and @Cached fields.
- Added standard block node for language implementations. Using the block node allows the optimizing runtime to split big blocks into multiple compilation units. This optimization may be enabled using
--engine.PartialBlockCompilation(on by default) and configured using--engine.PartialBlockCompilationSize(default 3000). - Added new experimental inlining heuristic in which inlining budgets are based on Graal IR node counts and not Truffle Node counts. Enable with
-Dgraal.TruffleLanguageAgnosticInlining=true. - Deprecated
DynamicObject#isEmpty(),DynamicObject#size(); useShape#getPropertyCount()instead. - Deprecated
Shape#getPropertyList(Pred),Shape#getKeyList(Pred),Shape#hasTransitionWithKey(Object),Shape.Allocator#locationForValue(Object, EnumSet)without replacement. - Added Scope.Builder#rootInstance(Object), Scope#getRootInstance() and DebugScope#getRootInstance() to provide an instance of guest language representation of the root node (e.g. a guest language function).
- Debugger breakpoints can be restricted to a particular root instance via Breakpoint.Builder#rootInstance(DebugValue) and found later on via DebugValue#getRootInstanceBreakpoints().
- Deprecated
TruffleLanguage.getContextReference()as this method is inefficient in many situations. The most efficient context lookup can be achieved knowing the current AST in which it is used by callingNode.lookupContextReference(Class). - Truffle languages and instruments no longer create
META-INF/trufflefiles, but generate service implementations for TruffleLanguage.Provider and TruffleInstrument.Provider automatically. Recompiling the TruffleLanguage using the Truffle annotation processor automatically migrates the language. - The Truffle DSL processor jar no longer requires the Truffle API or Graal SDK as a dependency.
- Added interop messages for guest language exception objects: InteropLibrary#isException(Object) and InteropLibrary#throwException(Object).
- TruffleLanguage.patchContext is invoked for all languages whose contexts were created during context pre-initialization. Originally the
patchContextwas invoked only for languages with initialized contexts.
- Added sub-process output (error output) redirection into OutputStream.
- Added
RootNode.getQualifiedName()for a better distinction when printing stack traces. Languages are encouraged to implement it, in case it differs from the root name. - Added methods to identify date, time, timezone, instant and duration values in
InteropLibraryand TCKTypeDescriptor. - Added ability to read the default time zone from the language Environment with
Env.getTimeZone(). - Deprecated
Env.parseand added replacement APIsEnv.parseInternalandEnv.parsePublic. The new API requires to differentiate between parse calls that were invoked by the guest language user and those which are part of the internal language semantics. The separation avoids accidentally exposing access to internal languages. - Deprecated
Env.getLanguages()and added replacement APIsEnv.getInternalLanguages()andEnv.getPublicLanguages(). - Added Source.newBuilder(Source) that inherits Source properties from an existing Source.
- Added RootBodyTag.
@GenerateUncachedis now inherited by subclasses.NodeFactorynow supportsgetUncachedInstancethat returns the uncached singleton.- Introduced Truffle process sandboxing. Added a TruffleLanguage.Env.newProcessBuilder method creating a new TruffleProcessBuilder to configure and start a new sub-process.
- Added support for reading environment variables, use TruffleLanguage.Env.getEnvironment to obtain process environment variables.
NodeFactorynow supportsgetUncachedInstancethat returns the uncached singleton.@GenerateUncachedcan now be used in combination with@NodeChildif execute signatures for all arguments are present.- Removed deprecated automatic registration of the language class as a service.
- The LanguageProvider can override the default verification of the TCK
IdentityFunctionTest. - Removed deprecated and misspelled method
TruffleStackTrace#getStacktrace. - Removed deprecated methods
TruffleStackTraceElement#getStackTraceandTruffleStackTraceElement#fillIn(use methods ofTruffleStackTraceinstead). SlowPathException#fillInStackTraceis nowfinal.- Added an ability to read a path separator used to separate filenames in a path list.
@TruffleBoundarymethods that throw but are not annotated with@TruffleBoundary(transferToInterpreterOnException=false)will now transfer to the interpreter only once perCallTarget(compilation root).- Added TruffleFile.setAttribute to allow languages to set file attributes.
- Renamed version 1.0.0 to 19.0.0
- This version includes a major revision of the Truffle Interoperability APIs. Most existing APIs for Truffle Interoperability were deprecated. The compatibility layer may cause significant performance reduction for interoperability calls.
- Please see the Interop Migration Guide for an overview and individual
@deprecatedjavadoc tags for guidance. - Deprecated classes
ForeignAccess,Message,MessageResolution,ResolveandKeyInfo. - The following methods got deprecated:
InteropException.raise, with libraries there should be no need to convert checked exceptions to runtime exceptions.TruffleObject.getForeignAccess().
- Introduced new classes:
InteropLibraryandInvalidArrayIndexException. - Added
ObjectType.dispatchto configure the dynamic dispatch and deprecatedObjectType.getForeignAccessFactory.
- Please see the Interop Migration Guide for an overview and individual
- Added Truffle Library API that allows language implementations to use polymorphic dispatch for receiver types with support for implementation specific caching/profiling with support for uncached dispatch.
- Please see the Truffle Library Tutorial for further details.
- Introduced new package:
com.oracle.truffle.api.library.
- Added
@GenerateUncachedto allow the generation of uncached Truffle DSL nodes accessible via the new static generated methodgetUncached().- Set the default value for @Cached to
"create()". This allows@Cachedto be used without attribute. - Added
@Cached(uncached="")to specify the expression to use for the uncached node. - Added
@Cached(allowUncached=true)to allow the cached expression to be reused as uncached expression. Only necessary if the cached expression is not trivial or there is nogetUncached()static method in the node. - Added
@Cached#parametersto allow to share the parameter specification for the cached and uncached version of a node. - Added
getUncached()method to the following classes:- BranchProfile
- ByteValueProfile
- ConditionProfile
- DoubleValueProfile
- FloatValueProfile
- IntValueProfile
- LongValueProfile
- LoopConditionProfile
- PrimitiveValueProfile
- ValueProfile
- IndirectCallNode
- Set the default value for @Cached to
- Truffle DSL can now properly handle checked exceptions in execute methods and specializations.
- Truffle DSL now guarantees to adopt nodes before they are executed in guards. Previously, nodes used in guards were only adopted for their second cached invocation.
- Added
@Cached.Sharedto allow sharing of cached values between specialization and exported Truffle Library methods. - Added
Node.isAdoptable()that allowsNode.getParent()to always remainnulleven if the node is adopted by a parent. This allows to share nodes statically and avoid the memory leak for the parent reference. - Added
NodeUtil.getCurrentEncapsulatingNodeto access the current encapsulating node in nodes that are not adoptable. - Added the
Assumption.isValidAssumptionmethod that allows for simpler checking of assumptions in generated code. - Added Truffle DSL option
-Dtruffle.dsl.ignoreCompilerWarnings=true|false, to ignore Truffle DSL compiler warnings. This is useful and recommended to be used for downstream testing. - Added
@CachedContextand@CachedLanguagefor convenient language and context lookup in specializations or exported methods. - Added
Node.lookupContextReference(Class)andNode.lookupLanguageReference(Class)that allows for a more convenient lookup. - Deprecated
RootNode.getLanguage(Class), the new language references should be used instead. - Added
TruffleFileaware file type detector- Added TruffleFile.FileTypeDetector SPI to detect a file MIME type and a file encoding. A language registering
FileTypeDetectorhas to support all the MIME types recognized by the registered detector. - Added TruffleFile.getMimeType method to obtain a
TruffleFileMIME type. - Added a possibility to set an encoding in SourceBuilder
- The Source builders are sandboxed for files and file URLs.
- Removed usage of NIO
FileTypeDetectorfor MIME type detection, language implementations have to migrate toTruffleFile.FileTypeDetector.
- Added TruffleFile.FileTypeDetector SPI to detect a file MIME type and a file encoding. A language registering
- TruffleFile's paths from image building time are translated in image execution time into new paths using Context's FileSystem. The absolute paths pointing to files in language homes in image generation time are resolved using image execution time language homes.
- Added Env.isPolylgotAccessAllowed() to check whether polyglot access (e.g. access to polyglot builtins) is allowed.
- The methods
Env.getPolyglotBindings()andEnv.importSymbolandEnv.exportSymbolnow throw aSecurityExceptionif polyglot access not allowed. - Added
DebugValue.isNull()to check for null values,DebugValue.execute()to be able to execute values andDebugValue.asString()to get the String from String values. - Added the TruffleFile.getAttribute method to read a single file's attribute and [TruffleFile.getAttributes] (https://www.graalvm.org/truffle/javadoc/com/oracle/truffle/api/TruffleFile.html#getAttributes-java.util.Collection-java.nio.file.LinkOption...-) method to read file's attributes as a bulk operation.
- Removed some deprecated elements:
- EventBinding.getFilter
- TruffleLanguage ParsingRequest.getFrame and ParsingRequest.getLocation
- LoopCountReceiver
- EventContext.parseInContext
- NativeLibraryDescriptor.getBindings
- Instrumenter.attachFactory and Instrumenter.attachListener
- SuppressFBWarnings
- TruffleBoundary.throwsControlFlowException
- DebuggerTester.startEval
- ExactMath.exact methods
- TruffleInstrument.toString
- TruffleInstrument.findMetaObject
- TruffleInstrument.findSourceLocation
- constructor of JSONStringBuilder
- constructor of JSONHelper
- constructor of CompilerDirectives
- constructor of ExactMath
- constructor of Truffle
- constructor of NodeUtil
- TruffleException.isTimeout
- TruffleGraphBuilderPlugins.registerUnsafeLoadStorePlugins
- TypedObject
- Node.getLanguage
- TVMCI.findLanguageClass
- ExecutionContext and RootNode.getExecutionContext
- FrameAccess.NONE
- RootNode.setCalltarget
- DirectCallNode.call and IndirectCallNode.call
- FrameInstance.getFrame
- Node.getAtomicLock
- ExplodeLoop.merge
- AcceptMessage
- RootNode.reportLoopCount
- GraalTruffleRuntime.getQueuedCallTargets
- PrimitiveValueProfile.exactCompare
- BranchProfile.isVisited
- DebugStackFrame.iterator and DebugStackFrame.getValue
- The @Option annotation can now specify the stability of an option.
- Fixed the case of the method
TruffleStackTrace.getStacktracetoTruffleStackTrace.getStackTrace. - Added a getter for name separator used by
TruffleFile's paths. - Added support for receiver object in a frame's Scope: Scope.Builder receiver(String, Object), Scope.getReceiver(), Scope.getReceiverName() and DebugScope.getReceiver().
- Added engine bound TruffleLogger for instruments. The engine bound logger can be used by threads executing without any context.
- Added Debugger.getSessionCount() to return the number of active debugger sessions.
- The TruffleFile.getName() returns
nullfor root directory. TruffleLanguagecan register additional services. This change also deprecates the automatic registration of the language class as a service.- Enabled the experimental monomorphization heuristic as default. Old heuristic still available as legacy, but will be removed soon.
- Added TypeDescriptor.instantiable(instanceType, vararg, parameterTypes) into TCK to support instantiable types.
- The name of an @Option can now start with a lowercase letter.
- Allowed navigation from host class to host symbol (companion object for static members) via the synthetic member
"static". - Moved
getStackTraceandfillInfrom TruffleStackTraceElement to TruffleStackTrace.
- Fixed: Env.asHostException() should throw an
IllegalArgumentExceptionif the provided value is not a host exception. - Changed host exceptions' getExceptionObject() to return the original host exception object.
Sourcecan be created from a relativeTruffleFile.Sourcecan be created without content usingSource.CONTENT_NONEconstant.SourceSectioncan be created from line/column information by Source.createSection(startLine,startColumn,endLine,endColumn).- Added SourceSection.hasLines(), SourceSection.hasColumns() and SourceSection.hasCharIndex() to distinguish which positions are defined and which are not.
DebuggerSessionaccepts source-path for source resolution.- Added Java interop support for string to primitive type conversion.
- Added support for setting current working directory for TruffleFiles, see Env.setCurrentWorkingDirectory
- Removed deprecated
TruffleLanguage.Env.newSourceBuilder. - Added
TruffleLanguage.Env.isPreInitializationmethod to determine whether the context is being pre-initialized. - Added
ArrayUtilsAPI providing additional array and/or string operations that may be intrinsified by the compiler. - Added a possibility to obtain a relative URI for a relative
TruffleFile. - Added
ForeignAccess.createAccessmethod taking a supplier of language check node, deprecated theForeignAccess.createmethod with languageCheckRootNodeparameter.
- Added support for setting the
ThreadGroupandstackSizeon truffle thread creation inTruffleLanguage.Env.createThread. - Added
Instrumenter.lookupExecutionEventNode()to find an execution event node inserted at the node's location by an event binding. - Added
SourceElement.ROOTandStepConfig.suspendAnchors()to tune debugger stepping. - Added
KeyInfo.READ_SIDE_EFFECTSandKeyInfo.WRITE_SIDE_EFFECTSto inform about side-effects of READ/WRITE messages. - Added
DebugValue.hasReadSideEffects()andDebugValue.hasWriteSideEffects()to test for side-effects of reading or writing the value.
- Added
SuspendedEvent.setReturnValueto change the return value of the currently executed source location. - Deprecated
FrameSlot#getIndexwithout replacement. - Added
TruffleInstrument.Env.startServer()to get a virtual message-based server provided viaMessageTransportservice. - Added
TruffleFile.relativize,TruffleFile.startsWith,TruffleFile.endsWith,TruffleFile.createLink,TruffleFile.createSymbolicLink,TruffleFile.getOwner,TruffleFile.getGroup,TruffleFile.newDirectoryStream,TruffleFile.visit,TruffleFile.copymethods.
-
Truffle was relicensed from GPLv2 with CPE to Universal Permissive License (UPL).
-
Made all Truffle DSL annotations retention policy CLASS instead of RUNTIME. Reflecting DSL annotations at runtime is no longer possible. It is recommended to use
@Introspectableinstead. -
Removed deprecated FrameDescriptor#shallowCopy (deprecated since 1.0.0 RC3).
-
Removed deprecated FrameSlot#getFrameDescriptor (deprecated since 1.0.0 RC3).
- Added support for byte based sources:
- Byte based sources may be constructed using a
ByteSequenceor from aTruffleFileorURL. Whether sources are interpreted as character or byte based sources depends on the specified language. Source.hasBytes()andSource.hasCharacters()may be used to find out whether a source is character or byte based.- Added
Source.getBytes()to access the contents of byte based sources. TruffleLanguage.Registration.mimeTypeis now deprecated in favor ofTruffleLanguage.Registration.byteMimeTypesandTruffleLanguage.Registration.characterMimeTypes.- Added
TruffleLanguage.Registration.defaultMimeTypeto define a default MIME type. This is mandatory if a language specifies more than one MIME type.
- Byte based sources may be constructed using a
TruffleLanguage.Registration.id()is now mandatory for all languages and reserved language ids will now be checked by the annotation processor.- Deprecated Source builders and aligned them with polyglot source builders.
- e.g.
Source.newBuilder("chars").name("name").language("language").build()can be translated toSource.newBuilder("language", "chars", "name").build() - This is a preparation step for removing Truffle source APIs in favor of polyglot Source APIs in a future release.
- e.g.
- Deprecated
Source.getInputStream(). UseSource.getCharacters()orSource.getBytes()instead. - Deprecated
TruffleLanguage.Env.newSourceBuilder(String, TruffleFile). UseSource.newBuilder(String, TruffleFile)instead. - Added
Source.findLanguageandSource.findMimeTypeto resolve languages and MIME types. - The method
Source.getMimeType()might now returnnull. Source builders now supportnullvalues formimeType(String). - A
nullsource name will no longer lead to an error but will be translated toUnnamed. - Added
TruffleFile.normalizeto allow explicit normalization ofTruffleFilepaths.TruffleFileis no longer normalized by default. - Added
Message#EXECUTE,Message#INVOKE,Message#NEW. - Deprecated
Message#createExecute(int),Message#createInvoke(int),Message#createNew(int)as the arity argument is no longer needed. Jackpot rules available (runmx jackpot --apply). - Removed APIs for deprecated packages:
com.oracle.truffle.api.vm,com.oracle.truffle.api.metadata,com.oracle.truffle.api.interop.java - Removed deprecated class
TruffleTCK. - Debugger API methods now throw DebugException on language failures.
- Deprecated API methods that use
java.beanspackage in AllocationReporter and Debugger. New add/remove listener methods were introduced as a replacement. - FrameDescriptor no longer shares a lock with a RootNode.
- Added
TruffleLanguage.Env.isHostFunction. - Added Java interop support for converting executable values to legacy functional interfaces without a
@FunctionalInterfaceannotation. - Added
TruffleLogger.getLogger(String)to obtain the root logger of a language or instrument. - Introduced per language context policy. Languages are encouraged to configure the most permissive policy that they can support.
- Added
TruffleLanguage.areOptionsCompatibleto allow customization of the context policy based on options. - Changed default context policy from SHARED to EXCLUSIVE, i.e. there is one exclusive language instance per polyglot or inner context by default. This can be configured by the language using the context policy.
- TruffleInstrument.Env.lookup(LanguagInfo, Class) now requires to be entered in a context for the current thread.
- Removed deprecated FindContextNode (deprecated since 0.25).
- All languages now need to have a public zero argument constructor. Using a static singleton field is no longer supported.
- Renamed and changed the return value of the method for TruffleLanguage.initializeMultiContext to TruffleLanguage.initializeMultipleContexts. The original method remains but is now deprecated.
- Added SourceSectionFilter#includes
- Deprecating
FrameSlot#getKindandFrameSlot#setKindin favor ofFrameDescriptor#getFrameSlotKindandFrameDescriptor#setFrameSlotKind. - The
FrameDescriptoris now thread-safe from the moment it is first passed to a RootNode constructor.- The list returned by FrameDescriptor#getSlots no longer reflects future changes in the FrameDescriptor. This is an incompatible change.
- The set returned by FrameDescriptor#getIdentifiers no longer reflects future changes in the FrameDescriptor. This is an incompatible change.
- Added LanguageInfo#isInteractive
- Added DebugStackFrame#getLanguage
- Removed deprecated ResultVerifier.getDefaultResultVerfier.
- Deprecated
com.oracle.truffle.api.frame.FrameDescriptor.shallowCopyandcom.oracle.truffle.api.frame.FrameSlot.getFrameDescriptor - Added DebugValue#set to set primitive values to a debug value.
- Added support for logging in Truffle languages and instruments.
- Added notification when multiple language contexts were created for a language instance. Allows languages to invalidate assumptions only valid with a single context. Returning true also allows to enable caching of ASTs per language and not only per context.
- Added asBoxedGuestValue method that allows to expose host members for primitive interop values.
- Added default value
"inherit"to TruffleLanguage.Registration#version which makes the language to inherit version from Engine#getVersion. - Changed default value of TruffleInstrument.Registration#version from
""to"inherit"which makes the instrument to inherit version from Engine#getVersion. An instrument previously not specifying any version will newly get version from Engine. - Added new annotation @IncomingConverter and @OutgoingConverter to declare methods for generated wrappers that allow to convert values when they are exposed to or introduced by the instrumentation framework.
- The documentation of FrameDescriptor#getSize clarifies that it returns the size of an array which is needed for storing all the slots in it using their
FrameSlot#getIndex()as a position in the array. (The number may be bigger than the number of slots, if some slots are removed.) - Added an
InstrumentExceptionsAreThrownengine option to propagate exceptions thrown by instruments. - Added Instrumenter.visitLoadedSourceSections to be notified about loaded source sections that corresponds to a filter.
- Added DebugValue#canExecute to distinguish executable values and DebugValue#getProperty to get a property value by its name.
- Removed deprecated
TruffleLanguage.Env.lookupSymbolmethod. - All Truffle source objects are now automatically weakly internalized when created using the source builder. The source builder will now return the same instance for every source where it was previously just equal.
- Added
Source.Builder.cached(boolean)andSource.isCached()to configure caching behavior by source. - Removed deprecated
Source.getCode()andSourceSection.getCode.
- As announced in 0.27 all classes in package com.oracle.truffle.api.vm are now deprecated.
- Deprecated all classes in com.oracle.truffle.api.vm. Replacements can be found in the org.graalvm.polyglot package.
- Deprecated all classes in com.oracle.truffle.api.interop.java. Replacements for embedders can be found in org.graalvm.polyglot. Replacements for language implementations can be found in TruffleLanguage.Env. See deprecated documentation on the individual methods for details.
- Deprecated TruffleTCK. Use the new TCK instead.
- Deprecated Debugger#find(PolyglotEngine)
- Added Debugger#find(TruffleInstrument.Env) and Debugger#find(Engine)
- Added FileSystem SPI to allow embedder to virtualize TruffleLanguage Input/Output operations.
- Added EventContext.lookupExecutionEventNodes to lookup all execution event nodes created by the bindings at the source location.
- Added
TruffleLanguage#getLanguageHometo return the language directory in the GraalVM distribution or the location of the language Jar file. - Added TryBlockTag as a new standard tag to mark program locations to be considered as try blocks, that are followed by a catch.
- Added DebugException, debugger methods that execute guest language code throws that exception and it's possible to create exception breakpoints that suspend when guest language exception occurs.
- Added DebugStackTraceElement as a representation of exception stack trace.
- Added Breakpoint.Kind to distinguish different breakpoint kinds.
- Added ResultVerifier.getDefaultResultVerifier.
- Added addToHostClassPath method that can be used to allow guest language users to add to the host class path.
- Added new permission TruffleLanguage.Env#isNativeAccessAllowed to control access to the Truffle NFI.
- Changed default permissions in language launchers to full access. The embedding API still defaults to restricted access.
- Added TruffleInstrument.onFinalize that can be overridden to be notified about closing of Engine, while still having access to other instruments.
- Deprecated
TraceASTJSONoption and related APIs.
- This release contains major changes to the instrumentation framework.
- Deprecated @Instrumentable and replaced it with InstrumentableNode. Please see InstrumentableNode on how to specify instrumentable nodes in 0.32.
- Added @GenerateWrapper for automatic wrapper generation.
- Added a standard expression tag, that allows languages to expose expressions for tools to use.
- Added the ability to listen to input values of instrumentable child nodes by specifying input filters.
- Added the the ability to save and load instrumentable child input values in ExecutionEventNode subclasses.
- Renamed Instrumenter#attachListener/Factory to Instrumenter#attachExecutionEventListener/Factory. (jackpot rule available)
- Automatic instrumentation wrapper generation now delegates non execute abstract methods to the delegate node.
- Added a Tag base class now required to be used by all tags.
- Added tag identifiers to allow the lookup of language specific tags in tools without compile time dependency to the languguage.
- Added assertions to verify that instrumentable nodes that are annotated with a standard tag return a source section if their root node returns a source section.
- Added assertions to verify that execution events always return interop values.
- Added the ability for instrumentable nodes to a expose a node object. This object is intended to contain language specific properties of the node.
- Added expression-stepping into debugger APIs. To support debugging of both statements and expressions, following changes were made:
- Added SourceElement enum to provide a list of source syntax elements known to the debugger.
- Added StepConfig class to represent a debugger step configuration.
- Added Debugger.startSession() accepting a list of source elements to enable stepping on them.
- Added Breakpoint.Builder.sourceElements to specify which source elements will the breakpoint adhere to.
- Added SuspendedEvent.getInputValues to get possible input values of the current source element.
- Removed deprecated methods on SuspendedEvent.
- Added column filters on SourceSectionFilter.Builder and Breakpoint.Builder.
- Added Instrumenter.attachExecuteSourceListener to be able to listen on source execution events.
- Added InstrumentableNode.findNearestNodeAt to be able to find the nearest tagged node to the given source character index. This is used to auto-correct breakpoint locations.
- Added Breakpoint.ResolveListener to listen on breakpoint location resolution. Breakpoints are now resolved after the source is to be executed for the first time and breakpoint location is adjusted to match the nearest instrumentable node.
- Added new DSL annotation @Executed that allows to manually specify executed node fields.
- The Truffle Node traversal order was slightly changed to always respect field declaration order (super class before sub class).
- The Assumption interface has an additional override for the
invalidatemethod to provide a message for debugging purposes. - Deprecated
KeyInfo.Builder. Use bitwise constants in the KeyInfo class instead. Introduced new flag KeyInfo.INSERTABLE to indicate that a key can be inserted at a particular location, but it does not yet exist. - Deprecated
TruffleLanguage#getLanguageGlobal, implement top scopes instead. - Deprecated
TruffleLanguage#findExportedSymbol, use the polyglot bindings TruffleLanguage.Env for exporting symbols into the polyglot scope explicitly. The polyglot scope no longer supports implicit exports, they should be exposed using top scopes instead. - Remove deprecated
TruffleInstrument#describeOptionsand TruffleLanguage#describeOptions - Remove deprecated
TruffleLanguage.Env#lookupSymbolwithout replacement. - Remove deprecated
TruffleLanguage.Env#importSymbols, use the polyglot bindings instead. - Removed deprecated APIs and public debug classes in truffle.api.object and truffle.object packages, respectively.
- Removed internal truffle.object package from javadoc.
- Added the compiler directive castExact.
- Added skipped exception types:
IndexOutOfBoundsException,BufferOverflowException, andBufferUnderflowException. - Introduced support for the experimental automated monomorphization feature:
- The Node.reportPolymorphicSpecialize method which notifies the runtime that a node has specialized to a more polymorphic state.
- The ReportPolymorphism and ReportPolymorphism.Exclude annotations which the DSL uses to generate (or not generate) calls to Node.reportPolymorphicSpecialize.
- Added
TruffleException.getSourceLocation()for syntax errors which don't have aNode. - Changed member lookup on
Classhost objects (as obtained by e.g.obj.getClass()) to exposeClassinstance members, whileTruffleLanguage.Env.lookupHostSymbol(String)returns a companion object providing the static members of the class and serving as a constructor.
- Added SuspendAnchor enum class that describes where, within a guest language source section, the suspend position is and Breakpoint.Builder.suspendAnchor() to be able to break before or after the source section.
- Deprecated
SuspendedEvent.isHaltedBefore(), SuspendedEvent.getSuspendAnchor() is to be used instead. - Added new interop message REMOVE with the appropriate foreign access methods ForeignAccess.sendRemove and KeyInfo.isRemovable flag.
- Added SourceFilter for source-only based filtering in instrumentation.
- Changed semantics of UnexpectedResultException when used in Specialization#rewriteOn to indicate that a result is already available and no other specialization methods need to be invoked in Truffle DSL.
- Removed deprecated
com.oracle.truffle.api.source.LineLocationclass. - Added
RootNode#isCaptureFramesForTrace()to allow subclasses to configure capturing of frames inTruffleExceptioninstances andTruffleStackTraceElement#getFrame()to access the captured frames. - MaterializedFrame changed to extend VirtualFrame, to be able to call methods taking
VirtualFramefrom behind Truffle boundary. - Added ExecutableNode, TruffleLanguage.parse(InlineParsingRequest) and TruffleInstrument.Env.parseInline to parse an inline code snippet at the provided location and produce an AST fragment that can be executed using frames valid at the provided location.
ParsingRequest.getLocation()andParsingRequest.getFrame()methods were deprecated in favor ofInlineParsingRequest,EventContext.parseInContext()was deprecated in favor ofTruffleInstrument.Env.parseInline(). - RootNode now extends ExecutableNode.
- Removed deprecated methods
TruffleLanguage.parse(Source, Node, String...)andTruffleLanguage.evalInContext(Source, Node, MaterializedFrame)and constructorRootNode(Class, SourceSection, FrameDescriptor). - Java Interop now wraps exceptions thrown by Java method invocations in host exceptions.
- Added JavaInterop.isHostException and JavaInterop.asHostException to identify and unwrap host exceptions, respectively.
- Added support for
TruffleLanguagecontext pre-initialization in the native image. To support context pre-initialization a language has to implement the patchContext method. - The profiler infrastructure (
CPUSampler,CPUTracerandMemoryTracer) moved to a new tools suite. - Added LanguageInfo.isInternal
- Removed special Java interop support for
java.util.Map. - Added a mechanism to unwind execution nodes in instrumentation by EventContext.createUnwind, ExecutionEventListener.onUnwind, ExecutionEventNode.onUnwind and ProbeNode.onReturnExceptionalOrUnwind. ProbeNode.UNWIND_ACTION_REENTER constant added.
- Deprecated
ProbeNode.onReturnExceptional()in favor ofProbeNode.onReturnExceptionalOrUnwind(). - The wrapper node specification has changed, see ProbeNode. If the annotation processor is used (
@Instrumentableannotation) then just a recompile is required. Manually written wrappers need to be updated. - Added SuspendedEvent.prepareUnwindFrame to unwind frame(s) during debugging.
- Added DebuggerTester constructor that takes
Context.Builder. - Removed deprecated DebuggerTester constructor that takes the legacy
PolyglotEngine.Builder. - Removed deprecated methods in
JavaInterop:isNull,isArray,isBoxed,unbox,getKeyInfo. - Disallowed
nullasFrameSlotidentifier. - Removed deprecated
FrameSlotconstructor andFrameDescriptor.createmethods. - Changed the behavior of exception handling (TruffleException) to capture stack frames lazily
- Truffle languages are being finalized before disposal. This allows languages to run code with all languages still in a valid state. It is no longer allowed to access other languages during language disposal.
- Truffle languages can now declare dependent languages. This allows to take influence on the disposal order.
- All classes of the com.oracle.truffle.api.metadata package were deprecated. As a replacement use Scope, TruffleLanguage.findLocalScopes and TruffleInstrument.Env.findLocalScopes instead.
- Added the ability to access top scopes of languages and exported symbols of the polyglot scope using the instrumentation API.
- Added the ability to access top scopes and exported symbols using the debugger API.
- Added the and method to the SourceSectionFilter Builder which allows composing filters.
- Added the new profiler infrastructure, including the CPU sampler, CPU tracer and an experimental Memory tracer.
- Added a new TCK SPI based on the org.graalvm.polyglot API to test a language inter-operability. To test the language inter-operability implement the LanguageProvider.
- Removed all deprecated API in com.oracle.truffle.api.dsl.
- New interop messages HAS_KEYS and IS_INSTANTIABLE added, with the appropriate foreign access methods ForeignAccess.sendHasKeys and ForeignAccess.sendIsInstantiable.
- New interop foreign access factory ForeignAccess.StandardFactory replaces the version-specific factories, the deprecated ForeignAccess.Factory10 and ForeignAccess.Factory18 were removed, ForeignAccess.Factory26 was deprecated.
- @MessageResolution automatically applies default value to boolean HAS/IS messages depending on presence of message handlers of corresponding messages.
- Added instrumentation API for listening on contexts and threads changes: Instrumenter.attachContextsListener, ContextsListener, Instrumenter.attachThreadsListener and ThreadsListener.
- Added debugger representation of a context DebugContext and API for listening on contexts and threads changes: DebuggerSession.setContextsListener, DebugContextsListener, DebuggerSession.setThreadsListener and DebugThreadsListener.
- Added TruffleContext.getParent to provide the hierarchy of inner contexts.
- Added TruffleLanguage.Env.getContext for use by language implementations to obtain the environment's polyglot context.
- SourceSectionFilter.Builder.includeInternal added to be able to exclude internal code from instrumentation.
- Debugger step filtering is extended with include of internal code and source filter. By default, debugger now does not step into internal code, unless a step filter that is set to include internal code is applied.
- DebugScope.getSourceSection added to provide source section of a scope.
4-Oct-2017
- Truffle languages may support access to contexts from multiple threads at the same time. By default the language supports only single-threaded access.
- Languages now need to use the language environment to create new threads for a context. Creating Threads using the java.lang.Thread constructor is no longer allowed and will be blocked in the next release.
- Added
JavaInterop.isJavaObject(Object)method overload. - Deprecated helper methods in
JavaInterop:isNull,isArray,isBoxed,unbox,getKeyInfo. ForeignAccess already provides equivalent methods:sendIsNull,sendIsArray,sendIsBoxed,sendUnbox,sendKeyInfo, respectively. - Deprecated all String based API in Source and SourceSection and replaced it with CharSequence based APIs. Automated migration with Jackpot rules is available (run
mx jackpot --apply). - Added Source.Builder.language and Source.getLanguage to be able to set/get source language in addition to MIME type.
- Added the inCompilationRoot compiler directive.
- Deprecated TruffleBoundary#throwsControlFlowException and introduced TruffleBoundary#transferToInterpreterOnException.
16-Aug-2017
- The Truffle API now depends on the Graal SDK jar to also be on the classpath.
- Added an implementation of org.graalvm.polyglot API in Truffle.
- API classes in com.oracle.truffe.api.vm package will soon be deprecated. Use the org.graalvm.polyglot API instead.
- Added SourceSectionFilter.Builder.
rootNameIs(Predicate<String>)to filter for source sections based on the name of the RootNode. - Added AllocationReporter as a service for guest languages to report allocation of guest language values.
- Added Instrumenter.attachAllocationListener, AllocationEventFilter, AllocationListener and AllocationEvent for profilers to be able to track creation and size of guest language values.
- Added RootNode.getCurrentContext, TruffleLanguage.getCurrentLanguage(Class), TruffleLanguage.getCurrentContext(Class) to allow static lookups of the language and context.
- Added an id property to TruffleLanguage.Registration to specify a unique identifier for each language. If not specified getName().toLowerCase() will be used. The registration id will be mandatory in future releases.
- Added an internal property to TruffleLanguage.Registration to specify whether a language is intended for internal use only. For example the Truffle Native Function Interface is a language that should be used from other languages only.
- Added an internal property to TruffleInstrument.Registration to specify whether a internal is intended for internal use by other instruments or languages only.
- Added the ability to describe options for languages and instruments using TruffleLanguage.getOptionDescriptors() and TruffleInstrument.getOptionDescriptors. User provided options are available to the language using TruffleLanguage.Env.getOptions() and TruffleInstrument.Env.getOptions().
- Added JavaInterop.isJavaObject(TruffleObject) and JavaInterop.asJavaObject(TruffleObject) to check and convert back to host language object from a TruffleObject.
- Added TruffleException to allow languages to throw standardized error information.
- Guest language stack traces are now collected automatically for each exception thrown and passed through a CallTarget.
- Added RootNode.isInternal to indicate if a RootNode is considered internal and should not be shown to the guest language programmer.
- Added TruffleLanguage.lookupSymbol to be implemented by languages to support language agnostic lookups in the top-most scope.
- Added TruffleLanguage.Env.getApplicationArguments() to access application arguments specified by the user.
- Added @Option annotation to allow simple declaration of options in TruffleLanguage or TruffleInstrument subclasses.
- Added TruffleLanguage.RunWithPolyglotRule JUnit rule to allow running unit tests in the context of a polyglot engine.
- Added implementationName property to TruffleLanguage.Registration to specify a human readable name of the language implementation name.
- Added TruffleLanguage.Env.lookupSymbol(String) to be used by other languages to support language lookups in their top-most scope.
- Added TruffleLanguage.Env.lookupHostSymbol(String) to be used by other languages to support language lookups from the host language.
- Added TruffleLanguage.Env.isHostLookupAllowed() to find out whether host lookup is generally allowed.
- Added Node#notifyInserted(Node) to notify the instrumentation framework about changes in the AST after the first execution.
- Added TruffleLanguage.Env.newContextBuilder() that allows guest languages to create inner language contexts/environments by returning TruffleContext instances.
- Added a concept of breakpoints shared across sessions, associated with Debugger instance: Debugger.install, Debugger.getBreakpoints and a possibility to listen on breakpoints changes: Debugger.PROPERTY_BREAKPOINTS, Debugger.addPropertyChangeListener and Debugger.removePropertyChangeListener. Breakpoint.isModifiable added to be able to distinguish the shared read-only copy of installed Breakpoints.
- TruffleInstrument.Env.getLanguages() returns languages by their IDs instead of MIME types when the new polyglot API is used.
- Deprecated ExactMath.addExact(int, int), ExactMath.addExact(long, long), ExactMath.subtractExact(int, int), ExactMath.subtractExact(long, long), ExactMath.multiplyExact(int, int), ExactMath.multiplyExact(long, long). Users can replace these with java.lang.Math utilities of same method names.
18-May-2017
- Language can provide additional services and instruments can look them up.
- Renamed
DebugValue.isWriteableto DebugValue.isWritable to fix spelling. - Breakpoint.setCondition does not throw the IOException any more.
- Added new message Message.KEY_INFO, and an argument to Message.KEYS specifying whether internal keys should be provided. The appropriate foreign access ForeignAccess.sendKeyInfo, ForeignAccess.sendKeys and a new factory ForeignAccess.Factory26.
- A new KeyInfo utility class added to help with dealing with bit flags.
- Added new Java interop utility methods: JavaInterop.getKeyInfo and JavaInterop.getMapView.
- Added metadata package, intended for APIs related to guest language structure and consumed by tools.
- Added ScopeProvider to provide a hierarchy of scopes enclosing the given node. The scopes are expected to contain variables valid at the associated node.
- Added Scope for instruments to get a list of scopes enclosing the given node. The scopes contain variables valid at the provided node.
- Added DebugScope, DebugStackFrame.getScope and DebugValue.getScope to allow debuggers to retrieve the scope information and associated variables.
- Deprecated DebugStackFrame.iterator and DebugStackFrame.getValue, DebugStackFrame.getScope is to be used instead.
- Added Cached.dimensions() to specify compilation finalness of cached arrays.
- SuspendedEvent.prepareStepOut has a
stepCountargument for consistency with other prepare methods. The no-argument method is deprecated. - Multiple calls to
SuspendedEvent.prepare*()methods accumulate the requests to create a composed action. This allows creation of debugging meta-actions. - JavaInterop.toJavaClass can find proper Java class for a wrapped object
- Added environment methods TruffleLanguage.Env.getLanguages(), TruffleLanguage.Env.getInstruments(), TruffleInstrument.Env.getLanguages(), TruffleInstrument.Env.getInstruments() that allows languages or instruments to inspect some basic information about other installed languages or instruments.
- Added lookup methods TruffleLanguage.Env.lookup(LanguageInfo, Class), TruffleLanguage.Env.lookup(InstrumentInfo, Class), TruffleInstrument.Env.lookup(LanguageInfo, Class) and TruffleInstrument.Env.lookup(InstrumentInfo, Class) that allows the exchange of services between instruments and languages.
- Added EventContext.isLanguageContextInitialized to be able to test language context initialization in instruments.
- Added SuspensionFilter class, DebuggerSession.setSteppingFilter and SuspendedEvent.isLanguageContextInitialized to be able to ignore language context initialization during debugging.
3-Apr-2017
- Added Instrumenter.attachOutConsumer and Instrumenter.attachErrConsumer to receive output from executions run in the associated PolyglotEngine.
- JavaInterop.asTruffleObject lists methods as keys
- Deprecated
TypedObjectinterface - Added PolyglotRuntime for global configuration and to allow engines share resources. The runtime of a PolyglotEngine can be configured using PolyglotEngine
.newBuilder().runtime(runtime).build(). - The
getInstruments()method has been moved from the PolyglotEngine to PolyglotRuntime. - TruffleLanguage now requires a public default constructor instead of a singleton field named INSTANCE.
- TruffleLanguage now requires a public no argument constructor instead of a singleton field named INSTANCE.
- The TruffleLanguage instance can now be used to share code and assumptions between engine instances. See the TruffleLanguage javadoc for details.
- Added a new constructor to RootNode with a TruffleLanguage instance as argument. The current constructor was deprecated.
- Added RootNode.getLanguage(Class) to access the current language implementation instance.
- Added RootNode.getLanguageInfo to access public information about the associated language.
- Added TruffleLanguage.ContextReference class and TruffleLanguage.getContextReference.
- Added Value.getMetaObject and Value.getSouceLocation
- Deprecated RootNode.getExecutionContext
- Deprecated TruffleLanguage.createFindContextNode and TruffleLanguage.findContext.
- Deprecated Node.getLanguage.
- Deprecated MessageResolution.language without replacement. (jackpot rule available)
- Deprecated ExecutionContext, use RootNode#getCompilerOptions().
- Added TruffleInstrument.Registration.services() to support declarative registration of services
- Deprecated internal class DSLOptions. Will be removed in the next release.
- Deprecated Shape.getData() and ObjectType.createShapeData(Shape) without replacement.
- Added TruffleRunner JUnit runner for unit testing Truffle compilation.
1-Mar-2017
- Added possibility to activate/deactivate breakpoints via DebuggerSession.setBreakpointsActive and get the active state via DebuggerSession.isBreakpointsActive.
- Deprecated the send methods in ForeignAccess and added a a new version that does not require a frame parameter. (Jackpot rule for automatic migration available)
- Made @NodeChild and @NodeField annotations repeatable
- Added Truffle Native Function Interface.
- Abstract deprecated methods in NodeClass have default implementation
- Added RootNode.cloneUninitialized that allows an optimizing runtime to efficiently create uninitialized clones of root nodes on demand.
1-Feb-2017
- Incompatible: Removed most of deprecated APIs from the com.oracle.truffle.api.source package.
- Enabled the new flat generated code layout for Truffle DSL as default. To use it just recompile your guest language with latest Truffle annotation processor. The new layout uses a bitset to encode the states of specializations instead of using a node chain for efficiency. The number of specializations per operation is now limited to 127 (with no implicit casts used). All changes in the new layout are expected to be compatible with the old layout. The optimization strategy for implicit casts and fallback handlers changed and might produce different peak performance results.
- Deprecated the frame argument for IndirectCallNode and DirectCallNode. The frame argument is no longer required.
- Deprecated FrameInstance.getFrame(FrameAccess, boolean). Usages need to be replaced by FrameInstance.getFrame(FrameAccess). The slowPath parameter was removed without replacement.
- Deprecated FrameAccess.NONE without replacement.
- FrameInstance.getFrame now throws an AssertionError if a local variable of a frame was written in READ_ONLY frame access mode.
13-Jan-2017
- TruffleLanguage.isVisible allows languages to control printing of values in interactive environments
- PolyglotEngine
.findGlobalSymbolsthat returnsIterable - TruffleLanguage
.importSymbolsthat returnsIterable - RootNode.setCallTarget is deprecated
- Generic parsing method TruffleLanguage.
parse(ParsingRequest)replaces now deprecated multi-argumentparsemethod. - Added TruffleLanguage.findMetaObject and DebugValue.getMetaObject to retrieve a meta-object of a value.
- Added TruffleLanguage.findSourceLocation and DebugValue.getSourceLocation to retrieve a source section where a value is declared.
- Added TruffleLanguage.Registration.interactive() and PolyglotEngine.Language.isInteractive() to inform about language interactive capability
- Deprecated the @Specialization contains attribute and renamed it to replaces.
- Deprecated @ShortCircuit DSL annotation without replacement. It is recommended to implement short circuit nodes manually without using the DSL.
- Added Truffle DSL introspection API that provides runtime information for specialization activation and cached data.
6-Dec-2016
- Added Source.isInteractive() to inform languages of a possibility to use polyglot engine streams during execution.
- Unavailable SourceSections created by different calls to createUnavailableSection() are no longer equals(). This means builtins can share a single Source and call createUnavailableSection() for each builtin to be considered different in instrumentation.
23-Nov-2016
- Deprecated Node.getAtomicLock() and replaced it with Node.getLock() which returns a Lock.
- Switching the source and target levels to 1.8
- Significant improvements in Java/Truffle interop
27-Oct-2016
- New helper methods in JavaInterop:
isArray,isBoxed,isNull,isPrimitive,unbox,asTruffleValue. - Relaxed the restrictions for calling methods on SuspendedEvent and DebugStackFrame from other threads than the execution thread. Please see the javadoc of the individual methods for details.
1-Oct-2016
- Added Instrumenter.querySourceSections(SourceSectionFilter) to get a filtered list of loaded instances.
- Added SourceSectionFilter.ANY, which always matches.
- Added Message.KEYS to let languages enumerate properties of its objects
- Deprecated LineLocation, SourceSection.getLineLocation(), Source.createLineLocation(int) without replacement.
- Deprecated SourceSection.getShortDescription(); users can replace uses with their own formatting code.
- Deprecated SourceSection.createUnavailable(String, String) and replaced it with.
- Added Source.createUnavailableSection(), SourceSection.isAvailable() to find out whether a source section is available.
- SourceSection.createSourceSection(int,int) now only throws IllegalArgumentExceptions if indices that are out of bounds with the source only when assertions (-ea) are enabled.
- Deprecated Source.createSection(int, int, int, int)
1-Sep-2016
-
This release removes many deprecated APIs and is thus slightly incompatible
- Remove deprecated instrumentation API package
com.oracle.truffle.api.instrumentand all its classes. - Remove deprecated API method TruffleLanguage
.isInstrumentable(Node),TruffleLanguage.getVisualizer(),TruffleLanguage.createWrapperNode(),TruffleLanguage.Env.instrumenter(),RootNode.applyInstrumentation() - Remove deprecated API Debugger
.setTagBreakpoint - Remove deprecated API RootNode
.applyInstrumentation - Remove deprecated tagging API in SourceSection and Source.
- Remove deprecated instrumentation API package
-
PolyglotEngine
evalmethod and few similar ones no longer declarethrows IOException. The I/O now only occurs when operating with Source. The evaluation of already loaded sources doesn't need to perform any I/O operations and thus it makes little sense to require callers to handle theIOException. This change is binary compatible, yet it is source incompatible change. You may need to adjust your sources to compile. -
Deprecate support for the "identifier" associated with each SourceSection
-
Deprecated
PolyglotEngine.Builder.onEvent(EventConsumer)and classEventConsumer, debugger events are now dispatched using theDebuggerSession. -
@Fallback does not support type specialized arguments anymore.
-
All debugging APIs are now thread-safe and can be used from other threads.
-
Changed the debugging API to a session based model.
- Added Debugger
.find(TruffleLanguage.Env)to lookup the debugger when inside a guest language implementation. - Added Debugger
.startSession(SuspendedCallback)to start a new debugging session using a SuspendedCallback as replacement forExecutionEvent.prepareStepInto(). - Added class DebuggerSession which represents a debugger session where breakpoints can be installed and the execution can be suspended and resumed.
- Added Breakpoint
.newBuildermethods to create a new breakpoint using the builder pattern based on Source, URI or SourceSections. - Added Breakpoint
.isResolved()to find out whether the source location of a breakpoint is loaded by the guest language. - Added Breakpoint
.isDisposed()to find out whether a breakpoint is disposed. - Added SuspendedEvent
.getReturnValue()to get return values of calls during debugging. - Added SuspendedEvent
.getBreakpoints()to return the breakpoints that hit for a suspended event. - Added SuspendedEvent
.getStackFrames()to return all guest language stack frames. - Added SuspendedEvent
.getTopStackFrame()to return the topmost stack frame. - Added SuspendedEvent
.getSourceSection()to return the current guest language execution location - Added SuspendedEvent
.getSourceSections()to return all guest language execution locations of the current method in the AST. - Added class DebugStackFrame which represents a guest language stack frame. Allows to get values from the current stack frame, access stack values and evaluate inline expressions.
- Added class DebugValue which represents a value on a stack frame or the result of an evaluated expression.
- Added class DebuggerTester which represents a utility for testing guest language debugger support more easily.
- Deprecated Breakpoint
.getCondition()and replaced it with Breakpoint.getConditionExpression()to return a String instead of a Source object. - Deprecated Breakpoint
.setCondition(String)and replaced it with Breakpoint.setConditionExpression(String)to avoid throwing IOException. - Deprecated class
ExecutionEventand replaced it with Debugger.startSession(SuspendedCallback) - Deprecated Debugger methods setLineBreakpoint, getBreakpoints, pause. Replacements are available in the DebuggerSession class
- Deprecated Breakpoint
.getState()to be replaced with BreakpointisResolved(), BreakpointisDisposed() and Breakpoint.isEnabled(). - Deprecated SuspendedEvent
.getNode()and SuspendedEvent.getFrame() without direct replacement. - Deprecated SuspendedEvent
.getRecentWarnings()and replaced it with SuspendedEvent.getBreakpointConditionException(Breakpoint) - Deprecated SuspendedEvent
.evaland replaced it withDebugStackFrame.eval(String) - Deprecated SuspendedEvent
.getStack()and replaced it with SuspendedEvent.getStackFrames() - Deprecated SuspendedEvent
.toString(Object, FrameInstance)and replaced it withDebugValue.as(String.class).
- Added Debugger
-
TruffleLanguage.createContext supports post initialization callback
-
Added SourceSectionFilter.Builder.
sourceIs(SourcePredicate)to filter for source sections with a custom source predicate. -
Added TruffleInstrument.Env.
isEngineRoot(RootNode)to find out where the context of the current evaluation ends when looking up the guest language stack trace withTruffleRuntime.iterateFrames(). -
Added TruffleInstrument.Env.
toString(Node, Object)to allow string conversions for objects given a Node to identify the guest language. -
Added EventContext.
lookupExecutionEventNode(EventBinding)to lookup other execution event nodes using the binding at a source location. -
Added Node.getAtomicLock() to allow atomic updates that avoid creating a closure.
- Layout
now accepts an alternative way to construct an object with the
buildmethod instead ofcreate. - TruffleTCK tests simple operation on foreign objects. For example, a simple WRITE access, a HAS_SIZE access, or an IS_NULL access. It also tests the message resolution of Truffle language objects, which enables using them in other languages.
1-Jul-2016
- Source shall be
constructed via its
newBuildermethods. The other ways to construct or modify source objects are now deprecated. - RootNode.getName to provide name of a method or function it represents.
- Instruments are now loaded eagerly - which has been reported as an observable behavioral change.
- The Instrumenter now allows one to observe when sources and source sections are being loaded via attaching a listener.
- Control the way loops are exploded with a new LoopExplosionKind enum.
- SuspendedEvent provides a way to convert any value on stack to its string representation.
- TruffleTCK checks whether languages properly support being interrupted after a time out
- Language implementations are encouraged to mark their internal sources as internal
2-Jun-2016
- Source has been rewritten to be more immutable. Once (part of) content of a source is loaded, it cannot be changed.
- Methods
fromNamedAppendableText,fromNamedTextandsetFileCachingofSourcehas been deprecated as useless or not well defined - New method
Source.getURI() has been introduced and should be used as a persistent identification ofSourcerather than existinggetName()& co. methods. Debugger is using theURIto attach breakpoints to not yet loaded sources - Debugger introduces new halt tag to
make it easier to simulate concepts like JavaScript's
debuggerstatement - Debugger can be paused via the Debugger.pause method
- @CompilationFinal annotation can now specify whether the finality applies to array elements as well
- TruffleTCK has been enhanced to test behavior of languages with respect to foreign array objects
22-Apr-2016
AcceptMessagehas been deprecated, replaced by MessageResolution & co. annotations. Now all message-oriented annotations need to be placed in a single source file. That simplifies readability as well as improves incremental compilation in certain systems.- Deprecated
Node.assignSourceSectionremoved. This reduces the amount of memory occupied by Node instance. PolyglotEngine.Value.executeis now as fast as directCallTarget.call. Using the PolyglotEngine abstraction now comes with no overhead. Just JPDA debuggers need to turn debugging on explicitly.- Sharing of efficient code/AST between multiple instances of
PolyglotEngine
is possible. Using more than one
PolyglotEngineresulted in code de-opt previously. That isn't the case anymore. Future version of the API will provide explicit control over the set of engines that share the code. - Simple language JAR no longer contains test classes. There is a separate simple language tests distribution.
- The Instrumentation Framework has been revised and has new APIs that are integrated into the PolyglotEngine.
- Instrumentation support required of language implementations is specified as abstract methods on TruffleLanguage.
- Clients access instrumentation services via an instance of Instrumenter, provided by the Polyglot framework.
TruffleRuntime#iterateFramesnow starts at the current frame.
28-Jan-2016
- Improved interop API
- PolyglotEngine.Builder.getConfig
- TruffleLanguage.Env.isMimeTypeSupported
18-Dec-2015
- Profile API classes moved into its own com.oracle.truffle.api.profiles package
21-Oct-2015
- Debugger API
17-Jul-2015, Repository Revision
- The Truffle repository no longer contains Graal
- PolyglotEngine is an entry point for creating, building and running multi language Truffle systems
- Implement TruffleLanguage and use @Registration to register your language into the Truffle polyglot system
- Include Truffle TCK (test compatibility kit) into your test cases to verify your language implementation is compliant enough
- Interoperability API polished
- Cleanup of Source related API
29-Apr-2015, Repository Revision
- New, faster partial evaluation (no more TruffleCache).
- If a method is annotated with @ExplodeLoop and contains a loop that can not be exploded, partial evaluation will fail.
- Truffle background compilation is now multi-threaded.
- Experimental merge=true flag for @ExplodeLoop allows building bytecode-based interpreters (see BytecodeInterpreterPartialEvaluationTest).
- Added Node#deepCopy as primary method to copy ASTs.
- Disable inlining across Truffle boundary by default. New option TruffleInlineAcrossTruffleBoundary default false.
- Node.replace(Node) now guards against non-assignable replacement, and Node.isReplacementSafe(Node) checks in advance.
- Instrumentation: AST "probing" is now safe and implemented by Node.probe(); language implementors need only implement Node.isInstrumentable() and Node.createWrapperNode().
- Instrumentation: A new framework defines a category of simple "instrumentation tools" that can be created, configured, and installed, after which they autonomously collect execution data of some kind.
- Instrumentation: A new example "instrumentation tool" is a language-agnostic collector of code coverage information (CoverageTracker); there are two other examples.
- Removed unsafe compiler directives; use
sun.misc.Unsafeinstead. - Removed
Node#onAdopt(). - Implemented a new generated code layout that reduces the code size.
- Changed all methods enclosed in a @TypeSystem must now be static.
- Changed all methods enclosed in generated type system classes are now static.
- Deprecated the type system constant used in the generated type system classes.
- Changed NodeFactory implementations are no longer generated by default. Use {Node}Gen#create instead of {Node}Factory#create to create new instances of nodes.
- Added @GenerateNodeFactory to generate NodeFactory implementations for this node and its subclasses.
- Deprecated @NodeAssumptions for removal in the next release.
- Deprecated experimental @Implies for removal in the next release.
- Added new package c.o.t.api.dsl.examples to the c.o.t.api.dsl project containing documented and debug-able Truffle-DSL use cases.
- Changed "typed execute methods" are no longer required for use as specialization return type or parameter. It is now sufficient to declare them in the @TypeSystem.
- Added @Cached annotation to express specialization local state.
- Added Specialization#limit to declare a limit expression for the maximum number of specialization instantiations.
- Changed syntax and semantics of Specialization#assumptions and Specialization#guards. They now use a Java like expression syntax.
- Changed guard expressions that do not bind any dynamic parameter are invoked just once per specialization instantiation. They are now asserted to be true on the fast path.
- Renamed @ImportGuards to @ImportStatic.
- Changed declaring a @TypeSystemReference for a node that contains specializations is not mandatory anymore.
- Changed types used in specializations are not restricted on types declared in the type system anymore.
- Changed nodes that declare all execute methods with the same number of evaluated arguments as specialization arguments do not require @NodeChild annotations anymore.
- Changed types used in checks and casts are not mandatory to be declared in the type system.
19-Dec-2014, Repository Revision
- Instrumentation: add Instrumentable API for language implementors, with most details automated (see package
com.oracle.truffle.api.instrument). - The BranchProfile constructor is now private. Use BranchProfile#create() instead.
- Renamed @CompilerDirectives.SlowPath to @CompilerDirectives.TruffleBoundary
- Renamed RootNode#isSplittable to RootNode#isCloningAllowed
- Removed RootNode#split. Cloning ASTs for splitting is now an implementation detail of the Truffle runtime implementation.
- Renamed DirectCallNode#isSplittable to DirectCallNode#isCallTargetCloningAllowed
- Renamed DirectCallNode#split to DirectCallNode#cloneCallTarget
- Renamed DirectCallNode#isSplit to DirectCallNode#isCallTargetCloned
- Added PrimitiveValueProfile.
- Added -G:TruffleTimeThreshold=5000 option to defer compilation for call targets
- Added RootNode#getExecutionContext to identify nodes with languages
- Removed
FrameTypeConversioninterface and changed the correspondingFrameDescriptorconstructor to have a default value parameter instead. - Removed
CompilerDirectives.unsafeFrameCast(equivalent to a(MaterializedFrame)cast). - Added
TruffleRuntime#getCapabilityAPI method. - Added
NodeInterfaceand allowed child field to be declared with interfaces that extend it. - Added
CompilerOptionsand allowed it to be set forExecutionContextandRootNode. - Added experimental object API (see new project
com.oracle.truffle.api.object).
23-Sep-2014, Repository Revision
- Added
TruffleRuntime#getCallTargets()to get all call targets that were created and are still referenced. - Added
NeverValidAssumptionto complementAlwaysValidAssumption. - Fixed a bug in
AssumedValuethat may not invalidate correctly. - New option,
-G:+/-TruffleCompilationExceptionsAreThrown, that will throw anOptimizationFailedExceptionfor compiler errors.
19-Aug-2014, Repository Revision
- Change API for stack walking to a visitor:
TruffleRuntime#iterateFramesreplacesTruffleRuntime#getStackTrace - New flag
-G:+TraceTruffleCompilationCallTreeto print the tree of inlined calls before compilation. truffle.jar: strip out build-time only dependency into a separated JAR file (truffle-dsl-processor.jar)- New flag
-G:+TraceTruffleCompilationASTto print the AST before compilation. - New experimental
TypedObjectinterface added. - Added
isVisitedmethod forBranchProfile. - Added new
ConditionProfile,BinaryConditionProfileandCountingConditionProfileutility classes to profile if conditions.
9-May-2014, Repository Revision
- The method
CallTarget#calltakes now a variable number of Object arguments. - Support for collecting stack traces and for accessing the current frame in slow paths (see
TruffleRuntime#getStackTrace). - Renamed
CallNodetoDirectCallNode. - Renamed
TruffleRuntime#createCallNodetoTruffleRuntime#createDirectCallNode. - Added
IndirectCallNodefor calls with a changingCallTarget. - Added
TruffleRuntime#createIndirectCallNodeto create anIndirectCallNode. DirectCallNode#inlinewas renamed toDirectCallNode#forceInlining().- Removed deprecated
Node#adoptChild.
25-Mar-2014, Repository Revision
- New API
TruffleRuntime#createCallNodeto create call nodes and to give the runtime system control over its implementation. - New API
RootNode#getCachedCallNodesto get a weak set ofCallNodes that have registered to call theRootNode. - New API to split the AST of a call-site context sensitively.
CallNode#split,CallNode#isSplittable,CallNode#getSplitCallTarget,CallNode#getCurrentCallTarget,RootNode#isSplittable,RootNode#split. - New API to inline a call-site into the call-graph.
CallNode#isInlinable,CallNode#inline,CallNode#isInlined. - New API for the runtime environment to register
CallTargets as caller to theRootNode.CallNode#registerCallTarget. - Improved API for counting nodes in Truffle ASTs.
NodeUtil#countNodescan be used with aNodeFilter. - New API to declare the cost of a Node for use in runtime environment specific heuristics. See
NodeCost,Node#getCostandNodeInfo#cost. - Changed
Node#replacereason parameter type toCharSequence(to enable lazy string building) - New
Node#insertmethod for inserting new nodes into the tree (formerlyadoptChild) - New
Node#adoptChildrenhelper method that adopts all (direct and indirect) children of a node - New API
Node#atomicfor atomic tree operations - Made
Node#replacethread-safe
5-Feb-2014, Repository Revision
- Initial version of a multi-language framework on top of Graal.