Displaying 4 results from an estimated 4 matches for "c_peeksharedmemory".
2019 May 16
3
ALTREP: Bug reports
...0c0 [NAM(7)] wrapper
> [srt=-2147483648,no_na=0]
> @0x00000000156f4d18 14 REALSXP g0c0 [NAM(7)]
It seems like the object alt2 automatically gets wrapped by R. Although at
the R level it seems fine because there are no differences between alt1 and
alt2, if we define a C function as:
SEXP C_peekSharedMemory(SEXP x) {
> return(R_altrep_data1(x));
}
and call it in R to get the internal data structure of an ALTREP object.
C_peekSharedMemory(alt1)
> C_peekSharedMemory(alt2)
The first one correctly returns its internal data structure, but the second
one returns the ALTREP object it wraps since...
2019 May 16
3
ALTREP: Bug reports
...res in its
> "data1" part. There is no recursion/descent going on, and there shouldn't
> be.
This is might be a bug since in R release 3.6 it will return the ALTREP
instead of the data of the ALTREP. I'm not sure if it has been fixed in
3.7. Here is a simple example:
SEXP C_peekSharedMemory(SEXP x) {
> while (ALTREP(x)) {
> Rprintf("getting data 1\n");
> x = R_altrep_data1(x);
> }
> return(x);
> }
If calling R_altrep_data1 return the internal data directly, we will only
see one message. following my last example
> .Internal(inspect(so1))
> @0x00000...
2019 May 16
0
ALTREP: Bug reports
...rt. There is no recursion/descent going on, and there shouldn't
>> be.
>
>
> This is might be a bug since in R release 3.6 it will return the ALTREP
> instead of the data of the ALTREP. I'm not sure if it has been fixed in
> 3.7. Here is a simple example:
>
> SEXP C_peekSharedMemory(SEXP x) {
>> while (ALTREP(x)) {
>> Rprintf("getting data 1\n");
>> x = R_altrep_data1(x);
>> }
>> return(x);
>> }
>
>
> If calling R_altrep_data1 return the internal data directly, we will only
> see one message. following my last example
&...
2019 May 16
0
ALTREP: Bug reports
...differences between alt1 and
> alt2, if we define a C function as:
>
So I'm not sure what is happening here, because it depends on what your
createAltrep function does. R automatically creates wrappers in some cases
but not nearly all (or even very many currently) cases.
>
> SEXP C_peekSharedMemory(SEXP x) {
> > return(R_altrep_data1(x));
>
> }
>
>
> and call it in R to get the internal data structure of an ALTREP object.
>
> C_peekSharedMemory(alt1)
> > C_peekSharedMemory(alt2)
>
>
> The first one correctly returns its internal data structure, but th...