DOC PREVIEW
UT CS 395T - A Static Analysis for Automatic Individual Object Reclamation

This preview shows page 1-2-14-15-29-30 out of 30 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 30 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 30 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 30 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 30 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 30 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 30 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 30 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Free-Me: A Static Analysis for Automatic Individual Object ReclamationMotivationExampleExplicit Reclamation as the solutionFreeMe as the solutionOutlineFreeMe AnalysisPointer AnalysisPointer Analysis in more depth (1) Data StructuresPointer Analysis in more depth (2) Calculating the Points-To relationInterprocedural componentGenerating summaries in more depthThe need for liveness analysisAdding LivenessLiveness AnalysisWhere can we free it?Free placement issuesLimitations & ExtensionsRuntime support for FreeMeExperimental EvaluationVolume freed – in MBSlide 22Comparing FreeMe & other approachesMark/sweep – timeMark/sweep – GC timeGenMS – timeGenMS – GC timeBloat – GC timeConclusionsDiscussionFree-Me: A Static Analysis for Automatic Individual Object Reclamation Samuel Z. Guyer, Kathryn McKinley, Daniel FramptonPresented by: Dimitris PrountzosSome slides adapted from the original PLDI talkMotivationAutomatic memory reclamation (GC)No need for explicit “free”Garbage collector reclaims memoryEliminates many programming errorsProblem: when do we get memory back?Frequent GCs: Reclaim memory quickly (minimize memory footprint), with high overheadInfrequent GCs: Lower overhead, but lots of garbage in memoryCan we combine the software engineering advantage of garbage collection with the low-cost incremental reclamation of explicit memory management ?Can we combine the software engineering advantage of garbage collection with the low-cost incremental reclamation of explicit memory management ?ExampleNotice: String idName is often garbageMemory:void parse(InputStream stream) { while (not_done) { String idName = stream.readToken(); Identifier id = symbolTable.lookup(idName); if (id == null) { id = new Identifier(idName); symbolTable.add(idName, id); } computeOn(id);}}Read a token (new String)Look up insymbol tableIf not there, create new identifier, add to symbol tableCompute onidentifierExplicit Reclamation as the solutionGarbage does not accumulateMemory:void parse(InputStream stream) { while (not_done) { String idName = stream.readToken(); Identifier id = symbolTable.lookup(idName) if (id == null) { id = new Identifier(idName); symbolTable.add(idName, id); } else free(idName); computeOn(id);}}String idName is garbage, free immediatelyFreeMe as the solutionAdds free() automaticallyFreeMe compiler pass inserts calls to free()Preserve software engineering benefitsCan’t determine lifetimes for all objectsWorks with the garbage collectorImplementation of free() depends on collectorGoal:Incremental, “eager” memory reclamation Results: reduce GC load, improve performancePotential: 1.7X performancemalloc/free vs GCin tight heaps(Hertz & Berger, OOPSLA 2005)Outline•Motivation•Analysis•Runtime support•Experimental evaluation•ConclusionsFreeMe AnalysisGoal:Determine when an object becomes unreachable Not a whole-program analysis*Idea: pointer analysis + livenessPointer analysis for reachabilityLiveness analysis for whenWithin a method, for allocation site “p = new A” where can we place a call to “free(p)”?I’ll describe the interprocedural parts laterPointer AnalysisidNamesymbolTablereadTokenStringIdentifier(global)idString idName = stream.readToken();Identifier id = symbolTable.lookup(idName);if (id == null) { id = new Identifier(idName); symbolTable.add(idName, id);}computeOn(id);Connectivity graphVariablesAllocation sitesGlobals (statics)Analysis algorithm Flow-insensitive, field-insensitivePointer Analysis in more depth (1) Data Structuresvoid function(A p1, A p2, A p3){ v1 = new O p1.f = v1 p2 = p1.f p3 = p1 }Pointer Analysis in more depth (2)Calculating the Points-To relation p1p1Np1Np1NI1NI1p2p2Np2Np2NI2NI2p3p3Np3Np3NI3NI3€ ∀i,PtsTo( pi) = {NPi}∀i,PtsTo(NPi) = {NIi}∀i,PtsTo(NIi) = {NIi}v1v1O1O1€ ∀n ∈ PtsTo( p1) : PtsTo(n)∪ = PtsTo(v1)€ PtsTo( p2)∪ = PtsTo * ( p1)€ PtsTo( p3)∪ = PtsTo( p1)€ PtsTo( p1) = {NP1,O1}PtsTo( p2) = {NP1,O1,NI1,NP 2}PtsTo( p3) = {NP1,NP3}Interprocedural componentDetection of factory methodsReturn value is a new objectCan be freed by the callerEffects of methods calledDescribes how parameters are connectedCompilation strategy:Summaries pre-computed for all methodsFree-me only applied to hot methodsString idName = stream.readToken();symbolTable.add(idName, id);Hashtable.add: (0 → 1) (0 → 2)Generating summaries in more depth€ PtsTo( p1) = {NP1,O1}PtsTo( p2) = {NP1,O1,NI1,NP 2}PtsTo( p3) = {NP1,NP3}€ ( p2, p1),( p2,*p1)( p3, p1)p1p1Np1Np1NI1NI1p2p2Np2Np2NI2NI2p3p3Np3Np3NI3NI3v1v1O1O1void function(A p1, A p2, A p3){ v1 = new O p1.f = v1 p2 = p1.f p3 = p1 }Getield is needed because a single pointer link in summary may represent multiple pointers in the calleeGetield is needed because a single pointer link in summary may represent multiple pointers in the calleeThe need for liveness analysis•Liveness identifies when objects become unreachable, not just whether or not they escape idNamesymbolTablereadTokenStringIdentifier(global)idAdding LivenessKey :idNamereadTokenStringIdentifier(global)An object is reachable only when all incoming pointers are live From a variable: Live range of the variable From a global: Live from the pointer store onward Live from the pointer store until source object becomes unreachableFrom other object:Reachability is union of all these live rangesLiveness AnalysisComputed as sets of edgesVariablesHeappointersString idName = stream.readToken();id = new Identifier(idName);computeOn(id);if (id == null)Identifier id = symbolTable.lookup(idName);symbolTable.add(idName, id);idName(global)readTokenStringIdentifierWhere can we free it?Where object exists -minus-Where reachableString idName = stream.readToken();id = new Identifier(idName);computeOn(id);if (id == null)Identifier id = symbolTable.lookup(idName);symbolTable.add(idName, id);readTokenStringCompiler inserts call to free(idName)Free placement issues•Select earliest point A, eliminate all B: A dom B•Deal with double free’sLimitations & Extensions•Free-me frees short-lived objects with explicit pointers to them in the code•Factory variability•Potential extensions:–Container internals•interprocedural liveness & pointer analysis || shape analysis–Large data structures•Global context sensitive heap model


View Full Document

UT CS 395T - A Static Analysis for Automatic Individual Object Reclamation

Documents in this Course
TERRA

TERRA

23 pages

OpenCL

OpenCL

15 pages

Byzantine

Byzantine

32 pages

Load more
Download A Static Analysis for Automatic Individual Object Reclamation
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view A Static Analysis for Automatic Individual Object Reclamation and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view A Static Analysis for Automatic Individual Object Reclamation 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?