Flow-Augmented Call Graph: A New Foundation for Taming API Complexity Qirun Zhang
2 Past work: Taming API Complexity Future plan: in the Presence of Pointers
Outline Background Approach Evaluation Conclusion Q&A 3
Background 4
Motivation 5 Background
A Flow-Augmented Call Graph (FACG) G = (N,E) for procedure P is a directed multigraph in which each node n corresponds to either a caller P or a callee Q, and each weighted edge e represents a call-site augmented with control flow. Call GraphFlow-Augmented Call Graph 6
Background 7 What is the insight of FACG?
Background Why taming API complexity? – For Software maintenances – Most of software are not documented well – For API documentation maintenances Apache Project alsoPercentage % % 8 scpSEE ALSO rcp(1), sftp(1), ssh(1), ssh-add(1), ssh- agent(1), ssh-keygen(1), ssh_config(5), sshd(8)
Background Research solutions – How API is used PLDI-05, OOPSLA-06, ECOOP-09, ASE-07, ICSE-05, AOSD-07 – How API is implemented Suade (FSE-05), Fran(FSE-07), Altair(FSE-09) 9
Approach 10
Approach Overview 11
Approach Parsing & Hashing – How to parse the source code? – What kind of elements should be extracted? Solution gcc Gimple IR API call-site, basic block, conditional block. Build the CFG 12
Approach Handling Function Pointers – Collecting the path conditions – Over-approximate the program behavior – Testing the validation by SMT solver 13
Approach Reducing CFG – The CFG considered [1] – Eliminate the back edge [2] – Unroll the loop once [1] Podgurski, A., Lori, Clarke, A.: A formal model of program dependences and its implications for software testing, debugging, and maintenance. IEEE Transactions on Software Engineering 16, 965–979 (1990) [2] Ramanathan, M.K., Grama, A., Jagannathan, S.: Path-sensitive inference of function precedence protocols. In: ICSE. pp. 240–250 (2007) 14
Approach Calculating the Flow of Callees – The inflow of the basic block associated with Q – The outflow of the basic block associated with Q 15
Approach Augmenting the Call graph Call GraphFlow-Augmented Call Graph 16
17 Augmenting the Call graph Approach
Recommending API – Computing Cosine similarities 18 g0h0g1h1g2 f f f200011
Evaluation 19
Evaluation Subject Project Experimental Setup – A specific task suggested by Fran [2]: Given a query API, retrieve other APIs in the same module – Module is defined by original documentation 20 [2] Saul, Z.M., Filkov, V., Devanbu, P.T., Bird, C.: Recommending random walks. In: ESEC/SIGSOFT FSE. pp. 15–24 (2007) 20
Evaluation Case study 21
Evaluation Quantitative evaluation – Compare the F1 according to the original documentation 22
Evaluation The impact of FACG Without FACG With FACG 23
Conclusion 24
Conclusion Our contribution – We proposed the Flow-Augmented Call Graph – We applied FACG on API recommendation. Our approach could advance the state-of-the-arts – We developed a framework for program analysis by Gcc. Future work – Recommendation system? – Static analysis? – SMT solving? 25
Q&A Thanks! 26
27