outline
play

Outline 1 Introduction 2 Andersens Analysis The Algorithm - PowerPoint PPT Presentation

Introduction Andersens Analysis Steensgaards Analysis Comparison Hybrids Outline 1 Introduction 2 Andersens Analysis The Algorithm Constraints Complexity 3 Steensgaards Analysis The Algorithm Making it Work Complexity 4


  1. Introduction Andersen’s Analysis Steensgaard’s Analysis Comparison Hybrids Outline 1 Introduction 2 Andersen’s Analysis The Algorithm Constraints Complexity 3 Steensgaard’s Analysis The Algorithm Making it Work Complexity 4 Comparison 5 Hybrids Maks Orlovich On Flow-Insensitive Points-To Analyses

  2. Introduction Andersen’s Analysis Steensgaard’s Analysis Comparison Hybrids Introduction and Rationale Introduction Last time we saw flow sensitive points-to analysis Computes information at every point of a program Precise The information is a (large) graph — expensive! Flow-Insensitive analysis Compute just one graph for the entire program Consider all statements regardless of control-flow SSA or similar forms can recover some precision Maks Orlovich On Flow-Insensitive Points-To Analyses

  3. Introduction Andersen’s Analysis Steensgaard’s Analysis Comparison Hybrids Introduction and Rationale Introduction Last time we saw flow sensitive points-to analysis Computes information at every point of a program Precise The information is a (large) graph — expensive! Flow-Insensitive analysis Compute just one graph for the entire program Consider all statements regardless of control-flow SSA or similar forms can recover some precision Maks Orlovich On Flow-Insensitive Points-To Analyses

  4. Introduction Andersen’s Analysis Steensgaard’s Analysis Comparison Hybrids A little comparison Code Flow-Sensitive Flow-Insensitive int x; x y int *y, *z; x = &y; x y z x = &z; x z Maks Orlovich On Flow-Insensitive Points-To Analyses

  5. Introduction Andersen’s Analysis The Algorithm Steensgaard’s Analysis Constraints Comparison Complexity Hybrids Outline 1 Introduction 2 Andersen’s Analysis The Algorithm Constraints Complexity 3 Steensgaard’s Analysis The Algorithm Making it Work Complexity 4 Comparison 5 Hybrids Maks Orlovich On Flow-Insensitive Points-To Analyses

  6. Introduction Andersen’s Analysis The Algorithm Steensgaard’s Analysis Constraints Comparison Complexity Hybrids Andersen’s algorithm Essentially the immediate adaptation of the usual dataflow points-to algorithm to be flow-insensitive Since do not know the order of statements, can say less: x = &y — can only know that y ∈ pt ( x ) x = y — can only know that pt ( y ) ⊆ pt ( x ) When analyzing, collect such constraints Can use a fixed-point computation to compute the actual points-to sets Maks Orlovich On Flow-Insensitive Points-To Analyses

  7. Introduction Andersen’s Analysis The Algorithm Steensgaard’s Analysis Constraints Comparison Complexity Hybrids Constraints for C 1 x = &y — y ∈ pt ( x ) 2 x = y — pt ( y ) ⊆ pt ( x ) Maks Orlovich On Flow-Insensitive Points-To Analyses

  8. Introduction Andersen’s Analysis The Algorithm Steensgaard’s Analysis Constraints Comparison Complexity Hybrids Constraints for C II x = *y x y w a z b c ∀ a ∈ pt ( y ) . pt ( a ) ⊆ pt ( x ) Maks Orlovich On Flow-Insensitive Points-To Analyses

  9. Introduction Andersen’s Analysis The Algorithm Steensgaard’s Analysis Constraints Comparison Complexity Hybrids Constraints for C III *x = y x w y a z b ∀ w ∈ pt ( x ) . pt ( y ) ⊆ pt ( w ) Maks Orlovich On Flow-Insensitive Points-To Analyses

  10. Introduction Andersen’s Analysis The Algorithm Steensgaard’s Analysis Constraints Comparison Complexity Hybrids Constraints for C — Summary 1 x = &y — y ∈ pt ( x ) 2 x = y — pt ( y ) ⊆ pt ( x ) 3 x = *y — ∀ a ∈ pt ( y ) . pt ( a ) ⊆ pt ( x ) 4 *x = y — ∀ w ∈ pt ( x ) . pt ( y ) ⊆ pt ( w ) Maks Orlovich On Flow-Insensitive Points-To Analyses

  11. Introduction Andersen’s Analysis The Algorithm Steensgaard’s Analysis Constraints Comparison Complexity Hybrids Constraints for Java 1 Stack variables can not be pointed to, only heap objects can be 2 Can take advantage of type safety 3 The following is one memory abstraction: Name objects by allocation site Variables point to objects Fields of objects point to objects Maks Orlovich On Flow-Insensitive Points-To Analyses

  12. Introduction Andersen’s Analysis The Algorithm Steensgaard’s Analysis Constraints Comparison Complexity Hybrids Constraints for Java II 1 x = y — pt ( y ) ⊆ pt ( x ) 2 y.f = x — ∀ o ∈ pt ( y ) ( pt ( x ) ⊆ pt ( o . f )) 3 x = y.f — ∀ o ∈ pt ( y ) ( o.f ⊆ pt ( x )) Maks Orlovich On Flow-Insensitive Points-To Analyses

  13. Introduction Andersen’s Analysis The Algorithm Steensgaard’s Analysis Constraints Comparison Complexity Hybrids Cost of the algorithm Asymptotically Implicitly have a constraint graph, O ( n ) nodes, O ( n 2 ) edges The fixed point computation essentially computes transitive closure — which is an O ( n 3 ) computation In practice Usually, nowhere near that bad... ... but can be bad enough to be unusable Maks Orlovich On Flow-Insensitive Points-To Analyses

  14. Introduction Andersen’s Analysis The Algorithm Steensgaard’s Analysis Constraints Comparison Complexity Hybrids Cost of the algorithm Asymptotically Implicitly have a constraint graph, O ( n ) nodes, O ( n 2 ) edges The fixed point computation essentially computes transitive closure — which is an O ( n 3 ) computation In practice Usually, nowhere near that bad... ... but can be bad enough to be unusable Maks Orlovich On Flow-Insensitive Points-To Analyses

  15. Introduction Andersen’s Analysis The Algorithm Steensgaard’s Analysis Constraints Comparison Complexity Hybrids Actual Performance (from [ShHo97]) Name Size (LoC) Time (sec) triangle 1986 2.9 gzip 4584 1.7 li 6054 738.5 bc 6745 5.5 less 12152 1.9 make 15564 260.8 tar 18585 23.2 espresso 22050 1373.6 screen 24300 514.5 75MHz SuperSPARC, 256MB RAM Maks Orlovich On Flow-Insensitive Points-To Analyses

  16. Introduction Andersen’s Analysis The Algorithm Steensgaard’s Analysis Constraints Comparison Complexity Hybrids Reducing the cost Cycles in a graph must have the same points-to sets, so can be collapsed to a single node [FäFoSuAi98] In some cases runs at much as 50x faster li is done in 30.25 seconds, espresso in 27 seconds, on UltraSparc in 167-400Mhz If two variables have the same points-to sets, they can be collapsed [RoCh00] Around 2x improvement in run time, 3x lower memory usage BDDs (Reduced Ordered Binary Decision Diagrams) have been used to represent the graph more sparsely [BeLhQiHeUm03] Maks Orlovich On Flow-Insensitive Points-To Analyses

  17. Introduction Andersen’s Analysis The Algorithm Steensgaard’s Analysis Making it Work Comparison Complexity Hybrids Outline 1 Introduction 2 Andersen’s Analysis The Algorithm Constraints Complexity 3 Steensgaard’s Analysis The Algorithm Making it Work Complexity 4 Comparison 5 Hybrids Maks Orlovich On Flow-Insensitive Points-To Analyses

  18. Introduction Andersen’s Analysis The Algorithm Steensgaard’s Analysis Making it Work Comparison Complexity Hybrids Overview Can view the problem as trying to assign synthetic types to each reference — so it points to objects of specified type A type is defined recursively as pointing to an another type Hence, proceeds as a type inference algorithm, doing unification x = y — τ ( x ) = τ ( y ) , so take pt ( x ) = pt ( y ) Each type points to one other type, so the points-to graph has at most 1 out edge for each node (but each node can be many variables) Graph is of linear size — fast! Limits precision Maks Orlovich On Flow-Insensitive Points-To Analyses

  19. Introduction Andersen’s Analysis The Algorithm Steensgaard’s Analysis Making it Work Comparison Complexity Hybrids Processing of assignments x=*y x z a y w v b Maks Orlovich On Flow-Insensitive Points-To Analyses

  20. Introduction Andersen’s Analysis The Algorithm Steensgaard’s Analysis Making it Work Comparison Complexity Hybrids Processing of assignments x=*y x z a y w v b Maks Orlovich On Flow-Insensitive Points-To Analyses

  21. Introduction Andersen’s Analysis The Algorithm Steensgaard’s Analysis Making it Work Comparison Complexity Hybrids Processing of assignments x=*y x a z v y w b Maks Orlovich On Flow-Insensitive Points-To Analyses

  22. Introduction Andersen’s Analysis The Algorithm Steensgaard’s Analysis Making it Work Comparison Complexity Hybrids Processing of assignments x=*y x a z v y w b Maks Orlovich On Flow-Insensitive Points-To Analyses

  23. Introduction Andersen’s Analysis The Algorithm Steensgaard’s Analysis Making it Work Comparison Complexity Hybrids Making it work There are a couple of problems that arise in practice Building a call graph Make the type a pair, including a function pointer portion Compute the set of functions that may point to using unification as well Integer assignments to pointers/lack of type safety int* a = 0, *x = a, *y = b; Will collapse them into a single node Should only do unification if RHS is known to be a pointer Don’t unify if we don’t see the RHS pointing to anything, just record an edge Perform a unification if RHS gets to point to something Maks Orlovich On Flow-Insensitive Points-To Analyses

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend