an efficient and parallel abstract interpreter in scala
play

An Efficient and Parallel Abstract Interpreter in Scala - PowerPoint PPT Presentation

Universit e Libre de Bruxelles MEMO-F524 Masters thesis Computer Science Department An Efficient and Parallel Abstract Interpreter in Scala Presentation Olivier Pirson opi@opimedia.be orcid.org/0000-0001-6296-9659 November 27,


  1. Universit´ e Libre de Bruxelles MEMO-F524 Masters thesis Computer Science Department An Efficient and Parallel Abstract Interpreter in Scala — Presentation — Olivier Pirson — opi@opimedia.be orcid.org/0000-0001-6296-9659 November 27, 2017 https:// bitbucket.org/OPiMedia /efficient-parallel-abstract-interpreter-in-scala Promotors Coen De Roover Wolfgang De Meuter Advisor Quentin Stievenart Vrije Universiteit Brussel

  2. An Efficient and Parallel Abstract Interpreter in Scala — Presentation 1 Abstract interpretation for static analysis Abstract interpretation for static analysis 2 Concrete vs abstract interpretation Concrete vs abstract interpretation 3 Parallelism Parallelism Next steps References 4 Next steps 5 References An Efficient and Parallel Abstract Interpreter in Scala — Presentation 2 / 24

  3. How do better than testing? An Efficient and Parallel Abstract “ The first moral of the story is that program testing can be used very Interpreter in Scala effectively to show the presence of bugs but never to show their absence.” — Presentation ( Dijkstra , 1971–1973) Abstract interpretation for static analysis Concrete vs abstract interpretation Parallelism Next steps References Figure: First “flight” of Ariane 5 in 1996. Investigation of Ariane failure: first large-scale example of static analysis by abstract interpretation. An Efficient and Parallel Abstract Interpreter in Scala — Presentation 3 / 24

  4. Static analysis An Efficient and Parallel Abstract Interpreter in Scala — Presentation Abstract Static analysis of program: analysis made without executing program. interpretation for static analysis Concrete vs Goal? Prove some properties of program (like correctness, or some abstract interpretation properties use to transform and optimize program). Or in the opposite, find Parallelism bugs. Next steps References Problem! Undecidable problem (we know that by Rice ’s theorem). An Efficient and Parallel Abstract Interpreter in Scala — Presentation 4 / 24

  5. Static analysis by abstract interpretation Abstract interpretation : An Efficient and Parallel Abstract approximation technique to perform static analysis. Interpreter in Scala — Presentation Based on mathematical notion of partially ordered sets (in particular lattice ). Abstract interpretation for static analysis Difficulty! Find good abstractions: Concrete vs enough precise to prove desired property, abstract interpretation and enough approximate to be decidable (and with doable complexity). Parallelism Next steps References Figure: Ren´ e Magritte , Le Calcul Mental . 1940. An Efficient and Parallel Abstract Interpreter in Scala — Presentation 5 / 24

  6. Example of abstraction An Efficient and { . . . , − 3 , − 2 , − 1 , 0 , 1 , 2 , 3 , . . . } abstracted by � sign = {⊥ , + , � 0 , − , ⊤} Parallel Abstract Interpreter in Scala ⊤ — Presentation − � + Abstract 0 interpretation for static analysis Concrete vs ⊥ abstract interpretation Figure: Hasse diagram of the complete lattice of signs. Parallelism Next steps top ⊤ = { . . . , − 3 , − 2 , − 1 , 0 , 1 , 2 , 3 , . . . } References + = { 1 , 2 , 3 , . . . } � 0 = { 0 } − = {− 1 , − 2 , − 3 , . . . } bottom ⊥ = ∅ May be good abstraction for multiplication operations. With additions, directly loss of precision. An Efficient and Parallel Abstract Interpreter in Scala — Presentation 6 / 24

  7. An Efficient and Parallel Abstract Interpreter in Scala — Presentation 1 Abstract interpretation for static analysis Abstract interpretation for static analysis 2 Concrete vs abstract interpretation Concrete vs abstract interpretation 3 Parallelism Parallelism Next steps References 4 Next steps 5 References An Efficient and Parallel Abstract Interpreter in Scala — Presentation 7 / 24

  8. Concrete interpretation An Efficient and Trace : concrete interpretation with small-step semantics , for one instance. Parallel Abstract Interpreter e in Scala — injection Presentation function Abstract interpretation for s 0 s 1 s 2 s 3 s 4 · · · static analysis Concrete vs concrete transition function abstract interpretation Parallelism Next steps Program is executed by interpreter, described by an Abstract Machine (AM). References One execution is for one instance on this program. e is for one expression, i.e. a program. s i are states during this execution. An Efficient and Parallel Abstract Interpreter in Scala — Presentation 8 / 24

  9. Abstract interpretation An Efficient and Trace : concrete interpretation with small-step semantics , for one instance. Parallel Abstract Interpreter e in Scala — injection Presentation function Abstract � injection interpretation for s 0 s 1 s 2 s 3 s 4 · · · static analysis function Concrete vs abstraction abstract interpretation function α Parallelism � � � � � s 0 s 1 s 2 s 3 s 4 Next steps References abstract transition function � s 3 ′ Abstracting Abstract Machine ( A AM). 2 over-approximations: Finite state space. Abstract transition function returns all directly reachable states. State graph : abstract interpretation, for all instances. “ The abstract simulates the concrete” ( Might ) An Efficient and Parallel Abstract Interpreter in Scala — Presentation 9 / 24

  10. Concrete interpretation Correct program Incorrect program An Efficient and Parallel Abstract Interpreter in Scala — Presentation Abstract interpretation for static analysis Concrete vs abstract Figure: Patrick Cousot . Abstract Interpretation in a Nutshell . interpretation Parallelism Next steps References An Efficient and Parallel Abstract Interpreter in Scala — Presentation 10 / 24

  11. Abstract interpretation Correct program Incorrect program An Efficient and Parallel Abstract Interpreter in Scala — Presentation Abstract interpretation for static analysis Concrete vs abstract Figure: Patrick Cousot . Abstract Interpretation in a Nutshell . interpretation Parallelism Next steps References Correct abstract interpretation Incorrect abstract interpretation An Efficient and Parallel Abstract Interpreter in Scala — Presentation 11 / 24

  12. Abstract interpretation An Efficient and Correct abstract interpretation Incorrect abstract interpretation Parallel Abstract Interpreter in Scala — Presentation Abstract interpretation for static analysis Concrete vs abstract interpretation Figure: Patrick Cousot . Abstract Interpretation in a Nutshell . Parallelism Next steps References Summary of difficulties: Decidability? Soundness vs completeness? ⇒ Parallelism Good complexity vs precision? = An Efficient and Parallel Abstract Interpreter in Scala — Presentation 12 / 24

  13. An Efficient and Parallel Abstract Interpreter in Scala — Presentation 1 Abstract interpretation for static analysis Abstract interpretation for static analysis 2 Concrete vs abstract interpretation Concrete vs abstract interpretation 3 Parallelism Parallelism Next steps References 4 Next steps 5 References An Efficient and Parallel Abstract Interpreter in Scala — Presentation 13 / 24

  14. Goal of the thesis: parallelism to improve speed An Efficient and Parallelism to keep good precision and improve speed. Parallel Abstract Interpreter in Scala — I will parallelize Scala-AM, implemented by Quentin Stievenart . Presentation Target language: Scheme (“simple” but “general”). Abstract interpretation for static analysis Concrete vs abstract interpretation Parallelism Next steps References An Efficient and Parallel Abstract Interpreter in Scala — Presentation 14 / 24

  15. Actor model An Efficient and Actor , like an object, isolated entity with its own encapsulated data and Parallel Abstract Interpreter behaviour. With some fundamental differences. in Scala — Entirely private. Presentation No shared mutable state (so no data race). Communication by immutable asynchronous messages Abstract interpretation for (sent and received sequentially). static analysis Each actor has a mailbox (a queue). Concrete vs abstract Capability to create other actors. interpretation Parallelism Next steps References Figure: Richard Doyle . Using Akka and Scala to Render a Mandelbrot Set . 2014. http://blog.scottlogic.com/2014/08/15/using-akka-and-scala-to-render-a-mandelbrot-set.html An Efficient and Parallel Abstract Interpreter in Scala — Presentation 15 / 24

  16. Akka toolkit An Efficient and Akka: toolkit for Scala (and also Java). Parallel Abstract Interpreter in Scala Concurrent and distributed — (use many cores or several computers without modification). Presentation Reduced overhead. Abstract interpretation for Light implementation of actors static analysis (in 1 GiB memory, possibility of millions actors, Concrete vs instead thousands of threads). abstract interpretation Parallelism Next steps References An Efficient and Parallel Abstract Interpreter in Scala — Presentation 16 / 24

  17. Sequential worklist strategy An Efficient and Parallel Abstract Interpreter in Scala — Presentation s � Abstract � s worklist interpretation for static analysis � s Concrete vs � s abstract interpretation � s Parallelism Next steps References Figure: K. Dewey , V. Kashyap , B. Hardekopf . A parallel abstract interpreter for JavaScript . 2015. An Efficient and Parallel Abstract Interpreter in Scala — Presentation 17 / 24

Recommend


More recommend