Faster Algorithms for Weighted Recursive State Machines Krishnendu Chatterjee Bernhard Kragl Samarth Mishra Andreas Pavlogiannis
Recursive State Machines (RSMs) β³ 1 Formal model of recursive computation B Linearly equivalent to pushdown A C systems (PDSs) π 1 : β³ 2 Advantages: β³ 2 β’ Natural modeling D F β’ Many parameters G β Number of modules π π 2 : β³ E 1 β Entry bound π π = max πΉπ π π β Exit bound π π¦ = max |πΉπ¦ π | π π΅, π β πΉ, π 1 β π΅, π 2 π 1 β π = max min( πΉπ π , |πΉπ¦ π |) β πΆ, π 2 π 1 β π 2 , π· , π 1 π β β¦ β β© π 1 , π» , πβͺ 2
RSMs over Semirings Label RSM transitions with weights from idempotent semiring β©π,β,β, 0,1βͺ weight of computation: β weight of computation set: β πΏ β β 0 1 πΊ β¨ β§ β₯ β€ Reachability β + βͺ {β} + β Shortest path min 0 [0,1] β Most probable path max 0 1 π 2 πΈ β β ππ¦. β€ ππ¦. π¦ 2 πΈ IFDS Canonical partial order Monotonicity π β€ π β π β π = π π β€ π β π β π β€ π β π Finite-height: πΌ β β longest descending chain in β€ 3
Distance Problems Given a set of initial configurations π β’ Configuration distance π π, π£, π 1 β― b π β’ Superconfiguration distance π π, π£, β³ 1 β― β³ π β’ Node distance π π, π£ 4
Our Solution 1. Configuration automata Representation structures for sets of RSM configurations [BEMβ97] Initial automaton π· , s.t. β π· = π 2. Dynamic programming algorithm Compute π· β , representing reachable configurations and distances Key: Entry-to- Exit summaries [ABEGRYβ05] 3. Distance extraction algorithms Query configuration/superconfiguration/node distances from π· β 5
Configuration Automata run assembles states correspond a stack to RSM nodes π£ π|π€ 1 β― π|π€ 2 π πβ² π π|π€ 4 π£β² β©π£, π β― βͺ is an accepted configuration Weight of configuration is β¨ over all accepting runs 6
Relaxation Steps π€ 2 π£β² Exit transition: π£ π¦ Internal transition: π£ π|π€ 1 π|π€ π|π€ 2 π£ π π£ π πβ² π| β¦ β¨(π€ 1 β v 2 ) π β¦ β (π€ 2 β π‘π£π π, π¦ π‘π£π π, π¦ π£β² β©π, π¦βͺ : = β― β π€ π€ 2 π, π β² Using summary: π‘π£π π β² , π¦ Call transition: π£ π|π€ 1 π|π€ π£ π πβ² π π| β¦ β π€ β π‘π£π π β² , π¦ π| β¦ β (π€ 1 β π€ 2 ) πβ² β©π, π¦βͺ 7
Reachability Example F β³ Summaries: 1 π π΅ β π· B πΉ β π» πΈ β π» A C D π 1 : β³ 2 π 1 π π β©π 1 , π»βͺ A B β³ 2 π 1 π 2 D F G E π 2 : β³ E 1 π β©π 2 , π·βͺ 8
Correctness and Complexity For every configuration π : π β π· , π = π· β (π) π· β is constructed in time π« πΌ β β β π π + π π β π π¦ β π·πππ Compared to PDS algorithm π« πΌ β β β π π β π π¦ β π β β π Factor ππ¦ + π·πππ improvement |β| 9
Empirical Evaluation RSM-based algorithm vs. PDS-based algorithm Our tool jMoped 1. Scaling on artificial examples 2. Interprocedural program analysis problems 10
A Family of Dense RSMs β 3 π π¦ + π·πππ = π 2 β 1 β β π = π |β| π 2 π +π 11
Boolean Programs from SLAM/SDV Absolute runtime (seconds) Relative speedup 12
Our Solution 1. Configuration automata Representation structures for sets of RSM configurations [BEMβ97] Initial automaton π· , s.t. β π· = π 2. Dynamic programming algorithm Compute π· β , representing reachable configurations and distances Key: Entry-to- Exit summaries [ABEGRYβ05] 3. Distance extraction algorithms Query configuration/superconfiguration/node distances from π· β 13
Distance Extraction β’ Configuration distance for β©π£, π 1 β― π π βͺ π 0 π‘ π 1 π‘ π π π‘ π π π π 1 β― u 2 Dynamic programming: π« π β π π β’ Superconfiguration distance for β©π£, β³ 1 β― β³ π βͺ π πβ² with π β³ πβ² where β³ is module of πβ² Replace π β’ Node distance Traditional single-source distance problem 14
Distances over Small Semirings π π π vector π π π Γπ π matrix π π π· β transitions labeled π π π· β transitions π£ π 1 π π β π΅ π£ β π΅ π 1 β― π΅ π π β 1 π π β’ Constant size semiring (Mailmanβs speedup) 2 π π π« π β log π π Size π semiring (Williamβs speedup) β’ 2 ππ for π > 0 , π« π β (some preprocessing) π2log2 ππ β’ Binary semiring (Four-Russians speedup) π π« β β π π β log π 15
Summary β’ Faster interprocedural analysis (RSM > PDS) β’ Configuration automata ο Saturation algorithm (summaries) ο Distance extraction β’ More in the paper β Further distance extraction speedups β Implications for context-bounded analysis (concurrency) 16
17
18
Recommend
More recommend