Commit d1482274 authored by Radford Neal's avatar Radford Neal

use PRIMVISON and PRIMVISOFF rather than PRIMPRINT (which still exists, but is now slower)

parent 8c93d49d
......@@ -480,8 +480,10 @@ typedef struct {
setprim_ptr->primsxp.arity = R_FunTab[setprim_value].arity; \
setprim_ptr->primsxp.internal \
= (R_FunTab[setprim_value].eval/10)&1; \
setprim_ptr->primsxp.print \
= (R_FunTab[setprim_value].eval/100)%10; \
setprim_ptr->primsxp.vis_on \
= (R_FunTab[setprim_value].eval/100)%10 == 0; \
setprim_ptr->primsxp.vis_off \
= (R_FunTab[setprim_value].eval/100)%10 == 1; \
setprim_ptr->primsxp.variant \
= (R_FunTab[setprim_value].eval/1000)&1; \
setprim_ptr->primsxp.pending_ok \
......@@ -508,7 +510,11 @@ typedef struct {
#define PRIMARITY(x) \
(((PRIMSEXP)UPTR_FROM_SEXP(x))->primsxp.arity)
#define PRIMPRINT(x) \
(((PRIMSEXP)UPTR_FROM_SEXP(x))->primsxp.print)
((R_FunTab[PRIMOFFSET(x)].eval/100)%10)
#define PRIMVISON(x) \
(((PRIMSEXP)UPTR_FROM_SEXP(x))->primsxp.vis_on)
#define PRIMVISOFF(x) \
(((PRIMSEXP)UPTR_FROM_SEXP(x))->primsxp.vis_off)
#define PRIMINTERNAL(x) \
(((PRIMSEXP)UPTR_FROM_SEXP(x))->primsxp.internal)
#define PRIMVARIANT(x) \
......
......@@ -356,7 +356,8 @@ struct primsxp_struct { /* table offset of this and other info is in gp */
short code; /* operation code, from table */
signed char arity; /* function arity (-1 for any), from table */
unsigned char pending_ok; /* whether args can have computation pending */
unsigned int print:2; /* print/invisible indicator, from table*/
unsigned int vis_on:1; /* whether to force visibility on */
unsigned int vis_off:1; /* whether to force vis off (internal only) */
unsigned int variant:1; /* pass variant to cfun, from table */
unsigned int internal:1; /* call with .Internal flag, from table */
unsigned int fast_sub:1; /* subassign/subset fn that can use fast method*/
......
......@@ -593,7 +593,7 @@ SEXP attribute_hidden Rf_evalv_other (SEXP e, SEXP rho, int variant)
else if (type_tr == BUILTINSXP) {
res = R_Profiling ? Rf_builtin_op(op, e, rho, variant)
: Rf_builtin_op_no_cntxt(op, e, rho, variant);
if (PRIMPRINT(op) == 0)
if (PRIMVISON(op))
R_Visible = TRUE;
}
else if (type_tr & TYPE_ET_CETERA_VEC_DOTS_TR) {
......
......@@ -767,9 +767,10 @@ static SEXP do_internal (SEXP call, SEXP op, SEXP args, SEXP env, int variant)
ans = CALL_PRIMFUN(s, ifun, args, env, variant);
int flag = PRIMPRINT(ifun);
if (flag == 0) R_Visible = TRUE;
else if (flag == 1) R_Visible = FALSE;
if (PRIMVISON(ifun))
R_Visible = TRUE;
else if (PRIMVISOFF(ifun))
R_Visible = FALSE;
/* If this .Internal function is the whole body of a function, we
try to undo the incrementing of NAMEDCNT that was done for the
......
......@@ -120,9 +120,10 @@ static SEXP applyMethod (SEXP call, SEXP op, SEXP args, SEXP rho,
const void *vmax = VMAXGET();
R_Visible = TRUE;
ans = CALL_PRIMFUN(call, op, args, rho, variant);
int flag = PRIMPRINT(op);
if (flag == 0) R_Visible = TRUE;
else if (flag == 1) R_Visible = FALSE;
if (PRIMVISON(op))
R_Visible = TRUE;
else if (PRIMVISOFF(op))
R_Visible = FALSE;
check_stack_balance(op, save);
VMAXSET(vmax);
}
......@@ -137,9 +138,10 @@ static SEXP applyMethod (SEXP call, SEXP op, SEXP args, SEXP rho,
PROTECT(args = evalList(args, rho));
R_Visible = TRUE;
ans = CALL_PRIMFUN(call, op, args, rho, variant);
int flag = PRIMPRINT(op);
if (flag == 0) R_Visible = TRUE;
else if (flag == 1) R_Visible = FALSE;
if (PRIMVISON(op))
R_Visible = TRUE;
else if (PRIMVISOFF(op))
R_Visible = FALSE;
UNPROTECT(1);
check_stack_balance(op, save);
VMAXSET(vmax);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment