SlideShare a Scribd company logo
Universit´e Libre de Bruxelles
Computer Science Department
MEMO-F524 Masters thesis
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
Vrije Universiteit Brussel
Promotors Coen De Roover
Wolfgang De Meuter
Advisor Quentin Stievenart
An Efficient and
Parallel Abstract
Interpreter
in Scala
—
Presentation
Abstract
interpretation for
static analysis
Concrete vs
abstract
interpretation
Parallelism
Next steps
References
1 Abstract interpretation for static analysis
2 Concrete vs abstract interpretation
3 Parallelism
4 Next steps
5 References
An Efficient and Parallel Abstract Interpreter in Scala — Presentation 2 / 24
An Efficient and
Parallel Abstract
Interpreter
in Scala
—
Presentation
Abstract
interpretation for
static analysis
Concrete vs
abstract
interpretation
Parallelism
Next steps
References
How do better than testing?
“The first moral of the story is that program testing can be used very
effectively to show the presence of bugs but never to show their absence.”
(Dijkstra, 1971–1973)
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
An Efficient and
Parallel Abstract
Interpreter
in Scala
—
Presentation
Abstract
interpretation for
static analysis
Concrete vs
abstract
interpretation
Parallelism
Next steps
References
Static analysis
Static analysis of program: analysis made without executing program.
Goal? Prove some properties of program (like correctness, or some
properties use to transform and optimize program). Or in the opposite, find
bugs.
Problem! Undecidable problem (we know that by Rice’s theorem).
An Efficient and Parallel Abstract Interpreter in Scala — Presentation 4 / 24
An Efficient and
Parallel Abstract
Interpreter
in Scala
—
Presentation
Abstract
interpretation for
static analysis
Concrete vs
abstract
interpretation
Parallelism
Next steps
References
Static analysis by abstract interpretation
Abstract interpretation:
approximation technique to perform static analysis.
Based on mathematical notion of partially ordered sets
(in particular lattice).
Difficulty! Find good abstractions:
enough precise to prove desired property,
and enough approximate to be decidable (and with doable complexity).
Figure: Ren´e Magritte, Le Calcul Mental. 1940.
An Efficient and Parallel Abstract Interpreter in Scala — Presentation 5 / 24
An Efficient and
Parallel Abstract
Interpreter
in Scala
—
Presentation
Abstract
interpretation for
static analysis
Concrete vs
abstract
interpretation
Parallelism
Next steps
References
Example of abstraction
{. . . , −3, −2, −1, 0, 1, 2, 3, . . .} abstracted by sign = {⊥, +, 0, −, ⊤}
⊤
− 0 +
⊥
Figure: Hasse diagram of the complete lattice of signs.
top ⊤ = {. . . , −3, −2, −1, 0, 1, 2, 3, . . .}
+ = {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
An Efficient and
Parallel Abstract
Interpreter
in Scala
—
Presentation
Abstract
interpretation for
static analysis
Concrete vs
abstract
interpretation
Parallelism
Next steps
References
1 Abstract interpretation for static analysis
2 Concrete vs abstract interpretation
3 Parallelism
4 Next steps
5 References
An Efficient and Parallel Abstract Interpreter in Scala — Presentation 7 / 24
An Efficient and
Parallel Abstract
Interpreter
in Scala
—
Presentation
Abstract
interpretation for
static analysis
Concrete vs
abstract
interpretation
Parallelism
Next steps
References
Concrete interpretation
Trace: concrete interpretation with small-step semantics, for one instance.
e
s0 s1 s2 s3 s4 · · ·
injection
function
concrete transition function
Program is executed by interpreter,
described by an Abstract Machine (AM).
One execution is for one instance on this program.
e is for one expression, i.e. a program.
si are states during this execution.
An Efficient and Parallel Abstract Interpreter in Scala — Presentation 8 / 24
An Efficient and
Parallel Abstract
Interpreter
in Scala
—
Presentation
Abstract
interpretation for
static analysis
Concrete vs
abstract
interpretation
Parallelism
Next steps
References
Abstract interpretation
Trace: concrete interpretation with small-step semantics, for one instance.
e
s0 s1 s2 s3 s4 · · ·
s0 s1 s2 s3 s4
s3′
injection
function
injection
function
abstraction
function α
abstract transition function
Abstracting Abstract Machine (AAM).
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
An Efficient and
Parallel Abstract
Interpreter
in Scala
—
Presentation
Abstract
interpretation for
static analysis
Concrete vs
abstract
interpretation
Parallelism
Next steps
References
Concrete interpretation
Correct program Incorrect program
Figure: Patrick Cousot. Abstract Interpretation in a Nutshell.
An Efficient and Parallel Abstract Interpreter in Scala — Presentation 10 / 24
An Efficient and
Parallel Abstract
Interpreter
in Scala
—
Presentation
Abstract
interpretation for
static analysis
Concrete vs
abstract
interpretation
Parallelism
Next steps
References
Abstract interpretation
Correct program Incorrect program
Figure: Patrick Cousot. Abstract Interpretation in a Nutshell.
Correct abstract interpretation Incorrect abstract interpretation
An Efficient and Parallel Abstract Interpreter in Scala — Presentation 11 / 24
An Efficient and
Parallel Abstract
Interpreter
in Scala
—
Presentation
Abstract
interpretation for
static analysis
Concrete vs
abstract
interpretation
Parallelism
Next steps
References
Abstract interpretation
Correct abstract interpretation Incorrect abstract interpretation
Figure: Patrick Cousot. Abstract Interpretation in a Nutshell.
Summary of difficulties:
Decidability?
Soundness vs completeness?
Good complexity vs precision? =⇒ Parallelism
An Efficient and Parallel Abstract Interpreter in Scala — Presentation 12 / 24
An Efficient and
Parallel Abstract
Interpreter
in Scala
—
Presentation
Abstract
interpretation for
static analysis
Concrete vs
abstract
interpretation
Parallelism
Next steps
References
1 Abstract interpretation for static analysis
2 Concrete vs abstract interpretation
3 Parallelism
4 Next steps
5 References
An Efficient and Parallel Abstract Interpreter in Scala — Presentation 13 / 24
An Efficient and
Parallel Abstract
Interpreter
in Scala
—
Presentation
Abstract
interpretation for
static analysis
Concrete vs
abstract
interpretation
Parallelism
Next steps
References
Goal of the thesis: parallelism to improve speed
Parallelism to keep good precision and improve speed.
I will parallelize Scala-AM, implemented by Quentin Stievenart.
Target language: Scheme (“simple” but “general”).
An Efficient and Parallel Abstract Interpreter in Scala — Presentation 14 / 24
An Efficient and
Parallel Abstract
Interpreter
in Scala
—
Presentation
Abstract
interpretation for
static analysis
Concrete vs
abstract
interpretation
Parallelism
Next steps
References
Actor model
Actor, like an object, isolated entity with its own encapsulated data and
behaviour. With some fundamental differences.
Entirely private.
No shared mutable state (so no data race).
Communication by immutable asynchronous messages
(sent and received sequentially).
Each actor has a mailbox (a queue).
Capability to create other actors.
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
An Efficient and
Parallel Abstract
Interpreter
in Scala
—
Presentation
Abstract
interpretation for
static analysis
Concrete vs
abstract
interpretation
Parallelism
Next steps
References
Akka toolkit
Akka: toolkit for Scala (and also Java).
Concurrent and distributed
(use many cores or several computers without modification).
Reduced overhead.
Light implementation of actors
(in 1 GiB memory, possibility of millions actors,
instead thousands of threads).
An Efficient and Parallel Abstract Interpreter in Scala — Presentation 16 / 24
An Efficient and
Parallel Abstract
Interpreter
in Scala
—
Presentation
Abstract
interpretation for
static analysis
Concrete vs
abstract
interpretation
Parallelism
Next steps
References
Sequential worklist strategy
s
s
s
s
s
worklist
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
An Efficient and
Parallel Abstract
Interpreter
in Scala
—
Presentation
Abstract
interpretation for
static analysis
Concrete vs
abstract
interpretation
Parallelism
Next steps
References
Naive worklist parallel strategy
s
s
s
s
s
worklist
merge
Figure: K. Dewey, V. Kashyap, B. Hardekopf. A parallel abstract interpreter for JavaScript. 2015.
An Efficient and Parallel Abstract Interpreter in Scala — Presentation 18 / 24
An Efficient and
Parallel Abstract
Interpreter
in Scala
—
Presentation
Abstract
interpretation for
static analysis
Concrete vs
abstract
interpretation
Parallelism
Next steps
References
Naive worklist parallel strategy
Redundant computations.
Synchronization at the merge step.
Article test on few real JavaScript programs.
Results show that this adaptation of the sequential algorithm is not optimal.
Figure: L. Andersen, M. Might. Multi-core Parallelization of Abstracted. 2013.
I am curious about the results of this algorithm with the lot of little
Scheme programs with Scala-AM.
An Efficient and Parallel Abstract Interpreter in Scala — Presentation 19 / 24
An Efficient and
Parallel Abstract
Interpreter
in Scala
—
Presentation
Abstract
interpretation for
static analysis
Concrete vs
abstract
interpretation
Parallelism
Next steps
References
Better, per-context parallel strategy
Authors introduce a per-context parallel strategy.
The main idea is to separate these two parts:
state exploration
control of state space by some merging operations.
The intuitive idea is to parallelize “functions” instead basic “blocks”.
Figure: K. Dewey, V. Kashyap, B. Hardekopf. A parallel abstract interpreter for JavaScript. 2015.
An Efficient and Parallel Abstract Interpreter in Scala — Presentation 20 / 24
An Efficient and
Parallel Abstract
Interpreter
in Scala
—
Presentation
Abstract
interpretation for
static analysis
Concrete vs
abstract
interpretation
Parallelism
Next steps
References
1 Abstract interpretation for static analysis
2 Concrete vs abstract interpretation
3 Parallelism
4 Next steps
5 References
An Efficient and Parallel Abstract Interpreter in Scala — Presentation 21 / 24
An Efficient and
Parallel Abstract
Interpreter
in Scala
—
Presentation
Abstract
interpretation for
static analysis
Concrete vs
abstract
interpretation
Parallelism
Next steps
References
Next steps
A lot of work!
Become more comfortable with actors paradigm and Akka.
Implement the naive parallel algorithm, and experiment.
Implement better parallel algorithms.
Evaluate all of them and identify problematic parts.
Read more.
. . .
An Efficient and Parallel Abstract Interpreter in Scala — Presentation 22 / 24
An Efficient and
Parallel Abstract
Interpreter
in Scala
—
Presentation
Abstract
interpretation for
static analysis
Concrete vs
abstract
interpretation
Parallelism
Next steps
References
1 Abstract interpretation for static analysis
2 Concrete vs abstract interpretation
3 Parallelism
4 Next steps
5 References
An Efficient and Parallel Abstract Interpreter in Scala — Presentation 23 / 24
An Efficient and
Parallel Abstract
Interpreter
in Scala
—
Presentation
Abstract
interpretation for
static analysis
Concrete vs
abstract
interpretation
Parallelism
Next steps
References
References
Thank you! Questions time. . .
L. Andersen, M. Might. Multi-core Parallelization of Abstracted
Abstract Machines. 2013.
Patrick Cousot. Abstract Interpretation in a Nutshell.
K. Dewey, V. Kashyap, B. Hardekopf. A parallel abstract
interpreter for JavaScript. 2015.
Matthew Might. Tutorial: Small-step CFA. 2011.
Quentin Sti´evenart. Static Analysis of Concurrency Constructs
in Higher-Order Programs. 2014.
D. Van Horn, M. Might. Abstracting Abstract Machines. 2010.
Document, LATEX sources, and complete references on Bitbucket:
https:// Ø Ù
 غÓÖ »ÇÈ Å /efficient-parallel-abstract-interpreter-in-scala
Olivier Pirson. An Efficient and Parallel Abstract Interpreter in
Scala — Preparatory Work. 2017.
An Efficient and Parallel Abstract Interpreter in Scala — Presentation 24 / 24

More Related Content

Similar to An Efficient and Parallel Abstract Interpreter in Scala — Presentation (20)

PDF
An Efficient and Parallel Abstract Interpreter in Scala — Second Presentation
🌳 Olivier Pirson — OPi 🇧🇪🇫🇷🇬🇧 🐧 👨‍💻 👨‍🔬
 
PDF
An Efficient and Parallel Abstract Interpreter in Scala — First Algorithm
🌳 Olivier Pirson — OPi 🇧🇪🇫🇷🇬🇧 🐧 👨‍💻 👨‍🔬
 
PDF
Lecture1
Muhammad Fayyaz
 
PDF
Codemotion akka voló sobre el nido del future
Javier Santos Paniego
 
PDF
Codemotion 2015 - Akka voló sobre el nido del future
scalerablog
 
PPT
Oscon keynote: Working hard to keep it simple
Martin Odersky
 
PDF
Haskell vs. F# vs. Scala
pt114
 
PPT
Devoxx
Martin Odersky
 
PPTX
Principles of functional progrmming in scala
ehsoon
 
PDF
Scala google
Navneet Kumar
 
PDF
A Survey of Concurrency Constructs
Ted Leung
 
PPTX
Concurrency Constructs Overview
stasimus
 
PDF
Google06
Zhiwen Guo
 
PDF
Programming Languages: some news for the last N years
Ruslan Shevchenko
 
PDF
Yoyak ScalaDays 2015
ihji
 
PDF
Ruslan.shevchenko: most functional-day-kiev 2014
Ruslan Shevchenko
 
PPTX
Fp and scala
vikram kadi
 
PPT
scala-intro
Manav Prasad
 
PDF
Reactive Software Systems
Behrad Zari
 
PDF
Functional programming
ijcd
 
An Efficient and Parallel Abstract Interpreter in Scala — Second Presentation
🌳 Olivier Pirson — OPi 🇧🇪🇫🇷🇬🇧 🐧 👨‍💻 👨‍🔬
 
An Efficient and Parallel Abstract Interpreter in Scala — First Algorithm
🌳 Olivier Pirson — OPi 🇧🇪🇫🇷🇬🇧 🐧 👨‍💻 👨‍🔬
 
Lecture1
Muhammad Fayyaz
 
Codemotion akka voló sobre el nido del future
Javier Santos Paniego
 
Codemotion 2015 - Akka voló sobre el nido del future
scalerablog
 
Oscon keynote: Working hard to keep it simple
Martin Odersky
 
Haskell vs. F# vs. Scala
pt114
 
Principles of functional progrmming in scala
ehsoon
 
Scala google
Navneet Kumar
 
A Survey of Concurrency Constructs
Ted Leung
 
Concurrency Constructs Overview
stasimus
 
Google06
Zhiwen Guo
 
Programming Languages: some news for the last N years
Ruslan Shevchenko
 
Yoyak ScalaDays 2015
ihji
 
Ruslan.shevchenko: most functional-day-kiev 2014
Ruslan Shevchenko
 
Fp and scala
vikram kadi
 
scala-intro
Manav Prasad
 
Reactive Software Systems
Behrad Zari
 
Functional programming
ijcd
 

More from 🌳 Olivier Pirson — OPi 🇧🇪🇫🇷🇬🇧 🐧 👨‍💻 👨‍🔬 (6)

Ad

Recently uploaded (20)

PDF
thesis dr Zahida and samia on plasma physics.pdf
HamzaKhalid267437
 
PPTX
Presentation 1 Microbiome Engineering and Synthetic Microbiology.pptx
Prachi Virat
 
PDF
EXploring Nanobiotechnology: Bridging Nanoscience and Biology for real world ...
Aamena3
 
PDF
Webinar: World's Smallest Pacemaker
Scintica Instrumentation
 
PDF
A High-Caliber View of the Bullet Cluster through JWST Strong and Weak Lensin...
Sérgio Sacani
 
PDF
Pharmakon of algorithmic alchemy: Marketing in the age of AI
Selcen Ozturkcan
 
PDF
Carbon-richDustInjectedintotheInterstellarMediumbyGalacticWCBinaries Survives...
Sérgio Sacani
 
PPTX
Systamatic Acquired Resistence (SAR).pptx
giriprasanthmuthuraj
 
PPTX
Neuroinflammation and microglial subtypes
KanakChaudhary10
 
DOCX
Critical Book Review (CBR) - "Hate Speech: Linguistic Perspectives"
Sahmiral Amri Rajagukguk
 
PDF
20250603 Recycling 4.pdf . Rice flour, aluminium, hydrogen, paper, cardboard.
Sharon Liu
 
PDF
RANKING THE MICRO LEVEL CRITICAL FACTORS OF ELECTRONIC MEDICAL RECORDS ADOPTI...
hiij
 
DOCX
Paper - Taboo Language (Makalah Presentasi)
Sahmiral Amri Rajagukguk
 
PDF
Service innovation with AI: Transformation of value proposition and market se...
Selcen Ozturkcan
 
PPTX
Ghent University Global Campus: Overview
Ghent University Global Campus
 
PPTX
Bacillus thuringiensis.crops & golden rice
priyadharshini87125
 
PPTX
Cerebellum_ Parts_Structure_Function.pptx
muralinath2
 
PPTX
CNS.pptx Central nervous system meninges ventricles of brain it's structure a...
Ashwini I Chuncha
 
PPTX
Fetus mudaliar. Obstetrics and gynaecology
Parvathy121069
 
PDF
Global Congress on Forensic Science and Research
infoforensicscience2
 
thesis dr Zahida and samia on plasma physics.pdf
HamzaKhalid267437
 
Presentation 1 Microbiome Engineering and Synthetic Microbiology.pptx
Prachi Virat
 
EXploring Nanobiotechnology: Bridging Nanoscience and Biology for real world ...
Aamena3
 
Webinar: World's Smallest Pacemaker
Scintica Instrumentation
 
A High-Caliber View of the Bullet Cluster through JWST Strong and Weak Lensin...
Sérgio Sacani
 
Pharmakon of algorithmic alchemy: Marketing in the age of AI
Selcen Ozturkcan
 
Carbon-richDustInjectedintotheInterstellarMediumbyGalacticWCBinaries Survives...
Sérgio Sacani
 
Systamatic Acquired Resistence (SAR).pptx
giriprasanthmuthuraj
 
Neuroinflammation and microglial subtypes
KanakChaudhary10
 
Critical Book Review (CBR) - "Hate Speech: Linguistic Perspectives"
Sahmiral Amri Rajagukguk
 
20250603 Recycling 4.pdf . Rice flour, aluminium, hydrogen, paper, cardboard.
Sharon Liu
 
RANKING THE MICRO LEVEL CRITICAL FACTORS OF ELECTRONIC MEDICAL RECORDS ADOPTI...
hiij
 
Paper - Taboo Language (Makalah Presentasi)
Sahmiral Amri Rajagukguk
 
Service innovation with AI: Transformation of value proposition and market se...
Selcen Ozturkcan
 
Ghent University Global Campus: Overview
Ghent University Global Campus
 
Bacillus thuringiensis.crops & golden rice
priyadharshini87125
 
Cerebellum_ Parts_Structure_Function.pptx
muralinath2
 
CNS.pptx Central nervous system meninges ventricles of brain it's structure a...
Ashwini I Chuncha
 
Fetus mudaliar. Obstetrics and gynaecology
Parvathy121069
 
Global Congress on Forensic Science and Research
infoforensicscience2
 
Ad

An Efficient and Parallel Abstract Interpreter in Scala — Presentation

  • 1. Universit´e Libre de Bruxelles Computer Science Department MEMO-F524 Masters thesis An Efficient and Parallel Abstract Interpreter in Scala — Presentation — Olivier Pirson — [email protected] orcid.org/0000-0001-6296-9659 November 27, 2017 https://bitbucket.org/OPiMedia/efficient-parallel-abstract-interpreter-in-scala Vrije Universiteit Brussel Promotors Coen De Roover Wolfgang De Meuter Advisor Quentin Stievenart
  • 2. An Efficient and Parallel Abstract Interpreter in Scala — Presentation Abstract interpretation for static analysis Concrete vs abstract interpretation Parallelism Next steps References 1 Abstract interpretation for static analysis 2 Concrete vs abstract interpretation 3 Parallelism 4 Next steps 5 References An Efficient and Parallel Abstract Interpreter in Scala — Presentation 2 / 24
  • 3. An Efficient and Parallel Abstract Interpreter in Scala — Presentation Abstract interpretation for static analysis Concrete vs abstract interpretation Parallelism Next steps References How do better than testing? “The first moral of the story is that program testing can be used very effectively to show the presence of bugs but never to show their absence.” (Dijkstra, 1971–1973) 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. An Efficient and Parallel Abstract Interpreter in Scala — Presentation Abstract interpretation for static analysis Concrete vs abstract interpretation Parallelism Next steps References Static analysis Static analysis of program: analysis made without executing program. Goal? Prove some properties of program (like correctness, or some properties use to transform and optimize program). Or in the opposite, find bugs. Problem! Undecidable problem (we know that by Rice’s theorem). An Efficient and Parallel Abstract Interpreter in Scala — Presentation 4 / 24
  • 5. An Efficient and Parallel Abstract Interpreter in Scala — Presentation Abstract interpretation for static analysis Concrete vs abstract interpretation Parallelism Next steps References Static analysis by abstract interpretation Abstract interpretation: approximation technique to perform static analysis. Based on mathematical notion of partially ordered sets (in particular lattice). Difficulty! Find good abstractions: enough precise to prove desired property, and enough approximate to be decidable (and with doable complexity). Figure: Ren´e Magritte, Le Calcul Mental. 1940. An Efficient and Parallel Abstract Interpreter in Scala — Presentation 5 / 24
  • 6. An Efficient and Parallel Abstract Interpreter in Scala — Presentation Abstract interpretation for static analysis Concrete vs abstract interpretation Parallelism Next steps References Example of abstraction {. . . , −3, −2, −1, 0, 1, 2, 3, . . .} abstracted by sign = {⊥, +, 0, −, ⊤} ⊤ − 0 + ⊥ Figure: Hasse diagram of the complete lattice of signs. top ⊤ = {. . . , −3, −2, −1, 0, 1, 2, 3, . . .} + = {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 Abstract interpretation for static analysis Concrete vs abstract interpretation Parallelism Next steps References 1 Abstract interpretation for static analysis 2 Concrete vs abstract interpretation 3 Parallelism 4 Next steps 5 References An Efficient and Parallel Abstract Interpreter in Scala — Presentation 7 / 24
  • 8. An Efficient and Parallel Abstract Interpreter in Scala — Presentation Abstract interpretation for static analysis Concrete vs abstract interpretation Parallelism Next steps References Concrete interpretation Trace: concrete interpretation with small-step semantics, for one instance. e s0 s1 s2 s3 s4 · · · injection function concrete transition function Program is executed by interpreter, described by an Abstract Machine (AM). One execution is for one instance on this program. e is for one expression, i.e. a program. si are states during this execution. An Efficient and Parallel Abstract Interpreter in Scala — Presentation 8 / 24
  • 9. An Efficient and Parallel Abstract Interpreter in Scala — Presentation Abstract interpretation for static analysis Concrete vs abstract interpretation Parallelism Next steps References Abstract interpretation Trace: concrete interpretation with small-step semantics, for one instance. e s0 s1 s2 s3 s4 · · · s0 s1 s2 s3 s4 s3′ injection function injection function abstraction function α abstract transition function Abstracting Abstract Machine (AAM). 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. An Efficient and Parallel Abstract Interpreter in Scala — Presentation Abstract interpretation for static analysis Concrete vs abstract interpretation Parallelism Next steps References Concrete interpretation Correct program Incorrect program Figure: Patrick Cousot. Abstract Interpretation in a Nutshell. An Efficient and Parallel Abstract Interpreter in Scala — Presentation 10 / 24
  • 11. An Efficient and Parallel Abstract Interpreter in Scala — Presentation Abstract interpretation for static analysis Concrete vs abstract interpretation Parallelism Next steps References Abstract interpretation Correct program Incorrect program Figure: Patrick Cousot. Abstract Interpretation in a Nutshell. Correct abstract interpretation Incorrect abstract interpretation An Efficient and Parallel Abstract Interpreter in Scala — Presentation 11 / 24
  • 12. An Efficient and Parallel Abstract Interpreter in Scala — Presentation Abstract interpretation for static analysis Concrete vs abstract interpretation Parallelism Next steps References Abstract interpretation Correct abstract interpretation Incorrect abstract interpretation Figure: Patrick Cousot. Abstract Interpretation in a Nutshell. Summary of difficulties: Decidability? Soundness vs completeness? Good complexity vs precision? =⇒ Parallelism An Efficient and Parallel Abstract Interpreter in Scala — Presentation 12 / 24
  • 13. An Efficient and Parallel Abstract Interpreter in Scala — Presentation Abstract interpretation for static analysis Concrete vs abstract interpretation Parallelism Next steps References 1 Abstract interpretation for static analysis 2 Concrete vs abstract interpretation 3 Parallelism 4 Next steps 5 References An Efficient and Parallel Abstract Interpreter in Scala — Presentation 13 / 24
  • 14. An Efficient and Parallel Abstract Interpreter in Scala — Presentation Abstract interpretation for static analysis Concrete vs abstract interpretation Parallelism Next steps References Goal of the thesis: parallelism to improve speed Parallelism to keep good precision and improve speed. I will parallelize Scala-AM, implemented by Quentin Stievenart. Target language: Scheme (“simple” but “general”). An Efficient and Parallel Abstract Interpreter in Scala — Presentation 14 / 24
  • 15. An Efficient and Parallel Abstract Interpreter in Scala — Presentation Abstract interpretation for static analysis Concrete vs abstract interpretation Parallelism Next steps References Actor model Actor, like an object, isolated entity with its own encapsulated data and behaviour. With some fundamental differences. Entirely private. No shared mutable state (so no data race). Communication by immutable asynchronous messages (sent and received sequentially). Each actor has a mailbox (a queue). Capability to create other actors. 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. An Efficient and Parallel Abstract Interpreter in Scala — Presentation Abstract interpretation for static analysis Concrete vs abstract interpretation Parallelism Next steps References Akka toolkit Akka: toolkit for Scala (and also Java). Concurrent and distributed (use many cores or several computers without modification). Reduced overhead. Light implementation of actors (in 1 GiB memory, possibility of millions actors, instead thousands of threads). An Efficient and Parallel Abstract Interpreter in Scala — Presentation 16 / 24
  • 17. An Efficient and Parallel Abstract Interpreter in Scala — Presentation Abstract interpretation for static analysis Concrete vs abstract interpretation Parallelism Next steps References Sequential worklist strategy s s s s s worklist 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
  • 18. An Efficient and Parallel Abstract Interpreter in Scala — Presentation Abstract interpretation for static analysis Concrete vs abstract interpretation Parallelism Next steps References Naive worklist parallel strategy s s s s s worklist merge Figure: K. Dewey, V. Kashyap, B. Hardekopf. A parallel abstract interpreter for JavaScript. 2015. An Efficient and Parallel Abstract Interpreter in Scala — Presentation 18 / 24
  • 19. An Efficient and Parallel Abstract Interpreter in Scala — Presentation Abstract interpretation for static analysis Concrete vs abstract interpretation Parallelism Next steps References Naive worklist parallel strategy Redundant computations. Synchronization at the merge step. Article test on few real JavaScript programs. Results show that this adaptation of the sequential algorithm is not optimal. Figure: L. Andersen, M. Might. Multi-core Parallelization of Abstracted. 2013. I am curious about the results of this algorithm with the lot of little Scheme programs with Scala-AM. An Efficient and Parallel Abstract Interpreter in Scala — Presentation 19 / 24
  • 20. An Efficient and Parallel Abstract Interpreter in Scala — Presentation Abstract interpretation for static analysis Concrete vs abstract interpretation Parallelism Next steps References Better, per-context parallel strategy Authors introduce a per-context parallel strategy. The main idea is to separate these two parts: state exploration control of state space by some merging operations. The intuitive idea is to parallelize “functions” instead basic “blocks”. Figure: K. Dewey, V. Kashyap, B. Hardekopf. A parallel abstract interpreter for JavaScript. 2015. An Efficient and Parallel Abstract Interpreter in Scala — Presentation 20 / 24
  • 21. An Efficient and Parallel Abstract Interpreter in Scala — Presentation Abstract interpretation for static analysis Concrete vs abstract interpretation Parallelism Next steps References 1 Abstract interpretation for static analysis 2 Concrete vs abstract interpretation 3 Parallelism 4 Next steps 5 References An Efficient and Parallel Abstract Interpreter in Scala — Presentation 21 / 24
  • 22. An Efficient and Parallel Abstract Interpreter in Scala — Presentation Abstract interpretation for static analysis Concrete vs abstract interpretation Parallelism Next steps References Next steps A lot of work! Become more comfortable with actors paradigm and Akka. Implement the naive parallel algorithm, and experiment. Implement better parallel algorithms. Evaluate all of them and identify problematic parts. Read more. . . . An Efficient and Parallel Abstract Interpreter in Scala — Presentation 22 / 24
  • 23. An Efficient and Parallel Abstract Interpreter in Scala — Presentation Abstract interpretation for static analysis Concrete vs abstract interpretation Parallelism Next steps References 1 Abstract interpretation for static analysis 2 Concrete vs abstract interpretation 3 Parallelism 4 Next steps 5 References An Efficient and Parallel Abstract Interpreter in Scala — Presentation 23 / 24
  • 24. An Efficient and Parallel Abstract Interpreter in Scala — Presentation Abstract interpretation for static analysis Concrete vs abstract interpretation Parallelism Next steps References References Thank you! Questions time. . . L. Andersen, M. Might. Multi-core Parallelization of Abstracted Abstract Machines. 2013. Patrick Cousot. Abstract Interpretation in a Nutshell. K. Dewey, V. Kashyap, B. Hardekopf. A parallel abstract interpreter for JavaScript. 2015. Matthew Might. Tutorial: Small-step CFA. 2011. Quentin Sti´evenart. Static Analysis of Concurrency Constructs in Higher-Order Programs. 2014. D. Van Horn, M. Might. Abstracting Abstract Machines. 2010. Document, LATEX sources, and complete references on Bitbucket: https:// Ø Ù ØºÓÖ »ÇÈ Å /efficient-parallel-abstract-interpreter-in-scala Olivier Pirson. An Efficient and Parallel Abstract Interpreter in Scala — Preparatory Work. 2017. An Efficient and Parallel Abstract Interpreter in Scala — Presentation 24 / 24