Commit 6c40587f authored by Radford Neal's avatar Radford Neal

performance tweak

parent 01c79faa
...@@ -639,6 +639,9 @@ extern void helpers_wait_until_not_in_use(SEXP); ...@@ -639,6 +639,9 @@ extern void helpers_wait_until_not_in_use(SEXP);
( UPTR_FROM_SEXP(x)->sxpinfo.nmcnt != 0 ? 0 : !helpers_is_in_use(x) ? 1 \ ( UPTR_FROM_SEXP(x)->sxpinfo.nmcnt != 0 ? 0 : !helpers_is_in_use(x) ? 1 \
: (helpers_wait_until_not_in_use(x), 1) ) : (helpers_wait_until_not_in_use(x), 1) )
#define NAMEDCNT_EQ_MAX(x) \
( UPTR_FROM_SEXP(x)->sxpinfo.nmcnt == MAX_NAMEDCNT)
#define NAMEDCNT_GT_0(x) \ #define NAMEDCNT_GT_0(x) \
( UPTR_FROM_SEXP(x)->sxpinfo.nmcnt != 0 ? 1 : !helpers_is_in_use(x) ? 0 \ ( UPTR_FROM_SEXP(x)->sxpinfo.nmcnt != 0 ? 1 : !helpers_is_in_use(x) ? 0 \
: (helpers_wait_until_not_in_use(x), 0) ) : (helpers_wait_until_not_in_use(x), 0) )
......
...@@ -703,8 +703,8 @@ static SEXP attribute_noinline evalv_other (SEXP, SEXP, int); ...@@ -703,8 +703,8 @@ static SEXP attribute_noinline evalv_other (SEXP, SEXP, int);
#define EVALV(e, rho, variant) ( \ #define EVALV(e, rho, variant) ( \
R_variant_result = 0, \ R_variant_result = 0, \
SELF_EVAL(TYPEOF(e)) ? \ SELF_EVAL(TYPEOF(e)) ? \
(UPTR_FROM_SEXP(e)->sxpinfo.nmcnt == MAX_NAMEDCNT ? e \ (NAMEDCNT_EQ_MAX(e) ? e \
: (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 */ ? \ : TYPE_ETC(e) == SYMSXP /* not ..., ..1, etc */ ? \
evalv_sym (e, rho, variant) \ evalv_sym (e, rho, variant) \
: evalv_other (e, rho, variant) \ : evalv_other (e, rho, variant) \
...@@ -3616,10 +3616,16 @@ static inline SEXP scalar_stack_eval2 (SEXP args, SEXP *arg1, SEXP *arg2, ...@@ -3616,10 +3616,16 @@ static inline SEXP scalar_stack_eval2 (SEXP args, SEXP *arg1, SEXP *arg2,
/* Now we evaluate the second argument, also allowing it to be on the /* Now we evaluate the second argument, also allowing it to be on the
scalar stack, again with VARIANT_UNCLASS. */ scalar stack, again with VARIANT_UNCLASS. */
INC_NAMEDCNT(x); if (SELF_EVAL(TYPEOF(y))) {
y = EVALV (y, env, R_variant_result = 0;
VARIANT_UNCLASS | VARIANT_SCALAR_STACK_OK | VARIANT_PENDING_OK); SET_NAMEDCNT_MAX(y);
DEC_NAMEDCNT(x); }
else {
INC_NAMEDCNT(x);
y = EVALV_NC (y, env,
VARIANT_UNCLASS | VARIANT_SCALAR_STACK_OK | VARIANT_PENDING_OK);
DEC_NAMEDCNT(x);
}
if (isObject(y)) { if (isObject(y)) {
......
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