Skip to content

Commit

Permalink
Merge commit 'c04b36087767a5b26d0b84bce40feaa2bb4b416b' into release/…
Browse files Browse the repository at this point in the history
…graal-vm/1.0
  • Loading branch information
ansalond committed Apr 4, 2019
2 parents 7479476 + c04b360 commit 1e21572
Show file tree
Hide file tree
Showing 198 changed files with 19,989 additions and 3,124 deletions.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -147,3 +147,12 @@ documentation/.pydevproject
com.oracle.truffle.r.native/gnur/patch-build
com.oracle.truffle.r.test.native/embedded/embedded.actual.output
com.oracle.truffle.r.test.native/embedded/main.actual.output
f2c
test.fastr
test.gnur
test.diffs
install.tmp.fastr
install.tmp.gnur
lib.install.packages.fastr
lib.install.packages.gnur
/com.oracle.truffle.r.release/doc/
17,798 changes: 15,691 additions & 2,107 deletions 3rd_party_licenses.txt

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
# 1.0 RC 15

* `ActiveBinding` objects do not support the `UNBOX` message anymore
* new Truffle interop converts `double` values to `int` values if they fit in the integer range
* see the changes in the [spec tests](https://github.com/oracle/fastr/commit/e08e2b19571479dddb6167d9a1d492a14cb4c7b2#diff-c842fa11097793b19bd410589c36af99)

Added missing R builtins and C APIa

* simple support for the weak reference API functions (`R_MakeWeakRef`, `R_MakeWeakRefC`, `R_WeakRefKey`, `R_WeakRefValue`)
* `Rf_i1mach`
* `gzcon` builtin for `url` connections, e.g., `load(url('protocol://path'))` should work now
* `Sys.localeconv` supports: `decimal_point`, `thousands_sep`, `grouping`, `int_curr_symbol`, `currency_symbol`, `mon_decimal_point`,
`mon_thousands_sep`, `mon_grouping`, `int_frac_digits`, `p_cs_precedes`, other fields are fixed to some meaningful but not culture
sensitive value for given field

Bug fixes:

* `rep.int` with value argument of length 0 just returns the value argument
* `tcrossprod` called from `apply` did not give correct result #60
* `Rf_lengthgets` can accept `NULL` argument
* FastR does not allow Java interop when not started with `--jvm`

# 1.0 RC 14

* all FastR specific options (NOT those GNU-R compatible like `--save`) are experimental except for `--R.PrintErrorStacktracesToFile`,
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This is a release of GraalVM Community Edition 1.0 R Language Component. This
particular copy of the software is released under version 3 of GNU General
Public License.

Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved
Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved

===========================================================================

Expand Down
2 changes: 2 additions & 0 deletions ci.hocon
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,6 @@ builds = [
${internalPkgtest} {capabilities : [linux, amd64], targets : [gate], name: "gate-internal-pkgtest-linux-amd64"}
${gateTestJava9Linux} {capabilities : [linux, amd64, fast], targets : [gate], name: "gate-test-java9-linux-amd64"}
# ${gnurTests} {capabilities : [linux, amd64, fast], targets : [gate], name: "gate-gnur-tests"}

${coverageLinux} {capabilities : [linux, amd64], targets : [weekly], name: "coverage-r-linux-amd64"}
]
23 changes: 17 additions & 6 deletions ci_common/common.hocon
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ logfiles : [

environmentLinux: {
environment : {
PKG_INCLUDE_FLAGS_OVERRIDE : "-I/cm/shared/apps/zlib/1.2.11/include -I/cm/shared/apps/bzip2/1.0.6/include -I/cm/shared/apps/xz/5.2.2/include -I/cm/shared/apps/pcre/8.38/include -I/cm/shared/apps/curl/7.50.1/include"
PKG_LDFLAGS_OVERRIDE : "-L/cm/shared/apps/zlib/1.2.11/lib -L/cm/shared/apps/bzip2/1.0.6/lib -L/cm/shared/apps/xz/5.2.2/lib -L/cm/shared/apps/pcre/8.38/lib -L/cm/shared/apps/curl/7.50.1/lib -L/cm/shared/apps/gcc/4.9.1/lib64"
PKG_INCLUDE_FLAGS_OVERRIDE : "-I/cm/shared/apps/zlib/1.2.11/include -I/cm/shared/apps/bzip2/1.0.6/include -I/cm/shared/apps/xz/5.2.2/include -I/cm/shared/apps/pcre/8.42/include -I/cm/shared/apps/curl/7.50.1/include"
PKG_LDFLAGS_OVERRIDE : "-L/cm/shared/apps/zlib/1.2.11/lib -L/cm/shared/apps/bzip2/1.0.6/lib -L/cm/shared/apps/xz/5.2.2/lib -L/cm/shared/apps/pcre/8.42/lib -L/cm/shared/apps/curl/7.50.1/lib -L/cm/shared/apps/gcc/4.9.1/lib64"
TZDIR: "/usr/share/zoneinfo"
}
}
Expand All @@ -84,7 +84,7 @@ packagesLinux : {
"pip:ninja_syntax" : "==1.7.2"
make : ">=3.83"
gcc-build-essentials : "==4.9.1" # TODO: upgrade to 4.9.2
pcre : ">=8.38"
pcre : "==8.42"
zlib : "==1.2.11"
# these are needed to build GNU-R
readline : "==6.3"
Expand All @@ -96,7 +96,7 @@ packagesDarwin : {
"pip:astroid" : "==1.1.0"
"pip:pylint" : "==1.1.0"
"pip:ninja_syntax" : "==1.7.2"
"pcre" : "==8.38"
"pcre" : "==8.42"
"homebrew/gcc" : "==4.9"
}

Expand Down Expand Up @@ -141,9 +141,9 @@ gateTestLinux : ${gateTestCommon} ${commonLinux}

gateTestDarwin : ${gateTestCommon} ${commonDarwin} {
setup : [
[set-export, PKG_INCLUDE_FLAGS_OVERRIDE, "-I/cm/shared/apps/pcre/8.38/include -I/cm/shared/apps/bzip2/1.0.6/include -I/cm/shared/apps/xz/5.2.2/include -I/cm/shared/apps/curl/7.50.1/include"]
[set-export, PKG_INCLUDE_FLAGS_OVERRIDE, "-I/cm/shared/apps/pcre/8.42/include -I/cm/shared/apps/bzip2/1.0.6/include -I/cm/shared/apps/xz/5.2.2/include -I/cm/shared/apps/curl/7.50.1/include"]
[set-export, MOD_LIB_PATH, [echo, "${LD_LIBRARY_PATH}", |, tr, "\:", "\\n", |, grep, lib/gcc, |, tail, "-1"]]
[set-export, PKG_LDFLAGS_OVERRIDE, "-L/cm/shared/apps/bzip2/1.0.6/lib -L/cm/shared/apps/xz/5.2.2/lib -L/cm/shared/apps/pcre/8.38/lib -L/cm/shared/apps/curl/7.50.1/lib -L${MOD_LIB_PATH} -L/usr/lib"]
[set-export, PKG_LDFLAGS_OVERRIDE, "-L/cm/shared/apps/bzip2/1.0.6/lib -L/cm/shared/apps/xz/5.2.2/lib -L/cm/shared/apps/pcre/8.42/lib -L/cm/shared/apps/curl/7.50.1/lib -L${MOD_LIB_PATH} -L/usr/lib"]
]
}

Expand Down Expand Up @@ -258,3 +258,14 @@ gnurTests: ${commonLinux} {
["mx", "gnu-rtests"]
]
}


coverageLinux : ${commonLinux} {
run : [
// cannot run with excluded "GeneratedBy" since that would lead to "command line too long"
// ["mx", "--jacoco-whitelist-package", "com.oracle.truffle.r", "--jacoco-exclude-annotation", "@GeneratedBy", "--strict-compliance", "rgate", "-B=--force-deprecation-as-warning", "--strict-mode", "-t", "Versions,JDKReleaseInfo,BuildJavaWithJavac,UnitTests: no specials,UnitTests: with specials,Rembedded", "--jacocout", "html"],
// ["mx", "--jacoco-whitelist-package", "com.oracle.truffle.r", "--jacoco-exclude-annotation", "@GeneratedBy", "sonarqube-upload", "-Dsonar.host.url=$SONAR_HOST_URL", "-Dsonar.projectKey=com.oracle.graalvm.r", "-Dsonar.projectName=GraalVM - R", "--exclude-generated"]
["mx", "--jacoco-whitelist-package", "com.oracle.truffle.r", "--strict-compliance", "rgate", "-B=--force-deprecation-as-warning", "--strict-mode", "-t", "Versions,JDKReleaseInfo,BuildJavaWithJavac,UnitTests: no specials,UnitTests: with specials,Rembedded", "--jacocout", "html"],
["mx", "--jacoco-whitelist-package", "com.oracle.truffle.r", "sonarqube-upload", "-Dsonar.host.url=$SONAR_HOST_URL", "-Dsonar.projectKey=com.oracle.graalvm.r", "-Dsonar.projectName=GraalVM - R", "--exclude-generated"]
]
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ private static void printValue(RContext ctx, MaterializedFrame callingFrame, Obj
if (result == null) {
str = "[polyglot value (null)]";
} else if (result instanceof CharSequence) {
str = "[1] \"" + String.valueOf(result) + "\"";
str = "[1] \"" + result + "\"";
} else {
str = String.valueOf(result);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,24 @@
package com.oracle.truffle.r.engine;

import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.spi.FileTypeDetector;
import java.nio.charset.Charset;
import com.oracle.truffle.api.TruffleFile;

import com.oracle.truffle.r.runtime.RRuntime;

public final class RFileTypeDetector extends FileTypeDetector {
public final class RFileTypeDetector implements TruffleFile.FileTypeDetector {

@Override
public String probeContentType(Path path) throws IOException {
Path fileNamePath = path.getFileName();
if (fileNamePath != null) {
String fileName = fileNamePath.toString();
if (fileName.endsWith(".R") || fileName.endsWith(".r")) {
return RRuntime.R_TEXT_MIME;
}
public String findMimeType(TruffleFile file) throws IOException {
String fileName = file.getName();
if (fileName != null && (fileName.endsWith(".R") || fileName.endsWith(".r"))) {
return RRuntime.R_TEXT_MIME;
}
return null;
}

@Override
public Charset findEncoding(TruffleFile file) throws IOException {
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@
import com.oracle.truffle.r.nodes.builtin.base.printer.DoubleVectorPrinter;
import com.oracle.truffle.r.nodes.builtin.helpers.DebugHandling;
import com.oracle.truffle.r.nodes.builtin.helpers.TraceHandling;
import com.oracle.truffle.r.nodes.control.AbstractBlockNode;
import com.oracle.truffle.r.nodes.control.AbstractLoopNode;
import com.oracle.truffle.r.nodes.control.BlockNode;
import com.oracle.truffle.r.nodes.control.BlockNode.HugeBlockRootNode;
import com.oracle.truffle.r.nodes.control.IfNode;
import com.oracle.truffle.r.nodes.control.ReplacementDispatchNode;
import com.oracle.truffle.r.nodes.function.ClassHierarchyNode;
Expand Down Expand Up @@ -281,28 +282,29 @@ public boolean isTaggedWith(Node node, Class<?> tag) {
return node instanceof RCallNode;
}
if (tag == FunctionBodyBlockTag.class) {
return node instanceof BlockNode && ((BlockNode) node).unwrapParent() instanceof RootBodyNode;
return node instanceof AbstractBlockNode && ((AbstractBlockNode) node).unwrapParent() instanceof RootBodyNode;
}
if (tag == LoopTag.class) {
return node instanceof AbstractLoopNode;
}
if (tag == StatementTag.class) {
if (node instanceof BlockNode) {
if (node instanceof AbstractBlockNode) {
// so that the stepping location is not the block itself, but the first statement in
// the block, note that the FastR's own debugging and tracing mechanism uses
// FunctionBodyBlockTag to recognize function bodies.
return false;
}
// How to recognize statement from some node inside a statement (e.g. expression)?
Node parent = ((RInstrumentableNode) node).unwrapParent();
if (parent instanceof BlockNode) {
if (parent instanceof AbstractBlockNode) {
// It's in a block of statements
return true;
} else {
// single statement block: as function body, if/else body, loop body
// note: RepeatingNode is not a RSyntaxElement but the body of a loop is
// under the repeating node !
return parent instanceof RootBodyNode || parent instanceof IfNode || AbstractLoopNode.isLoopBody(node) || EngineRootNode.isEngineBody(parent);
return parent instanceof RootBodyNode || parent instanceof IfNode || AbstractLoopNode.isLoopBody(node) ||
EngineRootNode.isEngineBody(parent) || parent instanceof HugeBlockRootNode;
}
}
// TODO: ExpressionTag: (!statement && !loop && !if && !call && !root)??
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
import com.oracle.truffle.r.runtime.context.RContext;
import com.oracle.truffle.r.runtime.context.TruffleRLanguage;
import com.oracle.truffle.r.runtime.data.RFunction;
import com.oracle.truffle.r.runtime.data.RInteropScalar.RInteropNA;
import com.oracle.truffle.r.runtime.data.RPromise;
import com.oracle.truffle.r.runtime.data.RTypedValue;
import com.oracle.truffle.r.runtime.env.REnvironment;
Expand All @@ -69,7 +70,7 @@
import com.oracle.truffle.r.runtime.nodes.RBaseNode;
import org.graalvm.options.OptionDescriptors;

@TruffleLanguage.Registration(name = "R", id = "R", version = "3.5.1", mimeType = {RRuntime.R_APP_MIME, RRuntime.R_TEXT_MIME}, interactive = true)
@TruffleLanguage.Registration(name = "R", id = "R", version = "3.5.1", mimeType = {RRuntime.R_APP_MIME, RRuntime.R_TEXT_MIME}, interactive = true, fileTypeDetectors = RFileTypeDetector.class)
@ProvidedTags({StandardTags.CallTag.class, StandardTags.StatementTag.class, StandardTags.RootTag.class, RSyntaxTags.LoopTag.class, FunctionBodyBlockTag.class})
public final class TruffleRLanguageImpl extends TruffleRLanguage {

Expand Down Expand Up @@ -140,6 +141,21 @@ protected void disposeContext(RContext context) {

@Override
protected String toString(RContext context, Object value) {
// primitive values are never produced by FastR so we don't print them as R vectors
if (value instanceof Boolean) {
// boolean constants are capitalized like in R
return (boolean) value ? "TRUE" : "FALSE";
}
if (value instanceof Number || value instanceof String || value instanceof Character) {
return value.toString();
}

// special class designated to exchange NA values with the outside world
// this value is a scalar, the only way to get it is via getArrayMember on an R vector
if (value instanceof RInteropNA) {
return "NA";
}

// the debugger also passes result of TruffleRLanguage.findMetaObject() to this method
Object unwrapped = value;
// print promises by other means than the "print" function to avoid evaluating them
Expand All @@ -155,8 +171,11 @@ protected String toString(RContext context, Object value) {
if (RMissingHelper.isMissing(unwrapped)) {
return "missing";
}
Object asVector = RRuntime.asAbstractVector(unwrapped);
if (!(asVector instanceof TruffleObject)) {

// the value unwrapped from an RPromise can be primitive Java type, but now we know that we
// are dealing with primitive that is supposed to be treated as R vector
unwrapped = RRuntime.asAbstractVector(unwrapped);
if (!(unwrapped instanceof TruffleObject)) {
throw RError.error(RError.NO_CALLER, Message.GENERIC, String.format("Printing value of type '%s' is not supported by the R language.", unwrapped.getClass().getSimpleName()));
}
Object printObj = REnvironment.baseEnv(context).get("print");
Expand All @@ -171,9 +190,9 @@ protected String toString(RContext context, Object value) {
try {
StringBuilder buffer = new StringBuilder();
stateStdConnections.setBuffer(buffer);
RContext.getEngine().evalFunction((RFunction) printObj, callingFrame, RCaller.topLevel, false, ArgumentsSignature.empty(1), asVector);
RContext.getEngine().evalFunction((RFunction) printObj, callingFrame, RCaller.topLevel, false, ArgumentsSignature.empty(1), unwrapped);
// remove the last "\n", which is useful for REPL, but not here
if (buffer.charAt(buffer.length() - 1) == '\n') {
if (buffer.length() > 0 && buffer.charAt(buffer.length() - 1) == '\n') {
buffer.setLength(buffer.length() - 1);
}
return buffer.toString();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -34,15 +34,7 @@ public class ActiveBindingMR {
@Resolve(message = "IS_BOXED")
public abstract static class ActiveBindingIsBoxedNode extends Node {
protected Object access(@SuppressWarnings("unused") ActiveBinding receiver) {
return true;
}
}

@Resolve(message = "UNBOX")
public abstract static class ActiveBindingUnboxNode extends Node {

protected Object access(ActiveBinding receiver) {
return receiver.readValue();
return false;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ public Object execute(VirtualFrame frame) {
}

public static final Supplier<RootNode> CHECK_FACTORY = new CheckFactory();
public static final ForeignAccess ACCESS = ForeignAccess.createAccess(new RAbstractVectorAccessFactory(), RAbstractVectorAccessFactory.CHECK_FACTORY);

private static final class CheckFactory implements Supplier<RootNode> {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
*/
package com.oracle.truffle.r.engine.interop;

import com.oracle.truffle.api.CompilerAsserts;
import com.oracle.truffle.api.interop.ForeignAccess;
import com.oracle.truffle.r.ffi.impl.interop.FFI_RForeignAccessFactoryImpl;
import com.oracle.truffle.r.runtime.RInternalError;
Expand Down Expand Up @@ -71,7 +70,6 @@ public final class RForeignAccessFactoryImpl implements RForeignAccessFactory {

@Override
public ForeignAccess getForeignAccess(RTruffleObject obj) {
CompilerAsserts.neverPartOfCompilation("getForeignAccess");
if (obj instanceof RNull) {
return RNullMRForeign.ACCESS;
} else if (obj instanceof RList) {
Expand Down Expand Up @@ -121,7 +119,7 @@ public ForeignAccess getForeignAccess(RTruffleObject obj) {
} else if (obj instanceof RInteropNA) {
return RInteropNAMRForeign.ACCESS;
} else if (obj instanceof RAbstractAtomicVector) {
return ForeignAccess.createAccess(new RAbstractVectorAccessFactory(), RAbstractVectorAccessFactory.CHECK_FACTORY);
return RAbstractVectorAccessFactory.ACCESS;
} else {
ForeignAccess access = FFI_RForeignAccessFactoryImpl.getForeignAccess(obj);
if (access != null) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -23,6 +23,7 @@
package com.oracle.truffle.r.ffi.codegen;

import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;

Expand All @@ -47,19 +48,20 @@ private void run(String[] args) {
out.append("#ifndef RFFI_UPCALLSINDEX_H\n");
out.append("#define RFFI_UPCALLSINDEX_H\n");
out.append('\n');
Method[] methods = UpCallsRFFI.class.getMethods();
Arrays.sort(methods, new Comparator<Method>() {
ArrayList<Method> methods = new ArrayList<>(Arrays.asList(UpCallsRFFI.class.getMethods()));
methods.removeAll(Arrays.asList(UpCallsRFFI.class.getDeclaredMethods()));
methods.sort(new Comparator<Method>() {
@Override
public int compare(Method e1, Method e2) {
return e1.getName().toString().compareTo(e2.getName().toString());
}
});
for (int i = 0; i < methods.length; i++) {
Method method = methods[i];
for (int i = 0; i < methods.size(); i++) {
Method method = methods.get(i);
out.append("#define ").append(method.getName()).append("_x ").append(Integer.toString(i)).append('\n');
}
out.append('\n');
out.append("#define ").append("UPCALLS_TABLE_SIZE ").append(Integer.toString(methods.length)).append('\n');
out.append("#define ").append("UPCALLS_TABLE_SIZE ").append(Integer.toString(methods.size())).append('\n');
out.append('\n');
out.append("#endif // RFFI_UPCALLSINDEX_H\n");
}
Expand Down
Loading

0 comments on commit 1e21572

Please sign in to comment.