Flow2Vec: value-flow-based precise code embedding

Author:

Sui Yulei1ORCID,Cheng Xiao2,Zhang Guanqin1,Wang Haoyu2

Affiliation:

1. University of Technology Sydney, Australia

2. Beijing University of Posts and Telecommunications, China

Abstract

Code embedding, as an emerging paradigm for source code analysis, has attracted much attention over the past few years. It aims to represent code semantics through distributed vector representations, which can be used to support a variety of program analysis tasks (e.g., code summarization and semantic labeling). However, existing code embedding approaches are intraprocedural, alias-unaware and ignoring the asymmetric transitivity of directed graphs abstracted from source code, thus they are still ineffective in preserving the structural information of code. This paper presents Flow2Vec, a new code embedding approach that precisely preserves interprocedural program dependence (a.k.a value-flows). By approximating the high-order proximity, i.e., the asymmetric transitivity of value-flows, Flow2Vec embeds control-flows and alias-aware data-flows of a program in a low-dimensional vector space. Our value-flow embedding is formulated as matrix multiplication to preserve context-sensitive transitivity through CFL reachability by filtering out infeasible value-flow paths. We have evaluated Flow2Vec using 32 popular open-source projects. Results from our experiments show that Flow2Vec successfully boosts the performance of two recent code embedding approaches codevec and codeseq for two client applications, i.e., code classification and code summarization. For code classification, Flow2Vec improves codevec with an average increase of 21.2%, 20.1% and 20.7% in precision, recall and F1, respectively. For code summarization, Flow2Vec outperforms codeseq by an average of 13.2%, 18.8% and 16.0% in precision, recall and F1, respectively.

Funder

Australian Research Council

Publisher

Association for Computing Machinery (ACM)

Subject

Safety, Risk, Reliability and Quality,Software

Reference69 articles.

1. Practical change impact analysis based on static program slicing for industrial software systems

2. Miltiadis Allamanis Earl T Barr Christian Bird and Charles Sutton. 2015. Suggesting Accurate Method and Class Names. In FSE' 15. 38ś49. Miltiadis Allamanis Earl T Barr Christian Bird and Charles Sutton. 2015. Suggesting Accurate Method and Class Names. In FSE' 15. 38ś49.

3. Miltiadis Allamanis Marc Brockschmidt and Mahmoud Khademi. 2018. Learning to represent programs with graphs. ( 2018 ). Miltiadis Allamanis Marc Brockschmidt and Mahmoud Khademi. 2018. Learning to represent programs with graphs. ( 2018 ).

4. Uri Alon Shaked Brody Omer Levy and Eran Yahav. 2019a. code2seq: Generating sequences from structured representations of code. ICLR ' 19 ( 2019 ). Uri Alon Shaked Brody Omer Levy and Eran Yahav. 2019a. code2seq: Generating sequences from structured representations of code. ICLR ' 19 ( 2019 ).

Cited by 53 articles. 订阅此论文施引文献 订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献

同舟云学术

1.学者识别学者识别

2.学术分析学术分析

3.人才评估人才评估

"同舟云学术"是以全球学者为主线,采集、加工和组织学术论文而形成的新型学术文献查询和分析系统,可以对全球学者进行文献检索和人才价值评估。用户可以通过关注某些学科领域的顶尖人物而持续追踪该领域的学科进展和研究前沿。经过近期的数据扩容,当前同舟云学术共收录了国内外主流学术期刊6万余种,收集的期刊论文及会议论文总量共计约1.5亿篇,并以每天添加12000余篇中外论文的速度递增。我们也可以为用户提供个性化、定制化的学者数据。欢迎来电咨询!咨询电话:010-8811{复制后删除}0370

www.globalauthorid.com

TOP

Copyright © 2019-2024 北京同舟云网络信息技术有限公司
京公网安备11010802033243号  京ICP备18003416号-3