Package com.oracle.truffle.api.strings
Class TruffleString.SubstringNode
java.lang.Object
com.oracle.truffle.api.nodes.Node
com.oracle.truffle.api.strings.TruffleString.SubstringNode
- All Implemented Interfaces:
NodeInterface
,Cloneable
- Enclosing class:
TruffleString
Node to create a substring of a given string. See
execute(AbstractTruffleString, int, int, TruffleString.Encoding, boolean)
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.SubstringNode
create()
Create a newTruffleString.SubstringNode
.abstract TruffleString
execute
(AbstractTruffleString a, int fromIndex, int length, TruffleString.Encoding expectedEncoding, boolean lazy) Create a substring ofa
, starting from codepoint indexfromIndex
, with codepoint lengthlength
.static TruffleString.SubstringNode
Get the uncached version ofTruffleString.SubstringNode
.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 abstract TruffleString execute(AbstractTruffleString a, int fromIndex, int length, TruffleString.Encoding expectedEncoding, boolean lazy) Create a substring ofa
, starting from codepoint indexfromIndex
, with codepoint lengthlength
. Iflazy
istrue
,a
's internal storage will be re-used instead of creating a copy of the requested range. Since the resulting string will have a reference toa
's internal storage, andTruffleString
currently does not resize/trim the substring's internal storage at any point, thelazy
variant effectively creates a memory leak! The caller is responsible for deciding whether this is acceptable or not.- Since:
- 22.1
-
create
Create a newTruffleString.SubstringNode
.- Since:
- 22.1
-
getUncached
Get the uncached version ofTruffleString.SubstringNode
.- Since:
- 22.1
-