Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "Department of Computer Sciences Dynamic Shape Analysis via Degree Metrics Maria Jump & Kathryn S. McKinley Department of Computer Sciences The University."— Presentation transcript:

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

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]

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]

4 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Code + Data Program = Program Analysis Software complexity leads to heap complexity

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

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

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

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

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%

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

11 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Class Field-Wise Graph (CFWG) Heap Home-brewed data structure from SPECjbb2000 (simplified) CFWG

12 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Class Field-Wise Graph (CFWG) Heap Home-brewed data structure from SPECjbb2000 (simplified) CFWG

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

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

15 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG

16 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG

17 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG

18 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=1

19 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=1

20 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=1

21 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=2

22 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=2

23 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=2

24 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=3

25 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=3

26 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=3

27 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=4

28 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=5

29 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=6

30 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=6

31 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=6

32 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=7

33 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=8

34 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=9

35 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=9

36 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=9

37 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=10

38 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=10

39 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=10

40 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=11

41 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=12

42 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=13

43 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=13

44 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=13

45 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=14

46 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG n=15

47 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile constant range n Complete Binary Tree CFWG

48 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Calculating Degree Profile CFWG left right constant range Complete Binary Tree

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?

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 <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

51 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Looking for errors TRAINING Ran microbenchmark 100 times Merged together dynamic invariants ERROR DETECTION Created RDS with 100,000 nodes Errors: 1, 2, 3, 4, 5, 10, 50, and 100 Detected dynamic invariant violations

52 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Doubly-linked List =0=1=2 in02n-2 out02n-2 circle cyclic disconnect skip

53 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Doubly-linked List =0=1=2 in02n-2 out02n-2

54 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Binary Tree =0=1=2 Complete Binary Tree in1 n-10 out[50.0,50.2]0[49.8,50.0] Full Binary Tree in1n-10 out[50.0,50.1]0[49.9,50.0] Random Binary Tree in1n-10 out[33.6,35.7][28.7,35.1][32.3,35.6] link

55 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Binary Tree =0=1=2 Complete Binary Tree in1 n-10 out[50.0,50.2]0[49.8,50.0] Full Binary Tree in1n-10 out[50.0,50.1]0[49.9,50.0] Random Binary Tree in1n-10 out[33.6,35.7][28.7,35.1][32.3,35.6]

56 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Binary Tree w/ PP =1=2=3 Complete Binary Tree w/ PP in[50.0,50.0]2[49.9,50.0] out[50.0,50.0]2[49.9,50.0] Full Binary Tree w/ PP in[50.0,50.1]1[49.9,50.0] out[50.0,50.1]1[49.9,50.0] Random Binary Tree w/ PP in[33.8,35.2][30.0,32.6][33.6,34.8] out[33.8,35.2][30.0,32.6][33.6,34.8] link disconnect

57 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Microbenchmark: Binary Tree w/ PP

58 Department of Computer Sciences 20-Jun-2009 Jump & McKinley ShapeUps Contributions Performs dynamic heap analysis to determine shape of current data structure Summarizes degree metrics using a class field-wise graph with low overheads Shows whole-heap degree metrics are not stable, but class degree metrics are Introduces degree profiles for RDS Regular RDS have more invariants than random RDS Degree profiles can detect some shape errors Thank You!

59 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Thank You!

60 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Space Overhead jessEclipse Geomean # of types bm+VM avg max # of edges avg max Increased Alloc %0.094%0.167%0.233% 19% 2.7X 0.233%

61 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Time Overhead Normalized Total Time Heap Size Relative to Minimum

62 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Singly-linked List circle := attaches head to tail cyclic := creates a cycle from tail to random node =0=1 in1n-1 out1n-1 Detection %

63 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Microbenchmark: HashMap =0=1=2 in[31.9,51.6][48.4,68.1]{0} out[31.9,51.6][48.4,68.1]{0} link := creates a connection between buckets from a null ptr to a random entry

64 Department of Computer Sciences 20-Jun-2009 Jump & McKinley Data Structures in Benchmarks BenchmarkRDS NodeL or H?% Raytrace OctNode H78.0 Jack LinkedHashMap$LinkedHashEntry L44.2 RuntimeNfaState H9.4 Antlr Object[] H76.2 Bloat HashMap$HashEntry L56.6 CallMethodExpr H3.7 Eclipse LinkedHashmap$LinkedHashEntry L59.0 AND_AND_Expression H0.4 Fop HashMap$HashEntry L51.4 PropertyList H4.4 Jython Pyframe H94.6 Luindex LinkedHashMap$LinkedHashEntry L99.3 Lusearch WeakHashMap$WeakBucket L47.5 HitDoc H2.0 Xalan ChildIterator H34.6


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

Similar presentations


Ads by Google