Matt Fowles <[EMAIL PROTECTED]> wrote: > ... Thus you can consider all of the > following questions (even though they will be phrased as statements).
> 1) After a full continuation is taken all of the registers must be > considered invalid. Calling a subroutine allocates a new register frame, that subs register frame pointer in the context points to these fresh registers. A continuation restores the context it captured, i.e. at the place, where it was created. This is true for all continuations. Inside the context there is a *pointer* to a register frame, which is therefore restored too. The effect of taking a continuation is therefore to restore registers to that state where the continuation was created. Due to calling conventions a part of the registers is volatile (used during a call or as return results), while the other part is non-volatile. Until here there is no difference between return or full continuation. The effect of a full continuation can be to create a loop, where the known control flow doesn't show a loop. Without further syntax to denote such loops 1) is true. This register invalidation happens, if a preserved register was e.g. only used once after the call and then that register got reassigned, which is allowed for a linear control flow but not inside a loop. This has per se nothing to do with a continuation. If you got an opcode that does *silently* a "goto again_label" the CFG doesn't cope with the loop, because it isn't there and things start breaking. The effect of a full continuation *is* to create such loops. > 2) After a return continuation is taken, the registers can be trusted. Yes, according to usage in pdd03. > 3) If someone takes a full continuation, all return continuations > down the callstack must be promoted. If one *creates* a full continuation ... > 4) After a function call, some magic needs to happen so that the code > knows whether it came back to itself via a return continuation and can > trust its registers, or it came back via a full continuation and > cannot trust them. No. It's too late for magic. Either the CFG is known at compile time or refetching in the presence of full continuations is mandatory. For both the code must reflect the facts. > Corrections welcome, > Matt leo