1 / 64

Dynamic Shape Analysis via Degree Metrics

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. Software is Dynamic. Software is always changing New expectations New algorithms New applications New users

khuong
Download Presentation

Dynamic Shape Analysis via Degree Metrics

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Dynamic Shape Analysisvia Degree Metrics Maria Jump & Kathryn S. McKinley Department of Computer Sciences The University of Texas at Austin {mjump,mckinley}@cs.utexas.edu

  2. 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] Jump & McKinley

  3. Property of a system that is directly proportional to thedifficulty 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] Software Complexity • Developed by large teams • Few, if any, understand all parts • Need tools to help Jump & McKinley

  4. Program Analysis Program= Code + Data Software complexity leads to heap complexity Jump & McKinley

  5. 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 incompletewithout heap analysis Jump & McKinley

  6. 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 performheap analysis dynamically Jump & McKinley

  7. Shape Analysis Characterize the “shape” of heap-allocatedpointer-based data structures andverify shape-preserving properties Jump & McKinley

  8. Shape Analysis Static • Conservatively characterizes all “possible” shapes at every program point • Only works on small programs Dynamic • Discover shape of current data structure • Generate assertionsfor verification • Monitor shape duringentire execution Program= Code + Data Jump & McKinley

  9. Shape Analysis Library Custom LinkedHashMap: 99.3% % of Heap BinaryTree: 35.8% HashMap: 59.5% OctTree: 98% Custom: 33% Library: 58% Jump & McKinley

  10. 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 Jump & McKinley

  11. Class Field-Wise Graph (CFWG) Heap CFWG Home-brewed data structure from SPECjbb2000 (simplified) Jump & McKinley

  12. Class Field-Wise Graph (CFWG) Heap CFWG Home-brewed data structure from SPECjbb2000 (simplified) Jump & McKinley

  13. Class Field-Wise Graph (CFWG) Heap CFWG Degree Metrics Home-brewed data structure from SPECjbb2000 (simplified) Jump & McKinley

  14. Degree Metrics • Degree metrics per instance: • Out-degree: # of outgoing references • In-degree: # of incoming references • Only count edges between objectsof same class • Use word in header to track in-degree of backbone objects • Summarize by class per data structure instance in a degree profile Jump & McKinley

  15. CFWG Calculating Degree Profile Jump & McKinley

  16. CFWG Calculating Degree Profile Jump & McKinley

  17. CFWG Calculating Degree Profile Jump & McKinley

  18. CFWG Calculating Degree Profile n=1 Jump & McKinley

  19. CFWG Calculating Degree Profile n=1 Jump & McKinley

  20. CFWG Calculating Degree Profile n=1 Jump & McKinley

  21. CFWG Calculating Degree Profile n=2 Jump & McKinley

  22. CFWG Calculating Degree Profile n=2 Jump & McKinley

  23. CFWG Calculating Degree Profile n=2 Jump & McKinley

  24. CFWG Calculating Degree Profile n=3 Jump & McKinley

  25. CFWG Calculating Degree Profile n=3 Jump & McKinley

  26. CFWG Calculating Degree Profile n=3 Jump & McKinley

  27. CFWG Calculating Degree Profile n=4 Jump & McKinley

  28. CFWG Calculating Degree Profile n=5 Jump & McKinley

  29. CFWG Calculating Degree Profile n=6 Jump & McKinley

  30. CFWG Calculating Degree Profile n=6 Jump & McKinley

  31. CFWG Calculating Degree Profile n=6 Jump & McKinley

  32. CFWG Calculating Degree Profile n=7 Jump & McKinley

  33. CFWG Calculating Degree Profile n=8 Jump & McKinley

  34. CFWG Calculating Degree Profile n=9 Jump & McKinley

  35. CFWG Calculating Degree Profile n=9 Jump & McKinley

  36. CFWG Calculating Degree Profile n=9 Jump & McKinley

  37. CFWG Calculating Degree Profile n=10 Jump & McKinley

  38. CFWG Calculating Degree Profile n=10 Jump & McKinley

  39. CFWG Calculating Degree Profile n=10 Jump & McKinley

  40. CFWG Calculating Degree Profile n=11 Jump & McKinley

  41. CFWG Calculating Degree Profile n=12 Jump & McKinley

  42. CFWG Calculating Degree Profile n=13 Jump & McKinley

  43. CFWG Calculating Degree Profile n=13 Jump & McKinley

  44. CFWG Calculating Degree Profile n=13 Jump & McKinley

  45. CFWG Calculating Degree Profile n=14 Jump & McKinley

  46. Calculating Degree Profile n=15 CFWG Jump & McKinley

  47. Calculating Degree Profile constant n CFWG range Complete Binary Tree Jump & McKinley

  48. CFWG Calculating Degree Profile constant range left right Complete Binary Tree Jump & McKinley

  49. 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? Jump & McKinley

  50. Implementation and Methodology • Jikes RVM • SPECjvm98, DaCapo, SPECjbb2000 • Heap composition • Showed degree metric are stable by class • Overheads • <8% total time • <1% space overhead [used bits in header] • Microbenchmarks • Single RDS in isolation • Random error injection Singly-linked list Doubly-linked list Binary Tree Binary Tree w/ PP Jump & McKinley

More Related