Commit a6879fa0 authored by Radford Neal's avatar Radford Neal

another performance tweak

parent b4c7980b
......@@ -1092,13 +1092,18 @@ SEXP forcePromise_v (SEXP e, int variant) /* e protected here if necessary */
if (PRVALUE(e) == R_UnboundValue)
return forcePromiseUnbound(e,variant);
else {
if ((variant & VARIANT_GRADIENT) && HAS_ATTRIB(e)) {
R_variant_result = VARIANT_GRADIENT_FLAG;
R_gradient = ATTRIB(e);
}
SEXP r = PRVALUE_PENDING_OK(e);
if ( ! (variant & VARIANT_PENDING_OK))
WAIT_UNTIL_COMPUTED(r);
if (variant & (VARIANT_PENDING_OK | VARIANT_GRADIENT)) {
if ( ! (variant & VARIANT_GRADIENT))
return r;
if (HAS_ATTRIB(e)) {
R_variant_result = VARIANT_GRADIENT_FLAG;
R_gradient = ATTRIB(e);
}
if (variant & VARIANT_PENDING_OK)
return r;
}
WAIT_UNTIL_COMPUTED(r);
return r;
}
}
......
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