1 / 26

Free me

Free me. Written By: Samuel Z. Guyer, Kathryn S. Mckinley and Daniel Frampton Presented by: Uri Inon. Today's Topics. Motivation Technique Performance Related Work Conclusion. Reminder – GC Definition. Garbage Collector is responsible for removing unused object for the heap.

rudolf
Télécharger la présentation

Free me

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. Free me Written By: Samuel Z. Guyer, Kathryn S. Mckinley and Daniel Frampton Presented by: Uri Inon

  2. Today's Topics • Motivation • Technique • Performance • Related Work • Conclusion

  3. Reminder – GC Definition • Garbage Collector is responsible for removing unused object for the heap. • Saves the programmer managing the heap. • On the other-hand, GC takes resources of the run-time.

  4. Motivation • We wish to “help” the GC, so it will be activated less often. • This is done by finding objects (in compilation time) that are dead, and add commands (in the code) to free them.

  5. Motivation - Example public void parse(InputStream stream){ while (...){ String idName=stream.readToken(); Identifier id=symbolTable.lookup(idName) if (id== null){ id= new Identifier(idName); symbolTable.add(idName,id); { computeOn(id); { { Allocated If id!=null idName isn’t used

  6. Technique • Build Internal Representation • Pointer Connectivity • Procedure Summaries • Object Reachability and Liveness • Free Placement • Possible improvements

  7. IR-Graph While … exit idName = stream.readToken() Id0 = symbolTable.lookup(idName) If (id0 = null) Id1 = new Identifier(idName) symbolTable.add(idName,id1) Id2 = (id0,id1) computeOn(id2)

  8. Pointer Connectivity • Flow insensitive • Field insensitive • Interprocedural • Build a graph of the pointers, Allocation sites and one node for all globals

  9. Pointer Connectivity - Example While … exit idName readToken idName = stream.readToken() id1 New Identifier Id0 = symbolTable.lookup(idName) id2 id0 If (id0 = null) global symbolTable Id1 = new Identifier(idName) symbolTable.add(idName,id1) Id2 = (id0,id1) computeOn(id2)

  10. Procedure Summaries • Checks if the procedure is a factory. • If at all paths of the procedure a new object is returned – it’s a factory. • Checks which parameters are connected. idName readToken id1 symbolTable.add(idName,id1) New Identifier (P0,P1),(P0,P2) global symbolTable

  11. Object Reachability and Liveness • Identifies when objects become dead. • Searches for a path that an object becomes un-reachable. • The reachability of an object is the union of then objects that might be pointing it idName New Identifier global readToken

  12. Object Reachability and Liveness - Example While … exit idName = stream.readToken() global Id0 = symbolTable.lookup(idName) If (id0 = null) We Can Add Free Id1 = new Identifier(idName) New Identifier readToken symbolTable.add(idName,id1) Id2 = (id0,id1) idName computeOn(id2)

  13. Free Placement • If we can free an object in several places – where should we do it? • In all of them! • Add temporary variable to avoid errors: • v = new Object(); • v = x.f; • free(v); //error!

  14. Free Placement – Example idName = stream.readToken() idName = stream.readToken() t0 = idName Id0 = symbolTable.lookup(idName) Id0 = symbolTable.lookup(idName) If (id0 = null) If (id0 = null) Id1 = new Identifier(idName) Id1 = new Identifier(idName) symbolTable.add(idName,id1) symbolTable.add(idName,id1) else free(to) t0 = null

  15. Possible improvements • Interprocedural analysis • Flow and field sensitive • TBD

  16. Implementation of Free() • Pass the pointer and size • Lazy Free-List • Links the object to the appropriate free-list. • Unbump • Frees the object. If it was the last move the pointer backwards. • Unreserved • Reduce the reserved size in the GC

  17. Experimental Results

  18. Methodology • Jikes RVM - The vm they use in the experiment • MMTK – Memory management component. Has several GCs. • Compilation time • Almost double • Can improve • Selecting less hot methods • Some optimizations of the analysis

  19. Effectiveness • 32% On average • 80% was the best • Javac-inl – add support for inline

  20. Mark-Sweep Collector – Total Time • 50% improvement on small heaps • 10% improvement on moderate heaps • 5% improvement on large heaps

  21. Mark-Sweep Collector – Times cont’ GC Time Run Time

  22. Generation Collector – Total Time

  23. Generation Collector – Times cont’ GC Time Run Time

  24. Related Work • Compile-Time free and Reuse • Identifying the last use of all objects and freeing them (without GC at all) • Reusing a dead object for another object at the same size • Stack Allocation • Detects objects whose lifetime correspond to method scope, and allocates them on the stack. • Region Allocation • Manage ALL objects based on allocation site lifetime or adding regions

  25. Conclusion • Free-me can’t replace GC. • It improves Mark and Sweep GC significantly, and helps it to have closer performances to Generation GC.

  26. Your turn – Any Questions?

More Related