Skip to content

Commit d6ce128

Browse files
committed
Merge commit '4a4a87fe64ece14e9594a3c42a372f3bd60bda20' into release/graal-vm/1.0
2 parents e791c2e + 4a4a87f commit d6ce128

File tree

141 files changed

+5676
-7256
lines changed

Some content is hidden

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

141 files changed

+5676
-7256
lines changed

CHANGELOG.md

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,37 @@
1+
# 1.0 RC 7
2+
3+
New features
4+
5+
* AWT based graphics devices (jpg, png, X11, ...) supported in native image
6+
7+
Added missing R builtins and C API
8+
9+
Bugfixes
10+
11+
# 1.0 RC 6
12+
13+
New features
14+
15+
* Support for reading/writing graphical parameters via par
16+
* in preparation for full graphics package support
17+
18+
Added missing R builtins and C API
19+
20+
* 'get' builtin supports the 'envir' argument
21+
* 'inspect' internal
22+
* SETLEVELS
23+
* Rf_isObject
24+
* SET_ENCLOS
25+
* R_nchar
26+
* R_forceAndCall
27+
28+
Bugfixes
29+
30+
* support for formulas that include '...'
31+
* updating attributes of NULL produces empty list with given attributes
32+
* treat CR/LF in readLine like GNU-R
33+
* fix in La_chol (incorrect pivot attribute in return)
34+
* various fixes in vector coercion code to produce GNU-R compatible warnings and errors
135

236
# 1.0 RC 5
337

@@ -7,7 +41,7 @@ New features
741
* allows to pass additional arguments for the underlying configure script
842
* by default uses the following arguments: --with-x=no --with-aqua=no --enable-memory-profiling FFLAGS=-O2
943

10-
Updates in interop:
44+
Updates in interop
1145

1246
* R code evaluated via interop never returns a Java primitive type, but always a vector
1347
* Vectors of size 1 that do not contain NA can be unboxed
@@ -16,7 +50,7 @@ Updates in interop:
1650
* if the value is `NA`, a special value that responds to `IS_NULL` with `true`. If this value is passed back to R it behaves as `NA` again
1751
* Note that sending the READ message to a list, environment, or other heterogenous data structure never gives atomic Java type but a primitive R vector
1852

19-
Bug fixes:
53+
Bug fixes
2054

2155
* Various smaller issues discovered during testing of CRAN packages.
2256

ci.hocon

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ include "ci_common/common.hocon"
1111
# overlay = "1823c758582f31386f8ba4d89157265a23cebd04"
1212
builds = [
1313
${gateTestLinux} {capabilities : [linux, amd64, fast], targets : [gate], name: "gate-test-linux-amd64"}
14+
${gateTestNoDSLCacheLinux} {capabilities : [linux, amd64, fast], targets : [gate], name: "gate-test-linux-amd64-no-dsl-cache"}
1415
${gateTestNoSpecialsLinux} {capabilities : [linux, amd64, fast], targets : [gate], name: "gate-test-linux-amd64-nospecials"}
16+
${gateTestNoDSLCacheNoSpecialsLinux} {capabilities : [linux, amd64, fast], targets : [gate], name: "gate-test-linux-amd64-nospecials-no-dsl-cache"}
1517
${gateTestDarwin} {capabilities : [darwin_sierra, amd64], targets : [gate], name: "gate-test-darwin-amd64"}
1618
${gateStyle} {capabilities : [linux, amd64], targets : [gate], name: "gate-style-linux-amd64"}
1719
${gateBuildWithEcj} {capabilities : [linux, amd64], targets : [gate], name: "gate-ecj-linux-amd64"}

ci_common/common.hocon

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,36 @@ gateTestCommon : ${common} {
106106
gateTestLinux : ${gateTestCommon} {
107107
}
108108

109+
gateTestNoDSLCacheLinux : ${common} {
110+
environment : ${common.environment} {
111+
FASTR_RELEASE: "true", # release build so that we also tests recommended pkgs installation
112+
FASTR_OPTION_DSLCacheSizeFactor: "0"
113+
}
114+
run : [
115+
${gateCmd} ["Versions,JDKReleaseInfo,BuildJavaWithJavac,UnitTests: with specials,Rembedded"]
116+
# to verify that we run with the desired configuration
117+
["mx", "r", "-e", "print(list(.fastr.option(as.character(quote(DSLCacheSizeFactor))),.fastr.option(as.character(quote(UseSpecials)))))"]
118+
]
119+
}
120+
109121
gateTestNoSpecialsLinux : ${common} {
110122
run : [
111123
${gateCmd} ["Versions,JDKReleaseInfo,BuildJavaWithJavac,UnitTests: no specials"]
112124
]
113125
}
114126

127+
gateTestNoDSLCacheNoSpecialsLinux : ${common} {
128+
environment : ${common.environment} {
129+
FASTR_RELEASE: "true", # release build so that we also tests recommended pkgs installation
130+
FASTR_OPTION_DSLCacheSizeFactor: "0"
131+
}
132+
run : [
133+
${gateCmd} ["Versions,JDKReleaseInfo,BuildJavaWithJavac,UnitTests: no specials"]
134+
# to verify that we run with the desired configuration
135+
["mx", "r", "-e", "print(list(.fastr.option(as.character(quote(DSLCacheSizeFactor))),.fastr.option(as.character(quote(UseSpecials)))))"]
136+
]
137+
}
138+
115139
darwinEnvironment : {
116140
environment : {
117141
PATH : "/usr/local/bin:$JAVA_HOME/bin:$PATH"

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@
2626
import com.oracle.truffle.api.source.SourceSection;
2727
import com.oracle.truffle.r.runtime.RInternalError;
2828
import com.oracle.truffle.r.runtime.context.Engine.ParseException;
29+
import com.oracle.truffle.r.runtime.nodes.RAttributableNode;
2930
import com.oracle.truffle.r.runtime.nodes.RInstrumentableNode;
30-
import com.oracle.truffle.r.runtime.nodes.RNode;
3131
import com.oracle.truffle.r.runtime.nodes.RSyntaxNode;
3232

3333
/**
34-
* Node that represents piece of AST that would throw syntax error when parser. Used to delay
34+
* Node that represents piece of AST that would throw syntax err or when parser. Used to delay
3535
* parsing error to the point when they should be reported.
3636
*/
37-
final class SyntaxErrorNode extends RNode implements RSyntaxNode, RInstrumentableNode {
37+
final class SyntaxErrorNode extends RAttributableNode implements RSyntaxNode, RInstrumentableNode {
3838
private final ParseException exception;
3939
private final SourceSection sourceSection;
4040

com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/AsCharNode.java

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,14 @@
3434
import com.oracle.truffle.r.runtime.data.RSymbol;
3535
import com.oracle.truffle.r.runtime.data.RTypes;
3636
import com.oracle.truffle.r.runtime.data.model.RAbstractAtomicVector;
37+
import com.oracle.truffle.r.runtime.data.model.RAbstractComplexVector;
38+
import com.oracle.truffle.r.runtime.data.model.RAbstractDoubleVector;
3739
import com.oracle.truffle.r.runtime.data.model.RAbstractStringVector;
3840

3941
@TypeSystemReference(RTypes.class)
4042
public abstract class AsCharNode extends FFIUpCallNode.Arg1 {
4143
private static final CharSXPWrapper CharSXPWrapper_NA = CharSXPWrapper.create(RRuntime.STRING_NA);
44+
private static final CharSXPWrapper CharSXPWrapper_NAString = CharSXPWrapper.create("NA");
4245

4346
public abstract CharSXPWrapper execute(Object obj);
4447

@@ -53,7 +56,8 @@ protected CharSXPWrapper asChar(RStringVector obj) {
5356
return CharSXPWrapper_NA;
5457
} else {
5558
obj.wrapStrings();
56-
return obj.getWrappedDataAt(0);
59+
CharSXPWrapper result = obj.getWrappedDataAt(0);
60+
return RRuntime.isNA(result.getContents()) ? CharSXPWrapper_NA : result;
5761
}
5862
}
5963

@@ -63,18 +67,29 @@ protected CharSXPWrapper asChar(RSymbol obj) {
6367
}
6468

6569
@Specialization(guards = {"obj.getLength() > 0", "isNotStringVec(obj)"})
66-
protected CharSXPWrapper asChar(RAbstractAtomicVector obj, //
70+
protected CharSXPWrapper asChar(RAbstractAtomicVector obj,
6771
@Cached("createNonPreserving()") CastStringNode castStringNode) {
6872
// for other than character vector, symbol or CHARSXP, the cast and creation of new vector
6973
// is inevitable and the user should know to take appropriate measures (i.e. PROTECT).
7074
Object castObj = castStringNode.executeString(obj);
75+
CharSXPWrapper result;
7176
if (castObj instanceof String) {
72-
return CharSXPWrapper.create((String) castObj);
77+
result = CharSXPWrapper.create((String) castObj);
7378
} else if (castObj instanceof RAbstractStringVector) {
74-
return CharSXPWrapper.create(((RAbstractStringVector) castObj).getDataAt(0));
79+
result = CharSXPWrapper.create(((RAbstractStringVector) castObj).getDataAt(0));
7580
} else {
7681
throw RInternalError.shouldNotReachHere();
7782
}
83+
84+
if (RRuntime.isNA(result.getContents())) {
85+
if (obj instanceof RAbstractComplexVector || obj instanceof RAbstractDoubleVector) {
86+
return CharSXPWrapper_NAString;
87+
} else {
88+
return CharSXPWrapper_NA;
89+
}
90+
} else {
91+
return result;
92+
}
7893
}
7994

8095
@Fallback

com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/AsIntegerNode.java

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import com.oracle.truffle.api.dsl.Specialization;
2828
import com.oracle.truffle.api.dsl.TypeSystemReference;
2929
import com.oracle.truffle.r.nodes.unary.CastIntegerNode;
30+
import com.oracle.truffle.r.runtime.RError;
3031
import com.oracle.truffle.r.runtime.RInternalError;
3132
import com.oracle.truffle.r.runtime.RRuntime;
3233
import com.oracle.truffle.r.runtime.data.RTypes;
@@ -49,29 +50,38 @@ protected int asInteger(int obj) {
4950
}
5051

5152
@Specialization
52-
protected int asInteger(double obj) {
53-
return (int) obj;
53+
protected int asInteger(double obj,
54+
@Cached("createCastIntegerNode()") CastIntegerNode castIntegerNode) {
55+
return (int) castIntegerNode.executeInt(obj);
5456
}
5557

5658
@Specialization
57-
protected int asReal(RAbstractDoubleVector obj) {
59+
protected int asInteger(RAbstractDoubleVector obj,
60+
@Cached("createCastIntegerNode()") CastIntegerNode castIntegerNode) {
5861
if (obj.getLength() == 0) {
5962
return RRuntime.INT_NA;
6063
}
61-
return (int) obj.getDataAt(0);
64+
Object castObj = castIntegerNode.executeInt(obj);
65+
if (castObj instanceof Integer) {
66+
return (Integer) castObj;
67+
} else if (castObj instanceof RAbstractIntVector) {
68+
return ((RAbstractIntVector) castObj).getDataAt(0);
69+
} else {
70+
throw RInternalError.shouldNotReachHere();
71+
}
6272
}
6373

6474
@Specialization
65-
protected int asReal(RAbstractIntVector obj) {
75+
protected int asInteger(RAbstractIntVector obj) {
6676
if (obj.getLength() == 0) {
6777
return RRuntime.INT_NA;
6878
}
6979
return obj.getDataAt(0);
7080
}
7181

7282
@Specialization(guards = "obj.getLength() > 0")
73-
protected int asReal(RAbstractAtomicVector obj,
74-
@Cached("createNonPreserving()") CastIntegerNode castIntegerNode) {
83+
protected int asInteger(RAbstractAtomicVector obj,
84+
@Cached("createCastIntegerNode()") CastIntegerNode castIntegerNode) {
7585
Object castObj = castIntegerNode.executeInt(obj);
7686
if (castObj instanceof Integer) {
7787
return (Integer) castObj;
@@ -83,11 +93,15 @@ protected int asReal(RAbstractAtomicVector obj,
8393
}
8494

8595
@Fallback
86-
protected int asRealFallback(@SuppressWarnings("unused") Object obj) {
96+
protected int asIntegerFallback(@SuppressWarnings("unused") Object obj) {
8797
return RRuntime.INT_NA;
8898
}
8999

90100
public static AsIntegerNode create() {
91101
return AsIntegerNodeGen.create();
92102
}
103+
104+
protected CastIntegerNode createCastIntegerNode() {
105+
return CastIntegerNode.createNonPreserving(RError.SHOW_CALLER);
106+
}
93107
}

com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/AsLogicalNode.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,28 +40,31 @@ public abstract class AsLogicalNode extends FFIUpCallNode.Arg1 {
4040

4141
@Specialization
4242
protected int asLogical(byte b) {
43-
return b;
43+
return RRuntime.isNA(b) ? RRuntime.INT_NA : b;
4444
}
4545

4646
@Specialization
4747
protected int asLogical(RAbstractLogicalVector obj) {
4848
if (obj.getLength() == 0) {
4949
return RRuntime.INT_NA;
5050
}
51-
return obj.getDataAt(0);
51+
byte result = obj.getDataAt(0);
52+
return RRuntime.isNA(result) ? RRuntime.INT_NA : result;
5253
}
5354

5455
@Specialization(guards = "obj.getLength() > 0")
5556
protected int asLogical(RAbstractAtomicVector obj,
5657
@Cached("createNonPreserving()") CastLogicalNode castLogicalNode) {
5758
Object castObj = castLogicalNode.doCast(obj);
59+
byte result;
5860
if (castObj instanceof Byte) {
59-
return (byte) castObj;
61+
result = (byte) castObj;
6062
} else if (castObj instanceof RAbstractLogicalVector) {
61-
return ((RAbstractLogicalVector) castObj).getDataAt(0);
63+
result = ((RAbstractLogicalVector) castObj).getDataAt(0);
6264
} else {
6365
throw RInternalError.shouldNotReachHere();
6466
}
67+
return RRuntime.isNA(result) ? RRuntime.INT_NA : result;
6568
}
6669

6770
@Fallback

com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/AsRealNode.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ protected double asReal(double obj) {
4949

5050
@Specialization
5151
protected double asReal(int obj) {
52-
return obj;
52+
return RRuntime.isNA(obj) ? RRuntime.DOUBLE_NA : obj;
5353
}
5454

5555
@Specialization
@@ -65,7 +65,8 @@ protected double asReal(RAbstractIntVector obj) {
6565
if (obj.getLength() == 0) {
6666
return RRuntime.DOUBLE_NA;
6767
}
68-
return obj.getDataAt(0);
68+
int result = obj.getDataAt(0);
69+
return RRuntime.isNA(result) ? RRuntime.DOUBLE_NA : result;
6970
}
7071

7172
@Specialization(guards = "obj.getLength() > 0")

com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/AttributesAccessNodes.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import com.oracle.truffle.r.nodes.attributes.GetAttributeNode;
4141
import com.oracle.truffle.r.nodes.attributes.GetAttributesNode;
4242
import com.oracle.truffle.r.nodes.attributes.SetAttributeNode;
43+
import com.oracle.truffle.r.nodes.attributes.SpecialAttributesFunctions.GetRowNamesAttributeNode;
4344
import com.oracle.truffle.r.nodes.function.opt.UpdateShareableChildValueNode;
4445
import com.oracle.truffle.r.nodes.unary.CastNode;
4546
import com.oracle.truffle.r.runtime.ArgumentsSignature;
@@ -106,7 +107,11 @@ public Object doAttributable(RAttributable obj,
106107
assert names.getLength() == list.getLength();
107108
for (int i = list.getLength() - 1; i >= 0; i--) {
108109
Object item = list.getDataAt(i);
109-
RSymbol symbol = RDataFactory.createSymbol(names.getDataAt(i));
110+
String name = names.getDataAt(i);
111+
if (name.equals(RRuntime.ROWNAMES_ATTR_KEY)) {
112+
item = GetRowNamesAttributeNode.ensureRowNamesCompactFormat(item);
113+
}
114+
RSymbol symbol = RDataFactory.createSymbol(name);
110115
result = RDataFactory.createPairList(item, result, symbol);
111116
}
112117
return result;
@@ -186,6 +191,9 @@ public Void doRAttributeStorage(RAttributeStorage x, RAttributeStorage y) {
186191
copyRegAttributes = insert(CopyOfRegAttributesNode.create());
187192
}
188193
copyRegAttributes.execute(x, y);
194+
if (x.isS4()) {
195+
y.setS4();
196+
}
189197
return null;
190198
}
191199

com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/MathFunctionsNodes.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
import com.oracle.truffle.r.runtime.data.model.RAbstractDoubleVector;
3939
import com.oracle.truffle.r.runtime.data.nodes.GetReadonlyData;
4040
import com.oracle.truffle.r.runtime.ffi.interop.UnsafeAdapter;
41-
import com.oracle.truffle.r.runtime.interop.ForeignArray2R;
41+
import com.oracle.truffle.r.runtime.interop.ConvertForeignObjectNode;
4242
import com.oracle.truffle.r.runtime.nmath.BesselFunctions;
4343
import com.oracle.truffle.r.runtime.nmath.Beta;
4444
import com.oracle.truffle.r.runtime.nmath.Choose;
@@ -695,7 +695,7 @@ abstract static class BesselExNode extends Node {
695695

696696
@Child private Node bIsPointerNode = Message.IS_POINTER.createNode();
697697
@Child private Node bAsPointerNode;
698-
@Child private ForeignArray2R bForeignArray2R;
698+
@Child private ConvertForeignObjectNode bConvertForeign;
699699

700700
public abstract double execute(BesselExCaller caller, Object b);
701701

@@ -717,11 +717,11 @@ protected double besselEx(BesselExCaller caller, Object b,
717717
throw RInternalError.shouldNotReachHere("IS_POINTER message returned true, AS_POINTER should not fail");
718718
}
719719
} else {
720-
if (bForeignArray2R == null) {
720+
if (bConvertForeign == null) {
721721
CompilerDirectives.transferToInterpreterAndInvalidate();
722-
bForeignArray2R = insert(ForeignArray2R.create());
722+
bConvertForeign = insert(ConvertForeignObjectNode.create());
723723
}
724-
bVec = (RAbstractDoubleVector) bForeignArray2R.convert(bTO);
724+
bVec = (RAbstractDoubleVector) bConvertForeign.convert(bTO);
725725
}
726726

727727
return caller.call(bReadonlyData.execute(bVec.materialize()));

0 commit comments

Comments
 (0)