fs.patchDelegate(FileSystems.newNoIOFileSystem(null)); if (!config.logLevels.isEmpty()) { VMAccessor.LANGUAGE.configureLoggers(context, null);
if (parent == null) { if (!this.config.logLevels.isEmpty()) { VMAccessor.LANGUAGE.configureLoggers(this, null);
PolyglotContextImpl(PolyglotEngineImpl engine, PolyglotContextConfig config) { super(engine.impl); this.parent = null; this.engine = engine; this.config = config; this.creator = null; this.creatorArguments = Collections.emptyMap(); this.truffleContext = VMAccessor.LANGUAGE.createTruffleContext(this); this.polyglotBindings = new ConcurrentHashMap<>(); this.weakReference = new ContextWeakReference(this); this.contexts = createContextArray(); if (!config.logLevels.isEmpty()) { VMAccessor.LANGUAGE.configureLoggers(this, config.logLevels); } PolyglotLanguageContext hostContext = getContextInitialized(engine.hostLanguage, null); this.polyglotHostBindings = getAPIAccess().newValue(polyglotBindings, new PolyglotBindingsValue(hostContext)); notifyContextCreated(); PolyglotContextImpl.initializeStaticContext(this); }
@SuppressWarnings("hiding") PolyglotContextImpl(PolyglotLanguageContext creator, Map<String, Object> langConfig, TruffleContext spiContext) { super(creator.getEngine().impl); PolyglotContextImpl parent = creator.context; this.parent = parent; this.config = parent.config; this.engine = parent.engine; this.creator = creator.language; this.creatorArguments = langConfig; this.weakReference = new ContextWeakReference(this); this.parent.addChildContext(this); this.truffleContext = spiContext; this.polyglotBindings = new ConcurrentHashMap<>(); if (!parent.config.logLevels.isEmpty()) { VMAccessor.LANGUAGE.configureLoggers(this, parent.config.logLevels); } this.contexts = createContextArray(); this.polyglotHostBindings = getAPIAccess().newValue(polyglotBindings, new PolyglotBindingsValue(getHostContext())); // notifyContextCreated() is called after spiContext.impl is set to this. initializeStaticContext(this); }
boolean patch(PolyglotContextConfig newConfig) { CompilerAsserts.neverPartOfCompilation(); this.config = newConfig; initializeStaticContext(this); if (!newConfig.logLevels.isEmpty()) { VMAccessor.LANGUAGE.configureLoggers(this, newConfig.logLevels); } final Object prev = enter(); try { for (int i = 1; i < this.contexts.length; i++) { final PolyglotLanguageContext context = this.contexts[i]; if (!context.patch(newConfig)) { return false; } } } finally { leave(prev); } return true; }