This changelog summarizes major changes between GraalVM SDK versions. The main focus is on APIs exported by GraalVM SDK.
- The
PerformanceWarningsAreFatal
andTracePerformanceWarnings
engine options take a comma separated list of performance warning types. Allowed warning types arecall
to enable virtual call warnings,instanceof
to enable virtual instance of warnings andstore
to enables virtual store warnings. There are alsoall
andnone
types to enable (disable) all performance warnings. - The
<language-id>.home
system property that can be used in some development scenarios to specify a language's directory is deprecated. Theorg.graalvm.language.<language-uid>.home
property should be used instead. Setting this new system property is reflected by theHomeFinder
API. - Added
CompilationFailureAction
engine option which deprecatesCompilationExceptionsArePrinted
,CompilationExceptionsAreThrown
,CompilationExceptionsAreFatal
andPerformanceWarningsAreFatal
options. - Added
TreatPerformanceWarningsAsErrors
engine option which deprecates thePerformanceWarningsAreFatal
option. To replace thePerformanceWarningsAreFatal
option use theTreatPerformanceWarningsAsErrors
withCompilationFailureAction
set toExitVM
. - Added
bailout
into performance warning kinds used byTracePerformanceWarnings
,PerformanceWarningsAreFatal
andCompilationExceptionsAreFatal
options. - Added OptionDescriptor.getDeprecationMessage returning the option deprecation reason. Added OptionDescriptor.Builder.deprecationMessage() to set the option deprecation reason.
- Added
Value.isMetaObject()
,Value.getMetaQualifiedName()
,Value.getMetaSimpleName()
andValue.isMetaInstance(Object)
to allow language agnostic access to meta-objects like classes or types. - The result of
Value.getMetaObject()
will now return always meta-objects. It is recommended but not required to change uses of meta-objects to useValue.getMetaQualifiedName()
instead ofValue.toString()
to return a type name.
- The deprecated
graalvm.home
andgraalvm.version
system properties have been removed, use the HomeFinder instead. - Added
EventContext.createError
which allows to introduce guest application errors in execution listeners/nodes. - Deprecated
Instrumenter.attachExecutionEventListener
andExecutionEventListener.onInputValue
as explicit input filters are not supported by event listeners. Use ExecutionEventNodes instead. - Added Context.Builder.currentWorkingDirectory to set the current working directory used by the guest application to resolve relative paths.
- The algorithm used to generate a unique URI for a
Source
built without anURI
was changed to SHA-256. - 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_DEPRECATION
environment variable can be used to detect usages of deprecated Graal options. When theTRUFFLE_STRICT_OPTION_DEPRECATION
is set totrue
and the deprecated Graal option is used the engine throws aPolyglotException
listing the used deprecated options and corresponding replacements.
- The default temporary directory can be configured by FileSystem.
- Added
org.graalvm.polyglot.ResourceLimits
that allows to specify context specific time and statement count execution limits. - Added HomeFinder, a utility class to find various paths of the running GraalVM.
- Contexts can now be closed if they are still explicitly entered using
Context.enter
on the current thread. This allows for simpler error recovery code. - Added
Value.getContext()
to access the context a value is associated with. - Added
org.graalvm.home.Version
version utility that allows to create, validate and compare GraalVM versions. - Added Value API methods for interacting with exception objects: Value#isException and Value#throwException.
- Added target type mapping from exception objects to PolyglotException.
- Added support for date, time, timezone and duration values in polyglot
- Added methods to identify polyglot date, time, timezone and duration values in
Value
. SeeValue.isDate
,Value.isTime
,Value.isTimeZone
,Value.isDuration
. - Polyglot languages now interpret the
java.time
host values of typeLocalDate
,LocalTime
,LocalDateTime
,ZonedDateTime
,Instant
,ZoneId
andDuration
. They are mapped to the appropriate guest language types. - Added
ProxyDate
,ProxyTime
,ProxyTimeZone
,ProxyInstant
andProxyDuration
to proxy date time and duration related guest values.
- Added methods to identify polyglot date, time, timezone and duration values in
- Added
Context.Builder.timeZone(ZoneId)
to configure the default timezone of polyglot contexts. - Added OptionKey.mapOf to group/accumulate key=value pairs for options whose keys are not known beforehand e.g. user-defined properties.
- Added ability to configure custom polyglot access configuration with
PolyglotAccess.newBuilder()
. It allows to configure fine-grained access control for polyglot bindings and between polyglot languages.
- Restricting guest languages from sub-process creation by Context.Builder.allowCreateProcess. Use
Context.newBuilder().allowCreateProcess(true)
to allow guest languages to create a new sub-process. - Added a possibility to control sub-process creation using a custom ProcessHandler implementation. Use
Context.newBuilder().processHandler(handler)
to install a customProcessHandler
. - Restricting access to the host environment variables via EnvironmentAccess configurations. Use
EnvironmentAccess.INHERIT
to allow guest languages to read process environment variables. - Deprecated
OptionValues#set
, OptionValues should be read-only. If the value needs to be changed, it can be stored in the language or instrument and read from there. - Removed deprecated
OptionCategory.DEBUG
(useOptionCategory.INTERNAL
instead). - The path separator can now be configured by FileSystem.
Value.as(Interface.class)
now requires interface classes to be annotated withHostAccess.Implementable
inEXPLICIT
host access mode. Added new APIs to configure implementable behavior in HostAccess.
--experimental-options
can now also be passed after polyglot options on the command line.--version
changed default message toIMPLEMENTATION-NAME (ENGINE-NAME GRAALVM-VERSION)
- Renamed 'Graal SDK' to 'GraalVM SDK'
- Added optional FileSystem.getMimeType and FileSystem.getEncoding methods. These methods can be used by
FileSystem
implementer to provide file MIME type and encoding. - Added a possibility to set an encoding in Source builder
- (incompatible change) Restricting access to the host language via HostAccess configurations. Use
Context.newBuilder().allowHostAccess(HostAccess.ALL)
to get previous behavior. Configurations that useallowAllAccess(true)
are not affected by this incompatible change. - Deprecated
Context.Builder.hostClassFilter
and added the new methodContext.Builder.allowHostClassLookup
as a replacement. The name was changed for clarity and now also acceptsnull
to indicate that no host class lookup is allowed. - (incompatible change) Restricting polyglot access for guest languages via PolyglotAccess configurations. Use
Context.newBuilder().allowPolyglotAccess(PolyglotAccess.ALL)
to get previous behavior. Configurations that useallowAllAccess(true)
are not affected by this incompatible change. - Removed deprecated API class
ProxyPrimitive
. - Started adding several options under
--engine
like--engine.TraceCompilation
, which can also be set on theEngine
. These options will progressively replace the-Dgraal.*Truffle*
properties. The list can be seen by passing--help:expert
to any language launcher. - Experimental options now require
--experimental-options
on the command line to be passed to GraalVM language launchers, or Context.Builder#allowExperimentalOptions and Engine.Builder#allowExperimentalOptions to be set in other scenarios. - Added new API for target type mappings using the new HostAccess API.
- (incompatible change) Removed default lossy string coercions. Previous behavior can be restored using the following snippets.
- Added Context.Builder#allowExperimentalOptions to control whether experimental options can be passed to a Context.
- Added Engine.Builder#allowExperimentalOptions to control whether experimental instrument and engine options can be passed.
- Removed deprecated API class
ProxyPrimitive
. - Restricting access (incompatible change) to host interop via HostAccess configurations. Use
Context.newBuilder().allowHostAccess(HostAccess.PUBLIC)
to get previous behavior. - Restricting access (incompatible change) to the host language via HostAccess configurations. Use
Context.newBuilder().allowHostAccess(HostAccess.ALL)
to get previous behavior. Configurations that useallowAllAccess(true)
are not affected by this incompatible change. - Deprecated
Context.Builder.hostClassFilter
and added the new methodContext.Builder.allowHostClassLookup
as a replacement. The name was changed change for clarity and now also allowsnull
values to indicate that no host class lookup is allowed. - Deprecated
defaultValue
ofOptionType
. Default value ofOptionKey
is sufficient. --vm.*
should now be used instead of--native.*
or--jvm.*
to pass VM options in GraalVM language launchers (the old style of option is still supported but deprecated and shows warnings on stderr).--native
and--jvm
should still be used to select the VM mode.--jvm.help
or--native.help
are deprecated in favor of--help:vm
.
- OptionCategory.DEBUG has been renamed to
OptionCategory.INTERNAL
for clarity. - Added
"static"
member to class objects that provides access to the class's static members. - OptionStability has been added for specifying the stability of an option.
- Added SourceSection.hasLines(), SourceSection.hasColumns() and SourceSection.hasCharIndex() to distinguish which positions are defined and which are not.
- Added FileSystem.getSeparator() to remove a dependency on NIO
FileSystem
for customPath
implementations. - Added support for automatic string to primitive type conversion using the Value API.
- Added FileSystem.setCurrentWorkingDirectory method to set a current working directory for relative paths resolution in the polyglot FileSystem.
- Added a Context.Builder.logHandler and Engine.Builder.logHandler methods to install a logging handler writing into a given
OutputStream
. Value.asValue(Object)
now also works if no currently entered context is available.- Primitives, host and
Proxy
values can now be shared between multiple context and engine instances. They no longer throw anIllegalArgumentException
when shared. Primitive types areBoolean
,Byte
,Short
,Integer
,Long
,Float
,Double
,Character
andString
of thejava.lang
package. Non primitive values originating from guest languages are not sharable.
- Added
MessageTransport
andMessageEndpoint
to virtualize transport of messages to a peer URI. - Added
Value.canInvokeMember()
andValue.invokeMember()
to invoke a member of an object value.
- Graal SDK was relicensed from GPLv2 with CPE to Universal Permissive License (UPL).
- Added new
ByteSequence
utility to the IO package that is intended to be used as immutable byte sequence representation. - Added support for byte based sources:
- Byte based sources may be constructed using a
ByteSequence
or from aFile
orURL
. 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.- Byte based sources throw an
UnsupportedOperationException
if methods that access characters, line numbers or column numbers. - Added
Source.getBytes()
to access the contents of byte based sources.
- Byte based sources may be constructed using a
- Added support for MIME types to sources:
- MIME types can now be assigned using
Source.Builder.mimeType(String)
to sources in addition to the target language. - The MIME type of a source allows languages support different kinds of input.
Language
instances allow access to the default and supported MIME types usingLanguage.getMimeTypes()
andLanguage.getDefaultMimeType()
.- MIME types are automatically detected if the source is constructed from a
File
orURL
if it is not specified explicitly. - Deprecated
Source.getInputStream()
. UseSource.getCharacters()
orSource.getBytes()
instead.
- MIME types can now be assigned using
- Context methods now consistently throw
IllegalArgumentException
instead ofIllegalStateException
for unsupported sources or missing / inaccessible languages. - Added
Engine.findHome()
to find the GraalVM home folder.
PolyglotException.getGuestObject()
now returnsnull
to indicate that no exception object is available instead of returning aValue
instance that returnstrue
forisNull()
.- Added new execution listener API that allows for simple, efficient and fine grained introspection of executed code.
- Added support for logging in Truffle languages and instruments.
- Added
Value.asValue(Object)
to convert a Java object into its value representation using the currently entered context. - Added
Context.getCurrent()
to lookup the current context to allow Java methods called by a Graal guest language to evaluate additional code in the current context. - Removed deprecated
Context.exportSymbol
andContext.importSymbol
. - Removed deprecated
Source.getCode
. - The code cache for sources is now weak. Code can be garbage collected if a source is no longer referenced but the Context or Engine is still active.
- Added
Source.Builder.cached(boolean)
to configure caching behavior by source.
- Added Context.Builder#allowHostClassLoading to allow loading of new classes by the guest language.
- Added
Value.getSourceLocation()
to find a functionSourceSection
.
- Expose Runtime name as Engine#getImplementationName();
- Deprecate Context#exportSymbol, Context#importSymbol, Context#lookup use Context#getBindings, Context#getPolyglotBindings instead.
- Remove deprecated API Engine#getLanguage, Engine#getInstrument.
- Remove deprecated Language#isHost.
- Deprecate ProxyPrimitive without replacement.
- Added Context.Builder#allAccess that allows to declare that a context has all access by default, also for new access rights.
- Added Value#as(Class) and Value.as(TypeLiteral) to convert to Java types.
- Added Context#asValue(Object) to convert Java values back to the polyglot Value representation.
- Added Value#isProxyObject() and Value#asProxyObject().
- Introduced Context.enter() and Context.leave() that allows explicitly entering and leaving the context to improve performance of performing many simple operations.
- Introduced Value.executeVoid to allow execution of functions more efficiently if not return value is expected.
- Initial revision of the polyglot API introduced.
- Initial revision of the native image API introduced.
- Initial revision of the options API introduced.