public abstract static class TruffleString.AsNativeNode extends Node
Node.Child, Node.Children
Modifier and Type | Method and Description |
---|---|
static TruffleString.AsNativeNode |
create()
Create a new
TruffleString.AsNativeNode . |
abstract TruffleString |
execute(TruffleString a,
NativeAllocator allocator,
TruffleString.Encoding expectedEncoding,
boolean useCompaction,
boolean cacheResult)
|
static TruffleString.AsNativeNode |
getUncached()
Get the uncached version of
TruffleString.AsNativeNode . |
accept, adoptChildren, atomic, atomic, copy, deepCopy, getChildren, getCost, getDebugProperties, getDescription, getEncapsulatingSourceSection, getLock, getParent, getRootNode, getSourceSection, insert, insert, isAdoptable, isSafelyReplaceableBy, notifyInserted, onReplace, replace, replace, reportPolymorphicSpecialize, toString
public abstract TruffleString execute(TruffleString a, NativeAllocator allocator, TruffleString.Encoding expectedEncoding, boolean useCompaction, boolean cacheResult)
managed
TruffleString
to a
native
string. If the given string is native
already, it is returned. Otherwise, a new string with a backing native buffer allocated
via allocator
is created and stored in the given managed string's internal
transcoding cache, such that subsequent calls on the same string will return the same
native string. This operation requires native access permissions
(TruffleLanguage.Env#isNativeAccessAllowed()
).allocator
- a function implementing NativeAllocator
. This parameter is
expected to be partial evaluation constant
.useCompaction
- if set to true
, TruffleString.Encoding.UTF_32
and
TruffleString.Encoding.UTF_16
- encoded strings may be compacted also in the native
representation. Otherwise, no string compaction is applied to the native
string. This parameter is expected to be
partial evaluation
constant
.cacheResult
- if set to true
, the newly created native string will be cached
in the given managed string's internal transcoding cache ring, guaranteeing
that subsequent calls on the managed string return the same native string.
Note that this ties the lifetime of the native string to that of the managed
string. This parameter is expected to be
partial evaluation
constant
.public static TruffleString.AsNativeNode create()
TruffleString.AsNativeNode
.public static TruffleString.AsNativeNode getUncached()
TruffleString.AsNativeNode
.