OntheUsefulnessofLiveness forGarbageCollection andLeakDetection - - PowerPoint PPT Presentation

on the usefulness of liveness for garbage collection and
SMART_READER_LITE
LIVE PREVIEW

OntheUsefulnessofLiveness forGarbageCollection andLeakDetection - - PowerPoint PPT Presentation

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


slide-1
SLIDE 1

1

OntheUsefulnessofLiveness forGarbageCollection andLeakDetection

MartinHirzel,AmerDiwan,and AntonyHosking

{hirzel,diwan}@cs.colorado.eduhosking@cs.purdue.edu

ECOOPJune2001Budapest,Hungary

slide-2
SLIDE 2

2

WhatisLiveness?

… Tree*ast=parse(); Cfg *cfg =translate(ast); 〈 codethatdoesnotusethevalue

  • fast〉

… ast

  • Avariableislive ifitsvaluewillbeusedinthefuture.
slide-3
SLIDE 3

3

AccuracyandReachability

p x A B C D E ast

Unreachable

slide-4
SLIDE 4

4

AccuracyandReachability

p x A B C D E ast [notlive]

  • Typeaccuracy:

whichvariablesholdpointers?

  • Liveness accuracy:

whichvariablesarelive?

Unreachable

slide-5
SLIDE 5

5

AccuracyandReachability

p x [notapointer] A B C D E ast

  • Typeaccuracy:

whichvariablesholdpointers?

Unreachable

slide-6
SLIDE 6

6

AccuracyandReachability

p x [notapointer] A B C D E ast [notlive]

  • Typeaccuracy:

whichvariablesholdpointers?

  • Liveness accuracy:

whichvariablesarelive?

Unreachable

slide-7
SLIDE 7

7

TheQuestions

  • Canliveness accuracybenefitreachability

traversals?

– Usefulforgarbagecollection? – Usefulforleakdetection?

  • Whatkindofanalysisisnecessary?
slide-8
SLIDE 8

8

Motivation

conservative partial full none weak strong Type Accuracy Liveness Accuracy investigatedinliterature unexplored

slide-9
SLIDE 9

9

ResultsinaNutshell

conservative partial full none weak strong Type Accuracy Liveness Accuracy investigatedinliterature unexplored

slide-10
SLIDE 10

10

Outline

  • Relatedwork
  • Summary

Conclusion

  • Reachableheapgivenvarious

accuracyschemes Results

  • Obtaininglivenessinformation
  • Metrics

Methodology

  • Motivation
  • Previewofresults

Introduction

slide-11
SLIDE 11

11

Liveness Approaches

  • Staticanalysis

– Compiler-analysisofsourcecode – Disadvantage:difficult,cost+benefitsunclear

  • Dynamicanalysis

– Trace-basedanalysis – Disadvantage:tworunsneeded,limitstudy

slide-12
SLIDE 12

12

InfrastructureforExperiments

CorEiffel program Instrument Analysis library Link Run-1 Liveness analysis Link Run-2 Trace Stubs+ BDWgc TypeInformation LivenessInformation Accuracy selection

slide-13
SLIDE 13

13

InfrastructureforExperiments

CorEiffel program Instrument Type-analysis library Link Run-1 Liveness analysis Link Run-2 Trace Stubs+ BDWgc TypeInformation LivenessInformation Accuracy selection

slide-14
SLIDE 14

14

GeneratingtheTrace

x= malloc(4*N); note_allocation(); note_assign(&x); i=0; note_assign(&i); while(i<N){ y=x+4*i; note_assign(&y,&x,&i); *y=i; note_use(&y); note_assign(y,&i); i++; note_assign(&i,&i); } x=malloc(4*N); i=0; while(i<N){ y=x+4*i; *y=i; i++; }

OriginalCode InstrumentedCode Trace

… allocation(91) assign(x) assign(i) assign(y,x,i) use(y) assign(91.0,i) assign(i,i) assign(y,x,i) use(y) assign(91.4,i) …

slide-15
SLIDE 15

15

AnalyzingtheTrace

… allocation(91) assign(x) assign(i) assign(y,x,i) use(y) assign(91.0,i) assign(i,i) assign(y,x,i) use(y) assign(91.4,i) …

Trace SimulatedLivenessState

x y i

ResultingInformation

T1:{x,i} T2:{} T1:{x,i}

“Avariableislive ifitsvaluewillbeusedinthefuture.”

slide-16
SLIDE 16

16

UsefulnessMetricforAccuracy

Conservative

Bytes reachable Time Accurate Reachabilitytraversal:123 Reachability reduction:10%20%0%

  • Theaccurate schemereducedreachability by10%onaverage.
slide-17
SLIDE 17

17

Outline

  • Relatedwork
  • Summary

Conclusion

  • Reachableheapgivenvariouslevels
  • faccuracy

Results

  • Obtaininglivenessinformation
  • Metrics

Methodology

  • Motivation
  • Previewofresults

Introduction

slide-18
SLIDE 18

18

Benchmarks

Spec95 9030872 7597 C li Spec95 GNU Austin Austin Austin Austin Austin Bezault Hillion Durian Hirzel Bartlett Bartlett Author/Source 148664 14180 12382400 41380 166832 7920 259512 106392 109548 222300 28700 1123180 2200004 Totalallocation[Bytes] Language LinesofCode Name 31211 8163 7308 3979 2156 782 647 17185 3137 927 350 196 85 C ijpeg C gzip C bc C yacr2 C ft C ks C anagram Programswithexplicitdeallocation: Eiffel gegrep Eiffel ebignum Eiffel erbt Eiffel bshift C gctest C gctest3 ProgramswrittenwithGCinmind:

slide-19
SLIDE 19

19

UsefulnessofLiveness

10 20 30 40 50 60

% Bytes

g c t e s t 3 g c t e s t b s h i f t e r b t e b i g n u m l i g e g r e p a n a g r a m k s f t y a c r 2 b c g z i p i j p e g

Reachabilityreductionw ithstrongestliveness

average atpeak

slide-20
SLIDE 20

20

UsefulnessofLiveness

10 20 30 40 50 60

% Bytes

g c t e s t 3 g c t e s t b s h i f t e r b t e b i g n u m l i g e g r e p a n a g r a m k s f t y a c r 2 b c g z i p i j p e g

Reachabilityreductionw ithstrongestliveness

average atpeak

79 94 98 87 2 98 90 98 50 20

% s traversal Num different

  • Traversals
slide-21
SLIDE 21

21

DifferentLevelsofLiveness

10 20 30 40 50 60 % Bytes

g c t e s t 3 b s h i f t e r b t e b i g n u m l i g e g r e p y a c r 2 b c g z i p i j p e g

Reachabilityreduction

stack intrascalars s.+glob interall s.+glob interscalars s.+glob intrascalars stack interall stack inter scalars

slide-22
SLIDE 22

22

TypeversusLivenessAccuracy

10 20 30 40 50 60 % Bytes gctest3 bshift erbt ebignum li gegrep yacr2 bc gzip ijpeg

Reachabilityreduction

Type(Pentium ) Liveness Type+Liveness

slide-23
SLIDE 23

23

Validation

  • Comparinglivenessinformationfoundin

differentruns

– Forhowmanylocationsdidtheobtained livenessinformationdiffer?

Global Stack Benchmark 2.2 0.0 0.0 %different 1.3 2.7 0.7 %different gzip yacr2 gegrep

slide-24
SLIDE 24

24

Outline

  • Relatedwork
  • Summary

Conclusion

  • Reachableheapgivenvariouslevels
  • faccuracy

Results

  • Obtaininglivenessinformation
  • Metrics

Methodology

  • Motivation
  • Previewofresults

Introduction

slide-25
SLIDE 25

25

RelatedWork

  • EvaluatingAccuracy

– Hirzel,Diwan:Onthetypeaccuracyofgarbage collection.ISMM2000. – Shaham,Kolodner,Sagiv:Ontheeffectiveness

  • fGCinJava.ISMM2000.
  • ImplementingAccuracy

– [Bartlett1988][DiwanMossHudson1992] [SmithMorrisett1998][Zorn1993] [AgesenDetlefsMoss1998]…

slide-26
SLIDE 26

26

Summary

  • Livenessaccuracycanbeveryusefulfor

reachability traversals.

  • Stronganalysesarenecessarytoreach

significantlyfewerBytes.

  • Typeaccuracywasnotveryusefulinthese

experiments.