Commit 8e6310b3 authored by Radford Neal's avatar Radford Neal

Define and use SET_PRVALUE_TO_PRCODE

parent 37aca0b6
......@@ -1775,8 +1775,8 @@ static inline SEXP SKIP_USING_SYMBITS (SEXP rho, SEXP symbol)
}
/* Macro version of SET_PRVALUE, returning void. Produces a fair amount
of code, but this shouldn't be used much anyway. */
/* Macro version of SET_PRVALUE, returning void. Should not be used
indiscriminantly, since it produces a fair amount of code. */
#define SET_PRVALUE_MACRO(x,y) do { \
SEXP __x__ = (x), __y__ = (y); \
......@@ -1785,6 +1785,16 @@ static inline SEXP SKIP_USING_SYMBITS (SEXP rho, SEXP symbol)
} while (0)
/* SET_PRVALUE_TO_PRCODE copies the code field of a promise to the
value field, as appropriate for self-evaluating code. This does not
require an old-to-new check. */
#define SET_PRVALUE_TO_PRCODE(x) do { \
SEXP __x__ = (x); \
UPTR_FROM_SEXP(__x__)->u.promsxp.value = PRCODE(__x__); \
} while (0)
/* Macro versions of SETCAR and SETCDR, returning void. Should not be
used indiscriminantly, since they produce a fair amount of code. */
......
......@@ -668,7 +668,13 @@ SEXP attribute_hidden forcePromiseUnbound (SEXP e, int variant)
val = PRCODE(e);
if ( ! SELF_EVAL(TYPEOF(val)) ) {
if (SELF_EVAL(TYPEOF(val)) ) {
/* Just copy code to value - avoids old-to-new check. */
SET_PRVALUE_TO_PRCODE (e);
}
else {
RPRSTACK prstack;
......@@ -682,7 +688,7 @@ SEXP attribute_hidden forcePromiseUnbound (SEXP e, int variant)
prstack.next = R_PendingPromises;
R_PendingPromises = &prstack;
SET_PRSEEN(e, 1);
SET_PRSEEN (e, 1);
PROTECT(e);
......@@ -694,10 +700,10 @@ SEXP attribute_hidden forcePromiseUnbound (SEXP e, int variant)
/* Pop the stack, unmark the promise and set its value field. */
R_PendingPromises = prstack.next;
SET_PRSEEN(e, 0);
}
SET_PRSEEN (e, 0);
SET_PRVALUE_MACRO(e, val);
SET_PRVALUE_MACRO (e, val);
}
if (val == R_MissingArg) { /* Attempt to mimic past behaviour... */
if ( ! (variant & VARIANT_MISSING_OK) && TYPEOF(PRCODE(e)) == SYMSXP
......
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