Commit 25a79299 authored by Radford Neal's avatar Radford Neal

fiddle with static and noinline attributes relating to eval

parent 532eae20
......@@ -353,14 +353,12 @@
Rf_evalListKeepMissing
Rf_evalListUnshared
Rf_evalList_v
Rf_evalv_other
Rf_evalv_sym
Rf_eval_unshared
Rf_findFun_nospecsym
Rf_findVar1
Rf_findcontext
Rf_find_binding_in_frame
Rf_forcePromiseUnbound
Rf_forcePromise_v
Rf_framedepth
Rf_gamma_cody
Rf_gammalims
......
......@@ -1275,7 +1275,7 @@ extern0 Rboolean known_to_be_utf8 INI_as(FALSE);
# define findFun_nospecsym Rf_findFun_nospecsym
# define findVar1 Rf_findVar1
# define forcePromise Rf_forcePromise
# define forcePromiseUnbound Rf_forcePromiseUnbound
# define forcePromise_v Rf_forcePromise_v
# define FrameClassFix Rf_FrameClassFix
# define framedepth Rf_framedepth
# define frameSubscript Rf_frameSubscript
......@@ -1493,7 +1493,7 @@ void R_NORETURN findcontext(int, SEXP, SEXP);
SEXP findFun_nospecsym(SEXP, SEXP);
SEXP findVar1(SEXP, SEXP, SEXPTYPE, int);
SEXP forcePromise(SEXP);
SEXP forcePromiseUnbound(SEXP,int);
SEXP forcePromise_v(SEXP,int);
void FrameClassFix(SEXP);
SEXP frameSubscript(int, SEXP, SEXP);
int get1index(SEXP, SEXP, int, int, int, SEXP);
......
......@@ -1759,8 +1759,6 @@ int Rf_ep_match_exprs(SEXP, SEXP);
int Rf_ep_match_string_expr(const char *, SEXP);
SEXP Rf_eval(SEXP, SEXP);
SEXP Rf_evalv(SEXP, SEXP, int);
SEXP Rf_evalv_sym(SEXP, SEXP, int);
SEXP Rf_evalv_other(SEXP, SEXP, int);
SEXP Rf_findFun(SEXP, SEXP);
SEXP Rf_findFunMethod(SEXP, SEXP);
SEXP Rf_findVar(SEXP, SEXP);
......
......@@ -690,9 +690,6 @@ static inline SEXP FINDFUN (SEXP symbol, SEXP rho)
}
static SEXP Rf_builtin_op_no_cntxt (SEXP op, SEXP e, SEXP rho, int variant);
#define CHECK_STACK_BALANCE(o,s) do { \
if (s != R_PPStackTop) check_stack_balance(o,s); \
} while (0)
......@@ -746,9 +743,8 @@ void attribute_hidden wait_until_arguments_computed (SEXP args)
expression depth or stack overflow, so should not be used if
infinite recursion could result. */
static SEXP evalv_lang (SEXP, SEXP, int);
static SEXP evalv_sym (SEXP, SEXP, int);
static SEXP evalv_other (SEXP, SEXP, int);
static SEXP attribute_noinline evalv_sym (SEXP, SEXP, int);
static SEXP attribute_noinline evalv_other (SEXP, SEXP, int);
#define EVALV(e, rho, variant) ( \
R_variant_result = 0, \
......@@ -756,8 +752,8 @@ static SEXP evalv_other (SEXP, SEXP, int);
(UPTR_FROM_SEXP(e)->sxpinfo.nmcnt == MAX_NAMEDCNT ? e \
: (UPTR_FROM_SEXP(e)->sxpinfo.nmcnt = MAX_NAMEDCNT, e)) \
: TYPE_ETC(e) == SYMSXP /* not ..., ..1, etc */ ? \
Rf_evalv_sym (e, rho, variant) \
: Rf_evalv_other (e, rho, variant) \
evalv_sym (e, rho, variant) \
: evalv_other (e, rho, variant) \
)
......@@ -766,11 +762,13 @@ static SEXP evalv_other (SEXP, SEXP, int);
arguments are protected. The "eval" function is just like "evalv"
with 0 for the variant return argument. */
static SEXP attribute_noinline forcePromiseUnbound (SEXP e, int variant);
static SEXP attribute_noinline Rf_builtin_op_no_cntxt (SEXP op, SEXP e,
SEXP rho, int variant);
SEXP Rf_builtin_op (SEXP op, SEXP e, SEXP rho, int variant);
#define evalcount R_high_frequency_globals.evalcount
SEXP eval (SEXP e, SEXP rho)
{
return evalv (e, rho, 0);
......@@ -800,8 +798,8 @@ SEXP evalv (SEXP e, SEXP rho, int variant)
/* Handle symbol lookup without stack overflow or expression depth check */
if (TYPE_ETC(e) == SYMSXP /* symbol, but not ..., ..1, etc */) {
res = Rf_evalv_sym (e, rho, variant); /* may change R_Visible, but
that seems to be desired... */
res = evalv_sym (e, rho, variant); /* may change R_Visible, but
that seems to be desired... */
return res;
}
......@@ -814,7 +812,7 @@ SEXP evalv (SEXP e, SEXP rho, int variant)
if (R_EvalDepth > R_Expressions)
too_deep_error();
res = Rf_evalv_other (e, rho, variant);
res = evalv_other (e, rho, variant);
R_EvalDepth -= 1;
......@@ -864,7 +862,7 @@ SEXP evalv (SEXP e, SEXP rho, int variant)
/* Evaluate an expression that is a symbol other than ..., ..1, ..2, etc. */
SEXP attribute_hidden Rf_evalv_sym (SEXP e, SEXP rho, int variant)
static SEXP attribute_noinline evalv_sym (SEXP e, SEXP rho, int variant)
{
SEXP res;
......@@ -902,7 +900,7 @@ SEXP attribute_hidden Rf_evalv_sym (SEXP e, SEXP rho, int variant)
/* Evaluate an expression that is not self-evaluating and not a symbol
(other than ..., ..1, ..2, etc.). */
SEXP attribute_hidden Rf_evalv_other (SEXP e, SEXP rho, int variant)
static SEXP attribute_noinline evalv_other (SEXP e, SEXP rho, int variant)
{
SEXP op, res;
......@@ -1038,7 +1036,7 @@ SEXP attribute_hidden Rf_evalv_other (SEXP e, SEXP rho, int variant)
/* e is protected here */
SEXP attribute_hidden forcePromiseUnbound (SEXP e, int variant)
static SEXP attribute_noinline forcePromiseUnbound (SEXP e, int variant)
{
SEXP val;
......@@ -1113,6 +1111,16 @@ SEXP forcePromise (SEXP e) /* e protected here if necessary */
return PRVALUE(e);
}
SEXP forcePromise_v (SEXP e, int variant) /* e protected here if necessary */
{
if (PRVALUE(e) == R_UnboundValue) {
return forcePromiseUnbound(e,variant);
}
else
return variant & VARIANT_PENDING_OK ? PRVALUE_PENDING_OK(e)
: PRVALUE(e);
}
/* Like Rf_builtin_op (defined in builtin.c) except that no context is
created. Making this separate from Rf_builtin_op saves on stack
......@@ -1120,7 +1128,8 @@ SEXP forcePromise (SEXP e) /* e protected here if necessary */
time-consuming context creation is not done, there is no advantage
to evaluating a single argument with pending OK. */
static SEXP Rf_builtin_op_no_cntxt (SEXP op, SEXP e, SEXP rho, int variant)
static SEXP attribute_noinline Rf_builtin_op_no_cntxt(SEXP op, SEXP e, SEXP rho,
int variant)
{
SEXP args = CDR(e);
SEXP arg1;
......@@ -2593,7 +2602,7 @@ SEXP attribute_hidden Rf_set_subassign (SEXP call, SEXP lhs, SEXP rhs, SEXP rho,
prom = mkValuePROMISE(s[d+1].expr,s[d+1].value);
PROTECT (e = LCONS (op, CONS (prom, fetch_args)));
R_variant_result = 0;
e = Rf_evalv_other (e, rho, VARIANT_QUERY_UNSHARED_SUBSET);
e = evalv_other (e, rho, VARIANT_QUERY_UNSHARED_SUBSET);
UNPROTECT(2); /* e, fetch_args */
}
......
......@@ -100,7 +100,7 @@ static SEXP GetObject(RCNTXT *cptr)
if (TYPEOF(s) == PROMSXP) {
if (PRVALUE_PENDING_OK(s) == R_UnboundValue)
s = forcePromiseUnbound(s,VARIANT_PENDING_OK);
s = forcePromise_v(s,VARIANT_PENDING_OK);
else
s = PRVALUE_PENDING_OK(s);
}
......
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