Displaying 7 results from an estimated 7 matches for "begincontext".
2009 Mar 03
1
profiler and loops
...uot;%s\" ",
TYPEOF(fun) == SYMSXP ? CHAR(PRINTNAME(fun)) :
"<Anonymous>");
}
}
so we can see it only cares about context CTXT_FUNCTION and
CTXT_BUILTIN, when for loops play with CTXT_LOOP (this is again in
eval.c within the do_for function)
begincontext(&cntxt, CTXT_LOOP, R_NilValue, rho, R_BaseEnv, R_NilValue,
R_NilValue);
which as the name implies, begins the context of the for loop. The
begincontext function looks like this :
void begincontext(RCNTXT * cptr, int flags,
SEXP syscall, SEXP env, SEXP sysp,
SEXP pr...
2009 Jun 16
1
calling handlers within R_tryEval
Hello,
When using R_tryEval (from JRI in my case), is there a way to setup
error recovery strategy and more generally calling handlers.
From my reading of context.c, R_tryEval calls R_ToplevelExec which
creates a context like this:
begincontext(&thiscontext, CTXT_TOPLEVEL, R_NilValue, R_GlobalEnv,
R_BaseEnv, R_NilValue, R_NilValue);
so I guess what I am trying to do is add "cend" and/or "handlerstack" to
this context. Is this possible ? Are there examples of packages doing this ?
Romain
--
Romain Fran...
2011 Nov 11
1
When collected warnings exceeds 50
...624 on ubuntu linux. Running the following under valgrind:
R -d valgrind
> options(warn=0)
> for (i in 1:51) factor(1,levels=c(1,1) # duplicate level warningcall
and you should see "Invalid read" messages. I've narrowed it down to
vwarningcall_dflt starting a new R context via begincontext() but
returning early without calling endcontext() in errors.c:
svn diff src/main/errors.c
Index: src/main/errors.c
===================================================================
--- src/main/errors.c (revision 57624)
+++ src/main/errors.c (working copy)
@@ -333,8 +333,11 @@
char *tr; int...
2024 Apr 25
1
Big speedup in install.packages() by re-using connections
...nel);
+}
+static CURLM *get_mhnd(void)
+{
+ if (!mhnd_sentinel) {
+ SEXP sentinel = PROTECT(R_MakeExternalPtr(NULL, R_NilValue, R_NilValue));
+ R_PreserveObject(sentinel);
+ UNPROTECT(1);
+ // Avoid leaking the sentinel before setting the finalizer
+ RCNTXT cntxt;
+ begincontext(&cntxt, CTXT_CCODE, R_NilValue, R_BaseEnv, R_BaseEnv,
+ R_NilValue, R_NilValue);
+ cntxt.cend = &rollback_mhnd_sentinel;
+ cntxt.cenddata = sentinel;
+ R_RegisterCFinalizerEx(sentinel, cleanup_mhnd, TRUE);
+ // Succeeded, no need to clean up if endconte...
2000 Nov 07
0
error handling
...ut is seems cludgy and I don't know the
POTENTIAL PROBLEMS that might be introduced. It involves setting up a
context and forcing R_GlobalContext's nextcontext to 0, as in the following
(by the way, this same approach doesn't work in the example above, which is
why I set up a context):
begincontext(&thiscontext, 0, CTXT_GENERIC, R_NilValue, R_NilValue,
R_NilValue);
R_GlobalContext->nextcontext = 0;
if (!SETJMP(thiscontext.cjmpbuf))
R_CurrentExpr = eval(R_CurrentExpr , rho);
endcontext(&thiscontext);
This code solves my problem, however, in certain cases my calling C++ client
appl...
2024 Apr 25
1
Big speedup in install.packages() by re-using connections
I'd like to raise this again now that 4.4 is out.
Below is a more complete patch which includes a function to properly
cleanup libcurl when R quits. Implementing this is a little tricky
because libcurl is a separate "module" in R, perhaps there is a better
way, but this works:
view: https://github.com/r-devel/r-svn/pull/166/files
patch:
2024 Sep 02
1
Big speedup in install.packages() by re-using connections
...gt; +{
> + if (!mhnd_sentinel) {
> + SEXP sentinel = PROTECT(R_MakeExternalPtr(NULL, R_NilValue, R_NilValue));
> + R_PreserveObject(sentinel);
> + UNPROTECT(1);
> + // Avoid leaking the sentinel before setting the finalizer
> + RCNTXT cntxt;
> + begincontext(&cntxt, CTXT_CCODE, R_NilValue, R_BaseEnv, R_BaseEnv,
> + R_NilValue, R_NilValue);
> + cntxt.cend = &rollback_mhnd_sentinel;
> + cntxt.cenddata = sentinel;
> + R_RegisterCFinalizerEx(sentinel, cleanup_mhnd, TRUE);
> + // Succeeded, no nee...