Department of Computer Sciences Dynamic Shape Analysis via Degree Metrics Maria Jump & Kathryn...

download Department of Computer Sciences Dynamic Shape Analysis via Degree Metrics Maria Jump & Kathryn S. McKinley Department of Computer Sciences The University

of 64

  • date post

    26-Mar-2015
  • Category

    Documents

  • view

    212
  • download

    0

Embed Size (px)

Transcript of Department of Computer Sciences Dynamic Shape Analysis via Degree Metrics Maria Jump & Kathryn...

  • Slide 1

Department of Computer Sciences Dynamic Shape Analysis via Degree Metrics Maria Jump & Kathryn S. McKinley Department of Computer Sciences The University of Texas at Austin {mjump,mckinley}@cs.utexas.edu Slide 2 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Software is Dynamic Software is always changing New expectations New algorithms New applications New users New notions of what is cool Limited only by human ambition First Law of Software: Software is a gas! It expands to fit the container it is in! [Nathan Myhrvold, Former CTO, Microsoft] Slide 3 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Software Complexity Developed by large teams Few, if any, understand all parts Need tools to help Property of a system that is directly proportional to the difficulty one has in comprehending the system at a level and detail necessary to make changes without introducing instability or functional regressions [Peter Rosser, Microsoft Software Engineer] Slide 4 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Code + Data Program = Program Analysis Software complexity leads to heap complexity Slide 5 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Heap Complexity Exacerbated by modern languages Objects are smaller and more numerous Most objects allocated on the heap Objects encode program state Heap contains semantic, memory, and concurrency bugs Program analysis is incomplete without heap analysis Slide 6 Department of Computer Sciences 20-Jun-2009 Jump & McKinley An Opportunity Automatic memory management examines live data on a regular basis Understand heap usage Detect heap-based bugs Optimize program based on heap usage Opportunity to perform heap analysis dynamically Slide 7 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Shape Analysis Characterize the shape of heap-allocated pointer-based data structures and verify shape-preserving properties Slide 8 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Shape Analysis Code + Data Program = Static Conservatively characterizes all possible shapes at every program point Only works on small programs Dynamic Discover shape of current data structure Generate assertions for verification Monitor shape during entire execution Slide 9 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Shape Analysis % of Heap LinkedHashMap: 99.3% OctTree: 98% BinaryTree: 35.8% HashMap: 59.5% Custom Library Custom: 33% Library: 58% Slide 10 Department of Computer Sciences 20-Jun-2009 Jump & McKinley ShapeUp Desired goals Discover shape of current data structure Discover dynamic invariants Monitor expected shape of current data structure during execution Heap summarization graph [POPL 07] Class field-wise graph (CFWG) Identifies recursive data structures (RDS) Summarize dynamic degree invariants Slide 11 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Class Field-Wise Graph (CFWG) Heap Home-brewed data structure from SPECjbb2000 (simplified) CFWG Slide 12 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Class Field-Wise Graph (CFWG) Heap Home-brewed data structure from SPECjbb2000 (simplified) CFWG Slide 13 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Class Field-Wise Graph (CFWG) Heap Home-brewed data structure from SPECjbb2000 (simplified) CFWG Degree Metrics Slide 14 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Degree Metrics Degree metrics per instance: Out-degree: # of outgoing references In-degree: # of incoming references Only count edges between objects of same class Use word in header to track in-degree of backbone objects Summarize by class per data structure instance in a degree profile Slide 15 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG Slide 16 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG Slide 17 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG Slide 18 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=1 Slide 19 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=1 Slide 20 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=1 Slide 21 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=2 Slide 22 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=2 Slide 23 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=2 Slide 24 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=3 Slide 25 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=3 Slide 26 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=3 Slide 27 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=4 Slide 28 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=5 Slide 29 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=6 Slide 30 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=6 Slide 31 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=6 Slide 32 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=7 Slide 33 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=8 Slide 34 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=9 Slide 35 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=9 Slide 36 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=9 Slide 37 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=10 Slide 38 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=10 Slide 39 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=10 Slide 40 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=11 Slide 41 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=12 Slide 42 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=13 Slide 43 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=13 Slide 44 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=13 Slide 45 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=14 Slide 46 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=15 Slide 47 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile constant range n Complete Binary Tree CFWG Slide 48 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG left right constant range Complete Binary Tree Slide 49 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Interpreting Degree Profile Monitoring degree profile shows errors: Error: constant violation Warning: range violation [min-,max+] Indicate problem with RDS during development and testing Monitor shape after deployment for dynamically introduced errors What kind of errors can be detected? Slide 50 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Implementation and Methodology Jikes RVM SPECjvm98, DaCapo, SPECjbb2000 Heap composition Showed degree metric are stable by class Overheads