一句话:提出基于图卷积缺失特征与双任务学习的 DeMinify,联合恢复变量名并推断类型。
为避免源码泄露,变量名常被替换为简短无意义名称,导致代码难以理解和分析。DeMinify 将变量名与类型恢复建模为图卷积网络中的缺失特征预测:图编码变量间及其类型间关系,部分节点名称或类型缺失;双任务学习让两者相互影响。作者在含18万个方法的 Python 数据集和含32.2万个文件的 JavaScript 数据集上评估。变量名预测单次建议在 Python/JS 上分别达76.7%/81.6%正确率;相比最优变量名恢复,top-1相对提升15.3%–40.7%和7.7%–49.7%,类型预测top-1相对提升14.5%–51.9%。类型学习有助于变量名恢复,反之亦然。
To avoid the exposure of original source code, the variable names deployed in the wild are often replaced by short, meaningless names, thus making the code difficult to understand and be analyzed. We introduce DeMinify, a Deep-Learning (DL)-based approach that formulates such recovery problem as the prediction of missing features in a Graph Convolutional Network–Missing Features. The graph represents both the relations among the variables and the relations among their types, in which the names or types of some nodes are missing. Moreover, DeMinify leverages dual-task learning to propagate the mutual impact between the learning of the variable names and that of their types. We conducted experiments to evaluate DeMinify in both name recovery and type prediction on a Python dataset with 180k methods and a JavaScript (JS) dataset with 322k files. For variable name prediction, in 76.7% and 81.6% of the cases in Python and JS code respectively, DeMinify can predict correctly the variables' names with a single suggested name. DeMinify relatively improves 15.3%–40.7% and 7.7%–49.7% in top-1 accuracy over the state-of-the-art variable name recovery approaches for Python and JS code, respectively. It also relatively improves 14.5%–51.9% in top-1 accuracy over the existing type prediction approaches. Our experimental results showed that learning of data types helps improve variable name recovery and vice versa.