search for: r_ppstacksize

Displaying 7 results from an estimated 7 matches for "r_ppstacksize".

2009 Nov 18
2
Unnecesary code?
Dear R-ers, While browsing the R sources, I found the following piece of code in src\main\memory.c: static void reset_pp_stack(void *data) { R_size_t *poldpps = data; R_PPStackSize = *poldpps; } To me, it looks like the poldpps pointer is a nuissance; can't you just cast the data pointer and derefer it at once? Say, static void reset_pp_stack(void *data) { R_PPStackSize = * (R_size_t *) data; } -- Hun
2019 May 19
4
most robust way to call R API functions from a secondary thread
...s use memory which was allocated in fun_running_in_main_thread() using e.g. R_alloc(). Best regards, Andreas Kersting #include <Rinternals.h> #include <pthread.h> #include <signal.h> #include <stdint.h> extern uintptr_t R_CStackLimit; extern int R_PPStackTop; extern int R_PPStackSize; #include <R_ext/libextern.h> LibExtern Rboolean R_interrupts_suspended; LibExtern int R_interrupts_pending; extern void Rf_onintr(void); // mutex for exclusive access to the R API: static pthread_mutex_t r_api_mutex = PTHREAD_MUTEX_INITIALIZER; // a wrapper arround R_CheckUserInterrupt()...
2008 Feb 23
0
patch: two minor debugging-related pointer protection stack issues (PR#10832)
...========================= --- trunk/src/main/memory.c (revision 44589) +++ trunk/src/main/memory.c (working copy) @@ -1557,7 +1557,7 @@ R_Suicide("couldn't allocate memory for pointer stack"); R_PPStackTop = 0; #if VALGRIND_LEVEL > 1 - VALGRIND_MAKE_NOACCESS(R_PPStackTop+R_PPStackSize,PP_REDZONE_SIZE); + VALGRIND_MAKE_NOACCESS(R_PPStack+R_PPStackSize,PP_REDZONE_SIZE); #endif vsfac = sizeof(VECREC); R_VSize = (((R_VSize + 1)/ vsfac)); @@ -2329,11 +2329,11 @@ } while ( R_PPStack[--i] != s ); /* OK, got it, and i is indexing its location */ - /* Now d...
2019 May 20
1
most robust way to call R API functions from a secondary thread
...R_alloc(). >> Best regards, >> Andreas Kersting >> #include <Rinternals.h> >> #include <pthread.h> >> #include <signal.h> >> #include <stdint.h> >> extern uintptr_t R_CStackLimit; >> extern int R_PPStackTop; >> extern int R_PPStackSize; >> #include <R_ext/libextern.h> >> LibExtern Rboolean R_interrupts_suspended; >> LibExtern int R_interrupts_pending; >> extern void Rf_onintr(void); >> // mutex for exclusive access to the R API: >> static pthread_mutex_t r_api_mutex = PTHREAD_MUTEX_INITIA...
2010 Aug 23
1
Speed improvement to PROTECT, UNPROTECT, etc.
...ne the macros to handled to the common case inline, and call the function in memory.c for the uncommon cases (eg, error on stack underflow). Here are my versions that do this: #define PROTECT(s) do { \ SEXP tmp_prot_sexp = (s); \ if (R_PPStackTop < R_PPStackSize) \ R_PPStack[R_PPStackTop++] = tmp_prot_sexp; \ else \ Rf_protect(tmp_prot_sexp); \ } while (0) #define UNPROTECT(n) (R_PPStackTop >= (n) ? \ (void) (R_PPStackTop -= (n)) : Rf...
2019 May 20
0
[External] most robust way to call R API functions from a secondary thread
...using e.g. R_alloc(). > > Best regards, > Andreas Kersting > > > > #include <Rinternals.h> > #include <pthread.h> > #include <signal.h> > #include <stdint.h> > > extern uintptr_t R_CStackLimit; > extern int R_PPStackTop; > extern int R_PPStackSize; > > #include <R_ext/libextern.h> > LibExtern Rboolean R_interrupts_suspended; > LibExtern int R_interrupts_pending; > extern void Rf_onintr(void); > > // mutex for exclusive access to the R API: > static pthread_mutex_t r_api_mutex = PTHREAD_MUTEX_INITIALIZER; > &g...
2019 May 20
0
most robust way to call R API functions from a secondary thread
...e.g. R_alloc(). > > Best regards, > Andreas Kersting > > > > #include <Rinternals.h> > #include <pthread.h> > #include <signal.h> > #include <stdint.h> > > extern uintptr_t R_CStackLimit; > extern int R_PPStackTop; > extern int R_PPStackSize; > > #include <R_ext/libextern.h> > LibExtern Rboolean R_interrupts_suspended; > LibExtern int R_interrupts_pending; > extern void Rf_onintr(void); > > // mutex for exclusive access to the R API: > static pthread_mutex_t r_api_mutex = PTHREAD_MUTEX_INITIALIZER; >...