Skip to content

Commit

Permalink
Merge pull request #92 from boris-spas/sl_update_release/graal-vm/20.0
Browse files Browse the repository at this point in the history
update 20.0
  • Loading branch information
boris-spas authored Feb 20, 2020
2 parents 9244b52 + ecfb46f commit e3e8266
Show file tree
Hide file tree
Showing 17 changed files with 382 additions and 71 deletions.
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ jdk:
- openjdk11

env:
- GRAALVM_VERSION="19.3.1" GRAALVM_JAVA_VERSION="8"
- GRAALVM_VERSION="19.3.1" GRAALVM_JAVA_VERSION="11"
- GRAALVM_VERSION="20.0.0" GRAALVM_JAVA_VERSION="8"
- GRAALVM_VERSION="20.0.0" GRAALVM_JAVA_VERSION="11"
- GRAALVM_VERSION="NONE" SL_BUILD_NATIVE="false"

matrix:
exclude:
- env: GRAALVM_VERSION="19.3.1" GRAALVM_JAVA_VERSION="8"
- env: GRAALVM_VERSION="20.0" GRAALVM_JAVA_VERSION="8"
jdk: openjdk11
os: linux
- env: GRAALVM_VERSION="19.3.1" GRAALVM_JAVA_VERSION="11"
- env: GRAALVM_VERSION="20.0" GRAALVM_JAVA_VERSION="11"
jdk: openjdk11
os: linux
# Travis does not provide an adequate jdk8 on mac (mac versioning issue)
Expand Down
4 changes: 2 additions & 2 deletions component/make_component.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ mkdir -p "$COMPONENT_DIR/META-INF"
{
echo "Bundle-Name: Simple Language";
echo "Bundle-Symbolic-Name: com.oracle.truffle.sl";
echo "Bundle-Version: 19.3.1";
echo 'Bundle-RequireCapability: org.graalvm; filter:="(&(graalvm_version=19.3.1)(os_arch=amd64))"';
echo "Bundle-Version: 20.0.0";
echo 'Bundle-RequireCapability: org.graalvm; filter:="(&(graalvm_version=20.0.0)(os_arch=amd64))"';
echo "x-GraalVM-Polyglot-Part: True"
} > "$COMPONENT_DIR/META-INF/MANIFEST.MF"

Expand Down
2 changes: 1 addition & 1 deletion component/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.oracle</groupId>
<artifactId>simplelanguage-graalvm-component</artifactId>
<version>19.3.1-SNAPSHOT</version>
<version>20.0.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<m2e.apt.activation>jdt_apt</m2e.apt.activation>
Expand Down
2 changes: 1 addition & 1 deletion language/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.oracle</groupId>
<artifactId>simplelanguage-parent</artifactId>
<version>19.3.1-SNAPSHOT</version>
<version>20.0.0-SNAPSHOT</version>
</parent>
<artifactId>simplelanguage</artifactId>
<profiles>
Expand Down
4 changes: 2 additions & 2 deletions language/src/main/java/com/oracle/truffle/sl/SLLanguage.java
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@
* </ul>
*/
@TruffleLanguage.Registration(id = SLLanguage.ID, name = "SL", defaultMimeType = SLLanguage.MIME_TYPE, characterMimeTypes = SLLanguage.MIME_TYPE, contextPolicy = ContextPolicy.SHARED, fileTypeDetectors = SLFileDetector.class)
@ProvidedTags({StandardTags.CallTag.class, StandardTags.StatementTag.class, StandardTags.RootTag.class, StandardTags.RootBodyTag.class, StandardTags.ExpressionTag.class,
DebuggerTags.AlwaysHalt.class})
@ProvidedTags({StandardTags.CallTag.class, StandardTags.StatementTag.class, StandardTags.RootTag.class, StandardTags.RootBodyTag.class, StandardTags.ExpressionTag.class, DebuggerTags.AlwaysHalt.class,
StandardTags.ReadVariableTag.class, StandardTags.WriteVariableTag.class})
public final class SLLanguage extends TruffleLanguage<SLContext> {
public static volatile int counter;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
/*
* Copyright (c) 2019, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* The Universal Permissive License (UPL), Version 1.0
*
* Subject to the condition set forth below, permission is hereby granted to any
* person obtaining a copy of this software, associated documentation and/or
* data (collectively the "Software"), free of charge and under any and all
* copyright rights in the Software, and any and all patent rights owned or
* freely licensable by each licensor hereunder covering either (i) the
* unmodified Software as contributed to or provided by such licensor, or (ii)
* the Larger Works (as defined below), to deal in both
*
* (a) the Software, and
*
* (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
* one is included with the Software each a "Larger Work" to which the Software
* is contributed by such licensors),
*
* without restriction, including without limitation the rights to copy, create
* derivative works of, display, perform, and distribute the Software and make,
* use, sell, offer for sale, import, export, have made, and have sold the
* Software and the Larger Work(s), and to sublicense the foregoing rights on
* either these or other terms.
*
* This license is subject to the following condition:
*
* The above copyright notice and either this complete permission notice or at a
* minimum a reference to the UPL must be included in all copies or substantial
* portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.oracle.truffle.sl.nodes.interop;

import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.instrumentation.StandardTags;
import com.oracle.truffle.api.interop.InteropLibrary;
import com.oracle.truffle.api.interop.TruffleObject;
import com.oracle.truffle.api.interop.UnknownIdentifierException;
import com.oracle.truffle.api.library.ExportLibrary;
import com.oracle.truffle.api.library.ExportMessage;

/**
* A container class used to store per-node attributes used by the instrumentation framework.
*/
public abstract class NodeObjectDescriptor implements TruffleObject {

private final String name;

private NodeObjectDescriptor(String name) {
assert name != null;
this.name = name;
}

public static NodeObjectDescriptor readVariable(String name) {
return new ReadDescriptor(name);
}

public static NodeObjectDescriptor writeVariable(String name) {
return new WriteDescriptor(name);
}

Object readMember(String member) throws UnknownIdentifierException {
if (isMemberReadable(member)) {
return name;
} else {
CompilerDirectives.transferToInterpreter();
throw UnknownIdentifierException.create(member);
}
}

abstract boolean isMemberReadable(String member);

@ExportLibrary(InteropLibrary.class)
static final class ReadDescriptor extends NodeObjectDescriptor {

private static final TruffleObject KEYS_READ = new NodeObjectDescriptorKeys(StandardTags.ReadVariableTag.NAME);

ReadDescriptor(String name) {
super(name);
}

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

@Override
@ExportMessage
boolean isMemberReadable(String member) {
return StandardTags.ReadVariableTag.NAME.equals(member);
}

@ExportMessage
@SuppressWarnings("static-method")
Object getMembers(@SuppressWarnings("unused") boolean includeInternal) {
return KEYS_READ;
}

@Override
@ExportMessage
Object readMember(String member) throws UnknownIdentifierException {
return super.readMember(member);
}
}

@ExportLibrary(InteropLibrary.class)
static final class WriteDescriptor extends NodeObjectDescriptor {

private static final TruffleObject KEYS_WRITE = new NodeObjectDescriptorKeys(StandardTags.WriteVariableTag.NAME);

WriteDescriptor(String name) {
super(name);
}

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

@Override
@ExportMessage
boolean isMemberReadable(String member) {
return StandardTags.WriteVariableTag.NAME.equals(member);
}

@ExportMessage
@SuppressWarnings("static-method")
Object getMembers(@SuppressWarnings("unused") boolean includeInternal) {
return KEYS_WRITE;
}

@Override
@ExportMessage
Object readMember(String member) throws UnknownIdentifierException {
return super.readMember(member);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/*
* Copyright (c) 2019, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* The Universal Permissive License (UPL), Version 1.0
*
* Subject to the condition set forth below, permission is hereby granted to any
* person obtaining a copy of this software, associated documentation and/or
* data (collectively the "Software"), free of charge and under any and all
* copyright rights in the Software, and any and all patent rights owned or
* freely licensable by each licensor hereunder covering either (i) the
* unmodified Software as contributed to or provided by such licensor, or (ii)
* the Larger Works (as defined below), to deal in both
*
* (a) the Software, and
*
* (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
* one is included with the Software each a "Larger Work" to which the Software
* is contributed by such licensors),
*
* without restriction, including without limitation the rights to copy, create
* derivative works of, display, perform, and distribute the Software and make,
* use, sell, offer for sale, import, export, have made, and have sold the
* Software and the Larger Work(s), and to sublicense the foregoing rights on
* either these or other terms.
*
* This license is subject to the following condition:
*
* The above copyright notice and either this complete permission notice or at a
* minimum a reference to the UPL must be included in all copies or substantial
* portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.oracle.truffle.sl.nodes.interop;

import com.oracle.truffle.api.dsl.Cached;
import com.oracle.truffle.api.interop.InteropLibrary;
import com.oracle.truffle.api.interop.InvalidArrayIndexException;
import com.oracle.truffle.api.interop.TruffleObject;
import com.oracle.truffle.api.library.ExportLibrary;
import com.oracle.truffle.api.library.ExportMessage;
import com.oracle.truffle.api.profiles.BranchProfile;

@ExportLibrary(InteropLibrary.class)
public final class NodeObjectDescriptorKeys implements TruffleObject {

private final String keyName;

NodeObjectDescriptorKeys(String keyName) {
this.keyName = keyName;
}

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

@ExportMessage
@SuppressWarnings("static-method")
boolean isArrayElementReadable(long index) {
return index >= 0 && index < 1;
}

@ExportMessage
@SuppressWarnings("static-method")
long getArraySize() {
return 1;
}

@ExportMessage
Object readArrayElement(long index, @Cached BranchProfile exception) throws InvalidArrayIndexException {
if (!isArrayElementReadable(index)) {
exception.enter();
throw InvalidArrayIndexException.create(index);
}
return keyName;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@
import com.oracle.truffle.api.frame.FrameSlot;
import com.oracle.truffle.api.frame.FrameUtil;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.instrumentation.StandardTags.ReadVariableTag;
import com.oracle.truffle.api.instrumentation.Tag;
import com.oracle.truffle.sl.nodes.SLExpressionNode;
import com.oracle.truffle.sl.nodes.interop.NodeObjectDescriptor;

/**
* Node to read a local variable from a function's {@link VirtualFrame frame}. The Truffle frame API
Expand Down Expand Up @@ -100,4 +103,14 @@ protected Object readObject(VirtualFrame frame) {

return FrameUtil.getObjectSafe(frame, getSlot());
}

@Override
public boolean hasTag(Class<? extends Tag> tag) {
return tag == ReadVariableTag.class || super.hasTag(tag);
}

@Override
public Object getNodeObject() {
return NodeObjectDescriptor.readVariable(getSlot().getIdentifier().toString());
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* The Universal Permissive License (UPL), Version 1.0
Expand Down Expand Up @@ -47,7 +47,10 @@
import com.oracle.truffle.api.frame.FrameSlot;
import com.oracle.truffle.api.frame.FrameSlotKind;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.instrumentation.StandardTags.WriteVariableTag;
import com.oracle.truffle.api.instrumentation.Tag;
import com.oracle.truffle.sl.nodes.SLExpressionNode;
import com.oracle.truffle.sl.nodes.interop.NodeObjectDescriptor;

/**
* Node to write a local variable to a function's {@link VirtualFrame frame}. The Truffle frame API
Expand Down Expand Up @@ -128,4 +131,14 @@ protected boolean isBooleanOrIllegal(VirtualFrame frame) {
final FrameSlotKind kind = frame.getFrameDescriptor().getFrameSlotKind(getSlot());
return kind == FrameSlotKind.Boolean || kind == FrameSlotKind.Illegal;
}

@Override
public boolean hasTag(Class<? extends Tag> tag) {
return tag == WriteVariableTag.class || super.hasTag(tag);
}

@Override
public Object getNodeObject() {
return NodeObjectDescriptor.writeVariable(getSlot().getIdentifier().toString());
}
}
Loading

0 comments on commit e3e8266

Please sign in to comment.