在MinCaml编译器中直接实现shift和reset

Moe Masuko, K. Asai
{"title":"在MinCaml编译器中直接实现shift和reset","authors":"Moe Masuko, K. Asai","doi":"10.1145/1596627.1596636","DOIUrl":null,"url":null,"abstract":"Although delimited control operators are becoming one of the useful tools to manipulate flow of programs, their direct and compiled implementation in a low-level language has not been proposed so far. The only direct and low-level implementations available are Gasbichler and Sperber's implementation in the Scheme 48 virtual machine and Kiselyov's implementation in the OCaml bytecode. Even though these implementations do provide insight into how stack frames are composed, they are not directly portable to compiled implementation in assembly language. This paper presents a direct implementation of delimited control operators shift and reset in the MinCaml compiler. It shows all the details of how composable continuations can be implemented in the PowerPC microprocessor using a stack discipline. We also show an implementation that copies stack frames lazily. To our knowledge, this is the first implementation of shift/reset in assembly language. It makes clear at the assembly language level what we have informally described so far, such as \"copying and composing stack frames\" and \"inserting a reset mark when captured continuations are called\". We demonstrate various benchmarks to show the performance of our implementation and discuss its pros and cons.","PeriodicalId":218033,"journal":{"name":"Proceedings of the 2009 ACM SIGPLAN workshop on ML","volume":"76 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2009-08-30","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"11","resultStr":"{\"title\":\"Direct implementation of shift and reset in the MinCaml compiler\",\"authors\":\"Moe Masuko, K. Asai\",\"doi\":\"10.1145/1596627.1596636\",\"DOIUrl\":null,\"url\":null,\"abstract\":\"Although delimited control operators are becoming one of the useful tools to manipulate flow of programs, their direct and compiled implementation in a low-level language has not been proposed so far. The only direct and low-level implementations available are Gasbichler and Sperber's implementation in the Scheme 48 virtual machine and Kiselyov's implementation in the OCaml bytecode. Even though these implementations do provide insight into how stack frames are composed, they are not directly portable to compiled implementation in assembly language. This paper presents a direct implementation of delimited control operators shift and reset in the MinCaml compiler. It shows all the details of how composable continuations can be implemented in the PowerPC microprocessor using a stack discipline. We also show an implementation that copies stack frames lazily. To our knowledge, this is the first implementation of shift/reset in assembly language. It makes clear at the assembly language level what we have informally described so far, such as \\\"copying and composing stack frames\\\" and \\\"inserting a reset mark when captured continuations are called\\\". We demonstrate various benchmarks to show the performance of our implementation and discuss its pros and cons.\",\"PeriodicalId\":218033,\"journal\":{\"name\":\"Proceedings of the 2009 ACM SIGPLAN workshop on ML\",\"volume\":\"76 1\",\"pages\":\"0\"},\"PeriodicalIF\":0.0000,\"publicationDate\":\"2009-08-30\",\"publicationTypes\":\"Journal Article\",\"fieldsOfStudy\":null,\"isOpenAccess\":false,\"openAccessPdf\":\"\",\"citationCount\":\"11\",\"resultStr\":null,\"platform\":\"Semanticscholar\",\"paperid\":null,\"PeriodicalName\":\"Proceedings of the 2009 ACM SIGPLAN workshop on ML\",\"FirstCategoryId\":\"1085\",\"ListUrlMain\":\"https://doi.org/10.1145/1596627.1596636\",\"RegionNum\":0,\"RegionCategory\":null,\"ArticlePicture\":[],\"TitleCN\":null,\"AbstractTextCN\":null,\"PMCID\":null,\"EPubDate\":\"\",\"PubModel\":\"\",\"JCR\":\"\",\"JCRName\":\"\",\"Score\":null,\"Total\":0}","platform":"Semanticscholar","paperid":null,"PeriodicalName":"Proceedings of the 2009 ACM SIGPLAN workshop on ML","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/1596627.1596636","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 11

摘要

虽然分隔控制操作符正在成为操纵程序流的有用工具之一,但迄今为止还没有提出用低级语言直接编译实现它们的方法。唯一可用的直接和低级实现是Gasbichler和Sperber在Scheme 48虚拟机中的实现和Kiselyov在OCaml字节码中的实现。尽管这些实现确实提供了对堆栈框架如何组成的洞察,但它们不能直接移植到汇编语言的编译实现中。本文给出了在MinCaml编译器中直接实现带分隔符的控制操作符shift和reset。它展示了如何使用堆栈规程在PowerPC微处理器中实现可组合延续的所有细节。我们还展示了一个延迟复制堆栈帧的实现。据我们所知,这是汇编语言中移位/重置的第一个实现。它在汇编语言级别明确了我们到目前为止非正式描述的内容,例如“复制和组合堆栈帧”和“在调用捕获的延续时插入重置标记”。我们演示了各种基准测试,以显示实现的性能,并讨论其优缺点。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
查看原文
分享 分享
微信好友 朋友圈 QQ好友 复制链接
本刊更多论文
Direct implementation of shift and reset in the MinCaml compiler
Although delimited control operators are becoming one of the useful tools to manipulate flow of programs, their direct and compiled implementation in a low-level language has not been proposed so far. The only direct and low-level implementations available are Gasbichler and Sperber's implementation in the Scheme 48 virtual machine and Kiselyov's implementation in the OCaml bytecode. Even though these implementations do provide insight into how stack frames are composed, they are not directly portable to compiled implementation in assembly language. This paper presents a direct implementation of delimited control operators shift and reset in the MinCaml compiler. It shows all the details of how composable continuations can be implemented in the PowerPC microprocessor using a stack discipline. We also show an implementation that copies stack frames lazily. To our knowledge, this is the first implementation of shift/reset in assembly language. It makes clear at the assembly language level what we have informally described so far, such as "copying and composing stack frames" and "inserting a reset mark when captured continuations are called". We demonstrate various benchmarks to show the performance of our implementation and discuss its pros and cons.
求助全文
通过发布文献求助,成功后即可免费获取论文全文。 去求助
来源期刊
自引率
0.00%
发文量
0
期刊最新文献
A cryptographic protocol compiler for multiparty sessions Session details: Implementation Direct implementation of shift and reset in the MinCaml compiler QML: explicit first-class polymorphism for ML Correctly translating concurrency primitives
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
现在去查看 取消
×
提示
确定
0
微信
客服QQ
Book学术公众号 扫码关注我们
反馈
×
意见反馈
请填写您的意见或建议
请填写您的手机或邮箱
已复制链接
已复制链接
快去分享给好友吧!
我知道了
×
扫码分享
扫码分享
Book学术官方微信
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术
文献互助 智能选刊 最新文献 互助须知 联系我们:info@booksci.cn
Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。
Copyright © 2023 Book学术 All rights reserved.
ghs 京公网安备 11010802042870号 京ICP备2023020795号-1