Skip to content

Commit

Permalink
Upgrade to GraalVM 20.1.0/JVMCI 20.1b2/MX 5.263.8
Browse files Browse the repository at this point in the history
and add support for new meta-data interop APIs
  • Loading branch information
fniephaus committed May 24, 2020
1 parent 1af5476 commit 522b010
Show file tree
Hide file tree
Showing 10 changed files with 211 additions and 55 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@ jobs:
- name: Build and install TruffleSqueak component
shell: pwsh
run: |
mx --disable-installables=false build --dependencies=SMALLTALK_INSTALLABLE_BTRUFFLESQUEAK.EXE_JAVA11
Copy-Item $(mx --disable-installables=false paths SMALLTALK_INSTALLABLE_BTRUFFLESQUEAK.EXE_JAVA11) -Destination "${pwd}\${env:INSTALLABLE_TARGET}"
mx --disable-installables=false build --dependencies=SMALLTALK_INSTALLABLE_JAVA11
Copy-Item $(mx --disable-installables=false paths SMALLTALK_INSTALLABLE_JAVA11) -Destination "${pwd}\${env:INSTALLABLE_TARGET}"
gu.cmd install -L "${pwd}\${env:INSTALLABLE_TARGET}"
- name: Run SystemReporter on GraalVM
run: 'trufflesqueak.cmd --jvm --code "String streamContents: [:s ^| SystemReporter new reportVM: s] limitedTo: 10000"'
Expand All @@ -227,8 +227,8 @@ jobs:
- name: Build and install TruffleSqueak component
shell: pwsh
run: |
mx --disable-installables=false build --dependencies=SMALLTALK_INSTALLABLE_BTRUFFLESQUEAK.EXE_JAVA8
Copy-Item $(mx --disable-installables=false paths SMALLTALK_INSTALLABLE_BTRUFFLESQUEAK.EXE_JAVA8) -Destination "${pwd}\${env:INSTALLABLE_TARGET}"
mx --disable-installables=false build --dependencies=SMALLTALK_INSTALLABLE_JAVA8
Copy-Item $(mx --disable-installables=false paths SMALLTALK_INSTALLABLE_JAVA8) -Destination "${pwd}\${env:INSTALLABLE_TARGET}"
gu.cmd install -L "${pwd}\${env:INSTALLABLE_TARGET}"
- name: Run SystemReporter on GraalVM
run: 'trufflesqueak.cmd --jvm --code "String streamContents: [:s ^| SystemReporter new reportVM: s] limitedTo: 10000"'
Expand Down
17 changes: 9 additions & 8 deletions mx.trufflesqueak/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,20 @@
# ==========================================================================
# METADATA
# ==========================================================================
"mxversion": "5.253.0",
"mxversion": "5.263.8",
"name": "trufflesqueak",
"versionConflictResolution": "latest",

"version": "1.0.0-rc10",
"version": "1.0.0-rc10-dev",
"trufflesqueak:dependencyMap": {
"graalvm": "20.0.0",
"graalvm": "20.1.0",
"image": "TruffleSqueakImage-1.0.0-rc9.zip",
"image_tag": "1.0.0-rc9",
"jdk8_update": "242",
"jdk11": "11.0.6",
"jdk11_update": "9",
"jvmci": "jvmci-20.0-b02",
"jdk8": "252",
"jdk8_update": "09",
"jdk11": "11.0.7",
"jdk11_update": "10",
"jvmci": "jvmci-20.1-b02",
"test_image": "GraalSqueakTestImage-19329-64bit.zip",
"test_image_tag": "1.0.0-rc6",
},
Expand Down Expand Up @@ -50,7 +51,7 @@
"suites": [{
"name": "truffle",
"subdir": True,
"version": "022fcbd2479944aeb411f851dc2cb062b1bbb441",
"version": "df628ae8688633d12dabc0a2a0e015d0ff65fcd5",
"urls": [{
"url": "https://github.com/oracle/graal",
"kind": "git"
Expand Down
21 changes: 11 additions & 10 deletions mx.trufflesqueak/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,9 @@ set-up-dependencies() {
set-up-graalvm-ce() {
local java_version=$1
local target_dir=$2
local graalvm_name="graalvm-ce-${java_version}-${OS_NAME}-amd64-${DEP_GRAALVM}"
local file_suffix=".tar.gz" && [[ "${OS_NAME}" == "windows" ]] && file_suffix=".zip"
local file="graalvm-ce-${java_version}-${OS_NAME}-amd64-${DEP_GRAALVM}${file_suffix}"
local file="${graalvm_name}${file_suffix}"

pushd "${target_dir}" > /dev/null

Expand All @@ -198,24 +199,24 @@ set-up-graalvm-ce() {
add-path "${graalvm_home}/bin"
set-env "GRAALVM_HOME" "$(resolve-path "${graalvm_home}")"

echo "[${file} set up successfully]"
echo "[${graalvm_name} set up successfully]"
}

set-up-labsjdk11() {
local target_dir=$1
local jdk_tar=${target_dir}/jdk.tar.gz
local file="labsjdk-ce-${DEP_JDK11}+${DEP_JDK11_UPDATE}-${DEP_JVMCI}-${OS_NAME}-amd64.tar.gz"
local jdk_name="labsjdk-ce-${DEP_JDK11}+${DEP_JDK11_UPDATE}-${DEP_JVMCI}-${OS_NAME}-amd64"

pushd "${target_dir}" > /dev/null

curl -sSL --retry 3 -o "${jdk_tar}" "https://github.com/graalvm/labs-openjdk-11/releases/download/${DEP_JVMCI}/${file}"
curl -sSL --retry 3 -o "${jdk_tar}" "https://github.com/graalvm/labs-openjdk-11/releases/download/${DEP_JVMCI}/${jdk_name}.tar.gz"
tar xzf "${jdk_tar}"

popd > /dev/null

enable-jdk "${target_dir}/labsjdk-ce-${DEP_JDK11}-${DEP_JVMCI}${JAVA_HOME_SUFFIX}"

echo "[${file} set up successfully]"
echo "[${jdk_name} set up successfully]"
}

set-up-mx() {
Expand All @@ -227,24 +228,24 @@ set-up-mx() {
set-up-openjdk8-jvmci() {
local target_dir=$1
local jdk_tar=${target_dir}/jdk.tar.gz
local file="openjdk-8u${DEP_JDK8_UPDATE}-${DEP_JVMCI}-${OS_NAME}-amd64.tar.gz"
local jdk_name="openjdk-8u${DEP_JDK8}+${DEP_JDK8_UPDATE}-${DEP_JVMCI}-${OS_NAME}-amd64"

pushd "${target_dir}" > /dev/null

curl -sSL --retry 3 -o "${jdk_tar}" "https://github.com/graalvm/openjdk8-jvmci-builder/releases/download/${DEP_JVMCI}/${file}"
curl -sSL --retry 3 -o "${jdk_tar}" "https://github.com/graalvm/openjdk8-jvmci-builder/releases/download/${DEP_JVMCI}/${jdk_name}.tar.gz"
tar xzf "${jdk_tar}"

popd > /dev/null

enable-jdk "${target_dir}/openjdk1.8.0_${DEP_JDK8_UPDATE}-${DEP_JVMCI}${JAVA_HOME_SUFFIX}"
enable-jdk "${target_dir}/openjdk1.8.0_${DEP_JDK8}-${DEP_JVMCI}${JAVA_HOME_SUFFIX}"

# Workaround for Windows (can be removed when https://git.io/Jv9IQ is available)
if [[ "${OS_NAME}" == "windows" ]]; then
# Remove empty lines
sed -i '/^$/d' "${target_dir}/openjdk1.8.0_${DEP_JDK8_UPDATE}-${DEP_JVMCI}${JAVA_HOME_SUFFIX}/release"
sed -i '/^$/d' "${target_dir}/openjdk1.8.0_${DEP_JDK8}-${DEP_JVMCI}${JAVA_HOME_SUFFIX}/release"
fi

echo "[openjdk1.8.0_${DEP_JDK8_UPDATE}-${DEP_JVMCI} set up successfully]"
echo "[${jdk_name} set up successfully]"
}

shallow-clone() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public final class SqueakLanguageConfig {
public static final String MIME_TYPE = "application/x-smalltalk";
public static final String NAME = "Squeak/Smalltalk";
public static final String ST_MIME_TYPE = "text/x-smalltalk";
public static final String VERSION = "1.0.0-rc8";
public static final String VERSION = "1.0.0-rc10-dev";

private SqueakLanguageConfig() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1687,6 +1687,7 @@ ForeignObjectTest>>testJSArray=passing
ForeignObjectTest>>testJSBasic=passing
ForeignObjectTest>>testJSDate=passing
ForeignObjectTest>>testJSExecutable=passing
ForeignObjectTest>>testJSMetadataAPIs=passing
ForeignObjectTest>>testJSObject=passing
ForeignObjectTest>>testSmalltalkFromJS=passing
FormCanvasTest>>testDefaultClipRect=passing
Expand Down Expand Up @@ -1957,6 +1958,7 @@ IntegerTest>>testSqrtFloor=passing
IntegerTest>>testSqrtRem=passing
IntegerTest>>testTwoComplementBitLogicWithCarry=passing
IntegerTest>>testTwoComplementRightShift=passing
InteropTest>>testMetadataAPIs=passing
InteropTest>>testSmalltalkDNU=passing

# Assumes values are large integers, but are treated as small integers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,12 @@
import com.oracle.truffle.api.instrumentation.StandardTags;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.source.Source;
import com.oracle.truffle.api.source.SourceSection;

import de.hpi.swa.trufflesqueak.image.SqueakImageContext;
import de.hpi.swa.trufflesqueak.interop.ContextObjectInfo;
import de.hpi.swa.trufflesqueak.interop.InteropArray;
import de.hpi.swa.trufflesqueak.interop.SqueakFileDetector;
import de.hpi.swa.trufflesqueak.interop.WrapToSqueakNode;
import de.hpi.swa.trufflesqueak.model.CompiledCodeObject;
import de.hpi.swa.trufflesqueak.model.FrameMarker;
import de.hpi.swa.trufflesqueak.nodes.SqueakGuards;
import de.hpi.swa.trufflesqueak.nodes.accessing.SqueakObjectClassNode;
import de.hpi.swa.trufflesqueak.shared.SqueakLanguageConfig;
import de.hpi.swa.trufflesqueak.util.FrameAccess;
import de.hpi.swa.trufflesqueak.util.MiscUtils;
Expand Down Expand Up @@ -71,25 +66,11 @@ protected CallTarget parse(final ParsingRequest request) throws Exception {
}
}

@Override
protected boolean isObjectOfLanguage(final Object object) {
return SqueakGuards.isAbstractSqueakObject(object);
}

@Override
protected boolean isThreadAccessAllowed(final Thread thread, final boolean singleThreaded) {
return true; // TODO: Experimental, make TruffleSqueak work in multiple threads.
}

@Override
protected Object findMetaObject(final SqueakImageContext image, final Object value) {
// TODO: return ContextObject instead?
if (value instanceof FrameMarker) {
return image.nilClass;
}
return SqueakObjectClassNode.getUncached().executeLookup(WrapToSqueakNode.getUncached().executeWrap(value));
}

@Override
protected Iterable<Scope> findTopScopes(final SqueakImageContext context) {
context.ensureLoaded();
Expand All @@ -110,12 +91,6 @@ protected Iterable<Scope> findLocalScopes(final SqueakImageContext context, fina
return Collections.singletonList(Scope.newBuilder(name, variables).node(node).receiver(receiver.toString(), receiver).arguments(arguments).build());
}

@Override
protected SourceSection findSourceLocation(final SqueakImageContext context, final Object value) {
// TODO Implement for LSP -> "go-to-definition within same workspace window"
return super.findSourceLocation(context, value);
}

public static SqueakImageContext getContext() {
CompilerAsserts.neverPartOfCompilation();
return getCurrentContext(SqueakLanguage.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.oracle.truffle.api.CompilerAsserts;
import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import com.oracle.truffle.api.TruffleLanguage;
import com.oracle.truffle.api.dsl.Cached;
import com.oracle.truffle.api.dsl.Cached.Exclusive;
import com.oracle.truffle.api.dsl.Cached.Shared;
Expand Down Expand Up @@ -43,6 +44,12 @@ public abstract class AbstractSqueakObject implements TruffleObject {

public abstract int size();

@Override
public String toString() {
CompilerAsserts.neverPartOfCompilation();
return "a " + getClass().getSimpleName() + " @" + Integer.toHexString(hashCode());
}

/*
* INTEROPERABILITY
*/
Expand Down Expand Up @@ -152,10 +159,33 @@ protected static final Object invokeMemberWithDNU(final AbstractSqueakObject rec
}
}

@Override
public String toString() {
CompilerAsserts.neverPartOfCompilation();
return "a " + getClass().getSimpleName() + " @" + Integer.toHexString(hashCode());
@ExportMessage
@SuppressWarnings("static-method")
public final boolean hasMetaObject() {
return true;
}

@ExportMessage
public final Object getMetaObject(@Shared("classNode") @Cached final SqueakObjectClassNode classNode) {
return classNode.executeLookup(this);
}

@ExportMessage
@SuppressWarnings("static-method")
public final boolean hasLanguage() {
return true;
}

@ExportMessage
@SuppressWarnings("static-method")
public final Class<? extends TruffleLanguage<?>> getLanguage() {
return SqueakLanguage.class;
}

@ExportMessage
@TruffleBoundary
public final Object toDisplayString(@SuppressWarnings("unused") final boolean allowSideEffects) {
return toString();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import java.util.List;

import com.oracle.truffle.api.Assumption;
import com.oracle.truffle.api.CompilerAsserts;
import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
Expand Down Expand Up @@ -39,6 +38,7 @@
import de.hpi.swa.trufflesqueak.model.layout.ObjectLayouts.CLASS_DESCRIPTION;
import de.hpi.swa.trufflesqueak.model.layout.ObjectLayouts.CLASS_TRAIT;
import de.hpi.swa.trufflesqueak.model.layout.ObjectLayouts.METACLASS;
import de.hpi.swa.trufflesqueak.nodes.accessing.SqueakObjectClassNode;
import de.hpi.swa.trufflesqueak.nodes.accessing.SqueakObjectNewNode;
import de.hpi.swa.trufflesqueak.util.ArrayUtils;
import de.hpi.swa.trufflesqueak.util.ObjectGraphUtils.ObjectTracer;
Expand Down Expand Up @@ -120,8 +120,8 @@ public String toString() {
}

@Override
@TruffleBoundary
public String getClassName() {
CompilerAsserts.neverPartOfCompilation();
if (isAMetaClass()) {
final Object classInstance = pointers[METACLASS.THIS_CLASS - CLASS_DESCRIPTION.SIZE];
if (classInstance != NilObject.SINGLETON && ((ClassObject) classInstance).pointers[CLASS.NAME] != NilObject.SINGLETON) {
Expand Down Expand Up @@ -654,4 +654,37 @@ private static void initializeObject(final Object[] arguments, final InteropLibr
}
}
}

@SuppressWarnings("static-method")
@ExportMessage
protected boolean isMetaObject() {
return true;
}

@SuppressWarnings("static-method")
@ExportMessage
protected Object getMetaQualifiedName() {
return getClassName();
}

@SuppressWarnings("static-method")
@ExportMessage
protected Object getMetaSimpleName() {
return getClassName();
}

@SuppressWarnings("static-method")
@ExportMessage
protected boolean isMetaInstance(final Object instance,
@Cached final SqueakObjectClassNode classNode) {
final ClassObject clazz = classNode.executeLookup(instance);
ClassObject currentClass = this;
while (currentClass != null) {
if (currentClass == clazz) {
return true;
}
currentClass = currentClass.getSuperclassOrNull();
}
return false;
}
}
Loading

0 comments on commit 522b010

Please sign in to comment.