arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1804.02380cs.PL
收藏

具有运行时间检查的程序静态性能保证方法

An Approach to Static Performance Guarantees for Programs with Run-time Checks

Maximiliano Klemen, Nataliia Stulova, Pedro Lopez-Garcia, José F. Morales, Manuel V. Hermenegildo

摘要:

检测程序以执行对属性(例如规则形状)的运行时间检查是帮助程序员检测不正确的程序行为的常见且有用的技术。这在动态语言如Prolog中尤其如此。然而,这种运行时间检查不可避免地引入运行时间开销(在执行时间、存储器、能量等方面)。已经提出了几种方法来减少这种开销,例如消除可以静态地证明总是成功的检查,和/或优化执行(剩余)检查的方式。然而,存在不可能静态地移除所有检查的情况(例如,必须检查其接口、复杂属性、未知代码等的开放库)并且其中即使在优化之后,这些剩余的检查仍然可能引入不可接受的开销水平。因此,对于程序员来说,重要的是能够确定由于运行时间检查而产生的额外成本,并将其与某些可接受成本的概念进行比较。用于估计运行时间检查开销的常见做法是分析,它本质上并不详尽。相反,我们提出了一种方法,使用静态分析来估计这样的开销,其优点是估计是由输入数据大小参数化的函数。与分析不同,这种方法可以为所有可能的执行跟踪提供保证,并允许评估开销如何随着输入大小的增长而增长。我们的方法还扩展了现有的断言验证框架,以表达“可接受的”开销,并静态和自动检查是否符合这些规范的仪表程序。最后,我们提出了我们的方法,表明我们的方法是可行的,有前途的实验评估。

英文摘要:

Instrumenting programs for performing run-time checking of properties, such as regular shapes, is a common and useful technique that helps programmers detect incorrect program behaviors. This is specially true in dynamic languages such as Prolog. However, such run-time checks inevitably introduce run-time overhead (in execution time, memory, energy, etc.). Several approaches have been proposed for reducing such overhead, such as eliminating the checks that can statically be proved to always succeed, and/or optimizing the way in which the (remaining) checks are performed. However, there are cases in which it is not possible to remove all checks statically (e.g., open libraries which must check their interfaces, complex properties, unknown code, etc.) and in which, even after optimizations, these remaining checks still may introduce an unacceptable level of overhead. It is thus important for programmers to be able to determine the additional cost due to the run-time checks and compare it to some notion of admissible cost. The common practice used for estimating run-time checking overhead is profiling, which is not exhaustive by nature. Instead, we propose a method that uses static analysis to estimate such overhead, with the advantage that the estimations are functions parameterized by input data sizes. Unlike profiling, this approach can provide guarantees for all possible execution traces, and allows assessing how the overhead grows as the size of the input grows. Our method also extends an existing assertion verification framework to express "admissible" overheads, and statically and automatically checks whether the instrumented program conforms with such specifications. Finally, we present an experimental evaluation of our approach that suggests that our method is feasible and promising.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑