Refactorings must not alter the program's functionality. However, not all refactorings fulfill this requirement. Hence, one must explicitly check that a refactoring does not alter the functionality. Since one rarely has a formal specification of the program's behavior, we utilize the original program as functional specification. Then, we check whether the original and refactored program are functionally equivalent. To this end, we apply a common idea and reduce equivalence checking to program verification. To increase efficiency, our equivalence checker PEQcheck constructs one verification task per refactored code segment instead of one per function as typically done by prior work. In addition, PEQcheck considers the context of the code segments. For instance, only variables that are modified and live are required to be equivalent and read-only variables may be shared between original and refactored code segments. We show that PEQcheck is sound.Moreover, our evaluation testifies that the localized and context-aware checking performed by \peqcheck can indeed be beneficial.
翻译:重新设定不能改变程序的功能。 但是, 并非所有的重新设定都符合此要求。 因此, 人们必须明确检查一个重新设定不会改变功能。 因为很少有人能正式指定程序的行为, 我们使用原始程序作为功能性规范。 然后, 我们检查原始和再设定程序是否在功能上等同。 为此, 我们应用了一个共同的想法, 并减少对等性检查程序验证。 为了提高效率, 我们的等同检查器 PEQcheck 将每个重新设定的代码部分构建一个核查任务, 而不是先前工作通常完成的每个功能。 此外, PEQ check 考虑代码部分的上下文。 例如, 仅需要修改和实时变量, 才能在原始和再设定代码部分之间共享。 我们显示 PEQ check是健全的。 更新后, 我们的评估证明\peqeck 所执行的本地和上下文检查确实有益 。