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

public abstract static class TruffleString.SubstringNode extends Node
Node to create a substring of a given string. See execute(AbstractTruffleString, int, int, TruffleString.Encoding, boolean) for details.
Since:
22.1
  • Method Details

    • execute

      public abstract TruffleString execute(AbstractTruffleString a, int fromIndex, int length, TruffleString.Encoding expectedEncoding, boolean lazy)
      Create a substring of a, starting from codepoint index fromIndex, with codepoint length length. If lazy is true, 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 to a's internal storage, and TruffleString currently does not resize/trim the substring's internal storage at any point, the lazy variant effectively creates a memory leak! The caller is responsible for deciding whether this is acceptable or not.
      Since:
      22.1
    • create

      public static TruffleString.SubstringNode create()
      Since:
      22.1
    • getUncached

      public static TruffleString.SubstringNode getUncached()
      Get the uncached version of TruffleString.SubstringNode.
      Since:
      22.1