private Object lookupLanguageContext(PolyglotContextImpl context) { Env env = context.contexts[language.index].env; if (env == null) { CompilerDirectives.transferToInterpreter(); throw new IllegalStateException( "The language context is not yet initialized or already disposed. "); } return LANGUAGE.getContext(env); }
Object getCurrentContext() { Env env = PolyglotContextImpl.requireContext().contexts[index].env; if (env == null) { CompilerDirectives.transferToInterpreter(); throw new IllegalStateException( "The language context is not yet initialized or already disposed. "); } return LANGUAGE.getContext(env); }
private Object lookupLanguageContext(PolyglotContextImpl context) { Env env = context.getContext(language).env; if (env == null) { CompilerDirectives.transferToInterpreter(); throw new IllegalStateException("The language context is not yet initialized or already disposed."); } return LANGUAGE.getContext(env); }
if (scopeProvider != null) { TruffleLanguage.Env env = ScopeAccessor.engine().getEnvForInstrument(languageInfo); Object context = ScopeAccessor.langs().getContext(env); ascope = scopeProvider.findScope(context, node, frame); } else {
void notifyContextCreate(PolyglotLanguageContext context, Env env) { if (singleContext.isValid()) { Object cachedSingle = this.cachedSingleContext; assert cachedSingle != LANGUAGE.getContext(env) || cachedSingle == null : "Non-null context objects should be distinct"; if (cachedSingle == UNSET_CONTEXT) { if (singleContext.isValid()) { this.cachedSingleContext = LANGUAGE.getContext(env); this.cachedSingleLanguageContext = context; } } else { singleContext.invalidate(); cachedSingleContext = UNSET_CONTEXT; cachedSingleLanguageContext = UNSET_CONTEXT; } } }
Object getContextImpl() { if (env != null) { return LANGUAGE.getContext(env); } else { return null; } }
@SuppressWarnings("unchecked") @Override public <C, T extends TruffleLanguage<C>> C getCurrentContext(Class<T> languageClass) { CompilerAsserts.partialEvaluationConstant(languageClass); PolyglotContextImpl context = PolyglotContextImpl.requireContext(); Env env = context.getLanguageContext(languageClass).env; if (env == null) { CompilerDirectives.transferToInterpreter(); throw new IllegalStateException("Current context is not yet initialized or already disposed."); } return (C) LANGUAGE.getContext(env); }
@SuppressWarnings("unchecked") @Override public <C, T extends TruffleLanguage<C>> C getCurrentContext(Class<T> languageClass) { CompilerAsserts.partialEvaluationConstant(languageClass); PolyglotContextImpl context = PolyglotContextImpl.requireContext(); Env env = context.getLanguageContext(languageClass).env; if (env == null) { CompilerDirectives.transferToInterpreter(); throw new IllegalStateException("Current context is not yet initialized or already disposed."); } return (C) LANGUAGE.getContext(env); }
void notifyContextCreate(Env env) { if (singleContext.isValid()) { Object cachedSingle = this.cachedSingleContext; assert cachedSingle != LANGUAGE.getContext(env); if (cachedSingle == UNSET_CONTEXT) { if (singleContext.isValid()) { cachedSingleContext = LANGUAGE.getContext(env); } } else { singleContext.invalidate(); cachedSingleContext = UNSET_CONTEXT; } } }