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

Upgrade Graal to 21.0 #1487

Merged
merged 5 commits into from
Feb 22, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
4 changes: 2 additions & 2 deletions .github/workflows/legal-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ on:

env:
# Please ensure that this is in sync with graalVersion in build.sbt
graalVersion: 20.2.0
graalVersion: 21.0.0.2
# 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
sbtVersion: 1.3.13
sbtVersion: 1.4.1
# Please ensure that this is in sync with rustVersion in build.sbt
rustToolchain: nightly-2019-11-04
excludedPaths: |
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

env:
# Please ensure that this is in sync with graalVersion in build.sbt
graalVersion: 20.2.0
graalVersion: 21.0.0.2
# 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 Expand Up @@ -98,6 +98,7 @@ jobs:
run: echo "ENSO_RELEASE_MODE=true" >> $GITHUB_ENV
- name: Bootstrap the Project
working-directory: repo
shell: bash
run: |
sleep 1
sbt --no-colors bootstrap
Expand All @@ -106,13 +107,15 @@ jobs:
- name: Verify Packages
if: runner.os != 'Windows' # TODO [RW] CRLF handling in licenses task
working-directory: repo
shell: bash
run: |
sleep 1
sbt --no-colors verifyLicensePackages

# Prepare distributions
- name: Build the Launcher Native Image
working-directory: repo
shell: bash
run: |
sleep 1
sbt --no-colors launcher/buildNativeImage
Expand Down Expand Up @@ -303,19 +306,22 @@ jobs:
prerelease: true

# - name: Login to ACR
# if: runner.os == "Linux"
iamrecursion marked this conversation as resolved.
Show resolved Hide resolved
# uses: docker/login-action@v1
# with:
# registry: ensosharedwus2acr.azurecr.io
# username: ${{ secrets.ACR_PUSH_CLIENT_ID }}
# password: ${{ secrets.ACR_PUSH_CLIENT_SECRET }}
#
# - name: Copy the docker entrypoint script
# if: runner.os == "Linux"
# shell: bash
# run: |
# sleep 1
# cp ./repo/tools/ci/docker/docker-entrypoint.sh ./repo/built-distribution/enso-engine-${{ env.DIST_VERSION }}-linux-amd64/enso-${{ env.DIST_VERSION }}/bin
#
# - name: Publish Runtime Docker Image
# if: runner.os == "Linux"
# shell: bash
# run: |
# sleep 1
Expand Down
33 changes: 11 additions & 22 deletions .github/workflows/scala.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,19 @@ on:

env:
# Please ensure that this is in sync with graalVersion in build.sbt
graalVersion: 20.2.0
graalVersion: 21.0.0.2
# 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
sbtVersion: 1.4.1
sbtVersion: 1.4.7
# Please ensure that this is in sync with rustVersion in build.sbt
rustToolchain: nightly-2019-11-04
excludedPaths: |
.github/PULL_REQUEST_TEMPLATE.md
.github/CODEOWNERS
.github/ISSUE_TEMPLATE/*
/doc/*
.gitignore
.scalafmt.conf
CODE_OF_CONDUCT.md
CONTRIBUTING.md
LICENSE
README.md
iamrecursion marked this conversation as resolved.
Show resolved Hide resolved

jobs:
test_and_publish:
name: Build and Test
runs-on: ${{ matrix.os }}
timeout-minutes: 60
timeout-minutes: 90
strategy:
matrix:
os: [macOS-latest, ubuntu-latest, windows-latest]
Expand Down Expand Up @@ -120,23 +109,22 @@ jobs:
echo "CI_TEST_TIMEFACTOR=2" >> $GITHUB_ENV
echo "CI_TEST_FLAKY_ENABLE=true" >> $GITHUB_ENV
- name: Build the Launcher
shell: bash
run: |
sleep 1
sbt --no-colors launcher/buildNativeImage
- name: Build the Runner & Runtime Uberjars
run: |
sleep 1
sbt --no-colors engine-runner/assembly
sbt --no-colors "runtime/clean; engine-runner/assembly"

- name: Test Enso
run: |
sleep 1
sbt --no-colors "set Global / parallelExecution := false; test"
sbt --no-colors "set Global / parallelExecution := false; runtime/clean; compile; test"
- name: Check Runtime Benchmark Compilation
run: |
sleep 1
sbt --no-colors runtime/Benchmark/compile
sbt --no-colors "runtime/clean; runtime/Benchmark/compile"
- name: Check Language Server Benchmark Compilation
run: |
sleep 1
Expand All @@ -152,10 +140,11 @@ jobs:
sleep 1
sbt --no-colors project-manager/buildNativeImage
- name: Build the Parser JS Bundle
# The builds are run on 3 platforms, but Flatbuffer schemas are platform
# agnostic, so they just need to be uploaded from one of the runners.
# The builds are run on 3 platforms, but
# Flatbuffer schemas are platform agnostic, so they just need to be
# uploaded from one of the runners.
if: runner.os == 'Linux'
run: sbt -no-colors syntaxJS/fullOptJS
run: sbt --no-colors syntaxJS/fullOptJS

# Prepare distributions
# The version used in filenames is based on the version of the launcher.
Expand Down Expand Up @@ -201,7 +190,7 @@ jobs:
shell: bash
run: |
sleep 1
sbt buildEngineDistribution
sbt "runtime/clean; buildEngineDistribution"

- name: Prepare Project Manager Distribution
shell: bash
Expand Down
17 changes: 11 additions & 6 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import java.io.File

import org.enso.build.BenchTasks._
import org.enso.build.WithDebugCommand
import sbt.Keys.{libraryDependencies, scalacOptions}
import sbt.addCompilerPlugin
import sbtassembly.AssemblyPlugin.defaultUniversalScript
import sbtcrossproject.CrossPlugin.autoImport.{crossProject, CrossType}

import java.io.File

// ============================================================================
// === Global Configuration ===================================================
// ============================================================================

val scalacVersion = "2.13.3"
val rustVersion = "1.40.0-nightly (b520af6fd 2019-11-03)"
val graalVersion = "20.2.0"
val graalVersion = "21.0.0.2"
val javaVersion = "11"
val ensoVersion = "0.2.4-SNAPSHOT" // Note [Engine And Launcher Version]

Expand All @@ -31,7 +31,7 @@ scalaVersion in ThisBuild := scalacVersion
lazy val gatherLicenses =
taskKey[Unit]("Gathers licensing information for relevant dependencies")
gatherLicenses := {
GatherLicenses.run.value
val _ = GatherLicenses.run.value
}
lazy val verifyLicensePackages =
taskKey[Unit](
Expand Down Expand Up @@ -964,11 +964,16 @@ lazy val parser = (project in file("lib/scala/parser"))
)
.dependsOn(ast)

lazy val cleanInstruments = taskKey[Unit](
"Cleans fragile class files to force a full recompilation and preserve" +
"consistency of instrumentation configuration."
)
lazy val runtime = (project in file("engine/runtime"))
.configs(Benchmark)
.settings(
version := ensoVersion,
commands += WithDebugCommand.withDebug,
cleanInstruments := FixInstrumentsGeneration.cleanInstruments.value,
inConfig(Compile)(truffleRunOptionsSettings),
inConfig(Benchmark)(Defaults.testSettings),
parallelExecution in Test := false,
Expand Down Expand Up @@ -1267,7 +1272,7 @@ lazy val `std-bits` = project
),
Compile / packageBin := Def.task {
val result = (Compile / packageBin).value
StdBits
val _ = StdBits
.copyDependencies(
`std-lib-polyglot-root`,
"std-bits.jar",
Expand All @@ -1289,7 +1294,7 @@ lazy val `table` = project
),
Compile / packageBin := Def.task {
val result = (Compile / packageBin).value
StdBits
val _ = StdBits
.copyDependencies(
`table-polyglot-root`,
"table.jar",
Expand Down
8 changes: 8 additions & 0 deletions distribution/std-lib/Base/src/Error/Extensions.enso
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ unimplemented message="" = Panic.throw (Unimplemented_Error message)
Error.catch : (Error -> Any) -> Any
Error.catch (handler = x->x) = this.catch_primitive handler

## Returns a display representation of the dataflow error on which it is called.

> Example
Displaying a dataflow error.
(Error.throw "oops!").to_display
Error.to_display : Text
Error.to_display = this.catch .to_display

## Takes any value, and if it is a dataflow error, throws it as a Panic.
Otherwise, returns the original value unchanged.
Panic.rethrow : (Any ! Any) -> Any
Expand Down
26 changes: 26 additions & 0 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,32 @@ getting the project into a working state in IntelliJ.
Java Format for formatting Java code. For more information see the relevant
[Style Guides](style-guide/README.md).

Depending on the version of GraalVM with which you are working, you may be
required to add the following flags to the per-module overrides for IntelliJ's
java compiler in order for it to not show spurious errors. This is because some
versions of GraalVM export their own closed version of `com.oracle.truffle.api`
that IntelliJ picks up preferentially to the version we use for development. You
can find these options in
`Preferences -> Build, Execution, Deployment -> Compiler -> Java Compiler`.

```
--add-exports org.graalvm.truffle/com.oracle.truffle.api=ALL-UNNAMED
--add-exports org.graalvm.truffle/com.oracle.truffle.api.debug=ALL-UNNAMED
--add-exports org.graalvm.truffle/com.oracle.truffle.api.dsl=ALL-UNNAMED
--add-exports org.graalvm.truffle/com.oracle.truffle.api.exception=ALL-UNNAMED
--add-exports org.graalvm.truffle/com.oracle.truffle.api.frame=ALL-UNNAMED
--add-exports org.graalvm.truffle/com.oracle.truffle.api.instrumentation=ALL-UNNAMED
--add-exports org.graalvm.truffle/com.oracle.truffle.api.interop=ALL-UNNAMED
--add-exports org.graalvm.truffle/com.oracle.truffle.api.io=ALL-UNNAMED
--add-exports org.graalvm.truffle/com.oracle.truffle.api.library=ALL-UNNAMED
--add-exports org.graalvm.truffle/com.oracle.truffle.api.memory=ALL-UNNAMED
--add-exports org.graalvm.truffle/com.oracle.truffle.api.nodes=ALL-UNNAMED
--add-exports org.graalvm.truffle/com.oracle.truffle.api.object=ALL-UNNAMED
--add-exports org.graalvm.truffle/com.oracle.truffle.api.profiles=ALL-UNNAMED
--add-exports org.graalvm.truffle/com.oracle.truffle.api.source=ALL-UNNAMED
--add-exports org.graalvm.truffle/com.oracle.truffle.api.utilities=ALL-UNNAMED
```

However, as mentioned in the [Troubleshooting](#troubleshooting) section below,
the forked nature of execution in the SBT shell means that we can't trivially
make use of the IntelliJ debugger. In order to get debugging working, you will
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,6 @@ class ModuleManagementTest extends AnyFlatSpec with Matchers {
)
val exception =
the[PolyglotException] thrownBy mod2.getAssociatedConstructor
exception.getMessage shouldEqual "Module Test.Main does not exist."
exception.getMessage shouldEqual "org.enso.interpreter.runtime.error.PanicException: Module_Does_Not_Exist Test.Main"
}
}
11 changes: 6 additions & 5 deletions engine/runtime/src/main/java/org/enso/interpreter/Language.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.oracle.truffle.api.debug.DebuggerTags;
import com.oracle.truffle.api.instrumentation.ProvidedTags;
import com.oracle.truffle.api.instrumentation.StandardTags;
import com.oracle.truffle.api.library.ExportLibrary;
import com.oracle.truffle.api.nodes.RootNode;
import java.util.Collections;

Expand Down Expand Up @@ -108,14 +109,14 @@ protected OptionDescriptors getOptionDescriptors() {
}

/**
* Returns the top scope of the requested context.
* Returns the top scope of the requested contenxt.
*
* @param context the context holding the top scope.
* @return a singleton collection containing the context's top scope.
* @param context the context holding the top scope
* @return the language's top scope
*/
@Override
protected Iterable<Scope> findTopScopes(Context context) {
return Collections.singleton(context.getTopScope().getScope());
protected Object getScope(Context context) {
return context.getTopScope();
}

/** @return a reference to the execution instrument */
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package org.enso.interpreter.epb.node;

import com.oracle.truffle.api.dsl.Fallback;
import com.oracle.truffle.api.dsl.GenerateUncached;
import com.oracle.truffle.api.dsl.ReportPolymorphism;
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.exception.AbstractTruffleException;
import com.oracle.truffle.api.nodes.Node;
import org.enso.interpreter.epb.runtime.GuardedTruffleContext;
import org.enso.interpreter.epb.runtime.PolyglotExceptionProxy;
import org.enso.interpreter.epb.runtime.PolyglotProxy;

@GenerateUncached
@ReportPolymorphism
public abstract class ContextRewrapExceptionNode extends Node {
/**
* Wraps a value originating from {@code origin} into a value valid in {@code target}. This method
* is allowed to use interop library on {@code value} and therefore must be called with {@code
* origin} entered.
*
* @param value the value to wrap
* @param origin the context the value originates in (and is currently entered)
* @param target the context in which the value will be accessed in the future
* @return a context-switch-safe wrapper for the value
*/
public abstract AbstractTruffleException execute(
AbstractTruffleException value, GuardedTruffleContext origin, GuardedTruffleContext target);

@Specialization(guards = "proxy.getOrigin() == target")
AbstractTruffleException doUnwrapProxy(
PolyglotExceptionProxy proxy, GuardedTruffleContext origin, GuardedTruffleContext target) {
return proxy.getOriginal();
}

@Specialization(guards = "proxy.getTarget() == target")
AbstractTruffleException doAlreadyProxied(
PolyglotExceptionProxy proxy, GuardedTruffleContext origin, GuardedTruffleContext target) {
return proxy;
}

@Fallback
AbstractTruffleException doWrapProxy(
AbstractTruffleException o, GuardedTruffleContext origin, GuardedTruffleContext target) {
return new PolyglotExceptionProxy(o, origin, target);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ private void parseJs(ContextReference<EpbContext> ctxRef) {
EpbContext context = ctxRef.get();
GuardedTruffleContext outer = context.getCurrentContext();
GuardedTruffleContext inner = context.getInnerContext();
Object p = inner.enter();
Object p = inner.enter(this);
try {
String args = Arrays.stream(argNames).skip(1).collect(Collectors.joining(","));
String wrappedSrc =
Expand All @@ -86,7 +86,7 @@ private void parseJs(ContextReference<EpbContext> ctxRef) {
Object fn = rewrapNode.execute(ct.call(), inner, outer);
foreign = insert(JsForeignNodeGen.create(argNames.length, fn));
} finally {
inner.leave(p);
inner.leave(this, p);
}
}
}
Loading