Skip to content

Commit 0775f08

Browse files
committed
[GR-44222] [GR-47557] Separate SVM and Truffle (Unchained Part 6).
PullRequest: graal/15126
2 parents 172f40c + 818a8fd commit 0775f08

File tree

92 files changed

+918
-406
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+918
-406
lines changed

common.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"Jsonnet files should not include this file directly but use ci/common.jsonnet instead."
55
],
66

7-
"mx_version": "6.34.0",
7+
"mx_version": "6.35.1",
88

99
"COMMENT.jdks": "When adding or removing JDKs keep in sync with JDKs in ci/common.jsonnet",
1010
"jdks": {

compiler/mx.compiler/mx_compiler.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -704,11 +704,7 @@ def _unittest_config_participant(config):
704704
# for the junit harness which uses reflection to find @Test methods. In addition, the
705705
# tests widely use JVMCI classes so JVMCI needs to also export all its packages to
706706
# ALL-UNNAMED.
707-
708707
mainClassArgs.extend(['-JUnitOpenPackages', 'jdk.internal.vm.ci/*=org.graalvm.truffle.runtime,jdk.internal.vm.compiler,ALL-UNNAMED'])
709-
mainClassArgs.extend(['-JUnitOpenPackages', 'org.graalvm.truffle/*=ALL-UNNAMED'])
710-
mainClassArgs.extend(['-JUnitOpenPackages', 'org.graalvm.truffle.compiler/*=ALL-UNNAMED'])
711-
mainClassArgs.extend(['-JUnitOpenPackages', 'org.graalvm.truffle.runtime/*=ALL-UNNAMED'])
712708

713709
limited_modules = None
714710
for arg in vmArgs:
@@ -1341,7 +1337,7 @@ def _jvmci_jars():
13411337
dir_name='graal',
13421338
license_files=[],
13431339
third_party_license_files=[],
1344-
dependencies=['Truffle API'],
1340+
dependencies=['Truffle Compiler'],
13451341
jar_distributions=[ # Dev jars (annotation processors)
13461342
'compiler:GRAAL_PROCESSOR',
13471343
],

compiler/mx.compiler/suite.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,9 @@
452452
"truffle:TRUFFLE_TEST",
453453
"truffle:TRUFFLE_COMPILER",
454454
"truffle:TRUFFLE_RUNTIME",
455-
"regex:TREGEX"
455+
"regex:TREGEX",
456+
"ASM_TREE_9.5",
457+
"ASM_UTIL_9.5",
456458
],
457459
"exclude" : [
458460
"mx:JUNIT",
@@ -493,7 +495,7 @@
493495
],
494496
"exports" : [
495497
"""* to com.oracle.graal.graal_enterprise,org.graalvm.nativeimage.pointsto,org.graalvm.nativeimage.builder,org.graalvm.nativeimage.llvm,com.oracle.svm.svm_enterprise,com.oracle.svm_enterprise.ml_dataset,org.graalvm.nativeimage.base,
496-
org.graalvm.extraimage.builder,com.oracle.svm.extraimage_enterprise""",
498+
org.graalvm.extraimage.builder,com.oracle.svm.extraimage_enterprise,org.graalvm.truffle.runtime.svm,com.oracle.truffle.enterprise.svm""",
497499
"org.graalvm.compiler.java to org.graalvm.nativeimage.agent.tracing,org.graalvm.nativeimage.configure",
498500
"org.graalvm.compiler.core.common to org.graalvm.nativeimage.agent.tracing,org.graalvm.nativeimage.objectfile",
499501
"org.graalvm.compiler.debug to org.graalvm.nativeimage.objectfile",

compiler/src/jdk.internal.vm.compiler.test/src/org/graalvm/compiler/test/SubprocessUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ public static Subprocess process(List<String> command, Map<String, String> env,
445445
}
446446

447447
private static boolean hasArg(String optionName) {
448-
if (optionName.equals("-cp") || optionName.equals("-classpath")) {
448+
if (optionName.equals("-cp") || optionName.equals("-classpath") || optionName.equals("-p")) {
449449
return true;
450450
}
451451
if (optionName.equals("--version") ||

compiler/src/jdk.internal.vm.compiler/src/org/graalvm/compiler/truffle/compiler/KnownTruffleTypes.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ public class KnownTruffleTypes extends AbstractKnownTruffleTypes {
154154
public final ResolvedJavaType CompilationState = lookupType("com.oracle.truffle.runtime.CompilationState");
155155

156156
public final ResolvedJavaType OptimizedCallTarget = lookupTypeCached("com.oracle.truffle.runtime.OptimizedCallTarget");
157+
public final ResolvedJavaMethod OptimizedCallTarget_call = findMethod(OptimizedCallTarget, "call", Object_Array);
157158
public final ResolvedJavaMethod OptimizedCallTarget_callDirect = findMethod(OptimizedCallTarget, "callDirect", Node, Object_Array);
158159
public final ResolvedJavaMethod OptimizedCallTarget_callInlined = findMethod(OptimizedCallTarget, "callInlined", Node, Object_Array);
159160
public final ResolvedJavaMethod OptimizedCallTarget_callIndirect = findMethod(OptimizedCallTarget, "callIndirect", Node, Object_Array);

compiler/src/jdk.internal.vm.compiler/src/org/graalvm/compiler/truffle/compiler/PartialEvaluator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ public InstrumentPhase.Instrumentation getInstrumentation() {
171171
throw new IllegalStateException("PartialEvaluator is not yet initialized");
172172
}
173173
long[] accessTable = new long[instrumentationCfg.instrumentationTableSize];
174-
instrumentation = new InstrumentPhase.Instrumentation(accessTable);
174+
instrumentation = new InstrumentPhase.Instrumentation(types, accessTable);
175175
}
176176
}
177177
}

compiler/src/jdk.internal.vm.compiler/src/org/graalvm/compiler/truffle/compiler/phases/InstrumentPhase.java

Lines changed: 17 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import static org.graalvm.compiler.truffle.compiler.TruffleCompilerOptions.InstrumentBranchesPerInlineSite;
3131
import static org.graalvm.compiler.truffle.compiler.TruffleCompilerOptions.InstrumentationTableSize;
3232

33-
import java.lang.reflect.Method;
3433
import java.util.AbstractMap;
3534
import java.util.ArrayList;
3635
import java.util.Collections;
@@ -55,47 +54,24 @@
5554
import org.graalvm.compiler.nodes.java.StoreIndexedNode;
5655
import org.graalvm.compiler.options.OptionValues;
5756
import org.graalvm.compiler.phases.BasePhase;
57+
import org.graalvm.compiler.truffle.compiler.KnownTruffleTypes;
5858
import org.graalvm.compiler.truffle.compiler.TruffleCompilerOptions;
5959
import org.graalvm.compiler.truffle.compiler.TruffleTierContext;
6060

6161
import jdk.vm.ci.code.CodeUtil;
6262
import jdk.vm.ci.meta.JavaConstant;
6363
import jdk.vm.ci.meta.JavaKind;
6464
import jdk.vm.ci.meta.MetaUtil;
65+
import jdk.vm.ci.meta.ResolvedJavaMethod;
6566

6667
public abstract class InstrumentPhase extends BasePhase<TruffleTierContext> {
67-
68-
private static boolean checkMethodExists(String declaringClassName, String methodName) {
69-
try {
70-
Class<?> declaringClass = Class.forName(declaringClassName);
71-
for (Method m : declaringClass.getDeclaredMethods()) {
72-
if (m.getName().equals(methodName)) {
73-
return true;
74-
}
75-
}
76-
} catch (ClassNotFoundException e) {
77-
throw new NoClassDefFoundError(declaringClassName);
78-
}
79-
throw new NoSuchMethodError(declaringClassName + "." + methodName);
80-
}
81-
82-
private static String asStackPattern(String declaringClassName, String methodName) {
83-
assert checkMethodExists(declaringClassName, methodName);
84-
return declaringClassName + "." + methodName;
85-
}
86-
87-
private static final String[] OMITTED_STACK_PATTERNS = new String[]{
88-
asStackPattern("com.oracle.truffle.runtime.OptimizedCallTarget", "executeRootNode"),
89-
asStackPattern("com.oracle.truffle.runtime.OptimizedCallTarget", "profiledPERoot"),
90-
asStackPattern("com.oracle.truffle.runtime.OptimizedCallTarget", "callDirect"),
91-
asStackPattern("com.oracle.truffle.runtime.OptimizedDirectCallNode", "call"),
92-
};
9368
private final Instrumentation instrumentation;
9469
protected final SnippetReflectionProvider snippetReflection;
9570

9671
public InstrumentPhase(SnippetReflectionProvider snippetReflection, Instrumentation instrumentation) {
9772
this.snippetReflection = snippetReflection;
9873
this.instrumentation = instrumentation;
74+
9975
}
10076

10177
public Instrumentation getInstrumentation() {
@@ -190,9 +166,20 @@ public int compare(Map.Entry<String, Point> x, Map.Entry<String, Point> y) {
190166
public Map<String, Point> pointMap = new LinkedHashMap<>();
191167
public int tableIdCount;
192168
public int tableStartIndex;
169+
private final String[] omittedStackPatterns;
193170

194-
public Instrumentation(long[] accessTable) {
171+
public Instrumentation(KnownTruffleTypes types, long[] accessTable) {
195172
this.accessTable = accessTable;
173+
this.omittedStackPatterns = new String[]{
174+
asStackPattern(types.OptimizedCallTarget_executeRootNode),
175+
asStackPattern(types.OptimizedCallTarget_profiledPERoot),
176+
asStackPattern(types.OptimizedCallTarget_callDirect),
177+
asStackPattern(types.OptimizedCallTarget_call),
178+
};
179+
}
180+
181+
private static String asStackPattern(ResolvedJavaMethod method) {
182+
return method.getDeclaringClass().toJavaName(true) + "." + method.getName();
196183
}
197184

198185
/*
@@ -226,7 +213,7 @@ private static String filterAndEncode(MethodFilter methodFilter, Node node, Inst
226213
}
227214
}
228215

229-
private static String prettify(String key, Point p) {
216+
private String prettify(String key, Point p) {
230217
if (p.isPrettified()) {
231218
StringBuilder sb = new StringBuilder();
232219
NodeSourcePosition pos = p.getPosition();
@@ -235,7 +222,7 @@ private static String prettify(String key, Point p) {
235222

236223
callerChainLoop: while (pos != null) {
237224
// Skip stack frame if it is a known pattern.
238-
for (String pattern : OMITTED_STACK_PATTERNS) {
225+
for (String pattern : omittedStackPatterns) {
239226
if (pos.getMethod().format("%H.%n(%p)").contains(pattern)) {
240227
pos = pos.getCaller();
241228
continue callerChainLoop;

compiler/src/jdk.internal.vm.compiler/src/org/graalvm/compiler/truffle/compiler/phases/InstrumentationSuite.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030

3131
public class InstrumentationSuite extends PhaseSuite<TruffleTierContext> {
3232
@SuppressWarnings("this-escape")
33-
public InstrumentationSuite(InstrumentPhase.InstrumentationConfiguration instrumentationCfg, SnippetReflectionProvider snippetReflection, InstrumentPhase.Instrumentation instrumentation) {
33+
public InstrumentationSuite(InstrumentPhase.InstrumentationConfiguration instrumentationCfg, SnippetReflectionProvider snippetReflection,
34+
InstrumentPhase.Instrumentation instrumentation) {
3435
if (instrumentationCfg.instrumentBranches) {
3536
appendPhase(new InstrumentBranchesPhase(snippetReflection, instrumentation, instrumentationCfg.instrumentBranchesPerInlineSite));
3637
}

espresso/mx.espresso/jvm-ce

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# mx --dynamicimports=/vm,/substratevm --components="Espresso Launcher,LibGraal,SubstrateVM,suite:tools" --native-images=lib:jvmcicompiler --disable-installables=true graalvm-show
22

33
DYNAMIC_IMPORTS=/vm,/substratevm
4-
COMPONENTS=Espresso Launcher,LibGraal,SubstrateVM,suite:tools
4+
COMPONENTS=Espresso Launcher,LibGraal,SubstrateVM,suite:tools,tflm
55
NATIVE_IMAGES=lib:jvmcicompiler
66
DISABLE_INSTALLABLES=true

espresso/mx.espresso/jvm-ce-llvm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# mx --dynamicimports=/vm,/substratevm --components="Espresso Launcher,LibGraal,SubstrateVM,Java on Truffle LLVM Java libraries,suite:tools" --native-images=lib:jvmcicompiler --disable-installables=true graalvm-show
22

33
DYNAMIC_IMPORTS=/vm,/substratevm
4-
COMPONENTS=Espresso Launcher,LibGraal,SubstrateVM,Java on Truffle LLVM Java libraries,suite:tools
4+
COMPONENTS=Espresso Launcher,LibGraal,SubstrateVM,Java on Truffle LLVM Java libraries,suite:tools,tflm
55
NATIVE_IMAGES=lib:jvmcicompiler
66
DISABLE_INSTALLABLES=true

0 commit comments

Comments
 (0)