on the usefulness of liveness for garbage collection and
play

OntheUsefulnessofLiveness forGarbageCollection andLeakDetection - PowerPoint PPT Presentation

OntheUsefulnessofLiveness forGarbageCollection andLeakDetection MartinHirzel,AmerDiwan,and AntonyHosking {hirzel,diwan}@cs.colorado.eduhosking@cs.purdue.edu


  1. On�the�Usefulness�of�Liveness for�Garbage�Collection and�Leak�Detection Martin�Hirzel,�Amer�Diwan,�and Antony�Hosking {hirzel,diwan}@cs.colorado.edu�����hosking@cs.purdue.edu ECOOP�June�2001�Budapest,�Hungary 1

  2. What�is�Liveness? • A�variable�is� live if�its�value�will�be�used�in�the�future. ast … Tree�*ast�=�parse(); Cfg *cfg =�translate(ast); 〈 code�that�does�not�use�the�value of� ast� 〉 … 2

  3. Accuracy�and�Reachability Unreachable p B A x C ast E D 3

  4. Accuracy�and�Reachability Unreachable p B A x C ast [not�live] E D • Type�accuracy: which�variables�hold�pointers? • Liveness accuracy: which�variables�are�live? 4

  5. Accuracy�and�Reachability Unreachable p B A x [not�a�pointer] C ast E D • Type�accuracy: which�variables�hold�pointers? 5

  6. Accuracy�and�Reachability Unreachable p B A x [not�a�pointer] C ast [not�live] E D • Type�accuracy: which�variables�hold�pointers? • Liveness accuracy: which�variables�are�live? 6

  7. The�Questions • Can�liveness accuracy�benefit�reachability� traversals? – Useful�for�garbage�collection? – Useful�for�leak�detection? • What�kind�of�analysis�is�necessary? 7

  8. Motivation conservative partial full Type Accuracy none weak strong Liveness investigated�in�literature Accuracy unexplored 8

  9. Results�in�a�Nutshell conservative partial full Type Accuracy none weak strong Liveness investigated�in�literature Accuracy unexplored 9

  10. Outline Introduction • Motivation • Preview�of�results Methodology • Obtaining�liveness�information • Metrics Results • Reachable�heap�given�various� accuracy�schemes Conclusion • Related�work • Summary 10

  11. Liveness Approaches • Static�analysis – Compiler-analysis�of�source�code – Disadvantage:�difficult,�cost�+�benefits�unclear • Dynamic�analysis – Trace-based�analysis – Disadvantage:�two�runs�needed,�limit�study 11

  12. Infrastructure�for�Experiments Analysis Accuracy library selection Trace C�or�Eiffel Instrument Link Run-1 Liveness program analysis Type�Information Link Run-2 Liveness�Information Stubs�+ BDW�gc 12

  13. Infrastructure�for�Experiments Type-analysis Accuracy library selection Trace C�or�Eiffel Instrument Link Run-1 Liveness program analysis Type�Information Link Run-2 Liveness�Information Stubs�+ BDW�gc 13

  14. Generating�the�Trace Original�Code Instrumented�Code Trace x�=�malloc(4*N); x�= malloc(4*N); … note_allocation(); allocation(91) note_assign(&x); assign(x) i�=�0; i�=�0; assign(i) note_assign(&i); assign(y,�x,�i) while(i�<�N){ while(i�<�N){ use(y) y�=�x�+�4*i; y�=�x�+�4*i; assign(91.0,�i) note_assign(&y,&x,&i); assign(i,�i) *y�=�i; *y�=�i; assign(y,�x,�i) note_use(&y); use(y) note_assign(y,&i); assign(91.4,�i) i++; i++; … note_assign(&i,&i); } } 14

  15. Analyzing�the�Trace Trace Simulated�Liveness�State Resulting�Information x y i … allocation(91) assign(x) assign(i) T1:�{ x,�i } assign(y,�x,�i) use(y) assign(91.0,�i) assign(i,�i) T1:�{ x,�i } assign(y,�x,�i) use(y) assign(91.4,�i) T2:�{} … “A�variable�is� live if�its�value�will�be�used�in�the�future.” 15

  16. � Usefulness�Metric�for�Accuracy Bytes reachable Conservative Accurate Time Reachability�traversal:�����1���������������������2�������������������3 Reachability reduction:��10%���������������20%����������������0% The�accurate scheme�reduced�reachability by�10%�on�average. 16

  17. Outline Introduction • Motivation • Preview�of�results Methodology • Obtaining�liveness�information • Metrics Results • Reachable�heap�given�various�levels of�accuracy Conclusion • Related�work • Summary 17

  18. Benchmarks Name Language Lines�of�Code Total�allocation�[Bytes] Author/Source Programs�written�with�GC�in�mind: gctest3 C 85 2�200�004 Bartlett gctest C 196 1�123�180 Bartlett bshift Eiffel 350 28�700 Hirzel erbt Eiffel 927 222�300 Durian ebignum Eiffel 3�137 109�548 Hillion li C 7�597 9�030�872 Spec95 gegrep Eiffel 17�185 106�392 Bezault Programs�with�explicit�deallocation: anagram C 647 259�512 Austin ks C 782 7�920 Austin ft C 2�156 166�832 Austin yacr2 C 3�979 41�380 Austin bc C 7�308 12�382�400 Austin gzip C 8�163 14�180 GNU 18 ijpeg C 31�211 148�664 Spec95

  19. Usefulness�of�Liveness Reachability�reduction�w ith�strongest�liveness % �Bytes 60 average 50 at�peak 40 30 20 10 0 m m 3 t p t 2 p g t s f t c i s t b e k f r e i u l a i b e s h z r r c p n r e t g g a s e c g t j g b e y c g i a i g g b n e a 19

  20. Usefulness�of�Liveness Reachability�reduction�w ith�strongest�liveness % �Bytes 98 60 average 50 94 at�peak 40 30 90 98 87 50 20 10 98 20 79 0 2 0 0 0 0 m m 3 t p t 2 p g t s f t c i s t b e k f r e i u l a i b e s h z r r c p n r e t g g a s e c g t j g b e y c g i a i g g b n e a Traversals � different % Num �traversal s 20

  21. Different�Levels�of�Liveness Reachability�reduction % �Bytes stack� intra�scalars stack�� inter scalars 60 stack�� inter�all 50 s.+glob intra�scalars s.+glob inter�scalars 40 s.+glob inter�all 30 20 10 0 m 3 t p 2 p g t f c i t b u e r e i l i b s h z r r c p n e g g s a e j t g b e y c i i g g b e 21

  22. Type�versus�Liveness�Accuracy Reachability�reduction % �Bytes Type�(Pentium ) 60 Liveness 50 Type+Liveness 40 30 20 10 0 ebignum gegrep gctest3 yacr2 ijpeg bshift gzip erbt bc li 22

  23. Validation • Comparing�liveness�information�found�in� different�runs – For�how�many�locations�did�the�obtained� liveness�information�differ? Benchmark Stack Global %�different %�different gegrep 0.7 0.0 yacr2 2.7 0.0 gzip 1.3 2.2 23

  24. Outline Introduction • Motivation • Preview�of�results Methodology • Obtaining�liveness�information • Metrics Results • Reachable�heap�given�various�levels of�accuracy Conclusion • Related�work • Summary 24

  25. Related�Work • Evaluating�Accuracy – Hirzel,�Diwan:�On�the�type�accuracy�of�garbage� collection.�ISMM�2000. – Shaham,�Kolodner,�Sagiv:�On�the�effectiveness� of�GC�in�Java.�ISMM�2000. • Implementing�Accuracy – [Bartlett1988]�[DiwanMossHudson1992]� [SmithMorrisett1998]�[Zorn1993]� [AgesenDetlefsMoss1998]�… 25

  26. Summary • Liveness�accuracy�can�be�very�useful�for� reachability traversals. • Strong�analyses�are�necessary�to�reach� significantly�fewer�Bytes. • Type�accuracy�was�not�very�useful�in�these� experiments. 26

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