diff --git a/.github/workflows/formatting.yml b/.github/workflows/formatting.yml index ac094e360a39..b0d35be1944c 100644 --- a/.github/workflows/formatting.yml +++ b/.github/workflows/formatting.yml @@ -8,7 +8,7 @@ on: env: # Please ensure that this is in sync with graalVersion in build.sbt - graalVersion: 22.3.0 + graalVersion: 22.3.1 # Please ensure that this is in sync with javaVersion in build.sbt javaVersion: 11 # Please ensure that this is in sync with project/build.properties diff --git a/CHANGELOG.md b/CHANGELOG.md index b5fb5fd00c80..85c31a91a03c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -563,6 +563,7 @@ - [Profile engine startup][4110] - [Report type of polyglot values][4111] - [Engine can now recover from serialization failures][5591] +- [Update to GraalVM 22.3.1][5602] [3227]: https://github.com/enso-org/enso/pull/3227 [3248]: https://github.com/enso-org/enso/pull/3248 @@ -657,6 +658,7 @@ [4110]: https://github.com/enso-org/enso/pull/4110 [4111]: https://github.com/enso-org/enso/pull/4111 [5591]: https://github.com/enso-org/enso/pull/5591 +[5602]: https://github.com/enso-org/enso/pull/5602 # Enso 2.0.0-alpha.18 (2021-10-12) diff --git a/build.sbt b/build.sbt index ecccfa69b454..12a03c5e399b 100644 --- a/build.sbt +++ b/build.sbt @@ -21,7 +21,7 @@ import java.io.File // ============================================================================ val scalacVersion = "2.13.8" -val graalVersion = "22.3.0" +val graalVersion = "22.3.1" val javaVersion = "11" val defaultDevEnsoVersion = "0.0.0-dev" val ensoVersion = sys.env.getOrElse( diff --git a/build/ci_utils/src/cache/goodie/graalvm.rs b/build/ci_utils/src/cache/goodie/graalvm.rs index 85cc707c8ea9..0ca735b0f563 100644 --- a/build/ci_utils/src/cache/goodie/graalvm.rs +++ b/build/ci_utils/src/cache/goodie/graalvm.rs @@ -147,7 +147,7 @@ mod tests { #[ignore] async fn test_is_enabled() -> Result { setup_logging()?; - let graal_version = Version::parse("22.3.0").unwrap(); + let graal_version = Version::parse("22.3.1").unwrap(); let java_version = java::LanguageVersion(11); let os = TARGET_OS; let arch = Arch::X86_64; @@ -166,14 +166,14 @@ mod tests { /// Check that we correctly recognize both the GraalVM version and the Java version. #[test] fn version_recognize() { - let version_string = r"openjdk 11.0.17 2022-10-18 -OpenJDK Runtime Environment GraalVM CE 22.3.0 (build 11.0.17+8-jvmci-22.3-b08) -OpenJDK 64-Bit Server VM GraalVM CE 22.3.0 (build 11.0.17+8-jvmci-22.3-b08, mixed mode, sharing)"; + let version_string = r"openjdk 11.0.18 2023-01-17 +OpenJDK Runtime Environment GraalVM CE 22.3.1 (build 11.0.18+10-jvmci-22.3-b13) +OpenJDK 64-Bit Server VM GraalVM CE 22.3.1 (build 11.0.18+10-jvmci-22.3-b13, mixed mode, sharing)"; let found_graal = graal_version_from_version_string(version_string).unwrap(); - assert_eq!(found_graal, Version::new(22, 3, 0)); + assert_eq!(found_graal, Version::new(22, 3, 1)); let found_java = Java.parse_version(version_string).unwrap(); - assert_eq!(found_java, Version::new(11, 0, 17)); + assert_eq!(found_java, Version::new(11, 0, 18)); } } diff --git a/docs/infrastructure/upgrading-graalvm.md b/docs/infrastructure/upgrading-graalvm.md index 9496cb5b47df..b4bc192b8003 100644 --- a/docs/infrastructure/upgrading-graalvm.md +++ b/docs/infrastructure/upgrading-graalvm.md @@ -34,9 +34,6 @@ to perform the following tasks: - Change the expected GraalVM version in the [`build.sbt`](../../build.sbt) configuration. This is both a version number and (if it is changed), the associated version of Java. -- Change the expected GraalVM version in the - [`release-publish-edition`](../../.github/workflows/release-publish-edition.yml) - workflow. - Change the base image in the [`Dockerfile`](../../tools/ci/docker/Dockerfile) to contain the correct GraalVM version. - Just to be sure, search for the version regex in all the files in the repo. diff --git a/engine/runtime/src/main/java/org/enso/interpreter/instrument/HostObjectDebugWrapper.java b/engine/runtime/src/main/java/org/enso/interpreter/instrument/HostObjectDebugWrapper.java deleted file mode 100644 index b30db49b1744..000000000000 --- a/engine/runtime/src/main/java/org/enso/interpreter/instrument/HostObjectDebugWrapper.java +++ /dev/null @@ -1,105 +0,0 @@ -package org.enso.interpreter.instrument; - -import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; -import com.oracle.truffle.api.TruffleLanguage; -import com.oracle.truffle.api.TruffleLanguage.Env; -import com.oracle.truffle.api.interop.InteropLibrary; -import com.oracle.truffle.api.interop.TruffleObject; -import com.oracle.truffle.api.interop.UnsupportedMessageException; -import com.oracle.truffle.api.library.ExportLibrary; -import com.oracle.truffle.api.library.ExportMessage; - -import java.util.Arrays; - -import org.enso.interpreter.EnsoLanguage; -import org.enso.interpreter.runtime.EnsoContext; -import org.enso.interpreter.runtime.callable.atom.Atom; -import org.enso.interpreter.runtime.callable.atom.StructsLibrary; - -/** - * Wrapper for host objects. Is a workaround for a bug in chromeinspector - * (https://github.com/oracle/graal/issues/5513). All the host objects should - * be wrapped before passing to instruments. - *
- * Note that specifying delegate in the {@code @ExportLibrary} annotation does - * not work. - */ -@ExportLibrary(InteropLibrary.class) -public final class HostObjectDebugWrapper implements TruffleObject { - - private final String stringRepr; - - public HostObjectDebugWrapper(Object hostObject) { - Env env = EnsoContext.get(null).getEnvironment(); - InteropLibrary interop = InteropLibrary.getUncached(); - assert env.isHostObject(hostObject); - StringBuilder sb = new StringBuilder(); - sb.append("HostObject{"); - try { - if (interop.hasMetaObject(hostObject)) { - Object metaObject = interop.getMetaObject(hostObject); - Object metaQualifiedName = interop.getMetaQualifiedName(metaObject); - sb.append(interop.asString(metaQualifiedName)).append(": "); - } - sb.append("'").append(interop.asString(interop.toDisplayString(hostObject))).append("'"); - } catch (UnsupportedMessageException e) { - sb.append("unknown"); - } - sb.append("}"); - this.stringRepr = sb.toString(); - } - - /** - * Wraps given object in {@link HostObjectDebugWrapper} if necessary. The returned - * wrapper is a string from the Truffle perspective. - *
- * Serves as a workaround for https://github.com/oracle/graal/issues/5513.
- *
- * @param object Object to potentialy wrap in {@link HostObjectDebugWrapper}.
- */
- @TruffleBoundary
- public static Object wrapHostValues(Object object, InteropLibrary interop, StructsLibrary structs) {
- if (object instanceof Atom atom) {
- Object[] fields = structs.getFields(atom);
- Object[] wrappedFields = new Object[fields.length];
- for (int i = 0; i < fields.length; i++) {
- wrappedFields[i] = wrapHostValues(fields[i], interop, structs);
- }
- return atom.getConstructor().newInstance(wrappedFields);
- } else if (isHostValue(object, interop)) {
- return new HostObjectDebugWrapper(object);
- } else {
- return object;
- }
- }
-
- private static boolean isHostValue(Object value, InteropLibrary interop) {
- return EnsoContext.get(interop).getEnvironment().isHostObject(value);
- }
-
-
- @ExportMessage
- boolean hasLanguage() {
- return true;
- }
-
- @ExportMessage
- Class extends TruffleLanguage>> getLanguage() {
- return EnsoLanguage.class;
- }
-
- @ExportMessage
- boolean isString() {
- return true;
- }
-
- @ExportMessage
- String asString() {
- return stringRepr;
- }
-
- @ExportMessage
- String toDisplayString(boolean allowSideEffects) {
- return stringRepr;
- }
-}
diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/ExpressionNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/ExpressionNode.java
index d470cf997ca9..623eabffd713 100644
--- a/engine/runtime/src/main/java/org/enso/interpreter/node/ExpressionNode.java
+++ b/engine/runtime/src/main/java/org/enso/interpreter/node/ExpressionNode.java
@@ -21,11 +21,8 @@
import java.util.UUID;
-import org.enso.interpreter.instrument.HostObjectDebugWrapper;
-import org.enso.interpreter.runtime.EnsoContext;
import org.enso.interpreter.runtime.builtin.Builtins;
import org.enso.interpreter.runtime.callable.atom.AtomConstructor;
-import org.enso.interpreter.runtime.callable.atom.StructsLibrary;
import org.enso.interpreter.runtime.callable.function.Function;
import org.enso.interpreter.runtime.scope.DebugLocalScope;
import org.enso.interpreter.runtime.tag.AvoidIdInstrumentationTag;
@@ -203,26 +200,6 @@ public WrapperNode createWrapper(ProbeNode probe) {
return new ExpressionNodeWrapper(this, probe);
}
- /**
- * Transitively converts the given value to a wrapper that treats the host objects
- * as simple strings. This is a workaround for https://github.com/oracle/graal/issues/5513
- * - there is a bug in chromeinspector which reinterprets host objects in host original
- * language, which causes NullPointerException. Therefore, we have to wrap all the
- * host objects.
- *
- * @param retValue Value returned from this expression node
- * @return Value with all the host objects wrapped.
- */
- @OutgoingConverter
- public Object wrapHostObjects(Object retValue) {
- // Wrap only if chrome inspector is attached.
- if (EnsoContext.get(this).getChromeInspectorNotAttached().isValid()) {
- return retValue;
- } else {
- return HostObjectDebugWrapper.wrapHostValues(retValue, InteropLibrary.getUncached(), StructsLibrary.getUncached());
- }
- }
-
@ExportMessage
boolean hasScope(Frame frame) {
return isInstrumentable();
diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/function/StatementNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/function/StatementNode.java
index 6bf607902c00..7ac125605c2e 100644
--- a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/function/StatementNode.java
+++ b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/function/StatementNode.java
@@ -42,14 +42,6 @@ public boolean isInstrumentable() {
@Override
public Object executeGeneric(VirtualFrame frame) {
- if (CompilerDirectives.inInterpreter()) {
- var ctx = EnsoContext.get(this);
- Assumption chromeInspectorNotAttached = ctx.getChromeInspectorNotAttached();
- if (chromeInspectorNotAttached.isValid()
- && ctx.getEnvironment().getInstruments().containsKey("inspect")) {
- chromeInspectorNotAttached.invalidate("Chrome inspector attached");
- }
- }
return node.executeGeneric(frame);
}
diff --git a/engine/runtime/src/main/java/org/enso/interpreter/runtime/EnsoContext.java b/engine/runtime/src/main/java/org/enso/interpreter/runtime/EnsoContext.java
index de8608deddfd..ab9c875c30cc 100644
--- a/engine/runtime/src/main/java/org/enso/interpreter/runtime/EnsoContext.java
+++ b/engine/runtime/src/main/java/org/enso/interpreter/runtime/EnsoContext.java
@@ -34,9 +34,7 @@
import org.enso.polyglot.RuntimeServerInfo;
import org.graalvm.options.OptionKey;
-import com.oracle.truffle.api.Assumption;
import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
-import com.oracle.truffle.api.Truffle;
import com.oracle.truffle.api.TruffleFile;
import com.oracle.truffle.api.TruffleLanguage;
import com.oracle.truffle.api.TruffleLanguage.Env;
@@ -80,9 +78,6 @@ public class EnsoContext {
private final LockManager lockManager;
private final AtomicLong clock = new AtomicLong();
- private final Assumption chromeInspectorNotAttached =
- Truffle.getRuntime().createAssumption("chromeInspectorNotAttached");
-
private final Shape rootStateShape = Shape.newBuilder().layout(State.Container.class).build();
private final IOPermissions rootIOPermissions;
@@ -218,11 +213,6 @@ public final Compiler getCompiler() {
return compiler;
}
- /** Returns an {@link Assumption} that Chrome inspector is not attached to this context. */
- public Assumption getChromeInspectorNotAttached() {
- return chromeInspectorNotAttached;
- }
-
/**
* Returns the {@link Env} instance used by this context.
*
diff --git a/engine/runtime/src/main/java/org/enso/interpreter/runtime/scope/DebugLocalScope.java b/engine/runtime/src/main/java/org/enso/interpreter/runtime/scope/DebugLocalScope.java
index 2f4784f38f8a..e228c99072ec 100644
--- a/engine/runtime/src/main/java/org/enso/interpreter/runtime/scope/DebugLocalScope.java
+++ b/engine/runtime/src/main/java/org/enso/interpreter/runtime/scope/DebugLocalScope.java
@@ -20,7 +20,6 @@
import java.util.stream.Collectors;
import org.enso.interpreter.EnsoLanguage;
-import org.enso.interpreter.instrument.HostObjectDebugWrapper;
import org.enso.interpreter.node.EnsoRootNode;
import org.enso.interpreter.runtime.callable.atom.StructsLibrary;
import org.enso.interpreter.runtime.callable.function.Function;
@@ -183,16 +182,12 @@ boolean isMemberReadable(String memberName) {
}
@ExportMessage
- Object readMember(
- String member,
- @CachedLibrary(limit = "10") InteropLibrary interop,
- @CachedLibrary(limit = "10") StructsLibrary structs) {
+ Object readMember(String member) {
FramePointer framePtr = allBindings.get(member);
if (framePtr == null) {
return null;
} else {
- Object value = getValue(frame, framePtr);
- return HostObjectDebugWrapper.wrapHostValues(value, interop, structs);
+ return getValue(frame, framePtr);
}
}
diff --git a/engine/runtime/src/test/java/org/enso/interpreter/test/DebuggingEnsoTest.java b/engine/runtime/src/test/java/org/enso/interpreter/test/DebuggingEnsoTest.java
index cb821593667a..f36036b2e117 100644
--- a/engine/runtime/src/test/java/org/enso/interpreter/test/DebuggingEnsoTest.java
+++ b/engine/runtime/src/test/java/org/enso/interpreter/test/DebuggingEnsoTest.java
@@ -183,9 +183,6 @@ public void callerVariablesAreVisibleOnPreviousStackFrame() {
}
}
- /**
- * Host values in the stack frame are handled specially, because of https://github.com/oracle/graal/issues/5513
- */
@Test
public void testHostValues() {
Value fooFunc = createEnsoMethod("""
@@ -208,15 +205,12 @@ public void testHostValues() {
assertTrue(pathValue.isReadable());
assertFalse(pathValue.isInternal());
assertFalse(pathValue.hasReadSideEffects());
- assertTrue(pathValue.toDisplayString().startsWith("HostObject"));
DebugValue listValue = scope.getDeclaredValue("list");
- // ArrayList is internally represented as Enso list, but as an object
- // initialized in host context, it suffers from the issue mentioned in
- // https://github.com/oracle/graal/issues/5513. Therefore, we display
- // it just as 'HostObject' in the debugger.
assertNotNull(listValue);
- assertTrue(listValue.toDisplayString().startsWith("HostObject"));
+ assertTrue(listValue.isArray());
+ assertEquals(10, listValue.getArray().get(0).asInt());
+ assertEquals(20, listValue.getArray().get(1).asInt());
}
}
event.getSession().suspendNextExecution();
@@ -537,48 +531,6 @@ public void testSteppingIntoMoreExpressionsOneLine() {
testStepping(src, "foo", new Object[]{0}, steps, expectedLineNumbers);
}
- /**
- * Steps through some stdlib methods, enumerates all the values in frames and checks if all
- * the host values are wrapped.
- *
- * Note that this is essentially a check whether the workaround for https://github.com/oracle/graal/issues/5513 works.
- */
- @Test
- public void testAllHostObjectsAreWrapped() {
- Value fooFunc = createEnsoMethod("""
- from Standard.Base import Vector
- foo x =
- vec = [5, 5, 1, 2, 1]
- vec.distinct
- """, "foo");
- List