Displaying 18 results from an estimated 18 matches for "r_globalcontext".
2009 Mar 03
1
profiler and loops
...point loops as responsible for bottlenecks. The coder of
script1 would not know what to 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\" ",...
2000 Nov 07
0
error handling
...commands using eval(SEXP,SEXP) which is
included in a personal make of R.dll. (Similiar to R_Proxy_evaluate() in
rproxy_impl.c) Using SETJMP to catch errors works but there is a problem.
For example, the following code:
if (SETJMP(R_ToplevelContext->cjmpbuf)) // R_ToplevelContext->cjmpbuf
R_GlobalContext->cjmpbuf
return FALSE;
R_CurrentExpr = eval(R_CurrentExpr , rho);
will appear to work the first time there is an error, but the second error
causes an infinite loop. I have identified the location where the loop
occurs. It is in the function jump_to_toplevel() in errors.c inside the for
loop:...
1998 Jan 03
1
R-beta: NextMethod(.Generic) bug
I'm a day-old R newbie (but a war-weary S veteran), with couple of
first-day questions:
In R 0.61, this code fails.
Ops.test <- function(e1,e2)
{
e1 <- NextMethod(.Generic)
e1
}
x <- 4
class(x) <- "test"
y <- x < 3
The error message is "Error in NextMethod(.Generic) : negative length vectors
are not allowed.".
I assume it is a bug.
2003 Mar 26
0
Rprof/UseMethod
...ds like a bug in the usemethod code. Profiling adds an extra
# 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-&...
2020 Feb 26
1
Profiling: attributing costs to place of invocation (instead of place of evaluation)?
.../main/eval.c
===================================================================
--- src/main/eval.c??? (revision 77857)
+++ src/main/eval.c??? (working copy)
@@ -218,7 +218,10 @@
???? if (R_Line_Profiling)
???? 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...
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]
2016 Jun 04
1
RProfmem output format
...w"
The question is why this is not reported as:
192 :
360 :
360 :
1064 :
2040 :"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\" "...
2015 Aug 21
0
Problems with embedded R, ReplDLL
...pqR to work on Windows, I've also been testing it
in the context of embedded R, and in the process have found some
problems with the examples given of embedded R use.
One problem can be seen in R_ReplDLLinit, in src/main/main.c:
void R_ReplDLLinit(void)
{
SETJMP(R_Toplevel.cjmpbuf);
R_GlobalContext = R_ToplevelContext = R_SessionContext = &R_Toplevel;
R_IoBufferWriteReset(&R_ConsoleIob);
prompt_type = 1;
DLLbuf[0] = DLLbuf[CONSOLE_BUFFER_SIZE] = '\0';
DLLbufp = DLLbuf;
}
The call of SETJMP makes no sense. Nothing that follows in this
function can possibly ca...
2003 Aug 07
2
segmentation fault: formula() with long variable names (PR#3680)
R version: 1.7.1
OS: Red Hat Linux 7.2
In this example, I would expect an error for the overly long variable
name. This is always reproducable for me.
> formula(paste("y~",paste(rep("x",50000),collapse="")))
Segmentation fault
Sincerely,
Jerome Asselin
--
Jerome Asselin (Jérôme), Statistical Analyst
British Columbia Centre for Excellence in HIV/AIDS
St.
2009 Apr 14
0
top level condition handlers
...namespace:base>
but it does not work, probably because the handler stack is reset
somewhere.
Would it work if I poke into the RTopLevel.handlerstack instead of the
R_HandlerStack as .addCondHands is doing ?
R_Toplevel.handlerstack = R_HandlerStack;
R_Toplevel.restartstack = R_RestartStack;
R_GlobalContext = R_ToplevelContext = &R_Toplevel;
Romain
--
Romain Francois
Independent R Consultant
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
1999 Sep 07
1
sys.on.exit appears non-functional (PR#269)
As far as I can see sys.on.exit() does not work. The following
will give a non-null result in S, and seems about the simplest possible
usage.
test <- function() {
on.exit(print(1))
ex <- sys.on.exit()
str(ex)
cat("exiting...\n")
}
> test()
NULL
exiting...
[1] 1
Looking at the code suggests that on.exit is installing the code in
a different context from the one
2006 May 19
2
delayedAssign and interrupts
I noticed something recently that I thought was odd:
delayedAssign("x", { Sys.sleep(5); 1 })
x ## Hit Ctrl-C within the first second or 2
gives me:
> delayedAssign("x", { Sys.sleep(5); 1 })
> x ## Hit Ctrl-C within the first second or two
> x
Error: recursive default argument reference
>
My only problem here is that now I'm stuck---there's no way
2002 Jun 13
1
Increasing Max Vector Length
I'm looking at doing some really large linear algebra problems. I
followed the helpful instructions in the back of the installation
guide for rather aggressive compilation options on 64-bit
Solaris. Happily, I can address more than 6GB of RAM at once in R, so
I the 64 bit part works fine. With the Sun Performance libraries, R is
also very fast.
One thing that still bugs me is the maximum
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"
1997 Aug 05
1
R-beta: Characters in .C
I am having some difficulties using dynamically loaded
C functions on a Sparc 10 with R compiled
using cc (both R-0.49 and R-0.50). I get sporadic errors with the
error message:
Error: character variables must be duplicated in .C/.Fortran,
with C functions which pass character variables.
my C functions look like: anyfunc(char **filename, other variables )
This error message appears about 25%
1997 Aug 05
1
R-beta: Characters in .C
I am having some difficulties using dynamically loaded
C functions on a Sparc 10 with R compiled
using cc (both R-0.49 and R-0.50). I get sporadic errors with the
error message:
Error: character variables must be duplicated in .C/.Fortran,
with C functions which pass character variables.
my C functions look like: anyfunc(char **filename, other variables )
This error message appears about 25%
2007 Jun 12
1
bug in R environments? Was: [BioC] 'recursive default argument' error...
Dear developers,
has anyone experienced the problem described below? Is it a bug in
handling interrupts in R?
Best,
Oleg
-------- Original Message --------
Subject: Re: [BioC] 'recursive default argument' error in GOENTREZID2GO
From: Diego Diez <diez at kuicr.kyoto-u.ac.jp>
...steps that use to reach me to that point. It happens with any
environment, or at least annotation
2011 Aug 14
0
Improved version of Rprofmem
...emReporting; /* Rboolean more appropriate? */
-static FILE *R_MemReportingOutfile;
-static 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) == SY...