通過建模對程式碼圖的動態依賴,學習預測程式執行
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