Skip to content

Commit 2a2609d

Browse files
committed
Merge commit '83a6900f945761b8244801e467897b428a208336' into release/graal-vm/1.0
2 parents 8aa5b4e + 83a6900 commit 2a2609d

File tree

72 files changed

+890
-815
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+890
-815
lines changed

ci.jsonnet

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
overlay: "d20cc2abdeb3cfb022e1a8035e40e350e5cfe5fc",
2+
overlay: "627f30447cbecc2e4f5d16553cbfc6b669396c5d",
33

44
// ======================================================================================================
55
//
@@ -71,7 +71,7 @@
7171
"mercurial": ">=3.2.4",
7272
"gcc": "==4.9.1",
7373
"llvm": "==4.0.1",
74-
"python": "==3.4.1",
74+
"python": "==3.6.5",
7575
"libffi": ">=3.2.1",
7676
"bzip2": ">=1.0.6",
7777
},
@@ -111,7 +111,7 @@
111111
// ------------------------------------------------------------------------------------------------------
112112
local pypyMixin = {
113113
downloads +: {
114-
PYPY_HOME: utils.download("pypy3", "5.8.0-minimal"),
114+
PYPY_HOME: utils.download("pypy3", "7.1.0.beta"),
115115
},
116116
},
117117
pypyMixin: pypyMixin,
@@ -128,8 +128,8 @@
128128

129129
local labsjdk8Mixin = {
130130
downloads +: {
131-
JAVA_HOME: utils.download("labsjdk", "8u202-jvmci-0.57"),
132-
EXTRA_JAVA_HOMES : { pathlist: [utils.download("oraclejdk", "11+20")] },
131+
JAVA_HOME: utils.download("labsjdk", "8u202-jvmci-0.58"),
132+
EXTRA_JAVA_HOMES : { pathlist: [utils.download("oraclejdk", "11+28")] },
133133
},
134134
environment +: {
135135
CI: "true",

graalpython/com.oracle.graal.python.cext/src/bytesobject.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ UPCALL_ID(PyBytes_FromStringAndSize);
5252
UPCALL_ID(PyTruffle_Bytes_EmptyWithCapacity);
5353
PyObject* PyBytes_FromStringAndSize(const char* str, Py_ssize_t sz) {
5454
if (str != NULL) {
55-
return UPCALL_CEXT_O(_jls_PyBytes_FromStringAndSize, polyglot_from_i8_array(str, sz));
55+
return UPCALL_CEXT_O(_jls_PyBytes_FromStringAndSize, polyglot_from_i8_array(str, sz), sz);
5656
}
5757
return UPCALL_CEXT_O(_jls_PyTruffle_Bytes_EmptyWithCapacity, sz);
5858
}
5959

6060
PyObject * PyBytes_FromString(const char *str) {
6161
if (str != NULL) {
62-
return UPCALL_CEXT_O(_jls_PyBytes_FromStringAndSize, polyglot_from_i8_array(str, strlen(str)));
62+
return UPCALL_CEXT_O(_jls_PyBytes_FromStringAndSize, polyglot_from_i8_array(str, strlen(str)), strlen(str));
6363
}
6464
return UPCALL_CEXT_O(_jls_PyTruffle_Bytes_EmptyWithCapacity, 0);
6565
}

graalpython/com.oracle.graal.python.shell/src/com/oracle/graal/python/shell/GraalPythonCompiler.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2018, 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
@@ -64,6 +64,7 @@ protected void exec(List<String> args) {
6464
System.exit(status);
6565
}
6666
} catch (IOException | InterruptedException e) {
67+
Thread.currentThread().interrupt();
6768
throw new RuntimeException(e);
6869
}
6970
}

graalpython/com.oracle.graal.python.shell/src/com/oracle/graal/python/shell/GraalPythonLD.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ void addFile(String f) {
176176
}
177177
nmProc.waitFor();
178178
} catch (InterruptedException | IOException e) {
179+
Thread.currentThread().interrupt();
179180
throw new RuntimeException(e);
180181
}
181182
}
@@ -196,6 +197,7 @@ private List<String> searchLib(List<String> libraryDirs, String lib) {
196197
try {
197198
bcFiles.addAll(arMembers(pathString));
198199
} catch (IOException | InterruptedException e) {
200+
Thread.currentThread().interrupt();
199201
throw new RuntimeException(e);
200202
}
201203
} else {
@@ -212,24 +214,21 @@ private List<String> searchLib(List<String> libraryDirs, String lib) {
212214

213215
private Collection<? extends String> arMembers(String path) throws IOException, InterruptedException {
214216
List<String> members = new ArrayList<>();
215-
File temp = File.createTempFile(path, Long.toString(System.nanoTime()));
216-
temp.delete();
217-
temp.mkdir();
218-
temp.deleteOnExit();
217+
Path temp = Files.createTempDirectory(Long.toString(System.nanoTime()));
219218

220219
ProcessBuilder extractAr = new ProcessBuilder();
221220
extractAr.redirectInput(Redirect.INHERIT);
222221
extractAr.redirectError(Redirect.INHERIT);
223222
extractAr.redirectOutput(Redirect.PIPE);
224-
extractAr.directory(temp);
223+
extractAr.directory(temp.toFile());
225224
logV("ar", path);
226225
// "ar t" lists the members one per line
227226
extractAr.command("ar", "t", path);
228227
Process start = extractAr.start();
229228
try (BufferedReader buffer = new BufferedReader(new InputStreamReader(start.getInputStream()))) {
230229
String line = null;
231230
while ((line = buffer.readLine()) != null) {
232-
members.add(temp.getAbsolutePath() + File.separator + line);
231+
members.add(temp.toFile().getAbsolutePath() + File.separator + line);
233232
}
234233
}
235234
start.waitFor();

graalpython/com.oracle.graal.python.shell/src/com/oracle/graal/python/shell/GraalPythonMain.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,8 @@ protected List<String> preprocessArguments(List<String> givenArgs, Map<String, S
189189
subprocessArgs.add("Dgraal.TruffleCompilationExceptionsArePrinted=true");
190190
subprocessArgs.add("Dgraal.TraceTruffleInlining=true");
191191
subprocessArgs.add("Dgraal.TruffleTraceSplittingSummary=true");
192+
subprocessArgs.add("Dgraal.TraceTruffleTransferToInterpreter=true");
193+
subprocessArgs.add("Dgraal.TraceTruffleAssumptions=true");
192194
inputArgs.remove("-debug-perf");
193195
} else {
194196
unrecognized.add(arg);
@@ -715,6 +717,7 @@ private static void subExec(List<String> args, List<String> subProcessDefs) {
715717
try {
716718
System.exit(new ProcessBuilder(cmd.toArray(new String[0])).inheritIO().start().waitFor());
717719
} catch (IOException | InterruptedException e) {
720+
Thread.currentThread().interrupt();
718721
System.err.println(e.getMessage());
719722
System.exit(-1);
720723
}

graalpython/com.oracle.graal.python.test/src/com/oracle/graal/python/test/PythonTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public static void enterContext(String... newArgs) {
9999
PythonTests.outArray.reset();
100100
PythonTests.errArray.reset();
101101
Context prevContext = context;
102-
context = Context.newBuilder().engine(engine).allowAllAccess(true).arguments("python", newArgs).option("python.Executable", executable).build();
102+
context = Context.newBuilder().engine(engine).allowExperimentalOptions(true).allowAllAccess(true).arguments("python", newArgs).option("python.Executable", executable).build();
103103
context.initialize("python");
104104
if (prevContext != null) {
105105
closeContext(prevContext);

graalpython/com.oracle.graal.python.test/src/com/oracle/graal/python/test/advance/MultiContextTest.java

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2017, 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
@@ -48,7 +48,7 @@
4848

4949
public class MultiContextTest extends PythonTests {
5050
@Test
51-
public void testContextReuse() {
51+
public void testSharingWithMemoryview() {
5252
Engine engine = Engine.newBuilder().build();
5353
for (int i = 0; i < 10; i++) {
5454
try (Context context = newContext(engine)) {
@@ -57,7 +57,18 @@ public void testContextReuse() {
5757
}
5858
}
5959

60+
@Test
61+
public void testSharingWithStruct() {
62+
Engine engine = Engine.newBuilder().build();
63+
for (int i = 0; i < 10; i++) {
64+
try (Context context = newContext(engine)) {
65+
context.eval("python", "import struct\n" +
66+
"n = struct.unpack('<q', struct.pack('<d', 1.1))[0]\n");
67+
}
68+
}
69+
}
70+
6071
private static Context newContext(Engine engine) {
61-
return Context.newBuilder().allowAllAccess(true).engine(engine).build();
72+
return Context.newBuilder().allowExperimentalOptions(true).allowAllAccess(true).engine(engine).build();
6273
}
6374
}

graalpython/com.oracle.graal.python.test/src/com/oracle/graal/python/test/debug/PythonDebugTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ public class PythonDebugTest {
7878
@Before
7979
public void before() {
8080
Builder newBuilder = Context.newBuilder();
81+
newBuilder.allowExperimentalOptions(true);
8182
newBuilder.allowAllAccess(true);
8283
PythonTests.closeContext();
8384
tester = new DebuggerTester(newBuilder);

graalpython/com.oracle.graal.python.test/src/com/oracle/graal/python/test/interop/InteropLibraryTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public class InteropLibraryTest extends PythonTests {
5959
@Before
6060
public void setUpTest() {
6161
Builder builder = Context.newBuilder();
62+
builder.allowExperimentalOptions(true);
6263
builder.allowAllAccess(true);
6364
context = builder.build();
6465
}

graalpython/com.oracle.graal.python.test/src/com/oracle/graal/python/test/interop/JavaInteropTest.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,6 @@
5252
import java.util.Arrays;
5353
import java.util.List;
5454

55-
import com.oracle.graal.python.runtime.interop.InteropArray;
56-
import com.oracle.graal.python.test.PythonTests;
57-
import com.oracle.truffle.api.interop.ArityException;
58-
import com.oracle.truffle.api.interop.InteropLibrary;
59-
import com.oracle.truffle.api.interop.TruffleObject;
60-
import com.oracle.truffle.api.interop.UnknownIdentifierException;
61-
import com.oracle.truffle.api.library.ExportLibrary;
62-
import com.oracle.truffle.api.library.ExportMessage;
63-
6455
import org.graalvm.polyglot.Context;
6556
import org.graalvm.polyglot.Context.Builder;
6657
import org.graalvm.polyglot.Engine;
@@ -76,6 +67,15 @@
7667
import org.junit.runners.Parameterized.Parameter;
7768
import org.junit.runners.Parameterized.Parameters;
7869

70+
import com.oracle.graal.python.runtime.interop.InteropArray;
71+
import com.oracle.graal.python.test.PythonTests;
72+
import com.oracle.truffle.api.interop.ArityException;
73+
import com.oracle.truffle.api.interop.InteropLibrary;
74+
import com.oracle.truffle.api.interop.TruffleObject;
75+
import com.oracle.truffle.api.interop.UnknownIdentifierException;
76+
import com.oracle.truffle.api.library.ExportLibrary;
77+
import com.oracle.truffle.api.library.ExportMessage;
78+
7979
@RunWith(Enclosed.class)
8080
public class JavaInteropTest {
8181
public static class GeneralInterop extends PythonTests {
@@ -89,6 +89,7 @@ public void setUpTest() {
8989
out = new ByteArrayOutputStream();
9090
err = new ByteArrayOutputStream();
9191
Builder builder = Context.newBuilder();
92+
builder.allowExperimentalOptions(true);
9293
builder.allowAllAccess(true);
9394
builder.out(out);
9495
builder.err(err);
@@ -113,7 +114,7 @@ public void evalFailsOnError() {
113114

114115
@Test
115116
public void evalNonInteractiveThrowsSyntaxError() throws IOException {
116-
try (Context c = Context.newBuilder().allowAllAccess(true).option("python.TerminalIsInteractive", "false").build()) {
117+
try (Context c = Context.newBuilder().allowExperimentalOptions(true).allowAllAccess(true).option("python.TerminalIsInteractive", "false").build()) {
117118
c.eval(Source.newBuilder("python", INCOMPLETE_SOURCE, "eval").interactive(false).build());
118119
} catch (PolyglotException t) {
119120
assertTrue(t.isSyntaxError());
@@ -125,7 +126,7 @@ public void evalNonInteractiveThrowsSyntaxError() throws IOException {
125126

126127
@Test
127128
public void evalNonInteractiveInInteractiveTerminalThrowsSyntaxError() throws IOException {
128-
try (Context c = Context.newBuilder().allowAllAccess(true).option("python.TerminalIsInteractive", "true").build()) {
129+
try (Context c = Context.newBuilder().allowExperimentalOptions(true).allowAllAccess(true).option("python.TerminalIsInteractive", "true").build()) {
129130
c.eval(Source.newBuilder("python", INCOMPLETE_SOURCE, "eval").interactive(false).build());
130131
} catch (PolyglotException t) {
131132
assertTrue(t.isSyntaxError());
@@ -137,7 +138,7 @@ public void evalNonInteractiveInInteractiveTerminalThrowsSyntaxError() throws IO
137138

138139
@Test
139140
public void evalInteractiveInNonInteractiveTerminalThrowsSyntaxError() throws IOException {
140-
try (Context c = Context.newBuilder().allowAllAccess(true).option("python.TerminalIsInteractive", "false").build()) {
141+
try (Context c = Context.newBuilder().allowExperimentalOptions(true).allowAllAccess(true).option("python.TerminalIsInteractive", "false").build()) {
141142
c.eval(Source.newBuilder("python", INCOMPLETE_SOURCE, "eval").interactive(true).build());
142143
} catch (PolyglotException t) {
143144
assertTrue(t.isSyntaxError());
@@ -149,7 +150,7 @@ public void evalInteractiveInNonInteractiveTerminalThrowsSyntaxError() throws IO
149150

150151
@Test
151152
public void evalInteractiveInInteractiveTerminalThrowsSyntaxError() throws IOException {
152-
try (Context c = Context.newBuilder().allowAllAccess(true).option("python.TerminalIsInteractive", "true").build()) {
153+
try (Context c = Context.newBuilder().allowExperimentalOptions(true).allowAllAccess(true).option("python.TerminalIsInteractive", "true").build()) {
153154
c.eval(Source.newBuilder("python", INCOMPLETE_SOURCE, "eval").interactive(true).build());
154155
} catch (PolyglotException t) {
155156
assertTrue(t.isSyntaxError());
@@ -513,7 +514,7 @@ static class OptionsChecker {
513514
private Builder builder;
514515

515516
OptionsChecker(String option, String code, String... values) {
516-
this.builder = Context.newBuilder("python").engine(engine).allowAllAccess(true);
517+
this.builder = Context.newBuilder("python").engine(engine).allowExperimentalOptions(true).allowAllAccess(true);
517518
this.option = "python." + option;
518519
this.source = Source.create("python", code);
519520
this.values = values;
@@ -528,7 +529,6 @@ public String toString() {
528529
@Parameters(name = "{0}")
529530
public static OptionsChecker[] input() {
530531
return new OptionsChecker[]{
531-
new OptionsChecker("OpaqueFilesystem", "import sys; sys.graal_python_opaque_filesystem", "true", "false"),
532532
new OptionsChecker("InspectFlag", "import sys; sys.flags.inspect", "true", "false"),
533533
new OptionsChecker("QuietFlag", "import sys; sys.flags.quiet", "true", "false"),
534534
new OptionsChecker("VerboseFlag", "import sys; sys.flags.verbose", "true", "false"),

0 commit comments

Comments
 (0)