diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/CoerceNodes.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/CoerceNodes.java index bc51d6d45c3eb4590ec0f85ec40df30d74dd49af..b3007b211c50f7552ebd8bfab8cf3bd583b09458 100644 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/CoerceNodes.java +++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/CoerceNodes.java @@ -51,6 +51,7 @@ import com.oracle.truffle.r.runtime.data.RNull; import com.oracle.truffle.r.runtime.data.RPairList; import com.oracle.truffle.r.runtime.data.RShareable; import com.oracle.truffle.r.runtime.data.RStringVector; +import com.oracle.truffle.r.runtime.data.RSymbol; import com.oracle.truffle.r.runtime.data.RTypedValue; import com.oracle.truffle.r.runtime.data.model.RAbstractIntVector; import com.oracle.truffle.r.runtime.data.model.RAbstractVector; @@ -75,7 +76,7 @@ public final class CoerceNodes { for (int i = 0; i < v.getLength(); i++) { Object element = v.getDataAtAsObject(i); adjustSharing(v, element); - RPairList cur = RDataFactory.createPairList(element, RNull.instance, names != null ? names.getDataAt(i) : RNull.instance, gnurType); + RPairList cur = RDataFactory.createPairList(element, RNull.instance, names != null ? RDataFactory.createSymbol(names.getDataAt(i)) : RNull.instance, gnurType); if (prev == null) { assert head == null; diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RArgsValuesAndNames.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RArgsValuesAndNames.java index fee0ee0e9f4f3d1ec84ad3b192ca03f0bdf94f8d..f0182160856b72173b12e5dd533ec35f7ad2f186 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RArgsValuesAndNames.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RArgsValuesAndNames.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2018, 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 @@ -108,7 +108,7 @@ public final class RArgsValuesAndNames extends RObject implements RTypedValue { assert signature.getLength() == getLength(); for (int i = 0; i < getLength(); i++) { String name = signature.getName(i); - RPairList cur = RDataFactory.createPairList(getArgument(i), RNull.instance, name != null ? name : RNull.instance, SEXPTYPE.DOTSXP); + RPairList cur = RDataFactory.createPairList(getArgument(i), RNull.instance, name != null ? RDataFactory.createSymbol(name) : RNull.instance, SEXPTYPE.DOTSXP); if (head == null) { head = cur; diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RPairList.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RPairList.java index 8ba6f70a6a9a78a99fd0fcf5609becef434cf1af..b729095f5df82ea0face701e2c98ccf540b0eb45 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RPairList.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RPairList.java @@ -45,7 +45,13 @@ import com.oracle.truffle.r.runtime.gnur.SEXPTYPE; * {@code null} is never allowed as a value for the tag, car or cdr, only the type. */ public final class RPairList extends RSharingAttributeStorage implements RAbstractContainer, Iterable<RPairList> { + /** + * Data of the current pair list cell. + */ private Object car = RNull.instance; + /** + * Link to the next {@link RPairList} cell or {@link RNull} if last. + */ private Object cdr = RNull.instance; /** * Externally, i.e., when serialized, this is either a SYMSXP ({@link RSymbol}) or an @@ -336,9 +342,7 @@ public final class RPairList extends RSharingAttributeStorage implements RAbstra int i = 0; while (true) { data[i] = Utils.toString(pl.tag); - if (pl.tag == RRuntime.STRING_NA) { - complete = false; - } + complete &= data[i] != RRuntime.STRING_NA; if (isNull(pl.cdr)) { break; } @@ -353,7 +357,7 @@ public final class RPairList extends RSharingAttributeStorage implements RAbstra Object p = this; for (int i = 0; i < newNames.getLength() && !isNull(p); i++) { RPairList pList = (RPairList) p; - pList.tag = newNames.getDataAt(i); + pList.tag = RDataFactory.createSymbol(newNames.getDataAt(i)); p = pList.cdr; } }