Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
gluon-bot committed Oct 27, 2023
2 parents 87011d1 + fd83528 commit c22ac20
Show file tree
Hide file tree
Showing 24 changed files with 502 additions and 330 deletions.
8 changes: 2 additions & 6 deletions sdk/mx.sdk/mx_sdk_vm_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -2250,13 +2250,9 @@ def _get_extra_jvm_args():
extra_jvm_args = mx.list_to_cmd_line(image_config.extra_jvm_args)
if not _jlink_libraries():
if mx.is_windows():
extra_jvm_args = ' '.join([extra_jvm_args, r'--upgrade-module-path "%location%\..\..\jvmci\graal.jar"',
r'--add-modules org.graalvm.polyglot',
r'--module-path "%location%\..\..\truffle\truffle-api.jar:%location%\..\..\jvmci\polyglot.jar"'])
extra_jvm_args = ' '.join([extra_jvm_args, r'--upgrade-module-path "%location%\..\..\jvmci\graal.jar"'])
else:
extra_jvm_args = ' '.join([extra_jvm_args, '--upgrade-module-path "${location}/../../jvmci/graal.jar"',
'--add-modules org.graalvm.polyglot',
'--module-path "${location}/../../truffle/truffle-api.jar:${location}/../../jvmci/polyglot.jar"'])
extra_jvm_args = ' '.join([extra_jvm_args, '--upgrade-module-path "${location}/../../jvmci/graal.jar"'])
return extra_jvm_args

def _get_option_vars():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -558,10 +558,12 @@ public List<String> getBuilderJavaArgs() {
*/
public List<Path> getBuilderModulePath() {
List<Path> result = new ArrayList<>();
// Non-jlinked JDKs need truffle and graal-sdk on the module path since they
// don't have those modules as part of the JDK.
// Non-jlinked JDKs need truffle and word, collections, nativeimage on the
// module path since they don't have those modules as part of the JDK. Note
// that graal-sdk is now obsolete after the split in GR-43819 (#7171)
if (libJvmciDir != null) {
result.addAll(getJars(libJvmciDir, "graal-sdk", "enterprise-graal"));
result.addAll(getJars(libJvmciDir, "enterprise-graal"));
result.addAll(getJars(libJvmciDir, "word", "collections", "nativeimage"));
}
if (modulePathBuild) {
result.addAll(createTruffleBuilderModulePath());
Expand All @@ -571,19 +573,37 @@ public List<Path> getBuilderModulePath() {
}

private List<Path> createTruffleBuilderModulePath() {
List<Path> jars = getJars(rootDir.resolve(Paths.get("lib", "truffle")), "truffle-api", "truffle-runtime", "truffle-enterprise");
Path libTruffleDir = rootDir.resolve(Paths.get("lib", "truffle"));
List<Path> jars = getJars(libTruffleDir, "truffle-api", "truffle-runtime", "truffle-enterprise");
if (!jars.isEmpty()) {
/*
* If Truffle is installed as part of the JDK we always add the builder modules of
* Truffle to the builder module path. This is legacy support and should in the
* future no longer be needed.
*/
jars.addAll(getJars(rootDir.resolve(Paths.get("lib", "truffle")), "truffle-compiler"));
jars.addAll(getJars(libTruffleDir, "truffle-compiler"));
Path builderPath = rootDir.resolve(Paths.get("lib", "truffle", "builder"));
if (Files.exists(builderPath)) {
jars.addAll(getJars(builderPath, "truffle-runtime-svm", "truffle-enterprise-svm"));
List<Path> truffleRuntimeSVMJars = getJars(builderPath, "truffle-runtime-svm", "truffle-enterprise-svm");
jars.addAll(truffleRuntimeSVMJars);
if (libJvmciDir != null && !truffleRuntimeSVMJars.isEmpty()) {
// truffle-runtime-svm depends on polyglot, which is not part of non-jlinked
// JDKs
jars.addAll(getJars(libJvmciDir, "polyglot"));
}
}
if (libJvmciDir != null) {
// truffle-runtime depends on polyglot, which is not part of non-jlinked JDKs
jars.addAll(getJars(libTruffleDir, "jniutils"));
}
}
/*
* Non-Jlinked JDKs don't have truffle-compiler as part of the JDK, however the native
* image builder still needs it
*/
if (libJvmciDir != null) {
jars.addAll(getJars(libTruffleDir, "truffle-compiler"));
}

return jars;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ protected final Future<?> runWith(Object truffleObject) throws Exception {
tester.sendMessage("{\"id\":1,\"method\":\"Runtime.enable\"}");
assertEquals("{\"result\":{},\"id\":1}", tester.getMessages(true).trim());
tester.sendMessage("{\"id\":2,\"method\":\"Debugger.enable\"}");
assertEquals("{\"result\":{},\"id\":2}", tester.getMessages(true).trim());
tester.receiveMessages(
"{\"result\":{\"debuggerId\":\"UniqueDebuggerId.", "},\"id\":2}\n");
tester.sendMessage("{\"id\":3,\"method\":\"Debugger.setBreakpointByUrl\",\"params\":{\"lineNumber\":3,\"url\":\"" + FILE_NAME + "\",\"columnNumber\":0,\"condition\":\"\"}}");
assertTrue(tester.compareReceivedMessages(
"{\"result\":{\"breakpointId\":\"1\",\"locations\":[]},\"id\":3}\n"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ private void testBuggyCalls(AtomicReference<ProxyLanguage> language, String pref
tester.setErr(errorStream);
tester.sendMessage("{\"id\":1,\"method\":\"Runtime.enable\"}");
tester.sendMessage("{\"id\":2,\"method\":\"Debugger.enable\"}");
assertTrue(tester.compareReceivedMessages(
tester.receiveMessages(
"{\"result\":{},\"id\":1}\n" +
"{\"result\":{},\"id\":2}\n"));
"{\"result\":{\"debuggerId\":\"UniqueDebuggerId.", "},\"id\":2}\n");
tester.sendMessage("{\"id\":3,\"method\":\"Runtime.runIfWaitingForDebugger\"}");
assertTrue(tester.compareReceivedMessages(
"{\"result\":{},\"id\":3}\n" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void testDisabledDomainsCalls() throws Exception {
tester.sendMessage("{\"id\":10," + debuggerMessage);
assertEquals("{\"id\":10,\"error\":{\"code\":-32601,\"message\":\"Domain Debugger is disabled.\"}}", tester.getMessages(true).trim());
tester.sendMessage("{\"id\":11,\"method\":\"Debugger.enable\"}");
assertEquals("{\"result\":{},\"id\":11}", tester.getMessages(true).trim());
tester.receiveMessages("{\"result\":{\"debuggerId\":\"UniqueDebuggerId.", "},\"id\":11}\n");
tester.sendMessage("{\"id\":12," + debuggerMessage);
assertEquals("{\"result\":{\"breakpointId\":\"1\",\"locations\":[]},\"id\":12}", tester.getMessages(true).trim());
tester.sendMessage("{\"id\":13,\"method\":\"Debugger.disable\"}");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ public void testSuspendInInitialization() throws Exception {
tester.sendMessage("{\"id\":1,\"method\":\"Runtime.enable\"}");
assertEquals("{\"result\":{},\"id\":1}", tester.getMessages(true).trim());
tester.sendMessage("{\"id\":2,\"method\":\"Debugger.enable\"}");
assertEquals("{\"result\":{},\"id\":2}", tester.getMessages(true).trim());
tester.receiveMessages(
"{\"result\":{\"debuggerId\":\"UniqueDebuggerId.", "},\"id\":2}\n");
tester.sendMessage("{\"id\":3,\"method\":\"Runtime.runIfWaitingForDebugger\"}");
assertTrue(tester.compareReceivedMessages(
"{\"result\":{},\"id\":3}\n" +
Expand Down Expand Up @@ -101,7 +102,8 @@ public void testSuspendInInitialization() throws Exception {
tester.sendMessage("{\"id\":1,\"method\":\"Runtime.enable\"}");
assertEquals("{\"result\":{},\"id\":1}", tester.getMessages(true).trim());
tester.sendMessage("{\"id\":2,\"method\":\"Debugger.enable\"}");
assertEquals("{\"result\":{},\"id\":2}", tester.getMessages(true).trim());
tester.receiveMessages(
"{\"result\":{\"debuggerId\":\"UniqueDebuggerId.", "},\"id\":2}\n");
tester.sendMessage("{\"id\":3,\"method\":\"Runtime.runIfWaitingForDebugger\"}");
assertTrue(tester.compareReceivedMessages(
"{\"result\":{},\"id\":3}\n" +
Expand Down Expand Up @@ -142,7 +144,8 @@ public void testSuspendInInternal() throws Exception {
tester.sendMessage("{\"id\":1,\"method\":\"Runtime.enable\"}");
assertEquals("{\"result\":{},\"id\":1}", tester.getMessages(true).trim());
tester.sendMessage("{\"id\":2,\"method\":\"Debugger.enable\"}");
assertEquals("{\"result\":{},\"id\":2}", tester.getMessages(true).trim());
tester.receiveMessages(
"{\"result\":{\"debuggerId\":\"UniqueDebuggerId.", "},\"id\":2}\n");
tester.sendMessage("{\"id\":3,\"method\":\"Runtime.runIfWaitingForDebugger\"}");
assertTrue(tester.compareReceivedMessages(
"{\"result\":{},\"id\":3}\n" +
Expand Down Expand Up @@ -172,7 +175,8 @@ public void testSuspendInInternal() throws Exception {
tester.sendMessage("{\"id\":1,\"method\":\"Runtime.enable\"}");
assertEquals("{\"result\":{},\"id\":1}", tester.getMessages(true).trim());
tester.sendMessage("{\"id\":2,\"method\":\"Debugger.enable\"}");
assertEquals("{\"result\":{},\"id\":2}", tester.getMessages(true).trim());
tester.receiveMessages(
"{\"result\":{\"debuggerId\":\"UniqueDebuggerId.", "},\"id\":2}\n");
tester.sendMessage("{\"id\":3,\"method\":\"Runtime.runIfWaitingForDebugger\"}");
assertTrue(tester.compareReceivedMessages(
"{\"result\":{},\"id\":3}\n" +
Expand Down Expand Up @@ -213,7 +217,8 @@ public void testThis() throws Exception {
tester.sendMessage("{\"id\":1,\"method\":\"Runtime.enable\"}");
assertEquals("{\"result\":{},\"id\":1}", tester.getMessages(true).trim());
tester.sendMessage("{\"id\":2,\"method\":\"Debugger.enable\"}");
assertEquals("{\"result\":{},\"id\":2}", tester.getMessages(true).trim());
tester.receiveMessages(
"{\"result\":{\"debuggerId\":\"UniqueDebuggerId.", "},\"id\":2}\n");
tester.sendMessage("{\"id\":3,\"method\":\"Runtime.runIfWaitingForDebugger\"}");
assertTrue(tester.compareReceivedMessages(
"{\"result\":{},\"id\":3}\n" +
Expand Down Expand Up @@ -269,9 +274,10 @@ public void testShortURIs() throws Exception {
tester.sendMessage("{\"id\":1,\"method\":\"Runtime.enable\"}");
tester.sendMessage("{\"id\":2,\"method\":\"Debugger.enable\"}");
tester.sendMessage("{\"id\":3,\"method\":\"Runtime.runIfWaitingForDebugger\"}");
assertTrue(tester.compareReceivedMessages(
tester.receiveMessages(
"{\"result\":{},\"id\":1}\n" +
"{\"result\":{},\"id\":2}\n" +
"{\"result\":{\"debuggerId\":\"UniqueDebuggerId.", "},\"id\":2}\n");
assertTrue(tester.compareReceivedMessages(
"{\"result\":{},\"id\":3}\n" +
"{\"method\":\"Runtime.executionContextCreated\",\"params\":{\"context\":{\"origin\":\"\",\"name\":\"test\",\"id\":1}}}\n"));
tester.eval(source1);
Expand Down Expand Up @@ -319,9 +325,10 @@ public void testOutput() throws Exception {
tester.sendMessage("{\"id\":1,\"method\":\"Runtime.enable\"}");
tester.sendMessage("{\"id\":2,\"method\":\"Debugger.enable\"}");
tester.sendMessage("{\"id\":3,\"method\":\"Runtime.runIfWaitingForDebugger\"}");
assertTrue(tester.compareReceivedMessages(
tester.receiveMessages(
"{\"result\":{},\"id\":1}\n" +
"{\"result\":{},\"id\":2}\n" +
"{\"result\":{\"debuggerId\":\"UniqueDebuggerId.", "},\"id\":2}\n");
assertTrue(tester.compareReceivedMessages(
"{\"result\":{},\"id\":3}\n" +
"{\"method\":\"Runtime.executionContextCreated\",\"params\":{\"context\":{\"origin\":\"\",\"name\":\"test\",\"id\":1}}}\n"));
tester.eval(source);
Expand Down Expand Up @@ -387,9 +394,10 @@ public void testOutputNoNL() throws Exception {
tester.sendMessage("{\"id\":1,\"method\":\"Runtime.enable\"}");
tester.sendMessage("{\"id\":2,\"method\":\"Debugger.enable\"}");
tester.sendMessage("{\"id\":3,\"method\":\"Runtime.runIfWaitingForDebugger\"}");
assertTrue(tester.compareReceivedMessages(
tester.receiveMessages(
"{\"result\":{},\"id\":1}\n" +
"{\"result\":{},\"id\":2}\n" +
"{\"result\":{\"debuggerId\":\"UniqueDebuggerId.", "},\"id\":2}\n");
assertTrue(tester.compareReceivedMessages(
"{\"result\":{},\"id\":3}\n" +
"{\"method\":\"Runtime.executionContextCreated\",\"params\":{\"context\":{\"origin\":\"\",\"name\":\"test\",\"id\":1}}}\n"));
tester.eval(source);
Expand Down Expand Up @@ -426,9 +434,10 @@ public void testAsynchronousStackTraces() throws Exception {
tester.sendMessage("{\"id\":2,\"method\":\"Debugger.enable\"}");
tester.sendMessage("{\"id\":3,\"method\":\"Debugger.setAsyncCallStackDepth\",\"params\":{\"maxDepth\":1}}");
tester.sendMessage("{\"id\":4,\"method\":\"Runtime.runIfWaitingForDebugger\"}");
assertTrue(tester.compareReceivedMessages(
tester.receiveMessages(
"{\"result\":{},\"id\":1}\n" +
"{\"result\":{},\"id\":2}\n" +
"{\"result\":{\"debuggerId\":\"UniqueDebuggerId.", "},\"id\":2}\n");
assertTrue(tester.compareReceivedMessages(
"{\"result\":{},\"id\":3}\n" +
"{\"result\":{},\"id\":4}\n" +
"{\"method\":\"Runtime.executionContextCreated\",\"params\":{\"context\":{\"origin\":\"\",\"name\":\"test\",\"id\":1}}}\n"));
Expand Down Expand Up @@ -511,9 +520,10 @@ public void testSuspendALot() throws Exception {
tester.sendMessage("{\"id\":2,\"method\":\"Debugger.enable\"}");
tester.sendMessage("{\"id\":3,\"method\":\"Debugger.setAsyncCallStackDepth\",\"params\":{\"maxDepth\":1}}");
tester.sendMessage("{\"id\":4,\"method\":\"Runtime.runIfWaitingForDebugger\"}");
assertTrue(tester.compareReceivedMessages(
tester.receiveMessages(
"{\"result\":{},\"id\":1}\n" +
"{\"result\":{},\"id\":2}\n" +
"{\"result\":{\"debuggerId\":\"UniqueDebuggerId.", "},\"id\":2}\n");
assertTrue(tester.compareReceivedMessages(
"{\"result\":{},\"id\":3}\n" +
"{\"result\":{},\"id\":4}\n" +
"{\"method\":\"Runtime.executionContextCreated\",\"params\":{\"context\":{\"origin\":\"\",\"name\":\"test\",\"id\":1}}}\n"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public class InspectorMessageTransportTest extends EnginesGCedTest {
private static final String[] MESSAGES_TO_BACKEND;
private static final String[] MESSAGES_TO_CLIENT = {
"{\"result\":{},\"id\":5}",
"{\"result\":{},\"id\":6}",
"{\"result\":{\"debuggerId\":\"UniqueDebuggerId.",
"{\"result\":{},\"id\":7}",
"{\"result\":{},\"id\":8}",
"{\"result\":{},\"id\":20}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ public void testThisReceiver1() throws Exception {
tester.sendMessage("{\"id\":1,\"method\":\"Runtime.enable\"}");
assertEquals("{\"result\":{},\"id\":1}", tester.getMessages(true).trim());
tester.sendMessage("{\"id\":2,\"method\":\"Debugger.enable\"}");
assertEquals("{\"result\":{},\"id\":2}", tester.getMessages(true).trim());
tester.receiveMessages(
"{\"result\":{\"debuggerId\":\"UniqueDebuggerId.", "},\"id\":2}\n");
tester.sendMessage("{\"id\":3,\"method\":\"Runtime.runIfWaitingForDebugger\"}");
assertTrue(tester.compareReceivedMessages(
"{\"result\":{},\"id\":3}\n" +
Expand Down Expand Up @@ -98,7 +99,8 @@ public void testThisReceiver2() throws Exception {
tester.sendMessage("{\"id\":1,\"method\":\"Runtime.enable\"}");
assertEquals("{\"result\":{},\"id\":1}", tester.getMessages(true).trim());
tester.sendMessage("{\"id\":2,\"method\":\"Debugger.enable\"}");
assertEquals("{\"result\":{},\"id\":2}", tester.getMessages(true).trim());
tester.receiveMessages(
"{\"result\":{\"debuggerId\":\"UniqueDebuggerId.", "},\"id\":2}\n");
tester.sendMessage("{\"id\":3,\"method\":\"Runtime.runIfWaitingForDebugger\"}");
assertTrue(tester.compareReceivedMessages(
"{\"result\":{},\"id\":3}\n" +
Expand Down Expand Up @@ -154,7 +156,8 @@ private static void checkMultipleReceivers(String receiver, String sourceHash) t
tester.sendMessage("{\"id\":1,\"method\":\"Runtime.enable\"}");
assertEquals("{\"result\":{},\"id\":1}", tester.getMessages(true).trim());
tester.sendMessage("{\"id\":2,\"method\":\"Debugger.enable\"}");
assertEquals("{\"result\":{},\"id\":2}", tester.getMessages(true).trim());
tester.receiveMessages(
"{\"result\":{\"debuggerId\":\"UniqueDebuggerId.", "},\"id\":2}\n");
tester.sendMessage("{\"id\":3,\"method\":\"Runtime.runIfWaitingForDebugger\"}");
assertTrue(tester.compareReceivedMessages(
"{\"result\":{},\"id\":3}\n" +
Expand Down Expand Up @@ -211,7 +214,8 @@ public void testOtherReceiver1() throws Exception {
tester.sendMessage("{\"id\":1,\"method\":\"Runtime.enable\"}");
assertEquals("{\"result\":{},\"id\":1}", tester.getMessages(true).trim());
tester.sendMessage("{\"id\":2,\"method\":\"Debugger.enable\"}");
assertEquals("{\"result\":{},\"id\":2}", tester.getMessages(true).trim());
tester.receiveMessages(
"{\"result\":{\"debuggerId\":\"UniqueDebuggerId.", "},\"id\":2}\n");
tester.sendMessage("{\"id\":3,\"method\":\"Runtime.runIfWaitingForDebugger\"}");
assertTrue(tester.compareReceivedMessages(
"{\"result\":{},\"id\":3}\n" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ public void testReadWithSideEffects() throws Exception {
InspectorTester tester = InspectorTester.start(true);
tester.sendMessage("{\"id\":1,\"method\":\"Runtime.enable\"}");
tester.sendMessage("{\"id\":2,\"method\":\"Debugger.enable\"}");
assertTrue(tester.compareReceivedMessages(
tester.receiveMessages(
"{\"result\":{},\"id\":1}\n" +
"{\"result\":{},\"id\":2}\n"));
"{\"result\":{\"debuggerId\":\"UniqueDebuggerId.", "},\"id\":2}\n");
tester.sendMessage("{\"id\":3,\"method\":\"Runtime.runIfWaitingForDebugger\"}");
assertTrue(tester.compareReceivedMessages(
"{\"result\":{},\"id\":3}\n" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ public void testNotReadableVariables() throws Exception {
InspectorTester tester = InspectorTester.start(true);
tester.sendMessage("{\"id\":1,\"method\":\"Runtime.enable\"}");
tester.sendMessage("{\"id\":2,\"method\":\"Debugger.enable\"}");
assertTrue(tester.compareReceivedMessages(
tester.receiveMessages(
"{\"result\":{},\"id\":1}\n" +
"{\"result\":{},\"id\":2}\n"));
"{\"result\":{\"debuggerId\":\"UniqueDebuggerId.", "},\"id\":2}\n");
tester.sendMessage("{\"id\":3,\"method\":\"Runtime.runIfWaitingForDebugger\"}");
assertTrue(tester.compareReceivedMessages(
"{\"result\":{},\"id\":3}\n" +
Expand Down
Loading

0 comments on commit c22ac20

Please sign in to comment.