Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update GraalVM to 22.3.1 #5602

Merged
merged 19 commits into from
Feb 14, 2023
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
267f2b1
Update to GraalVM 22.3.1
Akirathan Feb 9, 2023
dc040db
Remove host object wrapping workaround
Akirathan Feb 9, 2023
7e8c480
Update CHANGELOG
Akirathan Feb 9, 2023
8674785
Update java version in some tests
Akirathan Feb 10, 2023
6a6dc85
Remove host object wrapping workaround tests
Akirathan Feb 10, 2023
b97b372
Fix GraalVM version in ci_utils
Akirathan Feb 10, 2023
2b11852
Fix typo in CHANGELOG
Akirathan Feb 10, 2023
eff59a5
Merge branch 'develop' into wip/akirathan/update-graal-5086
mergify[bot] Feb 10, 2023
38bf048
Merge branch 'develop' into wip/akirathan/update-graal-5086
mergify[bot] Feb 10, 2023
5fe27e2
Merge branch 'develop' into wip/akirathan/update-graal-5086
mergify[bot] Feb 10, 2023
7d0a99d
Merge branch 'develop' into wip/akirathan/update-graal-5086
mergify[bot] Feb 11, 2023
93a12fe
Merge branch 'develop' into wip/akirathan/update-graal-5086
mergify[bot] Feb 11, 2023
6f4251c
Merge branch 'develop' into wip/akirathan/update-graal-5086
mergify[bot] Feb 13, 2023
7b3149f
Merge branch 'develop' into wip/akirathan/update-graal-5086
mergify[bot] Feb 13, 2023
d3faa87
Merge branch 'develop' into wip/akirathan/update-graal-5086
mergify[bot] Feb 13, 2023
adca190
Merge branch 'develop' into wip/akirathan/update-graal-5086
mergify[bot] Feb 13, 2023
9919176
Merge branch 'develop' into wip/akirathan/update-graal-5086
mergify[bot] Feb 14, 2023
461462a
Merge branch 'develop' into wip/akirathan/update-graal-5086
mergify[bot] Feb 14, 2023
dcb34ec
Merge branch 'develop' into wip/akirathan/update-graal-5086
mergify[bot] Feb 14, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/formatting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,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
Expand Down Expand Up @@ -654,6 +655,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)

Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
12 changes: 6 additions & 6 deletions build/ci_utils/src/cache/goodie/graalvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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));
}
}
3 changes: 0 additions & 3 deletions docs/infrastructure/upgrading-graalvm.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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("""
Expand All @@ -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());
radeusgd marked this conversation as resolved.
Show resolved Hide resolved
}
}
event.getSession().suspendNextExecution();
Expand Down Expand Up @@ -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<FrameEntry> frames = new ArrayList<>();
try (DebuggerSession session = debugger.startSession((SuspendedEvent event) -> {
DebugScope topScope = event.getTopStackFrame().getScope();
var frameEntry = new FrameEntry(topScope.getName(), event.getReturnValue());
for (DebugValue declaredValue : topScope.getDeclaredValues()) {
frameEntry.addValue(declaredValue);
}
frames.add(frameEntry);
event.prepareStepInto(1);
})) {
session.suspendNextExecution();
fooFunc.execute(0);
}
// Throughout Vector.distinct call, there will definitely be at least one host object
// in one of the stack frames.
long hostObjectValues = frames.stream()
.filter(frameEntry ->
frameEntry
.values
.values()
.stream()
.anyMatch(displayString -> displayString.contains("HostObject"))
)
.count();
assertTrue(frames.size() > 1);
assertTrue(hostObjectValues > 1);
}

private static final class FrameEntry {
private final String scopeName;
private final Map<String, String> values = new HashMap<>();
Expand Down
Loading