Finding Optimum Abstractions in Parametric Dataflow Analysis

Finding Optimum Abstractions in Parametric Dataflow Analysis

Finding Optimum Abstractions in Parametric Dataflow Analysis Xin Zhang Mayur Naik Hongseok Yang Georgia Institute of Technology, USA Georgia Institute of Technology, USA University of Oxford, UK [email protected] [email protected] [email protected] Abstract (CEGAR) but differs radically in how it analyzes an abstract coun- We propose a technique to efficiently search a large family of ab- terexample trace: it computes a sufficient condition for the failure stractions in order to prove a query using a parametric dataflow of the analysis to prove the query along the trace. The condition analysis. Our technique either finds the cheapest such abstraction represents a set of abstractions such that the analysis instantiated or shows that none exists. It is based on counterexample-guided using any abstraction in this set is guaranteed to fail to prove the abstraction refinement but applies a novel meta-analysis on abstract query. Our technique finds such unviable abstractions by doing a counterexample traces to efficiently find abstractions that are inca- backward analysis on the trace. This backward analysis is a meta- pable of proving the query. We formalize the technique in a generic analysis that must be proven sound with respect to the abstract se- framework and apply it to two analyses: a type-state analysis and mantics of the forward analysis. Scalability of backward analyses is a thread-escape analysis. We demonstrate the effectiveness of the typically hindered by exploring program states that are unreachable technique on a suite of Java benchmark programs. from the initial state. Our backward analysis avoids this problem as it is guided by the trace from the forward analysis. This trace also Categories and Subject Descriptors D.2.4 [SOFTWARE EN- enables our backward analysis to do under-approximation while GINEERING]: Software/Program Verification; F.3.2 [LOGICS guaranteeing to find a non-empty set of unviable abstractions. AND MEANINGS OF PROGRAMS]: Semantics of Programming Like the forward analysis, the backward meta-analysis is a static Languages—Program analysis analysis, and the performance of our technique depends on how this meta-analysis balances its own precision and cost. If it does General Terms Languages, Verification under-approximation aggressively, it analyzes the trace efficiently Keywords Dataflow analysis, CEGAR, abstraction refinement, but finds only the current abstraction unviable and needs more itera- optimum abstraction, impossibility, under-approximation tions to converge. On the other hand, if it does under-approximation passively, it analyzes the trace inefficiently but finds many abstrac- 1. Introduction tions unviable and needs fewer iterations. We present a generic framework to develop an efficient meta-analysis, which involves A central problem in static analysis concerns how to balance its choosing an abstract domain, devising (backward) transfer func- precision and cost. A query-driven analysis seeks to address this tions, and proving these functions sound with respect to the forward problem by searching for an abstraction that discards program analysis. Our framework uses a generic DNF representation of for- details that are unnecessary for proving an individual query. mulas in the domain and provides generic optimizations to scale We consider query-driven dataflow analyses that are parametric the meta-analysis. We show the applicability of the framework to in the abstraction. The abstraction is chosen from a large family two analyses: a type-state analysis and a thread-escape analysis. that allow abstracting different parts of a program with varying We evaluate our technique using these two client analyses on precision. A large number of fine-grained abstractions enables an seven Java benchmark programs of 400K–600K bytecodes each. analysis to specialize to a query but poses a hard search problem in Both analyses are fully flow- and context-sensitive with 2N pos- practice. First, the number of abstractions is infinite or intractably sible abstractions, where N is the number of pointer variables for large to search na¨ıvely, with most abstractions in the family being type-state analysis, and the number of object allocation sites for too imprecise or too costly to prove a particular query. Second, thread-escape analysis. The technique finds the cheapest abstrac- proving queries in different parts of the same program requires tion or shows that none exists for 92.5% of queries posed on aver- different abstractions. Finally, a query might be unprovable by all age per client analysis per benchmark program. abstractions in the family, either because the query is not true or We summarize the main contributions of this paper: due to limitations of the analysis at hand. We propose an efficient technique to solve the above search • We formulate the optimum abstraction problem for parametric problem. It either finds the cheapest abstraction in the family that dataflow analysis. The formulation seeks a cheapest abstraction proves a query or shows that no abstraction in the family can prove that proves the query or an impossibility result that none exists. the query. We call this the optimum abstraction problem. Our tech- nique is based on counterexample-guided abstraction refinement • We present a new refinement-based technique to solve the prob- lem. The key idea is a meta-analysis that analyzes counterexam- ples to find abstractions that are incapable of proving the query. Permission to make digital or hard copies of all or part of this work for personal or • We present a generic framework to design the meta-analysis classroom use is granted without fee provided that copies are not made or distributed along with an efficient representation and optimizations to scale for profit or commercial advantage and that copies bear this notice and the full citation it. We apply the framework to two analyses in the literature. on the first page. To copy otherwise, to republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. • We demonstrate the efficacy of our technique in practice on the PLDI’13, June 16–19, 2013, Seattle, WA, USA. two analyses, a type-state analysis and a thread-escape analysis, Copyright c 2013 ACM 978-1-4503-2014-6/13/06. $10.00 for several real-world Java benchmark programs. The rest of the paper is organized as follows. Section 2 illus- cannot be in the closed state after the call. This is because the trates our technique on an example. Section 3 formalizes paramet- analysis does a weak update as x is not in the must-alias set of ric dataflow analysis and the optimum abstraction problem. We first the incoming abstract state. define a generic framework and then apply it to our two example At this point our technique has eliminated abstraction π = fg analyses. Section 4 presents our meta-analysis, first in a generic set- as incapable of proving query check 1 and must determine which ting and then for a domain that suffices for our two analyses. Sec- abstraction to try next. Since the number of abstractions is large, tion 5 gives our overall algorithm and Section 6 presents empirical however, it first analyzes the trace to eliminate abstractions that results. Section 7 discusses related work and Section 8 concludes. are guaranteed to suffer a failure similar to the current one. It does so by performing a backward meta-analysis that inspects the 2. Example trace backwards and analyzes the result of the (forward) type- state analysis. This meta-analysis is itself a static analysis and the We illustrate our technique using the program in Figure 1(a). The abstract states it computes are denoted by " in Figure 1(c). Each program operates on a File object which can be in either state abstract state of the meta-analysis represents a set of pairs (d; π) opened or closed at any instant. It begins in state closed upon consisting of an abstract state d of the forward analysis and an creation, transitions to state opened after the call to open(), and abstraction π. An abstract state of the meta-analysis is a boolean back to state closed after the call to close(). Suppose that it is formula over primitives of the form: (1) err representing the set of an error to call open() in the opened state, or to call close() in pairs where the d component is >; (2) closed 2 ts representing the closed state. Statements check and check at the end of the 1 2 the set of pairs where the d component is hts; vsi and ts contains program are queries which ask whether the state of the File object closed; (3) x 2 vs which is analogous to (2) except that vs contains is closed or opened, respectively, at the end of every program run. x; and (4) x 2 π meaning the π component contains x. A static type-state analysis can be used to conservatively answer The meta-analysis starts with the weakest formula under which such queries. Such an analysis must track aliasing relationships check fails, which is err _ (opened 2 ts), and propagates its between pointer variables in order to track the state of objects 1 weakest precondition at each step of the trace to obtain formula correctly and precisely. For instance, in our example program, the (closed 2 ts) ^ (opened 2= ts) ^ (x2 = π) at the start of the trace. analysis must infer that variables x and y point to the same File This formula implies that any abstraction not containing variable x object in order to prove query check . Analyses that track more 1 cannot prove query check . Our meta-analysis has two notable as- program facts are typically more precise but also more costly. A 1 pects.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    19 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us