Re: Continuations

Liste des GroupesRevenir à c arch 
Sujet : Re: Continuations
De : anton (at) *nospam* mips.complang.tuwien.ac.at (Anton Ertl)
Groupes : comp.arch
Date : 14. Jul 2024, 16:22:23
Autres entêtes
Organisation : Institut fuer Computersprachen, Technische Universitaet Wien
Message-ID : <2024Jul14.162223@mips.complang.tuwien.ac.at>
References : 1 2
User-Agent : xrn 10.11
BGB <cr88192@gmail.com> writes:
On 7/13/2024 2:50 AM, Lawrence D'Oliveiro wrote:
Has there ever been a hardware architecture that managed the flow of
control via "continuations"?

RISCs usually have no architectural support for stack-based calling
conventions, so they work just as well for managing the flow of
control via continuations.

Doing an ABI based around continuations would basically wreck performance;
Conventional thread-based multitasking is cheaper to implement and gives
better performance.
>
There is basically no real way to get dynamically allocated stack-frames
and argument copying to be performance competitive with adjusting a
stack pointer and passing arguments in registers. Function calls are
also, not exactly rare.

Quite a while ago "continuation-passing style" was a hot research
topic (see some references below; I found [appel&jim89] more inspiring
than [appel92]), and AFAIK a number of compilers used this concept
(and some probably still use it, especially Scheme compilers, where
continuations are a language feature).

Around that time there was the argument (maybe also by Appel, but I
don't remember) that, in the limit, garbage collection is cheaper than
stack-based allocation (never mind malloc/free): If you delay garbage
collection long enough, the cost of a copying garbage collector will
be smaller than the cost of stack-deallocating the garbage.  That's a
copying garbage collector only accesses and copies the non-garbage.

In practice, you don't want to provide so much memory that this point
will be reached, plus stack-based allocation has better cache
characteristicts.

@InProceedings{appel&jim89,
  author = "Andrew W. Appel and Trevor Jim",
  title = "Continuation-Passing, Closure-Passing style",
  booktitle = "Sixteenth Annual {ACM} Symposium on Principles of
Programming Languages",
  year = "1989",
  pages = "293--302",
  address = "Austin, Texas",
  annote = "ML compiler based on continuation passing style.
After the translation into CPS and optimization
closures are made explicit and registers are
allocated. No stack is used for the closures. Instead
the compiler relies on garbage collection."
}

@Book{appel92,
  author = "Andrew W. Appel",
  title = "Compiling with Continuations",
  publisher = "Cambridge University Press",
  year = "1992"
}

@InProceedings{flanagan+93,
  author = "Cormac Flanagan and Amr Sabry and Bruce F. Duba and
  Matthias Felleisen",
  title = "The Essence of Compiling with Continuations",
  crossref = "sigplan93",
  pages = "237--247",
  annote = "CPS compilers convert into CPS form, optimize the
  program and convert back. Isomorphic optimizations can
  be performed on the original program, saving the
  transformation to and from CPS form."
}

@Proceedings{sigplan93,
  booktitle = "SIGPLAN '93 Conference on Programming Language
  Design and Implementation",
  title = "SIGPLAN '93 Conference on Programming Language
  Design and Implementation",
  year = "1993",
  key = "SIGPLAN '93",
  note = "SIGPLAN Notices 28(6)"
}

@InProceedings{bruggeman+96,
  author = {Carl Bruggeman and Oscar Waddel and R. Kent Dybvig},
  title = {Representing Control in the Presence of One-Shot
                  Continuations},
  crossref = {sigplan96},
  pages = {99--107},
  annote = {Discuss how to represent multi-shot continuations
                  and one-shot continuations in a stack-based Scheme
                  implementation. One-shot continuations are
                  programmer-specified (with the \emph{call/1cc}
                  call). They offer a small (about 13\% in the threads
                  benchmarks) performance benefit over multi-shot
                  continuations, if they are applicable.}
}

@Proceedings{sigplan96,
  booktitle = "SIGPLAN '96 Conference on Programming Language
  Design and Implementation",
  title = "SIGPLAN '96 Conference on Programming Language
  Design and Implementation",
  year = "1996",
  key = "PLDI '96"
}

- anton
--
'Anyone trying for "industrial quality" ISA should avoid undefined behavior.'
  Mitch Alsup, <c17fcd89-f024-40e7-a594-88a85ac10d20o@googlegroups.com>

Date Sujet#  Auteur
13 Jul 24 * Continuations138Lawrence D'Oliveiro
13 Jul 24 +* Re: Continuations4BGB
14 Jul 24 i+* Re: Continuations2aph
15 Jul 24 ii`- Re: Continuations1Lawrence D'Oliveiro
14 Jul 24 i`- Re: Continuations1Anton Ertl
13 Jul 24 +* Re: Continuations23John Dallman
14 Jul 24 i+* Re: Continuations21Lawrence D'Oliveiro
14 Jul 24 ii`* Re: Continuations20George Neuner
14 Jul 24 ii `* Re: Continuations19John Levine
14 Jul 24 ii  `* Re: Continuations18Niklas Holsti
15 Jul 24 ii   +* Re: Continuations16John Levine
15 Jul 24 ii   i+- Re: Continuations1Terje Mathisen
15 Jul 24 ii   i+- Re: Continuations1John Levine
15 Jul 24 ii   i+* Re: Continuations9Niklas Holsti
16 Jul 24 ii   ii`* Re: Continuations8Lawrence D'Oliveiro
16 Jul 24 ii   ii `* Re: Continuations7John Levine
16 Jul 24 ii   ii  +- Re: Continuations1Chris M. Thomasson
16 Jul 24 ii   ii  `* Re: Continuations5Lawrence D'Oliveiro
16 Jul 24 ii   ii   `* Re: Continuations4John Levine
16 Jul 24 ii   ii    `* Re: Continuations3Lawrence D'Oliveiro
16 Jul 24 ii   ii     `* Re: Continuations2MitchAlsup1
17 Jul 24 ii   ii      `- Re: Continuations1Lawrence D'Oliveiro
16 Jul 24 ii   i+* Re: Continuations3Lawrence D'Oliveiro
16 Jul 24 ii   ii`* Re: Continuations2MitchAlsup1
16 Jul 24 ii   ii `- Re: Continuations1Lawrence D'Oliveiro
16 Jul 24 ii   i`- Re: Continuations1MitchAlsup1
16 Jul 24 ii   `- Re: Continuations1Lawrence D'Oliveiro
14 Jul 24 i`- Re: Continuations1BGB
13 Jul 24 +- Re: Continuations1BGB
14 Jul 24 +* Re: Continuations10Lawrence D'Oliveiro
15 Jul 24 i+* Re: Continuations7Thomas Koenig
15 Jul 24 ii`* Re: Continuations6Thomas Koenig
16 Jul 24 ii +* Re: Continuations4Thomas Koenig
16 Jul 24 ii i+* Re: Continuations2MitchAlsup1
17 Jul 24 ii ii`- Re: Continuations1Lawrence D'Oliveiro
17 Jul 24 ii i`- Re: Continuations1Lawrence D'Oliveiro
17 Jul 24 ii `- Re: Continuations1John Dallman
16 Jul 24 i+- Re: Continuations1Lawrence D'Oliveiro
16 Jul 24 i`- Re: Continuations1John Levine
14 Jul 24 +- Re: Continuations1George Neuner
14 Jul 24 +* Re: Continuations92John Savard
14 Jul 24 i+- Re: Continuations1BGB
15 Jul 24 i`* Re: Continuations90Lawrence D'Oliveiro
16 Jul 24 i `* Re: Continuations89John Savard
16 Jul 24 i  +* Re: Continuations2MitchAlsup1
17 Jul 24 i  i`- Re: Continuations1Lawrence D'Oliveiro
16 Jul 24 i  `* Re: Continuations86MitchAlsup1
17 Jul 24 i   +* Re: Continuations69John Savard
17 Jul 24 i   i`* Re: Continuations68MitchAlsup1
17 Jul 24 i   i `* Re: Continuations67Thomas Koenig
17 Jul 24 i   i  +- Re: Continuations1Thomas Koenig
17 Jul 24 i   i  +- Re: Continuations1Michael S
17 Jul 24 i   i  +* Re: Continuations37MitchAlsup1
17 Jul 24 i   i  i`* Re: Continuations36Stephen Fuld
17 Jul 24 i   i  i `* Re: Continuations35MitchAlsup1
17 Jul 24 i   i  i  +* Re: Continuations22Stephen Fuld
18 Jul 24 i   i  i  i+* Re: Continuations8MitchAlsup1
18 Jul 24 i   i  i  ii+- Re: Continuations1Michael S
18 Jul 24 i   i  i  ii`* Re: Continuations6MitchAlsup1
19 Jul 24 i   i  i  ii +- Re: Continuations1Stephen Fuld
21 Jul 24 i   i  i  ii +* Re: Reservation stations [was Continuations]2Anton Ertl
21 Jul 24 i   i  i  ii i`- Re: Reservation stations [was Continuations]1MitchAlsup1
21 Jul 24 i   i  i  ii `* Re: Reservation stations [was Continuations]2MitchAlsup1
22 Jul 24 i   i  i  ii  `- IPC (was: Reservation stations)1Anton Ertl
18 Jul 24 i   i  i  i+* Re: Continuations11Thomas Koenig
18 Jul 24 i   i  i  ii`* Re: Continuations10Michael S
18 Jul 24 i   i  i  ii `* Re: Continuations9Thomas Koenig
18 Jul 24 i   i  i  ii  `* Re: Continuations8Michael S
18 Jul 24 i   i  i  ii   +* Re: Continuations6Thomas Koenig
18 Jul 24 i   i  i  ii   i+- Re: Continuations1Michael S
18 Jul 24 i   i  i  ii   i`* Re: Continuations4Michael S
19 Jul 24 i   i  i  ii   i `* Re: Continuations3Thomas Koenig
19 Jul 24 i   i  i  ii   i  `* Re: Continuations2Michael S
20 Jul 24 i   i  i  ii   i   `- Re: Continuations1Thomas Koenig
18 Jul 24 i   i  i  ii   `- Re: Continuations1MitchAlsup1
18 Jul 24 i   i  i  i`* Re: Continuations2John Savard
18 Jul 24 i   i  i  i `- Re: Continuations1Thomas Koenig
18 Jul 24 i   i  i  +* Re: Continuations6Thomas Koenig
18 Jul 24 i   i  i  i`* Re: Continuations5Michael S
18 Jul 24 i   i  i  i `* Re: Continuations4Michael S
18 Jul 24 i   i  i  i  `* Re: Continuations3Thomas Koenig
18 Jul 24 i   i  i  i   `* Re: Continuations2MitchAlsup1
20 Jul 24 i   i  i  i    `- Re: Continuations1Thomas Koenig
18 Jul 24 i   i  i  +* Non-pipelined FDIV/SQRT (was: Continuations)3Stefan Monnier
18 Jul 24 i   i  i  i+- Re: Non-pipelined FDIV/SQRT1MitchAlsup1
28 Jul 24 i   i  i  i`- Re: Non-pipelined FDIV/SQRT1Michael S
18 Jul 24 i   i  i  `* Re: Continuations3MitchAlsup1
28 Jul 24 i   i  i   `* Re: Continuations2Paul A. Clayton
28 Jul 24 i   i  i    `- Re: Continuations1Michael S
19 Jul 24 i   i  `* Re: Continuations27Terje Mathisen
19 Jul 24 i   i   +* Re: Continuations5Thomas Koenig
19 Jul 24 i   i   i+- Re: Continuations1Chris M. Thomasson
19 Jul 24 i   i   i`* Re: Continuations3MitchAlsup1
20 Jul 24 i   i   i +- Re: Continuations1Terje Mathisen
20 Jul 24 i   i   i `- Re: Continuations1Thomas Koenig
19 Jul 24 i   i   `* Re: Continuations21MitchAlsup1
19 Jul 24 i   i    +* Re: Continuations8Terje Mathisen
22 Jul 24 i   i    i`* Re: Continuations7Michael S
22 Jul 24 i   i    i +* Re: Continuations3MitchAlsup1
22 Jul 24 i   i    i i`* Re: Continuations2Michael S
23 Jul 24 i   i    i i `- Re: Continuations1MitchAlsup1
23 Jul 24 i   i    i `* Re: Continuations3Terje Mathisen
19 Jul 24 i   i    `* Faster div or 1/sqrt approximations (was: Continuations)12Thomas Koenig
17 Jul 24 i   +* Re: Continuations3Lawrence D'Oliveiro
17 Jul 24 i   +* Re: Continuations12Stephen Fuld
17 Jul 24 i   `- Re: fancy instructions, Continuations1John Levine
15 Jul 24 +- Re: Continuations1wolfgang kern
15 Jul 24 +* Re: pessimal storage allocation, Continuations3John Levine
15 Jul 24 +- Re: Continuations1MitchAlsup1
16 Jul 24 `- Re: Continuations1Lynn Wheeler

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal