如何实现延续? [英] How to implement continuations?

查看:146
本文介绍了如何实现延续?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在写在C的方案间preTER目前,它使用C运行时堆栈自己的堆栈,这是presenting一个小问题与执行的延续。我目前的解决方案是C叠堆需要的时候再拷贝回来的手动复制。除了不是标准C,这个解决方案是很难的理想选择。

I'm working on a Scheme interpreter written in C. Currently it uses the C runtime stack as its own stack, which is presenting a minor problem with implementing continuations. My current solution is manual copying of the C stack to the heap then copying it back when needed. Aside from not being standard C, this solution is hardly ideal.

什么是落实℃,计划延续的最简单方法。

What is the simplest way to implement continuations for Scheme in C?

推荐答案

我记得读,可能会帮上你的文章?的 切尼在MTA 的: - )

I remember reading an article that may be of help to you: Cheney on the M.T.A. :-)

方案的某些实现我所知道的,如 SISC ,分配在堆上他们呼吁帧。

Some implementations of Scheme I know of, such as SISC, allocate their call frames on the heap.

@ollie:你不需要做吊装如果所有的呼叫帧是在堆上。有一个折中的性能,当然:时间葫芦,与所需的开销分配在堆上所有帧。也许这应该是跨preTER可调runtime参数。 :-P

@ollie: You don't need to do the hoisting if all your call frames are on the heap. There's a tradeoff in performance, of course: the time to hoist, versus the overhead required to allocate all frames on the heap. Maybe it should be a tunable runtime parameter in the interpreter. :-P

这篇关于如何实现延续?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆