Skip to content

Commit b79291f

Browse files
committed
[GR-46590] Remove Truffle dependency on the jdk.vm.ci.services.Services#getSavedProperties.
PullRequest: graal/14785
2 parents 59e1d3f + fbb6413 commit b79291f

File tree

19 files changed

+54
-73
lines changed

19 files changed

+54
-73
lines changed

compiler/src/jdk.internal.vm.compiler/src/org/graalvm/compiler/truffle/runtime/GraalRuntimeSupport.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@
4949
import com.oracle.truffle.api.nodes.Node;
5050
import com.oracle.truffle.api.nodes.RootNode;
5151

52-
import jdk.vm.ci.services.Services;
53-
5452
final class GraalRuntimeSupport extends RuntimeSupport {
5553

5654
GraalRuntimeSupport(Object permission) {
@@ -214,11 +212,6 @@ public Assumption createAlwaysValidAssumption() {
214212
return OptimizedAssumption.createAlwaysValid();
215213
}
216214

217-
@Override
218-
public String getSavedProperty(String key) {
219-
return Services.getSavedProperties().get(key);
220-
}
221-
222215
@Override
223216
public void reportPolymorphicSpecialize(Node source) {
224217
final RootNode rootNode = source.getRootNode();

sdk/src/org.graalvm.polyglot/src/org/graalvm/polyglot/Context.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1938,7 +1938,7 @@ public Context build() {
19381938
hostAccess, polyglotAccess, nativeAccess, createThread, hostClassLoading, innerContextOptions,
19391939
experimentalOptions, localHostLookupFilter, contextOptions, arguments == null ? Collections.emptyMap() : arguments,
19401940
permittedLanguages, useIOAccess, logHandler, createProcess, processHandler, useEnvironmentAccess, environment, zone, limits,
1941-
localCurrentWorkingDirectory, hostClassLoader, allowValueSharing, useSystemExit);
1941+
localCurrentWorkingDirectory, System.getProperty("java.io.tmpdir"), hostClassLoader, allowValueSharing, useSystemExit);
19421942
return ctx;
19431943
}
19441944

sdk/src/org.graalvm.polyglot/src/org/graalvm/polyglot/Engine.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1195,7 +1195,7 @@ public Value asValue(Object o) {
11951195
}
11961196

11971197
@Override
1198-
public FileSystem newDefaultFileSystem() {
1198+
public FileSystem newDefaultFileSystem(String hostTmpDir) {
11991199
throw noPolyglotImplementationFound();
12001200
}
12011201

sdk/src/org.graalvm.polyglot/src/org/graalvm/polyglot/impl/AbstractPolyglotImpl.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -585,8 +585,8 @@ public abstract Context createContext(Object receiver, SandboxPolicy sandboxPoli
585585
Predicate<String> classFilter,
586586
Map<String, String> options,
587587
Map<String, String[]> arguments, String[] onlyLanguages, IOAccess ioAccess, LogHandler logHandler, boolean allowCreateProcess, ProcessHandler processHandler,
588-
EnvironmentAccess environmentAccess, Map<String, String> environment, ZoneId zone, Object limitsImpl, String currentWorkingDirectory, ClassLoader hostClassLoader,
589-
boolean allowValueSharing, boolean useSystemExit);
588+
EnvironmentAccess environmentAccess, Map<String, String> environment, ZoneId zone, Object limitsImpl, String currentWorkingDirectory, String tmpDir,
589+
ClassLoader hostClassLoader, boolean allowValueSharing, boolean useSystemExit);
590590

591591
public abstract String getImplementationName(Object receiver);
592592

@@ -1150,8 +1150,8 @@ public Object buildLimits(long statementLimit, Predicate<Source> statementLimitS
11501150
return getNext().buildLimits(statementLimit, statementLimitSourceFilter, onLimit);
11511151
}
11521152

1153-
public FileSystem newDefaultFileSystem() {
1154-
return getNext().newDefaultFileSystem();
1153+
public FileSystem newDefaultFileSystem(String hostTmpDir) {
1154+
return getNext().newDefaultFileSystem(hostTmpDir);
11551155
}
11561156

11571157
public FileSystem allowLanguageHomeAccess(FileSystem fileSystem) {

sdk/src/org.graalvm.polyglot/src/org/graalvm/polyglot/io/FileSystem.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ default boolean isSameFile(Path path1, Path path2, LinkOption... options) throws
495495
* @since 20.2.0
496496
*/
497497
static FileSystem newDefaultFileSystem() {
498-
return IOHelper.IMPL.newDefaultFileSystem();
498+
return IOHelper.IMPL.newDefaultFileSystem(System.getProperty("java.io.tmpdir"));
499499
}
500500

501501
/**

sdk/src/org.graalvm.polyglot/src/org/graalvm/polyglot/io/IOHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2018, 2023, 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

truffle/src/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/polyglot/FileSystemsTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2973,9 +2973,9 @@ protected Object execute(RootNode node, Env env, Object[] contextArguments, Obje
29732973

29742974
private static FileSystem createPreInitializeContextFileSystem() throws ReflectiveOperationException {
29752975
Class<? extends FileSystem> clazz = Class.forName("com.oracle.truffle.polyglot.FileSystems$PreInitializeContextFileSystem").asSubclass(FileSystem.class);
2976-
Constructor<? extends FileSystem> init = clazz.getDeclaredConstructor();
2976+
Constructor<? extends FileSystem> init = clazz.getDeclaredConstructor(String.class);
29772977
ReflectionUtils.setAccessible(init, true);
2978-
return init.newInstance();
2978+
return init.newInstance(System.getProperty("java.io.tmpdir"));
29792979
}
29802980

29812981
private static void switchToImageExecutionTime(FileSystem fileSystem, Path cwd) throws ReflectiveOperationException {

truffle/src/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/wrapper/HostEngineDispatch.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,16 +87,16 @@ public Context createContext(Object receiver, SandboxPolicy sandboxPolicy, Outpu
8787
boolean allowNativeAccess, boolean allowCreateThread, boolean allowHostClassLoading, boolean allowInnerContextOptions, boolean allowExperimentalOptions,
8888
Predicate<String> classFilter, Map<String, String> options, Map<String, String[]> arguments, String[] onlyLanguages, IOAccess ioAccess, LogHandler logHandler,
8989
boolean allowCreateProcess, ProcessHandler processHandler, EnvironmentAccess environmentAccess, Map<String, String> environment, ZoneId zone, Object limitsImpl,
90-
String currentWorkingDirectory, ClassLoader hostClassLoader, boolean allowValueSharing, boolean useSystemExit) {
90+
String currentWorkingDirectory, String tmpDir, ClassLoader hostClassLoader, boolean allowValueSharing, boolean useSystemExit) {
9191
HostEngine engine = (HostEngine) receiver;
9292
Engine localEngine = engine.localEngine;
9393
AbstractEngineDispatch dispatch = api.getDispatch(localEngine);
9494
Object engineReceiver = api.getReceiver(localEngine);
9595
Context localContext = dispatch.createContext(engineReceiver, sandboxPolicy, out, err, in, allowHostAccess, hostAccess, polyglotAccess, allowNativeAccess, allowCreateThread,
9696
allowHostClassLoading,
9797
allowInnerContextOptions, allowExperimentalOptions, classFilter, options, arguments, onlyLanguages, ioAccess, logHandler, allowCreateProcess, processHandler,
98-
environmentAccess, environment, zone, limitsImpl, currentWorkingDirectory, hostClassLoader, true, useSystemExit);
99-
long guestContextId = hostToGuest.remoteCreateContext(engine.remoteEngine, sandboxPolicy);
98+
environmentAccess, environment, zone, limitsImpl, currentWorkingDirectory, tmpDir, hostClassLoader, true, useSystemExit);
99+
long guestContextId = hostToGuest.remoteCreateContext(engine.remoteEngine, sandboxPolicy, tmpDir);
100100
HostContext context = new HostContext(engine, guestContextId, localContext);
101101
hostToGuest.registerHostContext(guestContextId, context);
102102
return polyglot.getAPIAccess().newContext(remoteContext, context, engine.api);

truffle/src/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/wrapper/HostEntryPoint.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,15 @@ <T> T unmarshall(Class<T> type, long id) {
117117
return type.cast(idToGuestObject.get(id));
118118
}
119119

120-
public long remoteCreateContext(long engineId, SandboxPolicy sandboxPolicy) {
120+
public long remoteCreateContext(long engineId, SandboxPolicy sandboxPolicy, String tmpDir) {
121121
Engine engine = unmarshall(Engine.class, engineId);
122122
Object receiver = api.getReceiver(engine);
123123
AbstractEngineDispatch dispatch = api.getDispatch(engine);
124124
Context remoteContext = dispatch.createContext(receiver, sandboxPolicy, null, null, null, false, null, PolyglotAccess.NONE, false,
125125
false, false, false, false, null, new HashMap<>(), new HashMap<>(),
126126
new String[0], IOAccess.NONE, null,
127127
false, null, EnvironmentAccess.NONE,
128-
null, null, null, null, null, true, false);
128+
null, null, null, null, tmpDir, null, true, false);
129129
return guestToHost(remoteContext);
130130
}
131131

truffle/src/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/wrapper/RemoteSLTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ public void setup() throws Throwable {
8888
HostPolyglotDispatch dispatch = new HostPolyglotDispatch();
8989
dispatch.setConstructors(previousPolyglot.getAPIAccess());
9090
dispatch.setNext(previousPolyglot);
91+
dispatch.setIO(previousPolyglot.getIO());
9192
setPolyglotImpl(dispatch);
9293
}
9394

0 commit comments

Comments
 (0)