synchronized void removeLogLevelsForContext(final Object context) { final Set<String> toRemove = collectRemovedLevels(); for (Iterator<ContextWeakReference> it = activeContexts.iterator(); it.hasNext();) { final Object activeContext = it.next().get(); if (context.equals(activeContext)) { toRemove.addAll(TruffleLanguage.AccessAPI.engineAccess().getLogLevels(context).keySet()); it.remove(); break; } } reconfigure(Collections.emptyMap(), toRemove); }
void checkDisposed() { if (AccessAPI.engineAccess().isDisposed(vmObject)) { throw new IllegalStateException("Language environment is already disposed."); } if (!valid) { throw new IllegalStateException("Language environment is already invalidated."); } }
void checkDisposed() { if (AccessAPI.engineAccess().isDisposed(vmObject)) { throw new IllegalStateException("Language environment is already disposed."); } if (!valid) { throw new IllegalStateException("Language environment is already invalidated."); } }
/** * Returns <code>true</code> if host access is generally allowed. If this method returns * <code>false</code> then {@link #lookupHostSymbol(String)} will always fail. * * @since 0.27 */ @TruffleBoundary public boolean isHostLookupAllowed() { return AccessAPI.engineAccess().isHostAccessAllowed(vmObject, this); }
/** * Returns a map mime-type to language instance of all languages that are installed in the * environment. Using the language instance additional services can be * {@link #lookup(LanguageInfo, Class) looked up} . * * @since 0.26 */ @TruffleBoundary public Map<String, LanguageInfo> getLanguages() { return AccessAPI.engineAccess().getLanguages(vmObject); }
/** * Returns <code>true</code> if the creation of new threads is allowed in the current * environment. * * @see #createThread(Runnable) * @since 0.28 */ public boolean isCreateThreadAllowed() { return AccessAPI.engineAccess().isCreateThreadAllowed(vmObject); }
private TruffleContext(TruffleLanguage.Env env, Map<String, Object> config) { this.impl = AccessAPI.engineAccess().createInternalContext(env.getVMObject(), config, this); this.closeable = false; // Initialized after this TruffleContext instance is fully set up AccessAPI.engineAccess().initializeInternalContext(env.getVMObject(), impl); }
/** * Converts a Java class to a host symbol as if by * {@code lookupHostSymbol(symbolClass.getName())} but without an actual lookup. Must not be * used with Truffle or guest language classes. * * @see #lookupHostSymbol(String) * @since 1.0 */ @TruffleBoundary public Object asHostSymbol(Class<?> symbolClass) { return AccessAPI.engineAccess().asHostSymbol(vmObject, symbolClass); }
/** * Returns <code>true</code> if the argument is a Java host language function wrapped using * Truffle interop. * * @since 1.0 */ @SuppressWarnings("static-method") public boolean isHostFunction(Object value) { return AccessAPI.engineAccess().isHostFunction(value); }
/** * Returns the polyglot context associated with this environment. * * @return the polyglot context * @since 0.30 */ public TruffleContext getContext() { return AccessAPI.engineAccess().getPolyglotContext(vmObject); }
/** * Returns a map instrument-id to instrument instance of all instruments that are installed * in the environment. Using the instrument instance additional services can be * {@link #lookup(InstrumentInfo, Class) looked up} . * * @since 0.26 */ @TruffleBoundary public Map<String, InstrumentInfo> getInstruments() { return AccessAPI.engineAccess().getInstruments(vmObject); }
/** * @since 0.8 or earlier * @deprecated in 0.25 use {@link #getContextReference()} instead */ @Deprecated protected final Node createFindContextNode() { return AccessAPI.engineAccess().createFindContextNode(this); }
/** * Get a parent context of this context, if any. This provides the hierarchy of inner contexts. * * @return a parent context, or <code>null</code> if there is no parent * @since 0.30 */ @TruffleBoundary public TruffleContext getParent() { return AccessAPI.engineAccess().getParentContext(impl); }
private <T extends Throwable> RuntimeException wrapHostException(T t) { if (TruffleLanguage.AccessAPI.engineAccess().isDefaultFileSystem(fileSystem)) { throw sthrow(t); } throw TruffleLanguage.AccessAPI.engineAccess().wrapHostException(TruffleLanguage.AccessAPI.engineAccess().getCurrentHostContext(), t); }
/** * Returns the polyglot context associated with this environment. * * @return the polyglot context * @since 0.30 */ public TruffleContext getContext() { return AccessAPI.engineAccess().getPolyglotContext(vmObject); }
/** * Returns a map instrument-id to instrument instance of all instruments that are installed * in the environment. Using the instrument instance additional services can be * {@link #lookup(InstrumentInfo, Class) looked up} . * * @since 0.26 */ @TruffleBoundary public Map<String, InstrumentInfo> getInstruments() { return AccessAPI.engineAccess().getInstruments(vmObject); }
/** * Returns {@code true} if the argument is a host symbol, representing the constructor and * static members of a Java class, as obtained by e.g. {@link #lookupHostSymbol}. * * @see #lookupHostSymbol(String) * @since 1.0 */ @SuppressWarnings("static-method") public boolean isHostSymbol(Object guestObject) { return AccessAPI.engineAccess().isHostSymbol(guestObject); }
/** * Returns <code>true</code> if host access is generally allowed. If this method returns * <code>false</code> then {@link #lookupHostSymbol(String)} will always fail. * * @since 0.27 */ @TruffleBoundary public boolean isHostLookupAllowed() { return AccessAPI.engineAccess().isHostAccessAllowed(vmObject, this); }
/** * Get a parent context of this context, if any. This provides the hierarchy of inner contexts. * * @return a parent context, or <code>null</code> if there is no parent * @since 0.30 */ @TruffleBoundary public TruffleContext getParent() { return AccessAPI.engineAccess().getParentContext(impl); }
SourceSection findSourceLocation(Object obj) { Object c = getLanguageContext(); if (c != UNSET_CONTEXT) { final Object rawValue = AccessAPI.engineAccess().findOriginalObject(obj); return spi.findSourceLocation(c, rawValue); } else { return null; } }