/** * Creates new root node given an language environment and frame descriptor. The language * instance is obtainable while {@link TruffleLanguage#createContext(Env)} or * {@link TruffleLanguage#parse(ParsingRequest)} is executed. If no language environment is * available, then <code>null</code> can be passed. Please note that root nodes with * <code>null</code> language are considered not instrumentable and have no access to the * {@link #getLanguage(Class) language} or its public {@link #getLanguageInfo() information}. * * @param language the language this root node is associated with * @since 0.25 */ protected RootNode(TruffleLanguage<?> language, FrameDescriptor frameDescriptor) { super(language); CompilerAsserts.neverPartOfCompilation(); if (this.languageInfo != null) { this.sourceVM = Node.ACCESSOR.engineSupport().getVMFromLanguageObject(this.languageInfo.getEngineObject()); } else { this.sourceVM = getCurrentVM(); } this.frameDescriptor = frameDescriptor == null ? new FrameDescriptor() : frameDescriptor; }
/** * Creates new root node given an language environment and frame descriptor. The language * instance is obtainable while {@link TruffleLanguage#createContext(Env)} or * {@link TruffleLanguage#parse(ParsingRequest)} is executed. If no language environment is * available, then <code>null</code> can be passed. Please note that root nodes with * <code>null</code> language are considered not instrumentable and have no access to the * {@link #getLanguage(Class) language} or its public {@link #getLanguageInfo() information}. * * @param language the language this root node is associated with * @since 0.25 */ protected RootNode(TruffleLanguage<?> language, FrameDescriptor frameDescriptor) { super(language); CompilerAsserts.neverPartOfCompilation(); if (this.language != null) { this.sourceVM = Node.ACCESSOR.engineSupport().getVMFromLanguageObject(Node.ACCESSOR.languageSupport().getLanguageInfo(this.language).getEngineObject()); } else { this.sourceVM = getCurrentVM(); } this.frameDescriptor = frameDescriptor == null ? new FrameDescriptor() : frameDescriptor; }