【24h】

Using the Heap to Eliminate Stack Accesses

机译:使用堆来消除堆栈访问

获取原文

摘要

The value of a variable is often given by a field of a heap cell, and frequently the program will pick up the values of several variables from different fields of the same heap cell. By keeping some of these variables out of the stack frame, and accessing them in their original locations on the heap instead, we can reduce the number of loads from and stores to the stack at the cost of introducing a smaller number of loads from the heap. We present an algorithm that finds the optimal set of variables to access via a heap cell instead of a stack slot, and transforms the code of the program accordingly. We have implemented this optimization in the Mercury compiler, and our measurements show that it can reduce program runtimes by up to 12% while at the same time reducing program size. The optimization is straightforward to apply to Mercury and to other languages with immutable data structures; its adaptation to languages with destructive assignment would require the compiler to perform mutability analysis.
机译:变量的值通常由堆小区的字段给出,并且频繁地,程序将从相同堆小区的不同字段中拾取几个变量的值。通过将这些变量从堆栈框架中保留出来,并在堆上的原始位置访问它们,我们可以以从堆中引入较少数量的负载的成本下减少负载数和存储到堆栈的数量。我们介绍了一种算法,该算法可以通过堆小区而不是堆栈槽来访问最佳变量集,并相应地转换程序的代码。我们在Mercury编译器中实施了这种优化,我们的测量结果表明它可以将程序运行时间降低到12%,同时降低程序大小。优化是直接应用于汞和其他语言的汞和不可变数据结构;它对具有破坏性分配的语言的适应需要编译器来执行可变分析。

著录项

相似文献

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

客服邮箱:kefu@zhangqiaokeyan.com

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

  • 服务号