Class TruffleString.MaterializeSubstringNode
- All Implemented Interfaces:
NodeInterface, Cloneable
- Enclosing class:
TruffleString
TruffleString.MaterializeNode that also materializes substrings/string views
created via e.g. TruffleString.SubstringNode with the lazy parameter set to true or
via TruffleString.FromByteArrayNode with the copy parameter set to false. Note that
this node returns a potentially new TruffleString, because these substrings cannot be
materialized internally. Native-backed strings are kept as-is, since this
node cannot decide whether a native-backed string is a substring/string view.
Lazy substrings keep a reference to the potentially larger byte array they were created from,
which may keep more memory alive than necessary (see the caveats mentioned at
TruffleString.SubstringNode.execute(AbstractTruffleString, int, int, TruffleString.Encoding, boolean)). With this node, unnecessarily held memory is reclaimed by
copying the referenced subregions. This is especially useful if a string is added to a data
structure known to be long-lived, e.g. during string interning.
- Since:
- 25.1
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class Node
Node.Child, Node.Children -
Method Summary
Modifier and TypeMethodDescriptioncreate()Create a newTruffleString.MaterializeSubstringNode.abstract TruffleStringexecute(AbstractTruffleString a, TruffleString.Encoding expectedEncoding) Extended version ofTruffleString.MaterializeNodethat also materializes substrings/string views created via e.g.Get the uncached version ofTruffleString.MaterializeSubstringNode.Methods inherited from class 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, reportReplace, toString
-
Method Details
-
execute
public abstract TruffleString execute(AbstractTruffleString a, TruffleString.Encoding expectedEncoding) Extended version ofTruffleString.MaterializeNodethat also materializes substrings/string views created via e.g.TruffleString.SubstringNodewith thelazyparameter set totrueor viaTruffleString.FromByteArrayNodewith thecopyparameter set tofalse. Note that this node returns a potentially newTruffleString, because these substrings cannot be materialized internally.Native-backedstrings are kept as-is, since this node cannot decide whether a native-backed string is a substring/string view.Lazy substrings keep a reference to the potentially larger byte array they were created from, which may keep more memory alive than necessary (see the caveats mentioned at
TruffleString.SubstringNode.execute(AbstractTruffleString, int, int, TruffleString.Encoding, boolean)). With this node, unnecessarily held memory is reclaimed by copying the referenced subregions. This is especially useful if a string is added to a data structure known to be long-lived, e.g. during string interning.- Since:
- 25.1
- See Also:
-
create
Create a newTruffleString.MaterializeSubstringNode.- Since:
- 25.1
-
getUncached
Get the uncached version ofTruffleString.MaterializeSubstringNode.- Since:
- 25.1
-