Quoth [EMAIL PROTECTED] (Leopold Toetsch):
> Ben Morrow wrote:
> > Quoth [EMAIL PROTECTED]:
> >>
> >>     RESUMABLE: func_that_might_loop_through_cc()
> >>
> >>  possibly accompanied with another markup of the function call that
> >>  loops back.
> > 
> > 
> > That can't work, because *any* function might loop back, unless you want
> > to analyse the entire logic flow of the called function
> 
> Yes. In general that is true. The proposed markup would need that the 
> HLL compiler spots all such places. I don't know if it's possible. 

It's not: consider the case of a function calling a method that hasn't
even been written yet. That method, when written and compiled, could
stuff its passed-in RC into some global (promoting it to a full
continuation, of course) and some other random piece of code could
then invoke it later. This is pretty unpleasant behaviour, of course;
but we need to either define such cases carefully and outlaw them, or
make them work.

Effectively this means that all function calls need to be marked
potentially resumable, except when all functions that could possibly get
hold of our RC are compiled already and known not to do anything nasty
with it. We can't even say that certain languages never use
continutations so they don't need to pay the price, as cross-language
method calls will presumably be possible, as will XS-like methods
written in IMCC.

> Codepaths due to continuation invocation aren't arbitrary. The compiler 
> should know affected subroutines and returns. This would work for 
> lexically nested closure as in t/op/gc_13.imc.

Yes; it's possible to make it work in the case of a single compilation
unit which makes no calls outside itself, as all the required
information is available at compile time.

> >>2) Fetch all from lexicals/globals after a function call.
> > 
> > Can you not make that re-fetch conditional on being invoked from a full
> > (as opposed to a return) continuation, so it will only happen if
> > someone's messing about with continuations?
> 
> Unlikely, I think no.
> 
<snippage>
> 
> This seems also hard to implement.

Fair enough. It was just an idea.

Ben

-- 
You poor take courage, you rich take care:
The Earth was made a common treasury for everyone to share
All things in common, all people one.
'We come in peace'---the order came to cut them down.       [EMAIL PROTECTED]

Reply via email to