Skip to content

Commit e3e8266

Browse files
authored
Merge pull request #92 from boris-spas/sl_update_release/graal-vm/20.0
update 20.0
2 parents 9244b52 + ecfb46f commit e3e8266

File tree

17 files changed

+382
-71
lines changed

17 files changed

+382
-71
lines changed

.travis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ jdk:
99
- openjdk11
1010

1111
env:
12-
- GRAALVM_VERSION="19.3.1" GRAALVM_JAVA_VERSION="8"
13-
- GRAALVM_VERSION="19.3.1" GRAALVM_JAVA_VERSION="11"
12+
- GRAALVM_VERSION="20.0.0" GRAALVM_JAVA_VERSION="8"
13+
- GRAALVM_VERSION="20.0.0" GRAALVM_JAVA_VERSION="11"
1414
- GRAALVM_VERSION="NONE" SL_BUILD_NATIVE="false"
1515

1616
matrix:
1717
exclude:
18-
- env: GRAALVM_VERSION="19.3.1" GRAALVM_JAVA_VERSION="8"
18+
- env: GRAALVM_VERSION="20.0" GRAALVM_JAVA_VERSION="8"
1919
jdk: openjdk11
2020
os: linux
21-
- env: GRAALVM_VERSION="19.3.1" GRAALVM_JAVA_VERSION="11"
21+
- env: GRAALVM_VERSION="20.0" GRAALVM_JAVA_VERSION="11"
2222
jdk: openjdk11
2323
os: linux
2424
# Travis does not provide an adequate jdk8 on mac (mac versioning issue)

component/make_component.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ mkdir -p "$COMPONENT_DIR/META-INF"
3535
{
3636
echo "Bundle-Name: Simple Language";
3737
echo "Bundle-Symbolic-Name: com.oracle.truffle.sl";
38-
echo "Bundle-Version: 19.3.1";
39-
echo 'Bundle-RequireCapability: org.graalvm; filter:="(&(graalvm_version=19.3.1)(os_arch=amd64))"';
38+
echo "Bundle-Version: 20.0.0";
39+
echo 'Bundle-RequireCapability: org.graalvm; filter:="(&(graalvm_version=20.0.0)(os_arch=amd64))"';
4040
echo "x-GraalVM-Polyglot-Part: True"
4141
} > "$COMPONENT_DIR/META-INF/MANIFEST.MF"
4242

component/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>com.oracle</groupId>
55
<artifactId>simplelanguage-graalvm-component</artifactId>
6-
<version>19.3.1-SNAPSHOT</version>
6+
<version>20.0.0-SNAPSHOT</version>
77
<properties>
88
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
99
<m2e.apt.activation>jdt_apt</m2e.apt.activation>

language/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>com.oracle</groupId>
66
<artifactId>simplelanguage-parent</artifactId>
7-
<version>19.3.1-SNAPSHOT</version>
7+
<version>20.0.0-SNAPSHOT</version>
88
</parent>
99
<artifactId>simplelanguage</artifactId>
1010
<profiles>

language/src/main/java/com/oracle/truffle/sl/SLLanguage.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,8 @@
191191
* </ul>
192192
*/
193193
@TruffleLanguage.Registration(id = SLLanguage.ID, name = "SL", defaultMimeType = SLLanguage.MIME_TYPE, characterMimeTypes = SLLanguage.MIME_TYPE, contextPolicy = ContextPolicy.SHARED, fileTypeDetectors = SLFileDetector.class)
194-
@ProvidedTags({StandardTags.CallTag.class, StandardTags.StatementTag.class, StandardTags.RootTag.class, StandardTags.RootBodyTag.class, StandardTags.ExpressionTag.class,
195-
DebuggerTags.AlwaysHalt.class})
194+
@ProvidedTags({StandardTags.CallTag.class, StandardTags.StatementTag.class, StandardTags.RootTag.class, StandardTags.RootBodyTag.class, StandardTags.ExpressionTag.class, DebuggerTags.AlwaysHalt.class,
195+
StandardTags.ReadVariableTag.class, StandardTags.WriteVariableTag.class})
196196
public final class SLLanguage extends TruffleLanguage<SLContext> {
197197
public static volatile int counter;
198198

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
/*
2+
* Copyright (c) 2019, 2019, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* The Universal Permissive License (UPL), Version 1.0
6+
*
7+
* Subject to the condition set forth below, permission is hereby granted to any
8+
* person obtaining a copy of this software, associated documentation and/or
9+
* data (collectively the "Software"), free of charge and under any and all
10+
* copyright rights in the Software, and any and all patent rights owned or
11+
* freely licensable by each licensor hereunder covering either (i) the
12+
* unmodified Software as contributed to or provided by such licensor, or (ii)
13+
* the Larger Works (as defined below), to deal in both
14+
*
15+
* (a) the Software, and
16+
*
17+
* (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
18+
* one is included with the Software each a "Larger Work" to which the Software
19+
* is contributed by such licensors),
20+
*
21+
* without restriction, including without limitation the rights to copy, create
22+
* derivative works of, display, perform, and distribute the Software and make,
23+
* use, sell, offer for sale, import, export, have made, and have sold the
24+
* Software and the Larger Work(s), and to sublicense the foregoing rights on
25+
* either these or other terms.
26+
*
27+
* This license is subject to the following condition:
28+
*
29+
* The above copyright notice and either this complete permission notice or at a
30+
* minimum a reference to the UPL must be included in all copies or substantial
31+
* portions of the Software.
32+
*
33+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
34+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
35+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
36+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
37+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
38+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
39+
* SOFTWARE.
40+
*/
41+
package com.oracle.truffle.sl.nodes.interop;
42+
43+
import com.oracle.truffle.api.CompilerDirectives;
44+
import com.oracle.truffle.api.instrumentation.StandardTags;
45+
import com.oracle.truffle.api.interop.InteropLibrary;
46+
import com.oracle.truffle.api.interop.TruffleObject;
47+
import com.oracle.truffle.api.interop.UnknownIdentifierException;
48+
import com.oracle.truffle.api.library.ExportLibrary;
49+
import com.oracle.truffle.api.library.ExportMessage;
50+
51+
/**
52+
* A container class used to store per-node attributes used by the instrumentation framework.
53+
*/
54+
public abstract class NodeObjectDescriptor implements TruffleObject {
55+
56+
private final String name;
57+
58+
private NodeObjectDescriptor(String name) {
59+
assert name != null;
60+
this.name = name;
61+
}
62+
63+
public static NodeObjectDescriptor readVariable(String name) {
64+
return new ReadDescriptor(name);
65+
}
66+
67+
public static NodeObjectDescriptor writeVariable(String name) {
68+
return new WriteDescriptor(name);
69+
}
70+
71+
Object readMember(String member) throws UnknownIdentifierException {
72+
if (isMemberReadable(member)) {
73+
return name;
74+
} else {
75+
CompilerDirectives.transferToInterpreter();
76+
throw UnknownIdentifierException.create(member);
77+
}
78+
}
79+
80+
abstract boolean isMemberReadable(String member);
81+
82+
@ExportLibrary(InteropLibrary.class)
83+
static final class ReadDescriptor extends NodeObjectDescriptor {
84+
85+
private static final TruffleObject KEYS_READ = new NodeObjectDescriptorKeys(StandardTags.ReadVariableTag.NAME);
86+
87+
ReadDescriptor(String name) {
88+
super(name);
89+
}
90+
91+
@ExportMessage
92+
@SuppressWarnings("static-method")
93+
boolean hasMembers() {
94+
return true;
95+
}
96+
97+
@Override
98+
@ExportMessage
99+
boolean isMemberReadable(String member) {
100+
return StandardTags.ReadVariableTag.NAME.equals(member);
101+
}
102+
103+
@ExportMessage
104+
@SuppressWarnings("static-method")
105+
Object getMembers(@SuppressWarnings("unused") boolean includeInternal) {
106+
return KEYS_READ;
107+
}
108+
109+
@Override
110+
@ExportMessage
111+
Object readMember(String member) throws UnknownIdentifierException {
112+
return super.readMember(member);
113+
}
114+
}
115+
116+
@ExportLibrary(InteropLibrary.class)
117+
static final class WriteDescriptor extends NodeObjectDescriptor {
118+
119+
private static final TruffleObject KEYS_WRITE = new NodeObjectDescriptorKeys(StandardTags.WriteVariableTag.NAME);
120+
121+
WriteDescriptor(String name) {
122+
super(name);
123+
}
124+
125+
@ExportMessage
126+
@SuppressWarnings("static-method")
127+
boolean hasMembers() {
128+
return true;
129+
}
130+
131+
@Override
132+
@ExportMessage
133+
boolean isMemberReadable(String member) {
134+
return StandardTags.WriteVariableTag.NAME.equals(member);
135+
}
136+
137+
@ExportMessage
138+
@SuppressWarnings("static-method")
139+
Object getMembers(@SuppressWarnings("unused") boolean includeInternal) {
140+
return KEYS_WRITE;
141+
}
142+
143+
@Override
144+
@ExportMessage
145+
Object readMember(String member) throws UnknownIdentifierException {
146+
return super.readMember(member);
147+
}
148+
}
149+
}
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
/*
2+
* Copyright (c) 2019, 2019, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* The Universal Permissive License (UPL), Version 1.0
6+
*
7+
* Subject to the condition set forth below, permission is hereby granted to any
8+
* person obtaining a copy of this software, associated documentation and/or
9+
* data (collectively the "Software"), free of charge and under any and all
10+
* copyright rights in the Software, and any and all patent rights owned or
11+
* freely licensable by each licensor hereunder covering either (i) the
12+
* unmodified Software as contributed to or provided by such licensor, or (ii)
13+
* the Larger Works (as defined below), to deal in both
14+
*
15+
* (a) the Software, and
16+
*
17+
* (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
18+
* one is included with the Software each a "Larger Work" to which the Software
19+
* is contributed by such licensors),
20+
*
21+
* without restriction, including without limitation the rights to copy, create
22+
* derivative works of, display, perform, and distribute the Software and make,
23+
* use, sell, offer for sale, import, export, have made, and have sold the
24+
* Software and the Larger Work(s), and to sublicense the foregoing rights on
25+
* either these or other terms.
26+
*
27+
* This license is subject to the following condition:
28+
*
29+
* The above copyright notice and either this complete permission notice or at a
30+
* minimum a reference to the UPL must be included in all copies or substantial
31+
* portions of the Software.
32+
*
33+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
34+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
35+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
36+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
37+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
38+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
39+
* SOFTWARE.
40+
*/
41+
package com.oracle.truffle.sl.nodes.interop;
42+
43+
import com.oracle.truffle.api.dsl.Cached;
44+
import com.oracle.truffle.api.interop.InteropLibrary;
45+
import com.oracle.truffle.api.interop.InvalidArrayIndexException;
46+
import com.oracle.truffle.api.interop.TruffleObject;
47+
import com.oracle.truffle.api.library.ExportLibrary;
48+
import com.oracle.truffle.api.library.ExportMessage;
49+
import com.oracle.truffle.api.profiles.BranchProfile;
50+
51+
@ExportLibrary(InteropLibrary.class)
52+
public final class NodeObjectDescriptorKeys implements TruffleObject {
53+
54+
private final String keyName;
55+
56+
NodeObjectDescriptorKeys(String keyName) {
57+
this.keyName = keyName;
58+
}
59+
60+
@ExportMessage
61+
@SuppressWarnings("static-method")
62+
boolean hasArrayElements() {
63+
return true;
64+
}
65+
66+
@ExportMessage
67+
@SuppressWarnings("static-method")
68+
boolean isArrayElementReadable(long index) {
69+
return index >= 0 && index < 1;
70+
}
71+
72+
@ExportMessage
73+
@SuppressWarnings("static-method")
74+
long getArraySize() {
75+
return 1;
76+
}
77+
78+
@ExportMessage
79+
Object readArrayElement(long index, @Cached BranchProfile exception) throws InvalidArrayIndexException {
80+
if (!isArrayElementReadable(index)) {
81+
exception.enter();
82+
throw InvalidArrayIndexException.create(index);
83+
}
84+
return keyName;
85+
}
86+
87+
}

language/src/main/java/com/oracle/truffle/sl/nodes/local/SLReadLocalVariableNode.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@
4646
import com.oracle.truffle.api.frame.FrameSlot;
4747
import com.oracle.truffle.api.frame.FrameUtil;
4848
import com.oracle.truffle.api.frame.VirtualFrame;
49+
import com.oracle.truffle.api.instrumentation.StandardTags.ReadVariableTag;
50+
import com.oracle.truffle.api.instrumentation.Tag;
4951
import com.oracle.truffle.sl.nodes.SLExpressionNode;
52+
import com.oracle.truffle.sl.nodes.interop.NodeObjectDescriptor;
5053

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

101104
return FrameUtil.getObjectSafe(frame, getSlot());
102105
}
106+
107+
@Override
108+
public boolean hasTag(Class<? extends Tag> tag) {
109+
return tag == ReadVariableTag.class || super.hasTag(tag);
110+
}
111+
112+
@Override
113+
public Object getNodeObject() {
114+
return NodeObjectDescriptor.readVariable(getSlot().getIdentifier().toString());
115+
}
103116
}

language/src/main/java/com/oracle/truffle/sl/nodes/local/SLWriteLocalVariableNode.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* The Universal Permissive License (UPL), Version 1.0
@@ -47,7 +47,10 @@
4747
import com.oracle.truffle.api.frame.FrameSlot;
4848
import com.oracle.truffle.api.frame.FrameSlotKind;
4949
import com.oracle.truffle.api.frame.VirtualFrame;
50+
import com.oracle.truffle.api.instrumentation.StandardTags.WriteVariableTag;
51+
import com.oracle.truffle.api.instrumentation.Tag;
5052
import com.oracle.truffle.sl.nodes.SLExpressionNode;
53+
import com.oracle.truffle.sl.nodes.interop.NodeObjectDescriptor;
5154

5255
/**
5356
* Node to write a local variable to a function's {@link VirtualFrame frame}. The Truffle frame API
@@ -128,4 +131,14 @@ protected boolean isBooleanOrIllegal(VirtualFrame frame) {
128131
final FrameSlotKind kind = frame.getFrameDescriptor().getFrameSlotKind(getSlot());
129132
return kind == FrameSlotKind.Boolean || kind == FrameSlotKind.Illegal;
130133
}
134+
135+
@Override
136+
public boolean hasTag(Class<? extends Tag> tag) {
137+
return tag == WriteVariableTag.class || super.hasTag(tag);
138+
}
139+
140+
@Override
141+
public Object getNodeObject() {
142+
return NodeObjectDescriptor.writeVariable(getSlot().getIdentifier().toString());
143+
}
131144
}

0 commit comments

Comments
 (0)