通过建模对代码图的动态依赖关系,学习预测程序执行
Learning to Predict Program Execution by Modeling Dynamic Dependency on Code Graphs
August 5, 2024
作者: Cuong Chi Le, Hoang Nhat Phan, Huy Nhat Phan, Tien N. Nguyen, Nghi D. Q. Bui
cs.AI
摘要
在软件工程中,预测程序行为而无需执行是一项重要且具有挑战性的任务。传统模型通常难以捕捉代码中的动态依赖关系和交互。本文介绍了一种名为CodeFlowrepresents的新型基于机器学习的框架,通过动态依赖关系学习来预测代码覆盖率并检测运行时错误。利用控制流图(CFGs),CodeFlowrepresents展现了所有可能的执行路径和不同语句之间的关系,提供了对程序行为的全面理解。它构建CFGs来描述执行路径,并为CFG节点学习向量表示,捕捉静态控制流依赖关系。此外,它通过执行跟踪学习动态依赖关系,反映了执行过程中语句之间的影响。这种方法能够准确预测代码覆盖率并识别运行时错误。实证评估显示,在代码覆盖率预测准确性和有效定位运行时错误方面取得了显著改进,超越了当前模型。
English
Predicting program behavior without execution is an essential and challenging
task in software engineering. Traditional models often struggle to capture
dynamic dependencies and interactions within code. This paper introduces a
novel machine learning-based framework called CodeFlowrepresents, which
predicts code coverage and detects runtime errors through Dynamic Dependencies
Learning. Utilizing control flow graphs (CFGs), CodeFlowrepresents all possible
execution paths and the relationships between different statements, offering a
comprehensive understanding of program behavior. It constructs CFGs to depict
execution paths and learns vector representations for CFG nodes, capturing
static control-flow dependencies. Additionally, it learns dynamic dependencies
through execution traces, which reflect the impacts among statements during
execution. This approach enables accurate prediction of code coverage and
identification of runtime errors. Empirical evaluations show significant
improvements in code coverage prediction accuracy and effective localization of
runtime errors, surpassing current models.Summary
AI-Generated Summary