Mercurial > hg > truffle
diff truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/RootNode.java @ 22003:5bc7f7b867ab
Making debugger always on for each TruffleVM execution. Introducing EventConsumer to process such debugger events. Requesting each RootNode to be associated with a TruffleLanguage, so debugger can find out proper context for each Node where executions gets suspended.
author | Jaroslav Tulach <jaroslav.tulach@oracle.com> |
---|---|
date | Sat, 18 Jul 2015 18:03:36 +0200 |
parents | 9c8c0937da41 |
children | 78c3d3d8d86e |
line wrap: on
line diff
--- a/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/RootNode.java Thu Jul 16 19:11:31 2015 +0200 +++ b/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/RootNode.java Sat Jul 18 18:03:36 2015 +0200 @@ -37,20 +37,57 @@ * {@link TruffleRuntime#createCallTarget(RootNode)}. */ public abstract class RootNode extends Node { - + final Class<? extends TruffleLanguage> language; private RootCallTarget callTarget; @CompilationFinal private FrameDescriptor frameDescriptor; + /** + * @deprecated each RootNode should be associated with a {@link TruffleLanguage} use constructor + * that allows you to specify it. This method will be removed on Aug 15, 2015. + */ + @Deprecated protected RootNode() { - this(null, null); + this(null, null, null, false); + } + + /** + * @deprecated each RootNode should be associated with a {@link TruffleLanguage} use constructor + * that allows you to specify it. This method will be removed on Aug 15, 2015. + */ + @Deprecated + protected RootNode(SourceSection sourceSection) { + this(null, sourceSection, null, false); } - protected RootNode(SourceSection sourceSection) { - this(sourceSection, null); + /** + * @deprecated each RootNode should be associated with a {@link TruffleLanguage} use constructor + * that allows you to specify it. This method will be removed on Aug 15, 2015. + */ + @Deprecated + protected RootNode(SourceSection sourceSection, FrameDescriptor frameDescriptor) { + this(null, sourceSection, frameDescriptor, false); } - protected RootNode(SourceSection sourceSection, FrameDescriptor frameDescriptor) { + /** + * Creates new root node. Each {@link RootNode} is associated with a particular language - if + * the root node represents a method it is assumed the method is written in such language. + * + * @param language the language of the node, <b>cannot be</b> <code>null</code> + * @param sourceSection a part of source associated with this node, can be <code>null</code> + * @param frameDescriptor descriptor of slots, can be <code>null</code> + */ + protected RootNode(Class<? extends TruffleLanguage> language, SourceSection sourceSection, FrameDescriptor frameDescriptor) { + this(language, sourceSection, frameDescriptor, true); + } + + private RootNode(Class<? extends TruffleLanguage> language, SourceSection sourceSection, FrameDescriptor frameDescriptor, boolean checkLanguage) { super(sourceSection); + if (checkLanguage) { + if (!TruffleLanguage.class.isAssignableFrom(language)) { + throw new IllegalStateException(); + } + } + this.language = language; if (frameDescriptor == null) { this.frameDescriptor = new FrameDescriptor(); } else {