diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/common/JavaUpCallsRFFIImpl.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/common/JavaUpCallsRFFIImpl.java index ea88bb799a4ab6fd7e6421bf41fe4e0f16e841c6..560011c158ea0db24aa33c15d1d89c5896ee64a6 100644 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/common/JavaUpCallsRFFIImpl.java +++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/common/JavaUpCallsRFFIImpl.java @@ -71,6 +71,7 @@ import com.oracle.truffle.r.runtime.data.NativeDataAccess; import com.oracle.truffle.r.runtime.data.RArgsValuesAndNames; import com.oracle.truffle.r.runtime.data.RAttributable; import com.oracle.truffle.r.runtime.data.RAttributesLayout; +import com.oracle.truffle.r.runtime.data.RComplex; import com.oracle.truffle.r.runtime.data.RComplexVector; import com.oracle.truffle.r.runtime.data.RDataFactory; import com.oracle.truffle.r.runtime.data.RDoubleVector; @@ -84,6 +85,7 @@ import com.oracle.truffle.r.runtime.data.RLogicalVector; import com.oracle.truffle.r.runtime.data.RNull; import com.oracle.truffle.r.runtime.data.RObject; import com.oracle.truffle.r.runtime.data.RPromise; +import com.oracle.truffle.r.runtime.data.RRaw; import com.oracle.truffle.r.runtime.data.RPromise.EagerPromise; import com.oracle.truffle.r.runtime.data.RRawVector; import com.oracle.truffle.r.runtime.data.RShareable; @@ -140,6 +142,12 @@ public abstract class JavaUpCallsRFFIImpl implements UpCallsRFFI { } // Checkstyle: stop method name check + + @Override + public RComplexVector Rf_ScalarComplex(double real, double imag) { + return RDataFactory.createComplexVectorFromScalar(RComplex.valueOf(real, imag)); + } + @Override public RIntVector Rf_ScalarInteger(int value) { return RDataFactory.createIntVectorFromScalar(value); @@ -156,6 +164,11 @@ public abstract class JavaUpCallsRFFIImpl implements UpCallsRFFI { return RDataFactory.createLogicalVectorFromScalar(byteValue); } + @Override + public RRawVector Rf_ScalarRaw(int value) { + return RDataFactory.createRawVectorFromScalar(RRaw.valueOf((byte) value)); + } + @Override public RDoubleVector Rf_ScalarReal(double value) { return RDataFactory.createDoubleVectorFromScalar(value); @@ -465,7 +478,32 @@ public abstract class JavaUpCallsRFFIImpl implements UpCallsRFFI { RAbstractVector result = (RAbstractVector) Rf_allocVector(mode, n); setDims(newDims, result); return result; + } + @Override + @TruffleBoundary + public Object Rf_allocList(int length) { + Object result = RNull.instance; + for (int i = 0; i < length; i++) { + result = RDataFactory.createPairList(RNull.instance, result); + } + return result; + } + + @Override + @TruffleBoundary + public Object Rf_allocSExp(int mode) { + SEXPTYPE type = SEXPTYPE.mapInt(mode); + switch (type) { + case ENVSXP: + return RDataFactory.createNewEnv(null); + case LISTSXP: + return RDataFactory.createPairList(RNull.instance, RNull.instance); + case LANGSXP: + return RDataFactory.createPairList(1, type); + default: + throw unimplemented("unexpected SEXPTYPE " + type); + } } @TruffleBoundary diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/upcalls/StdUpCallsRFFI.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/upcalls/StdUpCallsRFFI.java index 51b0437fec1e9cdd1437a3ba530d751642b42a2b..b8f664b9b6e50ad60cb05a978ae072253efba5e7 100644 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/upcalls/StdUpCallsRFFI.java +++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/upcalls/StdUpCallsRFFI.java @@ -156,10 +156,14 @@ import com.oracle.truffle.r.runtime.nmath.distr.Wilcox; public interface StdUpCallsRFFI { // Checkstyle: stop method name check + Object Rf_ScalarComplex(double real, double imag); + Object Rf_ScalarInteger(int value); Object Rf_ScalarLogical(int value); + Object Rf_ScalarRaw(int value); + Object Rf_ScalarReal(double value); Object Rf_ScalarString(Object value); @@ -242,6 +246,12 @@ public interface StdUpCallsRFFI { @RFFIRunGC Object Rf_allocMatrix(int mode, int nrow, int ncol); + @RFFIRunGC + Object Rf_allocList(int length); + + @RFFIRunGC + Object Rf_allocSExp(int type); + int Rf_nrows(Object x); int Rf_ncols(Object x); diff --git a/com.oracle.truffle.r.native/fficall/src/common/rffi_upcalls.h b/com.oracle.truffle.r.native/fficall/src/common/rffi_upcalls.h index 68e849869fa823349b0484e9203867c86dbaf182..d6486680dd1e055b545cdaae3ac32d93658f4c58 100644 --- a/com.oracle.truffle.r.native/fficall/src/common/rffi_upcalls.h +++ b/com.oracle.truffle.r.native/fficall/src/common/rffi_upcalls.h @@ -30,10 +30,12 @@ extern __thread void* *callbacks; // This is the complete set , including those not yet implemented +typedef SEXP (*call_Rf_ScalarComplex)(double real, double imag); typedef SEXP (*call_Rf_ScalarInteger)(int value); +typedef SEXP (*call_Rf_ScalarLogical)(int value); +typedef SEXP (*call_Rf_ScalarRaw)(int value); typedef SEXP (*call_Rf_ScalarReal)(double value); typedef SEXP (*call_Rf_ScalarString)(SEXP value); -typedef SEXP (*call_Rf_ScalarLogical)(int value); typedef SEXP (*call_Rf_allocVector)(SEXPTYPE t, R_xlen_t len); typedef SEXP (*call_Rf_allocArray)(SEXPTYPE t, SEXP dims); typedef SEXP (*call_Rf_alloc3DArray)(SEXPTYPE t, int x, int y, int z); diff --git a/com.oracle.truffle.r.native/fficall/src/common/rffi_upcallsindex.h b/com.oracle.truffle.r.native/fficall/src/common/rffi_upcallsindex.h index 37624dd9b8f6bc7a1a4bc6b540e69bea3e9ffe99..ea67f4bf47ee9817f71105c9ffbe30dec929087d 100644 --- a/com.oracle.truffle.r.native/fficall/src/common/rffi_upcallsindex.h +++ b/com.oracle.truffle.r.native/fficall/src/common/rffi_upcallsindex.h @@ -123,233 +123,237 @@ #define Rf_NonNullStringMatch_x 94 #define Rf_PairToVectorList_x 95 #define Rf_PrintValue_x 96 -#define Rf_ScalarInteger_x 97 -#define Rf_ScalarLogical_x 98 -#define Rf_ScalarReal_x 99 -#define Rf_ScalarString_x 100 -#define Rf_VectorToPairList_x 101 -#define Rf_allocArray_x 102 -#define Rf_allocMatrix_x 103 -#define Rf_allocVector_x 104 -#define Rf_any_duplicated_x 105 -#define Rf_any_duplicated3_x 106 -#define Rf_asChar_x 107 -#define Rf_asCharacterFactor_x 108 -#define Rf_asInteger_x 109 -#define Rf_asLogical_x 110 -#define Rf_asReal_x 111 -#define Rf_bessel_i_x 112 -#define Rf_bessel_i_ex_x 113 -#define Rf_bessel_j_x 114 -#define Rf_bessel_j_ex_x 115 -#define Rf_bessel_k_x 116 -#define Rf_bessel_k_ex_x 117 -#define Rf_bessel_y_x 118 -#define Rf_bessel_y_ex_x 119 -#define Rf_beta_x 120 -#define Rf_choose_x 121 -#define Rf_classgets_x 122 -#define Rf_coerceVector_x 123 -#define Rf_cons_x 124 -#define Rf_copyListMatrix_x 125 -#define Rf_copyMatrix_x 126 -#define Rf_copyMostAttrib_x 127 -#define Rf_cospi_x 128 -#define Rf_dbeta_x 129 -#define Rf_dbinom_x 130 -#define Rf_dcauchy_x 131 -#define Rf_dchisq_x 132 -#define Rf_defineVar_x 133 -#define Rf_dexp_x 134 -#define Rf_df_x 135 -#define Rf_dgamma_x 136 -#define Rf_dgeom_x 137 -#define Rf_dhyper_x 138 -#define Rf_digamma_x 139 -#define Rf_dlnorm_x 140 -#define Rf_dlogis_x 141 -#define Rf_dnbeta_x 142 -#define Rf_dnbinom_x 143 -#define Rf_dnbinom_mu_x 144 -#define Rf_dnchisq_x 145 -#define Rf_dnf_x 146 -#define Rf_dnorm4_x 147 -#define Rf_dnt_x 148 -#define Rf_dpois_x 149 -#define Rf_dpsifn_x 150 -#define Rf_dsignrank_x 151 -#define Rf_dt_x 152 -#define Rf_dunif_x 153 -#define Rf_duplicate_x 154 -#define Rf_dweibull_x 155 -#define Rf_dwilcox_x 156 -#define Rf_error_x 157 -#define Rf_errorcall_x 158 -#define Rf_eval_x 159 -#define Rf_findFun_x 160 -#define Rf_findVar_x 161 -#define Rf_findVarInFrame_x 162 -#define Rf_findVarInFrame3_x 163 -#define Rf_fprec_x 164 -#define Rf_ftrunc_x 165 -#define Rf_gammafn_x 166 -#define Rf_getAttrib_x 167 -#define Rf_gsetVar_x 168 -#define Rf_inherits_x 169 -#define Rf_install_x 170 -#define Rf_installChar_x 171 -#define Rf_isNull_x 172 -#define Rf_isObject_x 173 -#define Rf_isString_x 174 -#define Rf_lbeta_x 175 -#define Rf_lchoose_x 176 -#define Rf_lengthgets_x 177 -#define Rf_lgamma1p_x 178 -#define Rf_lgammafn_x 179 -#define Rf_lgammafn_sign_x 180 -#define Rf_log1pexp_x 181 -#define Rf_log1pmx_x 182 -#define Rf_logspace_add_x 183 -#define Rf_logspace_sub_x 184 -#define Rf_match_x 185 -#define Rf_mkCharLenCE_x 186 -#define Rf_namesgets_x 187 -#define Rf_ncols_x 188 -#define Rf_nrows_x 189 -#define Rf_pbeta_x 190 -#define Rf_pbinom_x 191 -#define Rf_pcauchy_x 192 -#define Rf_pchisq_x 193 -#define Rf_pentagamma_x 194 -#define Rf_pexp_x 195 -#define Rf_pf_x 196 -#define Rf_pgamma_x 197 -#define Rf_pgeom_x 198 -#define Rf_phyper_x 199 -#define Rf_plnorm_x 200 -#define Rf_plogis_x 201 -#define Rf_pnbeta_x 202 -#define Rf_pnbinom_x 203 -#define Rf_pnbinom_mu_x 204 -#define Rf_pnchisq_x 205 -#define Rf_pnf_x 206 -#define Rf_pnorm5_x 207 -#define Rf_pnorm_both_x 208 -#define Rf_pnt_x 209 -#define Rf_ppois_x 210 -#define Rf_protect_x 211 -#define Rf_psigamma_x 212 -#define Rf_psignrank_x 213 -#define Rf_pt_x 214 -#define Rf_ptukey_x 215 -#define Rf_punif_x 216 -#define Rf_pweibull_x 217 -#define Rf_pwilcox_x 218 -#define Rf_qbeta_x 219 -#define Rf_qbinom_x 220 -#define Rf_qcauchy_x 221 -#define Rf_qchisq_x 222 -#define Rf_qexp_x 223 -#define Rf_qf_x 224 -#define Rf_qgamma_x 225 -#define Rf_qgeom_x 226 -#define Rf_qhyper_x 227 -#define Rf_qlnorm_x 228 -#define Rf_qlogis_x 229 -#define Rf_qnbeta_x 230 -#define Rf_qnbinom_x 231 -#define Rf_qnbinom_mu_x 232 -#define Rf_qnchisq_x 233 -#define Rf_qnf_x 234 -#define Rf_qnorm5_x 235 -#define Rf_qnt_x 236 -#define Rf_qpois_x 237 -#define Rf_qsignrank_x 238 -#define Rf_qt_x 239 -#define Rf_qtukey_x 240 -#define Rf_qunif_x 241 -#define Rf_qweibull_x 242 -#define Rf_qwilcox_x 243 -#define Rf_rbeta_x 244 -#define Rf_rbinom_x 245 -#define Rf_rcauchy_x 246 -#define Rf_rchisq_x 247 -#define Rf_rexp_x 248 -#define Rf_rf_x 249 -#define Rf_rgamma_x 250 -#define Rf_rgeom_x 251 -#define Rf_rhyper_x 252 -#define Rf_rlnorm_x 253 -#define Rf_rlogis_x 254 -#define Rf_rmultinom_x 255 -#define Rf_rnbinom_x 256 -#define Rf_rnbinom_mu_x 257 -#define Rf_rnchisq_x 258 -#define Rf_rnorm_x 259 -#define Rf_rpois_x 260 -#define Rf_rsignrank_x 261 -#define Rf_rt_x 262 -#define Rf_runif_x 263 -#define Rf_rweibull_x 264 -#define Rf_rwilcox_x 265 -#define Rf_setAttrib_x 266 -#define Rf_sign_x 267 -#define Rf_sinpi_x 268 -#define Rf_str2type_x 269 -#define Rf_tanpi_x 270 -#define Rf_tetragamma_x 271 -#define Rf_trigamma_x 272 -#define Rf_unprotect_x 273 -#define Rf_unprotect_ptr_x 274 -#define Rf_warning_x 275 -#define Rf_warningcall_x 276 -#define Rprintf_x 277 -#define SETCAD4R_x 278 -#define SETCADDDR_x 279 -#define SETCADDR_x 280 -#define SETCADR_x 281 -#define SETCAR_x 282 -#define SETCDR_x 283 -#define SETLENGTH_x 284 -#define SETLEVELS_x 285 -#define SET_ATTRIB_x 286 -#define SET_BODY_x 287 -#define SET_CLOENV_x 288 -#define SET_ENCLOS_x 289 -#define SET_FORMALS_x 290 -#define SET_NAMED_FASTR_x 291 -#define SET_OBJECT_x 292 -#define SET_RDEBUG_x 293 -#define SET_RSTEP_x 294 -#define SET_S4_OBJECT_x 295 -#define SET_STRING_ELT_x 296 -#define SET_SYMVALUE_x 297 -#define SET_TAG_x 298 -#define SET_TRUELENGTH_x 299 -#define SET_TYPEOF_x 300 -#define SET_VECTOR_ELT_x 301 -#define STRING_ELT_x 302 -#define SYMVALUE_x 303 -#define TAG_x 304 -#define TRUELENGTH_x 305 -#define TYPEOF_x 306 -#define UNSET_S4_OBJECT_x 307 -#define VECTOR_ELT_x 308 -#define forceSymbols_x 309 -#define getCCallable_x 310 -#define getConnectionClassString_x 311 -#define getEmbeddingDLLInfo_x 312 -#define getOpenModeString_x 313 -#define getSummaryDescription_x 314 -#define isSeekable_x 315 -#define octsize_x 316 -#define registerCCallable_x 317 -#define registerRoutines_x 318 -#define restoreHandlerStacks_x 319 -#define setDotSymbolValues_x 320 -#define unif_rand_x 321 -#define useDynamicSymbols_x 322 +#define Rf_ScalarComplex_x 97 +#define Rf_ScalarInteger_x 98 +#define Rf_ScalarLogical_x 99 +#define Rf_ScalarRaw_x 100 +#define Rf_ScalarReal_x 101 +#define Rf_ScalarString_x 102 +#define Rf_VectorToPairList_x 103 +#define Rf_allocArray_x 104 +#define Rf_allocList_x 105 +#define Rf_allocMatrix_x 106 +#define Rf_allocSExp_x 107 +#define Rf_allocVector_x 108 +#define Rf_any_duplicated_x 109 +#define Rf_any_duplicated3_x 110 +#define Rf_asChar_x 111 +#define Rf_asCharacterFactor_x 112 +#define Rf_asInteger_x 113 +#define Rf_asLogical_x 114 +#define Rf_asReal_x 115 +#define Rf_bessel_i_x 116 +#define Rf_bessel_i_ex_x 117 +#define Rf_bessel_j_x 118 +#define Rf_bessel_j_ex_x 119 +#define Rf_bessel_k_x 120 +#define Rf_bessel_k_ex_x 121 +#define Rf_bessel_y_x 122 +#define Rf_bessel_y_ex_x 123 +#define Rf_beta_x 124 +#define Rf_choose_x 125 +#define Rf_classgets_x 126 +#define Rf_coerceVector_x 127 +#define Rf_cons_x 128 +#define Rf_copyListMatrix_x 129 +#define Rf_copyMatrix_x 130 +#define Rf_copyMostAttrib_x 131 +#define Rf_cospi_x 132 +#define Rf_dbeta_x 133 +#define Rf_dbinom_x 134 +#define Rf_dcauchy_x 135 +#define Rf_dchisq_x 136 +#define Rf_defineVar_x 137 +#define Rf_dexp_x 138 +#define Rf_df_x 139 +#define Rf_dgamma_x 140 +#define Rf_dgeom_x 141 +#define Rf_dhyper_x 142 +#define Rf_digamma_x 143 +#define Rf_dlnorm_x 144 +#define Rf_dlogis_x 145 +#define Rf_dnbeta_x 146 +#define Rf_dnbinom_x 147 +#define Rf_dnbinom_mu_x 148 +#define Rf_dnchisq_x 149 +#define Rf_dnf_x 150 +#define Rf_dnorm4_x 151 +#define Rf_dnt_x 152 +#define Rf_dpois_x 153 +#define Rf_dpsifn_x 154 +#define Rf_dsignrank_x 155 +#define Rf_dt_x 156 +#define Rf_dunif_x 157 +#define Rf_duplicate_x 158 +#define Rf_dweibull_x 159 +#define Rf_dwilcox_x 160 +#define Rf_error_x 161 +#define Rf_errorcall_x 162 +#define Rf_eval_x 163 +#define Rf_findFun_x 164 +#define Rf_findVar_x 165 +#define Rf_findVarInFrame_x 166 +#define Rf_findVarInFrame3_x 167 +#define Rf_fprec_x 168 +#define Rf_ftrunc_x 169 +#define Rf_gammafn_x 170 +#define Rf_getAttrib_x 171 +#define Rf_gsetVar_x 172 +#define Rf_inherits_x 173 +#define Rf_install_x 174 +#define Rf_installChar_x 175 +#define Rf_isNull_x 176 +#define Rf_isObject_x 177 +#define Rf_isString_x 178 +#define Rf_lbeta_x 179 +#define Rf_lchoose_x 180 +#define Rf_lengthgets_x 181 +#define Rf_lgamma1p_x 182 +#define Rf_lgammafn_x 183 +#define Rf_lgammafn_sign_x 184 +#define Rf_log1pexp_x 185 +#define Rf_log1pmx_x 186 +#define Rf_logspace_add_x 187 +#define Rf_logspace_sub_x 188 +#define Rf_match_x 189 +#define Rf_mkCharLenCE_x 190 +#define Rf_namesgets_x 191 +#define Rf_ncols_x 192 +#define Rf_nrows_x 193 +#define Rf_pbeta_x 194 +#define Rf_pbinom_x 195 +#define Rf_pcauchy_x 196 +#define Rf_pchisq_x 197 +#define Rf_pentagamma_x 198 +#define Rf_pexp_x 199 +#define Rf_pf_x 200 +#define Rf_pgamma_x 201 +#define Rf_pgeom_x 202 +#define Rf_phyper_x 203 +#define Rf_plnorm_x 204 +#define Rf_plogis_x 205 +#define Rf_pnbeta_x 206 +#define Rf_pnbinom_x 207 +#define Rf_pnbinom_mu_x 208 +#define Rf_pnchisq_x 209 +#define Rf_pnf_x 210 +#define Rf_pnorm5_x 211 +#define Rf_pnorm_both_x 212 +#define Rf_pnt_x 213 +#define Rf_ppois_x 214 +#define Rf_protect_x 215 +#define Rf_psigamma_x 216 +#define Rf_psignrank_x 217 +#define Rf_pt_x 218 +#define Rf_ptukey_x 219 +#define Rf_punif_x 220 +#define Rf_pweibull_x 221 +#define Rf_pwilcox_x 222 +#define Rf_qbeta_x 223 +#define Rf_qbinom_x 224 +#define Rf_qcauchy_x 225 +#define Rf_qchisq_x 226 +#define Rf_qexp_x 227 +#define Rf_qf_x 228 +#define Rf_qgamma_x 229 +#define Rf_qgeom_x 230 +#define Rf_qhyper_x 231 +#define Rf_qlnorm_x 232 +#define Rf_qlogis_x 233 +#define Rf_qnbeta_x 234 +#define Rf_qnbinom_x 235 +#define Rf_qnbinom_mu_x 236 +#define Rf_qnchisq_x 237 +#define Rf_qnf_x 238 +#define Rf_qnorm5_x 239 +#define Rf_qnt_x 240 +#define Rf_qpois_x 241 +#define Rf_qsignrank_x 242 +#define Rf_qt_x 243 +#define Rf_qtukey_x 244 +#define Rf_qunif_x 245 +#define Rf_qweibull_x 246 +#define Rf_qwilcox_x 247 +#define Rf_rbeta_x 248 +#define Rf_rbinom_x 249 +#define Rf_rcauchy_x 250 +#define Rf_rchisq_x 251 +#define Rf_rexp_x 252 +#define Rf_rf_x 253 +#define Rf_rgamma_x 254 +#define Rf_rgeom_x 255 +#define Rf_rhyper_x 256 +#define Rf_rlnorm_x 257 +#define Rf_rlogis_x 258 +#define Rf_rmultinom_x 259 +#define Rf_rnbinom_x 260 +#define Rf_rnbinom_mu_x 261 +#define Rf_rnchisq_x 262 +#define Rf_rnorm_x 263 +#define Rf_rpois_x 264 +#define Rf_rsignrank_x 265 +#define Rf_rt_x 266 +#define Rf_runif_x 267 +#define Rf_rweibull_x 268 +#define Rf_rwilcox_x 269 +#define Rf_setAttrib_x 270 +#define Rf_sign_x 271 +#define Rf_sinpi_x 272 +#define Rf_str2type_x 273 +#define Rf_tanpi_x 274 +#define Rf_tetragamma_x 275 +#define Rf_trigamma_x 276 +#define Rf_unprotect_x 277 +#define Rf_unprotect_ptr_x 278 +#define Rf_warning_x 279 +#define Rf_warningcall_x 280 +#define Rprintf_x 281 +#define SETCAD4R_x 282 +#define SETCADDDR_x 283 +#define SETCADDR_x 284 +#define SETCADR_x 285 +#define SETCAR_x 286 +#define SETCDR_x 287 +#define SETLENGTH_x 288 +#define SETLEVELS_x 289 +#define SET_ATTRIB_x 290 +#define SET_BODY_x 291 +#define SET_CLOENV_x 292 +#define SET_ENCLOS_x 293 +#define SET_FORMALS_x 294 +#define SET_NAMED_FASTR_x 295 +#define SET_OBJECT_x 296 +#define SET_RDEBUG_x 297 +#define SET_RSTEP_x 298 +#define SET_S4_OBJECT_x 299 +#define SET_STRING_ELT_x 300 +#define SET_SYMVALUE_x 301 +#define SET_TAG_x 302 +#define SET_TRUELENGTH_x 303 +#define SET_TYPEOF_x 304 +#define SET_VECTOR_ELT_x 305 +#define STRING_ELT_x 306 +#define SYMVALUE_x 307 +#define TAG_x 308 +#define TRUELENGTH_x 309 +#define TYPEOF_x 310 +#define UNSET_S4_OBJECT_x 311 +#define VECTOR_ELT_x 312 +#define forceSymbols_x 313 +#define getCCallable_x 314 +#define getConnectionClassString_x 315 +#define getEmbeddingDLLInfo_x 316 +#define getOpenModeString_x 317 +#define getSummaryDescription_x 318 +#define isSeekable_x 319 +#define octsize_x 320 +#define registerCCallable_x 321 +#define registerRoutines_x 322 +#define restoreHandlerStacks_x 323 +#define setDotSymbolValues_x 324 +#define unif_rand_x 325 +#define useDynamicSymbols_x 326 -#define UPCALLS_TABLE_SIZE 323 +#define UPCALLS_TABLE_SIZE 327 #endif // RFFI_UPCALLSINDEX_H diff --git a/com.oracle.truffle.r.native/fficall/src/common/rffi_variablesindex.h b/com.oracle.truffle.r.native/fficall/src/common/rffi_variablesindex.h index 6ff33e79e5d32294052d4e943af37760aecb8141..dc6cc94ac6ec57c25a2511f883e31342564135dc 100644 --- a/com.oracle.truffle.r.native/fficall/src/common/rffi_variablesindex.h +++ b/com.oracle.truffle.r.native/fficall/src/common/rffi_variablesindex.h @@ -74,16 +74,19 @@ #define R_NegInf_x 46 #define R_NaReal_x 47 #define R_NaInt_x 48 -#define R_BlankString_x 49 -#define R_BlankScalarString_x 50 -#define R_BaseSymbol_x 51 -#define R_NamespaceEnvSymbol_x 52 -#define R_RestartToken_x 53 -#define R_SortListSymbol_x 54 -#define R_SpecSymbol_x 55 -#define R_TripleColonSymbol_x 56 -#define R_PreviousSymbol_x 57 +#define R_TrueValue_x 49 +#define R_FalseValue_x 50 +#define R_LogicalNAValue_x 51 +#define R_BlankString_x 52 +#define R_BlankScalarString_x 53 +#define R_BaseSymbol_x 54 +#define R_NamespaceEnvSymbol_x 55 +#define R_RestartToken_x 56 +#define R_SortListSymbol_x 57 +#define R_SpecSymbol_x 58 +#define R_TripleColonSymbol_x 59 +#define R_PreviousSymbol_x 60 -#define VARIABLES_TABLE_SIZE 58 +#define VARIABLES_TABLE_SIZE 61 #endif // RFFI_VARIABLESINDEX_H diff --git a/com.oracle.truffle.r.native/fficall/src/truffle_common/Rinternals_truffle_common.h b/com.oracle.truffle.r.native/fficall/src/truffle_common/Rinternals_truffle_common.h index 4252927b7b55bb9ae1b2e0453a004b964a0e9e95..1b03bf85389f81dd0c37edc48b76b8d5222559b7 100644 --- a/com.oracle.truffle.r.native/fficall/src/truffle_common/Rinternals_truffle_common.h +++ b/com.oracle.truffle.r.native/fficall/src/truffle_common/Rinternals_truffle_common.h @@ -144,13 +144,6 @@ int LENGTH(SEXP x) { return result; } -SEXP Rf_ScalarString(SEXP value) { - TRACE1(value); - SEXP result = ((call_Rf_ScalarString) callbacks[Rf_ScalarString_x])(value); - checkExitCall(); - return result; -} - SEXP Rf_mkString(const char *s) { TRACE0(); return ScalarString(Rf_mkChar(s)); @@ -300,6 +293,13 @@ void REvprintf(const char *format, va_list args) { UNIMPLEMENTED; } +SEXP Rf_ScalarComplex(Rcomplex value) { + TRACE0(); + SEXP result = ((call_Rf_ScalarComplex) callbacks[Rf_ScalarComplex_x])(value.r, value.i); + checkExitCall(); + return result; +} + SEXP Rf_ScalarInteger(int value) { TRACE0(); SEXP result = ((call_Rf_ScalarInteger) callbacks[Rf_ScalarInteger_x])(value); @@ -307,6 +307,20 @@ SEXP Rf_ScalarInteger(int value) { return result; } +SEXP Rf_ScalarLogical(int value) { + TRACE0(); + SEXP result = ((call_Rf_ScalarLogical) callbacks[Rf_ScalarLogical_x])(value); + checkExitCall(); + return result; +} + +SEXP Rf_ScalarRaw(Rbyte value) { + TRACE0(); + SEXP result = ((call_Rf_ScalarRaw) callbacks[Rf_ScalarRaw_x])(value); + checkExitCall(); + return result; +} + SEXP Rf_ScalarReal(double value) { TRACE0(); SEXP result = ((call_Rf_ScalarReal) callbacks[Rf_ScalarReal_x])(value); @@ -314,9 +328,9 @@ SEXP Rf_ScalarReal(double value) { return result; } -SEXP Rf_ScalarLogical(int value) { - TRACE0(); - SEXP result = ((call_Rf_ScalarLogical) callbacks[Rf_ScalarLogical_x])(value); +SEXP Rf_ScalarString(SEXP value) { + TRACE1(value); + SEXP result = ((call_Rf_ScalarString) callbacks[Rf_ScalarString_x])(value); checkExitCall(); return result; } @@ -350,14 +364,18 @@ SEXP Rf_allocMatrix(SEXPTYPE mode, int nrow, int ncol) { return result; } -SEXP Rf_allocList(int x) { +SEXP Rf_allocList(int length) { TRACE0(); - return UNIMPLEMENTED; + SEXP result = ((call_Rf_allocList) callbacks[Rf_allocList_x])(length); + checkExitCall(); + return result; } SEXP Rf_allocSExp(SEXPTYPE t) { TRACE0(); - return UNIMPLEMENTED; + SEXP result = ((call_Rf_allocSExp) callbacks[Rf_allocSExp_x])(t); + checkExitCall(); + return result; } void Rf_defineVar(SEXP symbol, SEXP value, SEXP rho) { diff --git a/com.oracle.truffle.r.native/fficall/src/truffle_common/variables_common.h b/com.oracle.truffle.r.native/fficall/src/truffle_common/variables_common.h index 66cfe800230eb27b13a28e9b561f309ce7a2194a..f30097de226e059964cedf9b7ffab3a7eb570ad8 100644 --- a/com.oracle.truffle.r.native/fficall/src/truffle_common/variables_common.h +++ b/com.oracle.truffle.r.native/fficall/src/truffle_common/variables_common.h @@ -102,6 +102,9 @@ double R_PosInf; double R_NegInf; double R_NaReal; int R_NaInt; +SEXP R_TrueValue; +SEXP R_FalseValue; +SEXP R_LogicalNAValue; SEXP R_BlankString; SEXP R_BlankScalarString; SEXP R_BaseSymbol; /* "base" */ @@ -187,6 +190,9 @@ void Call_initvar_obj_common(int index, void* value) { case R_SrcrefSymbol_x: R_SrcrefSymbol = value; break; case R_SrcfileSymbol_x: R_SrcfileSymbol = value; break; case R_NaString_x: R_NaString = value; break; + case R_TrueValue_x: R_TrueValue = value; break; + case R_FalseValue_x: R_FalseValue = value; break; + case R_LogicalNAValue_x: R_LogicalNAValue = value; break; case R_BlankString_x: R_BlankString = value; break; case R_BlankScalarString_x: R_BlankScalarString = value; break; case R_BaseSymbol_x: R_BaseSymbol = value; break; diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AsVector.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AsVector.java index 4a03881ca6309d7ad3de0b2c1c42af1bf2b41d23..bfafef9b2994b2da85401568e313c6d0008ecd56 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AsVector.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AsVector.java @@ -284,9 +284,9 @@ public abstract class AsVector extends RBuiltinNode.Arg2 { } @Fallback + @TruffleBoundary protected Object castPairlist(Object x) { - String name = x instanceof RTypedValue ? ((RTypedValue) x).getRType().getName() : x.getClass().getSimpleName(); - throw error(Message.CANNOT_COERCE, name, RType.PairList.getName()); + throw error(Message.CANNOT_COERCE, RRuntime.getRTypeName(x), RType.PairList.getName()); } @TruffleBoundary diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/DuplicatedFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/DuplicatedFunctions.java index 72241c43e5f262fab618a0efefa7b816bdcdc1da..b6b9c9d509bcc0cb769c2b4814d181b332b7a08d 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/DuplicatedFunctions.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/DuplicatedFunctions.java @@ -35,12 +35,12 @@ import com.oracle.truffle.r.nodes.binary.CastTypeNodeGen; import com.oracle.truffle.r.nodes.builtin.RBuiltinNode; import com.oracle.truffle.r.nodes.unary.TypeofNode; import com.oracle.truffle.r.runtime.RError; +import com.oracle.truffle.r.runtime.RError.Message; import com.oracle.truffle.r.runtime.RRuntime; import com.oracle.truffle.r.runtime.RType; import com.oracle.truffle.r.runtime.builtins.RBuiltin; import com.oracle.truffle.r.runtime.data.RDataFactory; import com.oracle.truffle.r.runtime.data.RLogicalVector; -import com.oracle.truffle.r.runtime.data.RTypedValue; import com.oracle.truffle.r.runtime.data.model.RAbstractLogicalVector; import com.oracle.truffle.r.runtime.data.model.RAbstractVector; import com.oracle.truffle.r.runtime.nodes.DuplicationHelper; @@ -107,12 +107,10 @@ public class DuplicatedFunctions { @SuppressWarnings("unused") @Specialization(guards = {"!isRAbstractVector(incomparables)", "x.getLength() != 0"}) + @TruffleBoundary protected RLogicalVector duplicatedTrueIncomparables(RAbstractVector x, Object incomparables, byte fromLast, int nmax, @Cached("createTypeof()") TypeofNode typeof) { - RType xType = typeof.execute(x); - // TODO: this is not quite correct, as passing expression generated some obscure error - // message, but is it worth fixing - throw error(RError.Message.CANNOT_COERCE, ((RTypedValue) incomparables).getRType().getName(), xType.getName()); + throw error(Message.CANNOT_COERCE, RRuntime.getRTypeName(incomparables), RRuntime.getRTypeName(x)); } @SuppressWarnings("unused") @@ -165,9 +163,8 @@ public class DuplicatedFunctions { @Specialization(guards = {"!isRAbstractVector(incomparables)", "x.getLength() != 0"}) @TruffleBoundary protected int anyDuplicatedTrueIncomparables(RAbstractVector x, Object incomparables, @SuppressWarnings("unused") byte fromLast) { - // TODO: this is not quite correct, as passing expression generated some obscure error - // message, but is it worth fixing - throw error(RError.Message.CANNOT_COERCE, TypeofNode.getTypeof(incomparables).getName(), TypeofNode.getTypeof(x).getName()); + // this is not quite correct, as passing expression generates some obscure error message + throw error(Message.CANNOT_COERCE, RRuntime.getRTypeName(incomparables), RRuntime.getRTypeName(x)); } @SuppressWarnings("unused") diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastBaseNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastBaseNode.java index deff01be84efd6b48203cf340a384fa44fa328b9..2e74d0bb7758b3bfec75a63332ad089f90283648 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastBaseNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastBaseNode.java @@ -25,7 +25,6 @@ package com.oracle.truffle.r.nodes.unary; import com.oracle.truffle.api.CompilerDirectives; import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; import com.oracle.truffle.api.dsl.Fallback; -import com.oracle.truffle.api.interop.TruffleObject; import com.oracle.truffle.api.profiles.BranchProfile; import com.oracle.truffle.api.profiles.ConditionProfile; import com.oracle.truffle.api.profiles.ValueProfile; @@ -36,7 +35,6 @@ import com.oracle.truffle.r.runtime.NullProfile; import com.oracle.truffle.r.runtime.RError; import com.oracle.truffle.r.runtime.RError.ErrorContext; import com.oracle.truffle.r.runtime.RError.Message; -import com.oracle.truffle.r.runtime.RInternalError; import com.oracle.truffle.r.runtime.RRuntime; import com.oracle.truffle.r.runtime.RType; import com.oracle.truffle.r.runtime.data.RDataFactory.VectorFactory; @@ -46,7 +44,6 @@ import com.oracle.truffle.r.runtime.data.RStringVector; import com.oracle.truffle.r.runtime.data.RTypedValue; import com.oracle.truffle.r.runtime.data.model.RAbstractContainer; import com.oracle.truffle.r.runtime.data.model.RAbstractVector; -import com.oracle.truffle.r.runtime.env.REnvironment; public abstract class CastBaseNode extends CastNode { @@ -182,27 +179,14 @@ public abstract class CastBaseNode extends CastNode { @TruffleBoundary protected Object doOther(Object value) { Object mappedValue = RRuntime.asAbstractVector(value); - return forRFFI ? doOtherRFFI(mappedValue) : doOtherDefault(mappedValue); - } - - protected Object doOtherDefault(Object mappedValue) { - if (mappedValue instanceof REnvironment) { - throw error(RError.Message.ENVIRONMENTS_COERCE); - } else if (mappedValue instanceof RTypedValue) { - throw error(RError.Message.CANNOT_COERCE, ((RTypedValue) mappedValue).getRType().getName(), getTargetType().getName()); - } else if (mappedValue instanceof TruffleObject) { - throw error(RError.Message.CANNOT_COERCE, "truffleobject", getTargetType().getName()); - } else { - throw RInternalError.shouldNotReachHere("unexpected value of type " + (mappedValue == null ? "null" : mappedValue.getClass())); + if (forRFFI && mappedValue instanceof RTypedValue) { + return doOtherRFFI(mappedValue); } + throw error(Message.CANNOT_COERCE, RRuntime.getRTypeName(mappedValue), getTargetType().getName()); } protected Object doOtherRFFI(Object mappedValue) { - if (mappedValue instanceof RTypedValue) { - warning(Message.CANNOT_COERCE_RFFI, ((RTypedValue) mappedValue).getRType().getName(), getTargetType().getName()); - } else if (mappedValue instanceof TruffleObject) { - throw error(RError.Message.CANNOT_COERCE, "truffleobject", getTargetType().getName()); - } + warning(Message.CANNOT_COERCE_RFFI, ((RTypedValue) mappedValue).getRType().getName(), getTargetType().getName()); return RNull.instance; } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/ToStringNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/ToStringNode.java index baa12172fa4a3b549440f2a53d35f6c459e13283..03921521b5e1801f027d64446e78de340f0bd18f 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/ToStringNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/ToStringNode.java @@ -27,10 +27,12 @@ import java.util.EnumMap; import com.oracle.truffle.api.CompilerDirectives; import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; import com.oracle.truffle.api.dsl.Cached; +import com.oracle.truffle.api.dsl.Fallback; import com.oracle.truffle.api.dsl.Specialization; import com.oracle.truffle.api.dsl.TypeSystemReference; import com.oracle.truffle.api.profiles.ConditionProfile; import com.oracle.truffle.r.nodes.function.ClassHierarchyNode; +import com.oracle.truffle.r.runtime.RError.Message; import com.oracle.truffle.r.runtime.RInternalError; import com.oracle.truffle.r.runtime.RRuntime; import com.oracle.truffle.r.runtime.RType; @@ -197,4 +199,10 @@ public abstract class ToStringNode extends RBaseNode { protected String toString(REnvironment env, String separator) { return env.toString(); } + + @Fallback + @TruffleBoundary + protected String toStringFallback(Object value, @SuppressWarnings("unused") String separator) { + throw error(Message.CANNOT_COERCE, RRuntime.getRTypeName(value), RType.Character.getName()); + } } diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ParserGeneration.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ParserGeneration.java index 23c7fa48bf1646a7e7f5bb910b889dff911c1282..a6a6e6655cf77887ec7526520e3d16b917e592c8 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ParserGeneration.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ParserGeneration.java @@ -101,5 +101,6 @@ public class ParserGeneration { ":: and ::: do not set argument names", "refactored: use file for interactive single-line source", "create lookups for field accesses where appropriate", + "allow unicode escape literals with {...}", }; } diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/R.g b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/R.g index 61e8a5979459880f5870305cacd415521c1f05a9..3a1d809d79729a74d9104b75de081ed13a2399cc 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/R.g +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/R.g @@ -789,6 +789,8 @@ fragment ESCAPE [StringBuilder buf] | 'x' a = HEX_DIGIT b = HEX_DIGIT { buf.append(hexChar($a.text, $b.text)); } | 'u' a = HEX_DIGIT b = HEX_DIGIT? c = HEX_DIGIT? d = HEX_DIGIT? { buf.append(hexChar($a.text, $b.text, $c.text, $d.text)); } | 'U' a = HEX_DIGIT b = HEX_DIGIT? c = HEX_DIGIT? d = HEX_DIGIT? e = HEX_DIGIT? f = HEX_DIGIT? g = HEX_DIGIT? h = HEX_DIGIT? { buf.append(hexChar($a.text, $b.text, $c.text, $d.text, $e.text, $f.text, $g.text, $h.text)); } + | 'u' '{' a = HEX_DIGIT b = HEX_DIGIT? c = HEX_DIGIT? d = HEX_DIGIT? '}' { buf.append(hexChar($a.text, $b.text, $c.text, $d.text)); } + | 'U' '{' a = HEX_DIGIT b = HEX_DIGIT? c = HEX_DIGIT? d = HEX_DIGIT? '}' { buf.append(hexChar($a.text, $b.text, $c.text, $d.text)); } ) ; diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/env/RScope.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/env/RScope.java index 151036939bf39da37b0cb2c0158a3a2d4d377e46..80c9abdbe4cc06a5aad396f7a48e12d5d545f556 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/env/RScope.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/env/RScope.java @@ -38,7 +38,6 @@ import com.oracle.truffle.api.interop.Resolve; import com.oracle.truffle.api.interop.TruffleObject; import com.oracle.truffle.api.interop.UnknownIdentifierException; import com.oracle.truffle.api.interop.UnsupportedMessageException; -import com.oracle.truffle.api.interop.UnsupportedTypeException; import com.oracle.truffle.api.nodes.Node; import com.oracle.truffle.r.runtime.ArgumentsSignature; import com.oracle.truffle.r.runtime.RArguments; @@ -46,7 +45,6 @@ import com.oracle.truffle.r.runtime.RInternalError; import com.oracle.truffle.r.runtime.context.RContext; import com.oracle.truffle.r.runtime.data.RFunction; import com.oracle.truffle.r.runtime.data.RStringVector; -import com.oracle.truffle.r.runtime.data.RTypedValue; import com.oracle.truffle.r.runtime.env.REnvironment.PutException; import com.oracle.truffle.r.runtime.env.frame.REnvFrameAccess; import com.oracle.truffle.r.runtime.env.frame.REnvTruffleFrameAccess; @@ -274,9 +272,6 @@ public final class RScope { if (varMap.frameAccess == null) { throw UnsupportedMessageException.raise(Message.WRITE); } - if (!(value instanceof RTypedValue)) { - throw UnsupportedTypeException.raise(new Object[]{value}); - } try { varMap.frameAccess.put(name, value); return value; diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/RFFIVariables.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/RFFIVariables.java index ed972ee45090f95076518b30f1787e249388aabb..a3957e47cc6b71de034c780a19bcea943a42df31 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/RFFIVariables.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/RFFIVariables.java @@ -86,6 +86,9 @@ public enum RFFIVariables { R_NegInf(Double.NEGATIVE_INFINITY), R_NaReal(RRuntime.DOUBLE_NA), R_NaInt(RRuntime.INT_NA), + R_TrueValue(RDataFactory.getPermanent().createLogicalVectorFromScalar(RRuntime.LOGICAL_TRUE)), + R_FalseValue(RDataFactory.getPermanent().createLogicalVectorFromScalar(RRuntime.LOGICAL_FALSE)), + R_LogicalNAValue(RDataFactory.getPermanent().createLogicalVectorFromScalar(RRuntime.LOGICAL_NA)), R_BlankString(CharSXPWrapper.create("")), R_BlankScalarString(RDataFactory.createStringVectorFromScalar("")), R_BaseSymbol(RDataFactory.createSymbol("base")), diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test index 4a61db00c5abe5a412be53699051d7d8ba0886b9..fd8870115834e8e6c40dab38fe2de518a4b15e0d 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test @@ -16787,7 +16787,7 @@ logical(0) #{ complex(3) } [1] 0+0i 0+0i 0+0i -##com.oracle.truffle.r.test.builtins.TestBuiltin_complex.testComplex# +##com.oracle.truffle.r.test.builtins.TestBuiltin_complex.testComplex#Output.IgnoreErrorMessage# #{ complex(3, 3, new.env()) } Error in complex(3, 3, new.env()) : environments cannot be coerced to other types @@ -16804,7 +16804,7 @@ Error in complex(3, 3, new.env()) : #{ complex(3, c(1,2,3), c(4,5,6)) } [1] 1+4i 2+5i 3+6i -##com.oracle.truffle.r.test.builtins.TestBuiltin_complex.testComplex# +##com.oracle.truffle.r.test.builtins.TestBuiltin_complex.testComplex#Output.IgnoreErrorMessage# #{ complex(3, new.env()) } Error in complex(3, new.env()) : environments cannot be coerced to other types @@ -31361,7 +31361,7 @@ raw(0) Error in intToBits(list(c(5, 5, 7, 8), 88, 6L)) : (list) object cannot be coerced to type 'integer' -##com.oracle.truffle.r.test.builtins.TestBuiltin_intToBits.testintToBits# +##com.oracle.truffle.r.test.builtins.TestBuiltin_intToBits.testintToBits#Output.IgnoreErrorMessage# #intToBits(new.env()) Error in intToBits(new.env()) : environments cannot be coerced to other types @@ -146388,9 +146388,9 @@ Error in as.character(to) : no method for coercing this polyglot value to a vector ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testAsXXX# -#if (!any(R.version$engine == "FastR")) { cat('Error in as.complex(to) :', '<<<NEWLINE>>>', ' cannot coerce type \'truffleobject\' to vector of type \'complex\'', '<<<NEWLINE>>>') } else { to <- .fastr.interop.new(java.type('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'));as.complex(to); } +#if (!any(R.version$engine == "FastR")) { cat('Error in as.complex(to) :', '<<<NEWLINE>>>', ' cannot coerce type \'polyglot.value\' to vector of type \'complex\'', '<<<NEWLINE>>>') } else { to <- .fastr.interop.new(java.type('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'));as.complex(to); } Error in as.complex(to) : - cannot coerce type 'truffleobject' to vector of type 'complex' + cannot coerce type 'polyglot.value' to vector of type 'complex' ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testAsXXX# #if (!any(R.version$engine == "FastR")) { cat('Error in as.double(to) :', '<<<NEWLINE>>>', ' no method for coercing this polyglot value to a vector', '<<<NEWLINE>>>') } else { to <- .fastr.interop.new(java.type('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'));as.double(to); } @@ -146413,9 +146413,9 @@ Error in as.logical(to) : no method for coercing this polyglot value to a vector ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testAsXXX# -#if (!any(R.version$engine == "FastR")) { cat('Error in as.raw(to) :', '<<<NEWLINE>>>', ' cannot coerce type \'truffleobject\' to vector of type \'raw\'', '<<<NEWLINE>>>') } else { to <- .fastr.interop.new(java.type('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'));as.raw(to); } +#if (!any(R.version$engine == "FastR")) { cat('Error in as.raw(to) :', '<<<NEWLINE>>>', ' cannot coerce type \'polyglot.value\' to vector of type \'raw\'', '<<<NEWLINE>>>') } else { to <- .fastr.interop.new(java.type('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'));as.raw(to); } Error in as.raw(to) : - cannot coerce type 'truffleobject' to vector of type 'raw' + cannot coerce type 'polyglot.value' to vector of type 'raw' ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testAsXXX# #if (!any(R.version$engine == "FastR")) { cat('Error in as.symbol(to) :', '<<<NEWLINE>>>', ' no method for coercing this polyglot value to a vector', '<<<NEWLINE>>>') } else { to <- .fastr.interop.new(java.type('com.oracle.truffle.r.test.library.fastr.TestJavaInterop$TestClass'));as.symbol(to); } @@ -171254,6 +171254,14 @@ see '?methods' for accessing help and source code "","double","bool","raw" "1",1231231234.5,TRUE,2a +##com.oracle.truffle.r.test.parser.TestParser.testBraceUnicodeLiterals# +#"\u{23}\u{9}\u{723}\u{1234}\U{23}\U{9}\U{723}\U{1234}" +[1] "#\tܣሴ#\tܣሴ" + +##com.oracle.truffle.r.test.parser.TestParser.testBraceUnicodeLiterals# +#'\u{23}\u{9}\u{723}\u{1234}\U{23}\U{9}\U{723}\U{1234}' +[1] "#\tܣሴ#\tܣሴ" + ##com.oracle.truffle.r.test.parser.TestParser.testDotIdentifiers# #{ .. <- 42; cat(..); } 42 diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_complex.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_complex.java index 5068d1ad6f99480eb197aa4690a9194bb4927338..46f448f1f67056fcf6846a6ca1b864daacef7f97 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_complex.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_complex.java @@ -68,8 +68,8 @@ public class TestBuiltin_complex extends TestBase { assertEval("{ complex(real=1,imag=2) }"); assertEval("{ complex(3) }"); assertEval(Output.IgnoreErrorMessage, "{ complex(new.env()) }"); - assertEval("{ complex(3, new.env()) }"); - assertEval("{ complex(3, 3, new.env()) }"); + assertEval(Output.IgnoreErrorMessage, "{ complex(3, new.env()) }"); + assertEval(Output.IgnoreErrorMessage, "{ complex(3, 3, new.env()) }"); assertEval("{ complex(3, c(1,2,3), c(4,5,6)) }"); assertEval("{ complex(3, c(1,2,3), c(4,5)) }"); assertEval("{ complex(3, c(1,2), c(4,5,6)) }"); diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_intToBits.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_intToBits.java index 0a87483ae829dfb8136772449067ad0062a48b12..7685cd1f7b01f51cef6f2caf6af557c5b78ef9b1 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_intToBits.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_intToBits.java @@ -56,7 +56,7 @@ public class TestBuiltin_intToBits extends TestBase { assertEval("intToBits(double(0))"); assertEval("intToBits(6:9)"); assertEval("intToBits('23rrff')"); - assertEval("intToBits(new.env())"); + assertEval(Output.IgnoreErrorMessage, "intToBits(new.env())"); assertEval("intToBits(environment)"); assertEval("intToBits(stdout())"); assertEval("intToBits(list(c(5,5,7,8),88,6L))"); diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/fastr/TestJavaInterop.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/fastr/TestJavaInterop.java index 0c765ee621c368083deeabf0850b649487d3586a..0c7cbb906542ba4c1d198ad67bb894c7e08e2539 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/fastr/TestJavaInterop.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/fastr/TestJavaInterop.java @@ -1057,7 +1057,7 @@ public class TestJavaInterop extends TestBase { if (asXXX.equals("as.expression")) { assertEvalFastR(Output.IgnoreErrorContext, CREATE_TRUFFLE_OBJECT + asXXX + "(to);", errorIn(asXXX + "(to)", "no method for coercing this polyglot value to a vector")); } else if (asXXX.equals("as.raw") || asXXX.equals("as.complex")) { - assertEvalFastR(CREATE_TRUFFLE_OBJECT + asXXX + "(to);", errorIn(asXXX + "(to)", "cannot coerce type 'truffleobject' to vector of type '" + type + "'")); + assertEvalFastR(CREATE_TRUFFLE_OBJECT + asXXX + "(to);", errorIn(asXXX + "(to)", "cannot coerce type 'polyglot.value' to vector of type '" + type + "'")); } else { assertEvalFastR(CREATE_TRUFFLE_OBJECT + asXXX + "(to);", errorIn(asXXX + "(to)", "no method for coercing this polyglot value to a vector")); } diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/parser/TestParser.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/parser/TestParser.java index 524a536573ef01a382a04cfdaf7dc8113d0472a7..e02819ca63aa3437b6f97bed908e6a58f661b2b1 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/parser/TestParser.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/parser/TestParser.java @@ -61,6 +61,12 @@ public class TestParser extends TestBase { assertEval("0xa.bp1i"); } + @Test + public void testBraceUnicodeLiterals() { + assertEval("\"\\u{23}\\u{9}\\u{723}\\u{1234}\\U{23}\\U{9}\\U{723}\\U{1234}\""); + assertEval("'\\u{23}\\u{9}\\u{723}\\u{1234}\\U{23}\\U{9}\\U{723}\\U{1234}'"); + } + private static final String[] HEX_VALUES = new String[]{"0xFFF", "0xFFFFFFFFFFF"}; @Test