Skip to content

Commit 779ac96

Browse files
committed
Introduce IsolatedTruffleCodeInstallBridge to avoid truffle dependency
Implements `OptimizedAssumptionDependency` on top of `IsolatedCodeInstallBridge` in `com.oracle.svm.truffle` to avoid pulling truffle dependencies in `com.oracle.svm.graal`.
1 parent 0a2f142 commit 779ac96

File tree

3 files changed

+39
-22
lines changed

3 files changed

+39
-22
lines changed

substratevm/src/com.oracle.svm.graal/src/com/oracle/svm/graal/isolated/IsolatedCodeInstallBridge.java

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,16 @@
2424
*/
2525
package com.oracle.svm.graal.isolated;
2626

27-
import org.graalvm.compiler.truffle.common.CompilableTruffleAST;
28-
import org.graalvm.compiler.truffle.common.OptimizedAssumptionDependency;
29-
3027
import com.oracle.svm.core.deopt.SubstrateInstalledCode;
3128
import com.oracle.svm.core.util.VMError;
3229

3330
import jdk.vm.ci.code.InstalledCode;
3431

3532
/**
3633
* A helper to pass information for installing code in the compilation client through a Truffle
37-
* compilation. It does not implement {@link InstalledCode} or {@link OptimizedAssumptionDependency}
38-
* in any meaningful way.
34+
* compilation. It does not implement {@link InstalledCode} in any meaningful way.
3935
*/
40-
public final class IsolatedCodeInstallBridge extends InstalledCode implements OptimizedAssumptionDependency {
36+
public class IsolatedCodeInstallBridge extends InstalledCode {
4137
private final ClientHandle<? extends SubstrateInstalledCode.Factory> factoryHandle;
4238
private ClientHandle<? extends SubstrateInstalledCode> installedCodeHandle;
4339

@@ -59,7 +55,7 @@ public ClientHandle<? extends SubstrateInstalledCode> getSubstrateInstalledCodeH
5955
return installedCodeHandle;
6056
}
6157

62-
private static final String DO_NOT_CALL_REASON = IsolatedCodeInstallBridge.class.getSimpleName() +
58+
protected static final String DO_NOT_CALL_REASON = IsolatedCodeInstallBridge.class.getSimpleName() +
6359
" only acts as an accessor for cross-isolate data. None of the implemented methods may be called.";
6460

6561
@Override
@@ -87,23 +83,9 @@ public byte[] getCode() {
8783
throw VMError.shouldNotReachHere(DO_NOT_CALL_REASON);
8884
}
8985

90-
@Override
91-
public void onAssumptionInvalidated(Object source, CharSequence reason) {
92-
throw VMError.shouldNotReachHere(DO_NOT_CALL_REASON);
93-
}
94-
9586
@Override
9687
public Object executeVarargs(Object... args) {
9788
throw VMError.shouldNotReachHere(DO_NOT_CALL_REASON);
9889
}
9990

100-
@Override
101-
public CompilableTruffleAST getCompilable() {
102-
throw VMError.shouldNotReachHere(DO_NOT_CALL_REASON);
103-
}
104-
105-
@Override
106-
public boolean soleExecutionEntryPoint() {
107-
throw VMError.shouldNotReachHere(DO_NOT_CALL_REASON);
108-
}
10991
}

substratevm/src/com.oracle.svm.truffle/src/com/oracle/svm/truffle/isolated/IsolatedCompilableTruffleAST.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ public SubstrateInstalledCode createSubstrateInstalledCode() {
144144

145145
@Override
146146
public InstalledCode createPreliminaryInstalledCode() {
147-
return new IsolatedCodeInstallBridge(handle);
147+
return new IsolatedTruffleCodeInstallBridge(handle);
148148
}
149149

150150
@Override
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package com.oracle.svm.truffle.isolated;
2+
3+
import com.oracle.svm.core.deopt.SubstrateInstalledCode;
4+
import com.oracle.svm.core.util.VMError;
5+
import com.oracle.svm.graal.isolated.ClientHandle;
6+
import com.oracle.svm.graal.isolated.IsolatedCodeInstallBridge;
7+
import jdk.vm.ci.code.InstalledCode;
8+
import org.graalvm.compiler.truffle.common.CompilableTruffleAST;
9+
import org.graalvm.compiler.truffle.common.OptimizedAssumptionDependency;
10+
11+
/**
12+
* A helper to pass information for installing code in the compilation client through a Truffle
13+
* compilation. It does not implement {@link InstalledCode} or {@link OptimizedAssumptionDependency}
14+
* in any meaningful way.
15+
*/
16+
public final class IsolatedTruffleCodeInstallBridge extends IsolatedCodeInstallBridge implements OptimizedAssumptionDependency {
17+
public IsolatedTruffleCodeInstallBridge(ClientHandle<? extends SubstrateInstalledCode.Factory> factoryHandle) {
18+
super(factoryHandle);
19+
}
20+
21+
@Override
22+
public void onAssumptionInvalidated(Object source, CharSequence reason) {
23+
throw VMError.shouldNotReachHere(DO_NOT_CALL_REASON);
24+
}
25+
26+
@Override
27+
public CompilableTruffleAST getCompilable() {
28+
throw VMError.shouldNotReachHere(DO_NOT_CALL_REASON);
29+
}
30+
31+
@Override
32+
public boolean soleExecutionEntryPoint() {
33+
throw VMError.shouldNotReachHere(DO_NOT_CALL_REASON);
34+
}
35+
}

0 commit comments

Comments
 (0)