help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-smalltalk] Re: Continuations and generators


From: Paolo Bonzini
Subject: [Help-smalltalk] Re: Continuations and generators
Date: Tue, 05 Jun 2007 20:23:54 +0200
User-agent: Thunderbird 2.0.0.0 (Macintosh/20070326)

I would like to know if there is interest in moving generators (and,
as a prerequisite, continuations) to the main image.

I'd be happy with them in kernel as long as this doesn't later lead to
sacrificing the performance of the engine in general to improve
performance of the (apparently stack-copying-on-resume) continuation
support.

Stack copying on resume is done simply with "thisContext deepCopy".

Actually, having them in the kernel does speed up the generator example by 15%, but that's because I added a primitive equivalent to this code:

    resume: returnValue nextContinuation: aContext
        | continuation |
        stack isNil ifTrue: [ ^self primitiveFailed ].
        continuation := stack.
        stack := aContext.
        thisContext parentContext: continuation.
        ^returnValue!

... but which does not need to construct a real object for thisContext.


As I anticipated, stack-copying-on-resume is a matter of doing

    continuation resume: value nextContinuation: stack deepCopy

while the more efficient version

    continuation resume: value nextContinuation: nil

only allows a continuation to restart once.

Paolo





reply via email to

[Prev in Thread] Current Thread [Next in Thread]