Package org.pkl.core.runtime
Class VmUtils
java.lang.Object
org.pkl.core.runtime.VmUtils
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic voidappendToBuilder(StringBuilder builder, String string) static StringbuilderToString(StringBuilder builder) static voidcheckIsInstantiable(VmClass parentClass, @Nullable com.oracle.truffle.api.nodes.Node parentNode) static voidcheckPositive(long n) static intcodePointOffsetFromEndToCharOffset(String string, long codePointOffset) static intcodePointOffsetToCharOffset(String string, long codePointOffset) static intcodePointOffsetToCharOffset(String string, long codePointOffset, int startIndex) static PatterncompilePattern(String pattern, com.oracle.truffle.api.nodes.Node location) static voidcopyLocals(com.oracle.truffle.api.frame.VirtualFrame sourceFrame, int firstSourceSlot, com.oracle.truffle.api.frame.VirtualFrame targetFrame, int firstTargetSlot, int numberOfLocalsToCopy) CopiesnumberOfLocalsToCopylocals fromsourceFrame, starting atfirstSourceSlot, tofirstSourceSlot, starting atfirstTargetSlot.static intstatic StringBuilderstatic org.graalvm.polyglot.ContextcreateContext(Runnable initializer) static DecimalFormatcreateDecimalFormat(int fractionDigits) static com.oracle.truffle.api.frame.MaterializedFramestatic ObjectMembercreateLocalObjectProperty(VmLanguage language, com.oracle.truffle.api.source.SourceSection sourceSection, com.oracle.truffle.api.source.SourceSection headerSection, Identifier propertyName, String qualifiedName, com.oracle.truffle.api.frame.FrameDescriptor descriptor, int modifiers, ExpressionNode bodyNode, @Nullable UnresolvedTypeNode typeNode) static ObjectMembercreateObjectProperty(VmLanguage language, com.oracle.truffle.api.source.SourceSection sourceSection, com.oracle.truffle.api.source.SourceSection headerSection, Identifier propertyName, String qualifiedName, com.oracle.truffle.api.frame.FrameDescriptor descriptor, int modifiers, ExpressionNode bodyNode, @Nullable PropertyTypeNode typeNode) static com.oracle.truffle.api.source.SourcecreateSource(ModuleKey moduleKey, String text) static StackFramecreateStackFrame(com.oracle.truffle.api.source.SourceSection section, @Nullable String memberName) static ObjectMembercreateSyntheticObjectElement(String qualifiedName, Object constantValue) Creates a constant object element that has no corresponding definition in Pkl code.static ObjectMembercreateSyntheticObjectEntry(String qualifiedName, Object constantValue) Creates a constant object entry that has no corresponding definition in Pkl code.static ObjectMembercreateSyntheticObjectProperty(@Nullable Identifier identifier, String qualifiedName, Object constantValue) Creates a constant object property that has no corresponding definition in Pkl code.static ExpressionNodecreateThisNode(com.oracle.truffle.api.source.SourceSection sourceSection, boolean isCustomThisScope) static ObjectdoReadMember(VmObjectLike receiver, VmObjectLike owner, Object memberKey, ObjectMember member) Before calling this method, always try `VmObject.getCachedValue()`.static ObjectdoReadMember(VmObjectLike receiver, VmObjectLike owner, Object memberKey, ObjectMember member, boolean checkType, com.oracle.truffle.api.nodes.IndirectCallNode callNode) Before calling this method, always try `VmObject.getCachedValue()`.evaluateAnnotations(com.oracle.truffle.api.frame.VirtualFrame frame, ExpressionNode[] annotationNodes) static voidevaluateAnnotations(com.oracle.truffle.api.frame.VirtualFrame frame, ExpressionNode[] annotationNodes, List<VmTyped> result) static ObjectevaluateExpression(VmTyped module, String expression, SecurityManager securityManager, ModuleResolver moduleResolver) exportAnnotations(List<VmTyped> annotations) static voidexportAnnotations(List<VmTyped> annotations, List<PObject> result) exportDocComment(com.oracle.truffle.api.source.SourceSection @Nullable [] docComment) static intfindCustomThisSlot(com.oracle.truffle.api.frame.VirtualFrame frame) static @Nullable ObjectMemberfindMember(VmObjectLike receiver, Object memberKey) static VmClassstatic StringgetConfigValue(com.oracle.truffle.api.TruffleLanguage.Env env, String name, String defaultValue) static StringgetDisplayUri(com.oracle.truffle.api.source.SourceSection section, StackFrameTransformer transformer) static StringgetDisplayUri(URI moduleUri, StackFrameTransformer transformer) static <K,V> K static <K,V> V getMapValue(Map<K, V> map, K key) static ObjectgetMemberKey(com.oracle.truffle.api.frame.Frame frame) Returns a `ObjectMember`'s key while executing the corresponding `MemberNode`.static ModuleInfogetModuleInfo(VmObjectLike composite) static com.oracle.truffle.api.nodes.NodeInfogetNodeInfo(com.oracle.truffle.api.nodes.Node node) static VmObjectLikegetObjectReceiver(com.oracle.truffle.api.frame.Frame frame) static VmObjectLikegetOwner(com.oracle.truffle.api.frame.Frame frame) Returns the owner of the currently executing code.static @Nullable VmObjectLikegetOwnerOrNull(com.oracle.truffle.api.frame.Frame frame) Returns the owner of the currently executing code.static ObjectgetReceiver(com.oracle.truffle.api.frame.Frame frame) Returns the receiver of the message that was dispatched to the currently executing code.getReceiverOrNull(com.oracle.truffle.api.frame.Frame frame) Returns the receiver of the message that was dispatched to the currently executing code.static VmTypedgetTypedObjectReceiver(com.oracle.truffle.api.frame.Frame frame) static <K,V> V static Stringstatic voidinsertStackFrame(ObjectMember member, com.oracle.truffle.api.CallTarget location, VmException exception) static booleanisPcfRenderDirective(Object value) static com.oracle.truffle.api.source.SourceloadSource(ResolvedModuleKey resolvedKey) static VmBytesreadBytesProperty(VmObjectLike receiver) static ObjectreadMember(VmObjectLike receiver, Object memberKey) static ObjectreadMember(VmObjectLike receiver, Object memberKey, com.oracle.truffle.api.nodes.IndirectCallNode callNode) readMemberOrNull(VmObjectLike receiver, Object memberKey) readMemberOrNull(VmObjectLike receiver, Object memberKey, boolean checkType) readMemberOrNull(VmObjectLike receiver, Object memberKey, boolean checkType, com.oracle.truffle.api.nodes.IndirectCallNode callNode) readMemberOrNull(VmObjectLike receiver, Object memberKey, com.oracle.truffle.api.nodes.IndirectCallNode callNode) static StringreadTextProperty(Object receiver) static StringreadTextProperty(VmObjectLike receiver) static TypeNode[]resolveParameterTypes(com.oracle.truffle.api.frame.VirtualFrame frame, com.oracle.truffle.api.frame.FrameDescriptor descriptor, UnresolvedTypeNode[] parameterTypeNodes) static booleanshouldRunTypeCheck(com.oracle.truffle.api.frame.VirtualFrame frame) If true, the value computed by this node is not the final value exposed to user code but will still be amended.static VmExceptiontoVmException(org.pkl.parser.ParserError e, com.oracle.truffle.api.source.Source source, String moduleName) static VmExceptiontoVmException(org.pkl.parser.ParserError e, String text, URI moduleUri, String moduleName) static com.oracle.truffle.api.source.SourceSection
-
Field Details
-
SKIP_TYPECHECK_MARKER
-
REPL_TEXT
- See Also:
-
REPL_TEXT_URI
-
-
Method Details
-
createEmptyMaterializedFrame
public static com.oracle.truffle.api.frame.MaterializedFrame createEmptyMaterializedFrame() -
createContext
-
countLeadingWhitespace
-
indent
-
getReceiverOrNull
@Nullable public static @Nullable Object getReceiverOrNull(com.oracle.truffle.api.frame.Frame frame) Returns the receiver of the message that was dispatched to the currently executing code. -
getReceiver
Returns the receiver of the message that was dispatched to the currently executing code. -
getObjectReceiver
-
getTypedObjectReceiver
-
getOwnerOrNull
@Nullable public static @Nullable VmObjectLike getOwnerOrNull(com.oracle.truffle.api.frame.Frame frame) Returns the owner of the currently executing code. -
getOwner
Returns the owner of the currently executing code. -
getMemberKey
Returns a `ObjectMember`'s key while executing the corresponding `MemberNode`. -
getModuleInfo
-
readTextProperty
-
readTextProperty
-
readBytesProperty
-
readMember
-
readMemberOrNull
@Nullable public static @Nullable Object readMemberOrNull(VmObjectLike receiver, Object memberKey, boolean checkType) -
readMemberOrNull
@Nullable public static @Nullable Object readMemberOrNull(VmObjectLike receiver, Object memberKey, com.oracle.truffle.api.nodes.IndirectCallNode callNode) -
readMemberOrNull
-
doReadMember
public static Object doReadMember(VmObjectLike receiver, VmObjectLike owner, Object memberKey, ObjectMember member) Before calling this method, always try `VmObject.getCachedValue()`. (This method writes to the cache, but doesn't read from it.) -
readMember
public static Object readMember(VmObjectLike receiver, Object memberKey, com.oracle.truffle.api.nodes.IndirectCallNode callNode) -
readMemberOrNull
@Nullable public static @Nullable Object readMemberOrNull(VmObjectLike receiver, Object memberKey, boolean checkType, com.oracle.truffle.api.nodes.IndirectCallNode callNode) -
doReadMember
public static Object doReadMember(VmObjectLike receiver, VmObjectLike owner, Object memberKey, ObjectMember member, boolean checkType, com.oracle.truffle.api.nodes.IndirectCallNode callNode) Before calling this method, always try `VmObject.getCachedValue()`. (This method writes to the cache, but doesn't read from it.) -
copyLocals
public static void copyLocals(com.oracle.truffle.api.frame.VirtualFrame sourceFrame, int firstSourceSlot, com.oracle.truffle.api.frame.VirtualFrame targetFrame, int firstTargetSlot, int numberOfLocalsToCopy) CopiesnumberOfLocalsToCopylocals fromsourceFrame, starting atfirstSourceSlot, tofirstSourceSlot, starting atfirstTargetSlot. -
insertStackFrame
public static void insertStackFrame(ObjectMember member, com.oracle.truffle.api.CallTarget location, VmException exception) -
findMember
-
createThisNode
public static ExpressionNode createThisNode(com.oracle.truffle.api.source.SourceSection sourceSection, boolean isCustomThisScope) -
isPcfRenderDirective
-
getNodeInfo
public static com.oracle.truffle.api.nodes.NodeInfo getNodeInfo(com.oracle.truffle.api.nodes.Node node) -
getClass
-
getConfigValue
-
put
-
createBuilder
-
appendToBuilder
-
builderToString
-
checkPositive
public static void checkPositive(long n) -
loadSource
-
createSource
-
toVmException
public static VmException toVmException(org.pkl.parser.ParserError e, String text, URI moduleUri, String moduleName) -
toVmException
public static VmException toVmException(org.pkl.parser.ParserError e, com.oracle.truffle.api.source.Source source, String moduleName) -
exportDocComment
-
exportAnnotations
-
exportAnnotations
-
evaluateAnnotations
public static List<VmTyped> evaluateAnnotations(com.oracle.truffle.api.frame.VirtualFrame frame, ExpressionNode[] annotationNodes) -
evaluateAnnotations
public static void evaluateAnnotations(com.oracle.truffle.api.frame.VirtualFrame frame, ExpressionNode[] annotationNodes, List<VmTyped> result) -
codePointOffsetToCharOffset
-
codePointOffsetToCharOffset
-
codePointOffsetFromEndToCharOffset
-
createDecimalFormat
-
createSyntheticObjectProperty
public static ObjectMember createSyntheticObjectProperty(@Nullable @Nullable Identifier identifier, String qualifiedName, Object constantValue) Creates a constant object property that has no corresponding definition in Pkl code. -
createSyntheticObjectEntry
Creates a constant object entry that has no corresponding definition in Pkl code. -
createSyntheticObjectElement
Creates a constant object element that has no corresponding definition in Pkl code. -
createObjectProperty
public static ObjectMember createObjectProperty(VmLanguage language, com.oracle.truffle.api.source.SourceSection sourceSection, com.oracle.truffle.api.source.SourceSection headerSection, Identifier propertyName, String qualifiedName, com.oracle.truffle.api.frame.FrameDescriptor descriptor, int modifiers, ExpressionNode bodyNode, @Nullable @Nullable PropertyTypeNode typeNode) -
createLocalObjectProperty
public static ObjectMember createLocalObjectProperty(VmLanguage language, com.oracle.truffle.api.source.SourceSection sourceSection, com.oracle.truffle.api.source.SourceSection headerSection, Identifier propertyName, String qualifiedName, com.oracle.truffle.api.frame.FrameDescriptor descriptor, int modifiers, ExpressionNode bodyNode, @Nullable @Nullable UnresolvedTypeNode typeNode) -
resolveParameterTypes
public static TypeNode[] resolveParameterTypes(com.oracle.truffle.api.frame.VirtualFrame frame, com.oracle.truffle.api.frame.FrameDescriptor descriptor, UnresolvedTypeNode[] parameterTypeNodes) -
checkIsInstantiable
-
compilePattern
-
getKey
-
getValue
-
getDisplayUri
public static String getDisplayUri(com.oracle.truffle.api.source.SourceSection section, StackFrameTransformer transformer) -
getDisplayUri
-
createStackFrame
public static StackFrame createStackFrame(com.oracle.truffle.api.source.SourceSection section, @Nullable @Nullable String memberName) -
evaluateExpression
public static Object evaluateExpression(VmTyped module, String expression, SecurityManager securityManager, ModuleResolver moduleResolver) -
findCustomThisSlot
public static int findCustomThisSlot(com.oracle.truffle.api.frame.VirtualFrame frame) -
getMapValue
-
shouldRunTypeCheck
public static boolean shouldRunTypeCheck(com.oracle.truffle.api.frame.VirtualFrame frame) If true, the value computed by this node is not the final value exposed to user code but will still be amended.Used to disable type check for to-be-amended properties. See
SKIP_TYPECHECK_MARKER. IDEA: might be more appropriate to only skip constraints check
-