首页> 外文期刊>Theory and Practice of Logic Programming >Region-based memory management for Mercury programs
【24h】

Region-based memory management for Mercury programs

机译:Mercury程序的基于区域的内存管理

获取原文

摘要

Region-based memory management (RBMM) is a form of compile time memory management, well-known from the world of functional programming. In this paper we describe our work on implementing RBMM for the logic programming language Mercury. One interesting point about Mercury is that it is designed with strong type, mode, and determinism systems. These systems not only provide Mercury programmers with several direct software engineering benefits, such as self-documenting code and clear program logic, but also give language implementors a large amount of information that is useful for program analyses. In this work, we make use of this information to develop program analyses that determine the distribution of data into regions and transform Mercury programs by inserting into them the necessary region operations. We prove the correctness of our program analyses and transformation. To execute annotated programs, we have implemented runtime support that tackles the two main challenges posed by backtracking. First, backtracking can require regions removed during forward execution to be "resurrected"; and second, any memory allocated during computation that has been backtracked over must be recovered promptly without waiting for the regions involved to come to the end of their life. We describe in detail our solution of both these problems. We study in detail how our RBMM system performs on a selection of benchmark programs, including some well-known difficult cases for RBMM. Even with these difficult cases, our RBMM-enabled Mercury system obtains clearly faster runtimes for 15 out of 18 benchmarks compared to the base Mercury system with its Boehm runtime garbage collector, with an average runtime speedup of 24%, and an average reduction in memory requirements of 95%. In fact, our system achieves optimal memory consumption in some programs.
机译:基于区域的内存管理(RBMM)是编译时内存管理的一种形式,在功能编程领域中众所周知。在本文中,我们描述了我们为逻辑编程语言Mercury实现RBMM的工作。关于Mercury的一个有趣的观点是,它采用强大的类型,模式和确定性系统进行设计。这些系统不仅为Mercury程序员提供了一些直接的软件工程优势,例如自文档代码和清晰的程序逻辑,而且还为语言实现者提供了大量可用于程序分析的信息。在这项工作中,我们利用这些信息来开发程序分析,以确定将数据分布到区域中的方法,并通过将必要的区域操作插入其中来转换Mercury程序。我们证明了程序分析和转换的正确性。为了执行带注释的程序,我们实现了运行时支持,以解决回溯带来的两个主要挑战。首先,回溯可能要求将在正向执行过程中删除的区域“复活”。其次,必须迅速恢复在计算过程中分配的任何已回溯的内存,而不必等待所涉及的区域的寿命结束。我们将详细描述这两个问题的解决方案。我们将详细研究我们的RBMM系统如何在一系列基准程序上执行,包括一些众所周知的RBMM困难案例。即使遇到这些困难的情况,与具有Boehm运行时垃圾收集器的基本Mercury系统相比,启用RBMM的Mercury系统在18个基准中的15个中仍可获得明显更快的运行时,平均运行时加速为24%,平均内存减少要求95%。实际上,我们的系统在某些程序中实现了最佳的内存消耗。

著录项

相似文献

  • 外文文献
  • 中文文献
  • 专利
获取原文

客服邮箱:kefu@zhangqiaokeyan.com

京公网安备:11010802029741号 ICP备案号:京ICP备15016152号-6 六维联合信息科技 (北京) 有限公司©版权所有
  • 客服微信

  • 服务号