Commit b3a41a97 authored by Radford Neal's avatar Radford Neal

optimization in evalv_other

parent 6bc4bf13
......@@ -911,16 +911,35 @@ static SEXP attribute_noinline evalv_other (SEXP e, SEXP rho, int variant)
return res;
}
if (TYPEOF(e) == PROMSXP) {
if (TYPE_ETC(e) == PROMSXP + TYPE_ET_CETERA_VEC_DOTS_TR) {
/* forced promise, no gradient */
res = PRVALUE_PENDING_OK(e);
if (res == R_UnboundValue)
res = forcePromiseUnbound(e,variant);
else if ( ! (variant & VARIANT_PENDING_OK))
if ( ! (variant & VARIANT_PENDING_OK))
WAIT_UNTIL_COMPUTED(res);
return res;
}
if (TYPE_ETC(e) ==
PROMSXP + TYPE_ET_CETERA_VEC_DOTS_TR + TYPE_ET_CETERA_HAS_ATTR) {
/* forced promise, with gradient */
res = PRVALUE_PENDING_OK(e);
if (variant & VARIANT_GRADIENT) {
R_variant_result = VARIANT_GRADIENT_FLAG;
R_gradient = ATTRIB(e);
}
if ( ! (variant & VARIANT_PENDING_OK))
WAIT_UNTIL_COMPUTED(res);
return res;
}
if (TYPE_ETC(e) == PROMSXP) { /* unforced promise, force here */
res = forcePromiseUnbound(e,variant);
if ((variant & VARIANT_GRADIENT) && HAS_ATTRIB(e)) {
R_variant_result = VARIANT_GRADIENT_FLAG;
R_gradient = ATTRIB(e);
}
if ( ! (variant & VARIANT_PENDING_OK))
WAIT_UNTIL_COMPUTED(res);
R_Visible = TRUE;
return res;
}
......
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