search for: ctxt_function

Displaying 8 results from an estimated 8 matches for "ctxt_function".

2009 Mar 03
1
profiler and loops
...o do to improve on the script. I have had a quick look in the code, and here are a few thoughts: in the function "doprof" in eval.c, this loop write the call stack on the profiler file: for (cptr = R_GlobalContext; cptr; cptr = cptr->nextcontext) { if ((cptr->callflag & (CTXT_FUNCTION | CTXT_BUILTIN)) && TYPEOF(cptr->call) == LANGSXP) { SEXP fun = CAR(cptr->call); if (!newline) newline = 1; fprintf(R_ProfileOutfile, "\"%s\" ", TYPEOF(fun) == SYMSXP ? CHAR(PRINTNAME(fun)) : "<Anonymous>...
2003 Mar 26
0
Rprof/UseMethod
...xtra # evaluation context around builtins and that can confuse things that # don't take this into account. I unfortunately don't have time to # track this properly now, but on a quick glance it looks like changing cptr = R_GlobalContext; if ( !(cptr->callflag & CTXT_FUNCTION) || cptr->cloenv != env) error("UseMethod used in an inappropriate fashion"); # # it two places in objects.c to # cptr = R_GlobalContext; if (cptr->callflag == CTXT_BUILTIN) cptr = cptr->nextcontext; if ( !(cptr->callflag &...
2020 Feb 26
1
Profiling: attributing costs to place of invocation (instead of place of evaluation)?
...? lineprof(buf, R_getCurrentSrcref()); +??? SEXP sysparent = NULL; + ???? for (cptr = R_GlobalContext; cptr; cptr = cptr->nextcontext) { +??? if (sysparent != NULL && cptr->cloenv != sysparent && cptr->sysparent != sysparent) continue; ???? if ((cptr->callflag & (CTXT_FUNCTION | CTXT_BUILTIN)) ???? ??? && TYPEOF(cptr->call) == LANGSXP) { ???? ??? SEXP fun = CAR(cptr->call); @@ -292,6 +295,8 @@ ???? ??? ??? else ???? ??? ??? lineprof(buf, cptr->srcref); ???? ??? } + +??? ??? sysparent = cptr->sysparent; ???? ??? } ???? } ???? }
2002 Jul 19
1
Rprof and setMethod conflict?
I noticed this oddity about R profiling and setMethod. First, I "test out" Rprof. > require(methods) Loading required package: methods [1] TRUE > > Rprof("test.out") > data.frame("a") X.a. 1 a > Rprof(NULL) So far, so good. Next, I define myClass. > setClass("myClass", representation(mySlot = "numeric")) [1]
2014 Feb 26
1
help with gotoExitingHandler(R_NilValue, call, entry); . Implementation of error handling internally
...ind a handler, so it jumps to the top level context. R does not allow me to call begin context and end context directly, so instead what I do is call R_ToplevelExec, grab the global context inside the function, install my own handler that I don?t set to be a calling one, pretend this context is a CTXT_FUNCTION. Eventually I get to jump fun, so that I can later on grab the condition from R_ReturnedValue. This works well in the ? not simple error ? case, i.e. if I call stop( simpleError(...) ), but with simple errors, i.e. calls to Rf_error internally or bare calls to stop( "vvzvz" ) I can?t...
2016 Jun 04
1
RProfmem output format
...raw" This was/is because C function R_OutputStackTrace() - part of src/main/memory.c - looks like: static void R_OutputStackTrace(FILE *file) { int newline = 0; RCNTXT *cptr; for (cptr = R_GlobalContext; cptr; cptr = cptr->nextcontext) { if ((cptr->callflag & (CTXT_FUNCTION | CTXT_BUILTIN)) && TYPEOF(cptr->call) == LANGSXP) { SEXP fun = CAR(cptr->call); if (!newline) newline = 1; fprintf(file, "\"%s\" ", TYPEOF(fun) == SYMSXP ? CHAR(PRINTNAME(fun)) : "<A...
2004 Jun 28
2
Problem with hasArg and the ... argument (PR#7027)
Full_Name: Jelle Goeman Version: 1.9.0 OS: mingw32, windows 2000 Submission from: (NULL) (145.88.209.33) Hi Everyone, I get very strange results using the function hasArg with the ... function argument. In my own function: > gt <- globaltest(X,Y) > sampling(gt) works fine, but > sampling(globaltest(X,Y)) results in: Error in eval(expr, envir, enclos) : "missing"
2011 Aug 14
0
Improved version of Rprofmem
...tatic R_size_t R_MemReportingThreshold; + newline = R_MemReportingToTerminal | R_MemDetailsReporting; -static void R_OutputStackTrace(FILE *file) -{ - int newline = 0; - RCNTXT *cptr; - for (cptr = R_GlobalContext; cptr; cptr = cptr->nextcontext) { if ((cptr->callflag & (CTXT_FUNCTION | CTXT_BUILTIN)) && TYPEOF(cptr->call) == LANGSXP) { SEXP fun = CAR(cptr->call); if (!newline) newline = 1; - fprintf(file, "\"%s\" ", - TYPEOF(fun) == SYMSXP ? CHAR(PRINTNAME(fun)) : - "<Anonymous>"); + if (R_Mem...