Package com.oracle.truffle.api.strings
Class TruffleString.AsManagedNode
java.lang.Object
com.oracle.truffle.api.nodes.Node
com.oracle.truffle.api.strings.TruffleString.AsManagedNode
- All Implemented Interfaces:
NodeInterface
,Cloneable
- Enclosing class:
TruffleString
Node to get the given
AbstractTruffleString
as a managed TruffleString
,
meaning that the resulting string's backing memory is not a native pointer. See
execute(AbstractTruffleString, TruffleString.Encoding)
for details.- Since:
- 22.1
-
Nested Class Summary
Nested classes/interfaces inherited from class com.oracle.truffle.api.nodes.Node
Node.Child, Node.Children
-
Method Summary
Modifier and TypeMethodDescriptionstatic TruffleString.AsManagedNode
create()
Create a newTruffleString.AsManagedNode
.final TruffleString
execute
(AbstractTruffleString a, TruffleString.Encoding expectedEncoding) Returns a given string if it is already managed (i.e.abstract TruffleString
execute
(AbstractTruffleString a, TruffleString.Encoding expectedEncoding, boolean cacheResult) If the given string is already a managed (i.e.static TruffleString.AsManagedNode
Get the uncached version ofTruffleString.AsManagedNode
.Methods inherited from class com.oracle.truffle.api.nodes.Node
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
-
Method Details
-
execute
public final TruffleString execute(AbstractTruffleString a, TruffleString.Encoding expectedEncoding) Returns a given string if it is already managed (i.e. not backed by a native pointer), otherwise, copies the string's native pointer content into a Java byte array and returns a new string backed by the byte array.- Since:
- 22.1
-
execute
public abstract TruffleString execute(AbstractTruffleString a, TruffleString.Encoding expectedEncoding, boolean cacheResult) If the given string is already a managed (i.e. not backed by a native pointer) string, return it. Otherwise, copy the string's native pointer content into a Java byte array and return a new string backed by the byte array.- Parameters:
cacheResult
- if set totrue
, managed strings created from nativeTruffleString
instances are cached in the native string's internal transcoding cache. Note that this will keep the native string alive and reachable viaTruffleString.AsNativeNode
. Subsequent calls ofTruffleString.AsManagedNode
withcacheResult=true
on the same native string are guaranteed to return the same managed string. This parameter is expected to bepartial evaluation constant
.- Since:
- 23.0
-
create
Create a newTruffleString.AsManagedNode
.- Since:
- 22.1
-
getUncached
Get the uncached version ofTruffleString.AsManagedNode
.- Since:
- 22.1
-