Skip to content

Commit 3edbad7

Browse files
committed
Declare default export for DynamicObjectLibrary without service lookup.
Remove DynamicObject accessor used for service provider lookup.
1 parent b54dc5c commit 3edbad7

File tree

4 files changed

+5
-82
lines changed

4 files changed

+5
-82
lines changed

truffle/src/com.oracle.truffle.api.object/src/com/oracle/truffle/api/object/DynamicObjectLibrary.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* The Universal Permissive License (UPL), Version 1.0
@@ -96,7 +96,8 @@
9696
*
9797
* @since 20.2.0
9898
*/
99-
@GenerateLibrary(defaultExportLookupEnabled = true, dynamicDispatchEnabled = false, pushEncapsulatingNode = false)
99+
@GenerateLibrary(defaultExportLookupEnabled = false, dynamicDispatchEnabled = false, pushEncapsulatingNode = false)
100+
@GenerateLibrary.DefaultExport(DynamicObjectLibraryImpl.class)
100101
public abstract class DynamicObjectLibrary extends Library {
101102

102103
private static final LibraryFactory<DynamicObjectLibrary> FACTORY = LibraryFactory.resolve(DynamicObjectLibrary.class);

truffle/src/com.oracle.truffle.api.object/src/com/oracle/truffle/api/object/DynamicObjectSupportImpl.java

Lines changed: 0 additions & 57 deletions
This file was deleted.

truffle/src/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/Accessor.java

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1370,18 +1370,6 @@ protected InstrumentProviderSupport() {
13701370
public abstract InternalResource createInternalResource(Object truffleInstrumentProvider, String resourceId);
13711371
}
13721372

1373-
public abstract static class DynamicObjectSupport extends Support {
1374-
1375-
static final String IMPL_CLASS_NAME = "com.oracle.truffle.api.object.DynamicObjectSupportImpl";
1376-
1377-
protected DynamicObjectSupport() {
1378-
super(IMPL_CLASS_NAME);
1379-
}
1380-
1381-
public abstract <T> Iterable<T> lookupTruffleService(Class<T> type);
1382-
1383-
}
1384-
13851373
/*
13861374
* We want to avoid exporting {@code jdk.internal.module} and {@code jdk.internal.access} to all
13871375
* classes in the unnamed module. So instead we load it in an isolated class loader and own
@@ -1505,7 +1493,6 @@ private static final class Constants {
15051493
private static final Accessor.RuntimeSupport RUNTIME;
15061494
private static final Accessor.LanguageProviderSupport LANGUAGE_PROVIDER;
15071495
private static final Accessor.InstrumentProviderSupport INSTRUMENT_PROVIDER;
1508-
private static final DynamicObjectSupport DYNAMIC_OBJECT;
15091496
private static final Accessor.MemorySupport MEMORY_SUPPORT;
15101497

15111498
static {
@@ -1524,7 +1511,6 @@ private static final class Constants {
15241511
RUNTIME = getTVMCI().createRuntimeSupport(RuntimeSupport.PERMISSION);
15251512
LANGUAGE_PROVIDER = loadSupport(LanguageProviderSupport.IMPL_CLASS_NAME);
15261513
INSTRUMENT_PROVIDER = loadSupport(InstrumentProviderSupport.IMPL_CLASS_NAME);
1527-
DYNAMIC_OBJECT = loadSupport(DynamicObjectSupport.IMPL_CLASS_NAME);
15281514
MEMORY_SUPPORT = loadSupport(MemorySupport.IMPL_CLASS_NAME);
15291515
STRINGS = loadSupport(StringsSupport.IMPL_CLASS_NAME);
15301516
}
@@ -1635,10 +1621,6 @@ public final InstrumentProviderSupport instrumentProviderSupport() {
16351621
return Constants.INSTRUMENT_PROVIDER;
16361622
}
16371623

1638-
public final DynamicObjectSupport dynamicObjectSupport() {
1639-
return Constants.DYNAMIC_OBJECT;
1640-
}
1641-
16421624
public final MemorySupport memorySupport() {
16431625
return Constants.MEMORY_SUPPORT;
16441626
}

truffle/src/com.oracle.truffle.polyglot/src/com/oracle/truffle/polyglot/EngineAccessor.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* The Universal Permissive License (UPL), Version 1.0
@@ -157,7 +157,6 @@ final class EngineAccessor extends Accessor {
157157
static final HostSupport HOST = ACCESSOR.hostSupport();
158158
static final LanguageProviderSupport LANGUAGE_PROVIDER = ACCESSOR.languageProviderSupport();
159159
static final InstrumentProviderSupport INSTRUMENT_PROVIDER = ACCESSOR.instrumentProviderSupport();
160-
static final DynamicObjectSupport DYNAMIC_OBJECT = ACCESSOR.dynamicObjectSupport();
161160

162161
private static List<AbstractClassLoaderSupplier> locatorLoaders() {
163162
if (ImageInfo.inImageRuntimeCode()) {
@@ -348,12 +347,10 @@ private static PolyglotContextImpl getPolyglotContext(TruffleContext truffleCont
348347
@SuppressWarnings("deprecation")
349348
public <T> Iterable<T> loadServices(Class<T> type) {
350349
Map<Class<?>, T> found = new LinkedHashMap<>();
351-
// 1) Add known Truffle DynamicObjectLibraryProvider service.
352-
DYNAMIC_OBJECT.lookupTruffleService(type).forEach((s) -> found.putIfAbsent(s.getClass(), s));
353350
for (AbstractClassLoaderSupplier loaderSupplier : EngineAccessor.locatorOrDefaultLoaders()) {
354351
ClassLoader loader = loaderSupplier.get();
355352
if (loader != null) {
356-
// 2) Lookup implementations of a module aware interface
353+
// Lookup implementations of a module aware interface
357354
for (T service : ServiceLoader.load(type, loader)) {
358355
if (loaderSupplier.accepts(service.getClass())) {
359356
JDKSupport.exportTransitivelyTo(service.getClass().getModule());

0 commit comments

Comments
 (0)