Skip to content

Commit 1d674b1

Browse files
committed
Merge commit 'c01c32f85d9' into release/graal-vm/1.0
2 parents 6b3d158 + c01c32f commit 1d674b1

File tree

527 files changed

+318638
-4374
lines changed

Some content is hidden

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

527 files changed

+318638
-4374
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@
7070
.metadata/
7171
.gdb_history
7272
*.swo
73-
*.csv
7473
*.iml
7574
*.swp
7675
*.class
@@ -103,7 +102,7 @@ scratch/
103102
bin/
104103
share/
105104
etc/
106-
doc/
105+
/doc/
107106
src_gen/
108107
/local/
109108
/.hgtip

3rd_party_licenses.txt

Lines changed: 1620 additions & 68 deletions
Large diffs are not rendered by default.

CHANGELOG.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,35 @@
1+
# 1.0 RC 11
2+
3+
* upgraded the R version to R-3.5.1
4+
* base packages and other sources used directly from GNU-R upgraded to their R-3.5.1 versions
5+
* fixed differences between R-3.4.0 and R-3.5.1
6+
7+
* FastR does not print or log any details for internal errors unless it is run with `--jvm.DR:+PrintErrorStacktracesToFile`
8+
9+
Added missing R builtins and C API
10+
11+
* `Rf_duplicated`
12+
* `Rf_setVar`
13+
* `norm_rand`
14+
* `exp_rand`
15+
16+
Bug fixes:
17+
18+
* internal error in `mapply` with empty arguments list
19+
* `comment` and `comment<-` work with S4 objects
20+
* `iconvlist()` was failing on argument error #43
21+
* `range` works properly with lists
22+
* the reference count of `dimnames` of the result of `==` was not handled properly leading to incorrect results #40
23+
* `exists` did not work properly in all cases when used with the `mode` argument #44
24+
* 'charIndex out of range' when parsing an incomplete source #39
25+
* `no_proxy` environment variable was not parsed correctly
26+
* `read.csv` treats empty value as `NA` of the same type as the rest of the values in the column #42
27+
* `SET_NAMED` allows to decrease the reference count to support a pattern from `data.table`
28+
* exception when writing into the result returned from `split`
29+
* `switch` falls through only if the actual argument is empty constant: `switch('x',x=,y=42)` vs. `switch('x',x=quote(f(1,))[[3]],y=42)`
30+
* `oldClass<-` works with external pointers and other less common R types
31+
* C API function `Rf_setAttrib` coerces double vector to integer when setting "dim" attribute #46
32+
133
# 1.0 RC 10
234

335
New features:

ci_common/common.hocon

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# java 7 is needed by Truffle (for now)
22
java7 : {name : oraclejdk, version : "7", platformspecific: true}
33
# java 8 must be a jvmci enabled variant
4-
java8 : {name : labsjdk, version : "8u172-jvmci-0.47", platformspecific: true}
4+
java8 : {name : labsjdk, version : "8u192-jvmci-0.52", platformspecific: true}
55
java9 : {name : oraclejdk, version : "9.0.4+11", platformspecific: true}
66

77
java8Downloads : {
@@ -64,6 +64,7 @@ packagesLinux : ${pkgEnvironment} {
6464
mercurial : ">=2.2"
6565
"pip:astroid" : "==1.1.0"
6666
"pip:pylint" : "==1.1.0"
67+
"pip:ninja_syntax" : "==1.7.2"
6768
make : ">=3.83"
6869
gcc-build-essentials : "==4.9.1" # GCC 4.9.0 fails on cluster
6970
readline : "==6.3"
@@ -76,6 +77,7 @@ packagesLinux : ${pkgEnvironment} {
7677
packagesDarwin : {
7778
"pip:astroid" : "==1.1.0"
7879
"pip:pylint" : "==1.1.0"
80+
"pip:ninja_syntax" : "==1.7.2"
7981
"pcre" : "==8.38"
8082
}
8183

@@ -88,6 +90,7 @@ common : ${java8Downloads} ${packagesLinux} {
8890
environment : {
8991
PKG_TEST_ENV_miniUI : "LC_ALL=C"
9092
PKG_TEST_ENV_compare : "LC_ALL=C"
93+
FASTR_OPTION_PrintErrorStacktracesToFile: "true"
9194
}
9295
}
9396

com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/REngine.java

Lines changed: 35 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,6 @@
2222
*/
2323
package com.oracle.truffle.r.engine;
2424

25-
import java.io.BufferedReader;
26-
import java.io.IOException;
27-
import java.net.URI;
28-
import java.util.ArrayList;
29-
import java.util.Arrays;
30-
import java.util.List;
31-
import java.util.stream.Collectors;
32-
3325
import com.oracle.truffle.api.CallTarget;
3426
import com.oracle.truffle.api.CompilerAsserts;
3527
import com.oracle.truffle.api.CompilerDirectives;
@@ -63,6 +55,7 @@
6355
import com.oracle.truffle.r.nodes.function.RCallerHelper;
6456
import com.oracle.truffle.r.nodes.function.call.CallRFunctionNode;
6557
import com.oracle.truffle.r.nodes.function.opt.ShareObjectNode;
58+
import com.oracle.truffle.r.nodes.function.opt.UnShareObjectNode;
6659
import com.oracle.truffle.r.nodes.function.visibility.GetVisibilityNode;
6760
import com.oracle.truffle.r.nodes.function.visibility.SetVisibilityNode;
6861
import com.oracle.truffle.r.nodes.instrumentation.RInstrumentation;
@@ -80,8 +73,8 @@
8073
import com.oracle.truffle.r.runtime.RRuntime;
8174
import com.oracle.truffle.r.runtime.RSource;
8275
import com.oracle.truffle.r.runtime.ReturnException;
83-
import com.oracle.truffle.r.runtime.RootWithBody;
8476
import com.oracle.truffle.r.runtime.RootBodyNode;
77+
import com.oracle.truffle.r.runtime.RootWithBody;
8578
import com.oracle.truffle.r.runtime.ThreadTimings;
8679
import com.oracle.truffle.r.runtime.Utils;
8780
import com.oracle.truffle.r.runtime.Utils.DebugExitException;
@@ -103,6 +96,14 @@
10396
import com.oracle.truffle.r.runtime.nodes.RNode;
10497
import com.oracle.truffle.r.runtime.nodes.RSyntaxNode;
10598

99+
import java.io.BufferedReader;
100+
import java.io.IOException;
101+
import java.net.URI;
102+
import java.util.ArrayList;
103+
import java.util.Arrays;
104+
import java.util.List;
105+
import java.util.stream.Collectors;
106+
106107
/**
107108
* The engine for the FastR implementation. Handles parsing and evaluation. There is one instance of
108109
* this class per {@link RContext}.
@@ -171,7 +172,7 @@ private void initializeNonShared() {
171172
} catch (ParseException e) {
172173
throw new RInternalError(e, "error while parsing system profile from %s", RProfile.systemProfile().getName());
173174
}
174-
checkAndRunStartupShutdownFunction(".OptRequireMethods");
175+
checkAndRunStartupShutdownFunction(".OptRequireMethods", ".OptRequireMethods()");
175176

176177
suppressWarnings = false;
177178
Source siteProfile = context.stateRProfile.siteProfile();
@@ -192,37 +193,25 @@ private void initializeNonShared() {
192193
}
193194
if (context.getStartParams().restore()) {
194195
// call sys.load.image(".RData", RCmdOption.QUIET
195-
checkAndRunStartupShutdownFunction("sys.load.image", new String[]{"\".RData\"", context.getStartParams().isQuiet() ? "TRUE" : "FALSE"});
196+
checkAndRunStartupShutdownFunction("sys.load.image", "sys.load.image('.RData'," + (context.getStartParams().isQuiet() ? "TRUE" : "FALSE") + ')');
196197
}
197-
checkAndRunStartupShutdownFunction(".First");
198-
checkAndRunStartupShutdownFunction(".First.sys");
198+
checkAndRunStartupShutdownFunction(".First", ".First()");
199+
checkAndRunStartupShutdownFunction(".First.sys", ".First.sys()");
199200

200201
StartupTiming.timestamp("After Profiles Loaded");
201202
}
202203
}
203204

204205
@Override
205-
public void checkAndRunStartupShutdownFunction(String name, String... args) {
206+
public void checkAndRunStartupShutdownFunction(String name, String code) {
207+
// sanity check: code should be invocation of the function, so it should contain
208+
// "{name}(some-args)"
209+
assert code.contains("(") && code.contains(name);
206210
Object func = REnvironment.globalEnv().findFunction(name);
207211
if (func != null) {
208-
String call = name;
209-
if (args.length == 0) {
210-
call += "()";
211-
} else {
212-
call += "(";
213-
if (args.length > 0) {
214-
for (int i = 0; i < args.length; i++) {
215-
call += args[i];
216-
if (i != args.length - 1) {
217-
call += ", ";
218-
}
219-
}
220-
}
221-
call += ")";
222-
}
223212
// Should this print the result?
224213
try {
225-
parseAndEval(RSource.fromTextInternal(call, RSource.Internal.STARTUP_SHUTDOWN), globalFrame, false);
214+
parseAndEval(RSource.fromTextInternal(code, RSource.Internal.STARTUP_SHUTDOWN), globalFrame, false);
226215
} catch (ParseException e) {
227216
throw new RInternalError(e, "error while parsing startup function");
228217
}
@@ -292,7 +281,10 @@ private List<RSyntaxNode> parseSource(Source source) throws ParseException {
292281
@Override
293282
public RExpression parse(Source source) throws ParseException {
294283
List<RSyntaxNode> list = parseSource(source);
295-
Object[] data = list.stream().map(node -> RASTUtils.createLanguageElement(node)).toArray();
284+
Object[] data = new Object[list.size()];
285+
for (int i = 0; i < data.length; i++) {
286+
data[i] = RASTUtils.createLanguageElement(list.get(i));
287+
}
296288
return RDataFactory.createExpression(data);
297289
}
298290

@@ -377,15 +369,18 @@ private EngineRootNode createRScriptRoot(Source fullSource, MaterializedFrame fr
377369
int lineIndex = 1;
378370
int startLine = lineIndex;
379371
StringBuilder sb = new StringBuilder();
372+
String nextLineInput = br.readLine();
373+
ParseException lastParseException = null;
380374
while (true) {
381-
String input = br.readLine();
375+
String input = nextLineInput;
382376
if (input == null) {
383377
if (sb.length() != 0) {
384378
// end of file, but not end of statement => error
385-
statements.add(new SyntaxErrorNode(null, fullSource.createSection(startLine, 1, sb.length())));
379+
statements.add(new SyntaxErrorNode(lastParseException, fullSource.createSection(startLine, 1, sb.length())));
386380
}
387381
break;
388382
}
383+
nextLineInput = br.readLine();
389384
sb.append(input);
390385
Source src = Source.newBuilder(RRuntime.R_LANGUAGE_ID, sb.toString(), file + "#" + startLine + "-" + lineIndex).uri(uri).build();
391386
lineIndex++;
@@ -394,7 +389,10 @@ private EngineRootNode createRScriptRoot(Source fullSource, MaterializedFrame fr
394389
RParserFactory.Parser<RSyntaxNode> parser = RParserFactory.getParser();
395390
currentStmts = parser.statements(src, fullSource, startLine, new RASTBuilder(), context.getLanguage());
396391
} catch (IncompleteSourceException e) {
397-
sb.append('\n');
392+
lastParseException = e;
393+
if (nextLineInput != null) {
394+
sb.append('\n');
395+
}
398396
continue;
399397
} catch (ParseException e) {
400398
statements.add(new SyntaxErrorNode(e, fullSource.createSection(startLine, 1, sb.length())));
@@ -647,8 +645,8 @@ public RNode getBody() {
647645

648646
@TruffleBoundary
649647
private static boolean checkResult(Object result) {
650-
if (FastROptions.CheckResultCompleteness.getBooleanValue() && result instanceof RAbstractVector) {
651-
assert RAbstractVector.verify((RAbstractVector) result);
648+
if (result instanceof RAbstractVector) {
649+
return RAbstractVector.verify((RAbstractVector) result);
652650
}
653651
return true;
654652
}
@@ -678,7 +676,7 @@ private static void printValue(RContext ctx, MaterializedFrame callingFrame, Obj
678676
RFunction function = (RFunction) evaluatePromise(printMethod);
679677
CallRFunctionNode.executeSlowpath(function, RCaller.createInvalid(callingFrame), callingFrame, new Object[]{resultValue, RArgsValuesAndNames.EMPTY}, null);
680678
}
681-
ShareObjectNode.unshare(resultValue);
679+
UnShareObjectNode.unshare(resultValue);
682680
} else {
683681
// this supports printing of non-R values (via toString for now)
684682
String str;

com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/RRuntimeASTAccessImpl.java

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
package com.oracle.truffle.r.engine;
2424

2525
import java.io.ByteArrayOutputStream;
26-
import java.io.FileInputStream;
2726
import java.io.IOException;
2827
import java.io.InputStream;
2928
import java.io.OutputStream;
@@ -55,7 +54,6 @@
5554
import com.oracle.truffle.r.nodes.function.ClassHierarchyNode;
5655
import com.oracle.truffle.r.nodes.function.FunctionDefinitionNode;
5756
import com.oracle.truffle.r.nodes.function.RCallNode;
58-
import com.oracle.truffle.r.nodes.instrumentation.RInstrumentation;
5957
import com.oracle.truffle.r.nodes.instrumentation.RSyntaxTags.FunctionBodyBlockTag;
6058
import com.oracle.truffle.r.nodes.instrumentation.RSyntaxTags.LoopTag;
6159
import com.oracle.truffle.r.runtime.ArgumentsSignature;
@@ -354,20 +352,20 @@ public boolean disableDebug(RFunction func) {
354352
}
355353

356354
@Override
357-
public Object rcommandMain(String[] args, String[] env, boolean intern) {
355+
public Object rcommandMain(String[] args, String[] env, boolean intern, int timeoutSecs) {
358356
IORedirect redirect = handleIORedirect(args, intern);
359357
assert env == null : "re-enable env arguments";
360-
int result = RMain.runR(redirect.args, redirect.in, redirect.out, redirect.err);
358+
int result = RMain.runR(redirect.args, redirect.in, redirect.out, redirect.err, timeoutSecs);
361359
return redirect.getInternResult(result);
362360
}
363361

364362
@Override
365-
public Object rscriptMain(String[] args, String[] env, boolean intern) {
363+
public Object rscriptMain(String[] args, String[] env, boolean intern, int timeoutSecs) {
366364
IORedirect redirect = handleIORedirect(args, intern);
367365
// TODO argument parsing can fail with ExitException, which needs to be handled correctly in
368366
// nested context
369367
assert env == null : "re-enable env arguments";
370-
int result = RMain.runRscript(redirect.args, redirect.in, redirect.out, redirect.err);
368+
int result = RMain.runRscript(redirect.args, redirect.in, redirect.out, redirect.err, timeoutSecs);
371369
return redirect.getInternResult(result);
372370
}
373371

@@ -433,7 +431,7 @@ private static IORedirect handleIORedirect(String[] args, boolean intern) {
433431
throw RError.error(RError.NO_CALLER, RError.Message.GENERIC, "redirect missing");
434432
}
435433
try {
436-
in = new FileInputStream(file);
434+
in = RContext.getInstance().getEnv().getTruffleFile(file).newInputStream();
437435
} catch (IOException ex) {
438436
throw RError.error(RError.NO_CALLER, RError.Message.NO_SUCH_FILE, file);
439437
}
@@ -490,11 +488,6 @@ public String encodeComplex(RComplex x, int digits) {
490488
return ComplexVectorPrinter.encodeComplex(x, digits);
491489
}
492490

493-
@Override
494-
public void checkDebugRequest(RFunction func) {
495-
RInstrumentation.checkDebugRequested(func);
496-
}
497-
498491
@Override
499492
public Class<? extends TruffleRLanguage> getTruffleRLanguage() {
500493
return TruffleRLanguageImpl.class;

com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/interop/ListMR.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,12 @@ protected Object write(TruffleObject receiver, int idx, Object valueObj) {
418418
return write(receiver, new Object[]{idx + 1}, valueObj);
419419
}
420420

421+
@Specialization
422+
protected Object write(TruffleObject receiver, long idx, Object valueObj) {
423+
// idx + 1 R is indexing from 1
424+
return write(receiver, new Object[]{idx + 1}, valueObj);
425+
}
426+
421427
@Specialization
422428
protected Object write(TruffleObject receiver, String field, Object valueObj) {
423429
return write(receiver, new Object[]{field}, valueObj);

com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/interop/RAbstractVectorAccessFactory.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,7 @@
2323
package com.oracle.truffle.r.engine.interop;
2424

2525
import java.util.List;
26+
import java.util.function.Supplier;
2627

2728
import com.oracle.truffle.api.CallTarget;
2829
import com.oracle.truffle.api.CompilerDirectives;
@@ -472,7 +473,16 @@ public Object execute(VirtualFrame frame) {
472473
});
473474
}
474475

475-
static class Check extends RootNode {
476+
public static final Supplier<RootNode> CHECK_FACTORY = new CheckFactory();
477+
478+
private static final class CheckFactory implements Supplier<RootNode> {
479+
@Override
480+
public RootNode get() {
481+
return new Check();
482+
}
483+
}
484+
485+
private static final class Check extends RootNode {
476486

477487
Check() {
478488
super(null);

com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/interop/RForeignAccessFactoryImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -122,7 +122,7 @@ public ForeignAccess getForeignAccess(RTruffleObject obj) {
122122
} else if (obj instanceof RInteropNA) {
123123
return RInteropNAMRForeign.ACCESS;
124124
} else if (obj instanceof RAbstractAtomicVector) {
125-
return ForeignAccess.create(new RAbstractVectorAccessFactory(), new RAbstractVectorAccessFactory.Check());
125+
return ForeignAccess.createAccess(new RAbstractVectorAccessFactory(), RAbstractVectorAccessFactory.CHECK_FACTORY);
126126
} else {
127127
ForeignAccess access = FFI_RForeignAccessFactoryImpl.getForeignAccess(obj);
128128
if (access != null) {

0 commit comments

Comments
 (0)