Update dependency org.graalvm.truffle:truffle-api to v24
This MR contains the following updates:
| Package | Type | Update | Change |
|---|---|---|---|
| org.graalvm.truffle:truffle-api (source) | compile | major |
22.3.4 -> 24.1.1
|
⚠ ️ WarningSome dependencies could not be looked up. Check the warning logs for more information.
Release Notes
oracle/graal (org.graalvm.truffle:truffle-api)
v24.1.0
- 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.
v24.0.0
- GR-45863 Yield and resume events added to the instrumentation:
-
ExecutionEventListener.onYield()andExecutionEventNode.onYield()is invoked on a yield of the current thread -
ExecutionEventListener.onResume()andExecutionEventNode.onResume()is invoked on a resume of the execution on the current thread after a yield -
ProbeNode.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.
v23.1.0
- 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 exisiting 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.
v23.0.0
-
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 suppressable 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.
Configuration
-
If you want to rebase/retry this MR, check this box
This MR has been generated by Renovate Bot.