Given a program, a quotient can be obtained from it by deleting zero or more statements. The field of program slicing is concerned with computing a quotient of a program which preserves part of the behaviour of the original program. All program slicing algorithms take account of the structural properties of a program such as control dependence and data dependence rather than the semantics of its functions and predicates, and thus work, in effect, with program schemas. The dynamic slicing criterion of Korel and Laski requires only that program behaviour is preserved in cases where the original program follows a particular path, and that the slice/quotient follows this path. In this paper we formalise Korel and Laski's definition of a dynamic slice as applied to linear schemas, and also formulate a less restrictive definition in which the path through the original program need not be preserved by the slice. The less restrictive definition has the benefit of leading to smaller slices. For both definitions, we compute complexity bounds for the problems of establishing whether a given slice of a linear schema is a dynamic slice and whether a linear schema has a non-trivial dynamic slice and prove that the latter problem is NP-hard in both cases. We also give an example to prove that minimal dynamic slices (whether or not they preserve the original path) need not be unique.
程序切片是一种通过关注程序行为的选定方面来简化程序的技术。当前主流的静态切片方法在PDG(程序依赖图)或SDG(系统依赖图)上操作,但是这些友好的图表示对于一些用户来说可能是昂贵的并且容易出错。在本文中,我们试图研究一个轻量级的静态程序切片的方法,称为符号程序切片(Symbolic Program Slicing,SymbolPas),它的工作原理是对LLVM(低级虚拟机)的一个简单的分析。在我们的SymPas方法中,切片是符号化存储的,而不是重新分析的过程(参见。程序摘要)。SymPas不是多次重新分析过程以找到每个调用上下文的切片,而是计算单个符号(或参数化)切片,该切片可以在调用站点实例化,避免重新分析;它在LLVM中实现以对其中间表示(IR)执行切片。为了比较,我们系统地适应IFDS(过程间有限分布子集)分析和基于SDG的切片方法(SDG-IFDS)静态IR切片程序。在开源和基准程序上进行评估,与后向SDG-IFDS相比,我们的后向SymPas显示出时间成本降低了6倍,空间成本降低了4倍,因此更高效。此外,结果表明,在研究了66个程序的切片后,大小范围高达336,800条IR指令,SymPas具有高度的大小可伸缩性。
Static Program Slicing Using Language Models With Dataflow-Aware Pretraining and Constrained Decoding
Department of Computer Science, University of Manitoba(曼尼托巴大学计算机科学系);School of Engineering and Computer Science, Concordia University(Concordia大学工程与计算机科学学院);School of Computer Science, University of Windsor(温莎大学计算机科学学院)