21
Exploiting Prolific Types for Memory Management and Optimizations By Yefim Shuf et al.

Exploiting Prolific Types for Memory Management and Optimizations

  • Upload
    latona

  • View
    37

  • Download
    0

Embed Size (px)

DESCRIPTION

Exploiting Prolific Types for Memory Management and Optimizations. By Yefim Shuf et al. Roadmap. What is prolific types? Properties of prolific types Applications Type-based garbage collection Reducing memory consumed by objects Object co-allocation Locality-based traversal Conclusions. - PowerPoint PPT Presentation

Citation preview

Page 1: Exploiting Prolific Types for Memory Management and Optimizations

Exploiting Prolific Types for Memory Management and

Optimizations By Yefim Shuf et al.

Page 2: Exploiting Prolific Types for Memory Management and Optimizations

Roadmap

• What is prolific types?– Properties of prolific types

• Applications– Type-based garbage collection– Reducing memory consumed by objects– Object co-allocation– Locality-based traversal

• Conclusions

Page 3: Exploiting Prolific Types for Memory Management and Optimizations

Prolific Types

• Observation:– Relatively few object types usually account for

a large percentage of objects (and heap space)

• These frequently instantiated types are prolific types

• Others are non-prolific types

Page 4: Exploiting Prolific Types for Memory Management and Optimizations

Identifying Prolific Types

• Offline profiling– Dump information in a file

• Adaptive approach– Collect info during execution– Sampling

• Compile-time– May be possible

Page 5: Exploiting Prolific Types for Memory Management and Optimizations

Checking a Variable for Prolific Type

• Given “T o”– Object o is prolific if all subclasses of T are prolific– Need class hierarchy analysis

• Check added at compile time– Handle dynamic loading

• A simple heuristic– Prolific types are likely leaves or close to leaves

• Treat all children of prolific types as prolific

Page 6: Exploiting Prolific Types for Memory Management and Optimizations

Application 1 :Type-based Memory Management

• Objects of prolific types have short lifetimes– Resemble nature: offspring of prolific species are often short-

lived

• Heap space partitioned into two regions– P-region: objects of prolific types– NP-region: objects of non-prolific types

• Collection– Perform frequent minor collection only in the P-region– In frequent full collection– Survivors of P-region collection stay in P-region

• Compared to generation collection

– Write barriers needed to remember pointer from NP-region to P-region

Page 7: Exploiting Prolific Types for Memory Management and Optimizations

Additional Advantages

• Compile-time write barrier elimination– Eliminate barrier that are not pointing from NP

to P

• P-region Collection Processing– Only need to scan pointers to P-region

• Methods return two reference list– One full list– One partial list: references to prolific objects

Page 8: Exploiting Prolific Types for Memory Management and Optimizations

Results: write barrier

Page 9: Exploiting Prolific Types for Memory Management and Optimizations

Results: Throughput

Page 10: Exploiting Prolific Types for Memory Management and Optimizations

Results: GC Times

Page 11: Exploiting Prolific Types for Memory Management and Optimizations

Application 2: Short Type Pointers

• Observation: The number of prolific types is small– Mostly <= 16

• Application– Shorten object headers– Using a 4-bit field to encode TIB

• The value is an index to the table of real TIBs

Page 12: Exploiting Prolific Types for Memory Management and Optimizations

Results: statistics on prolific types

Page 13: Exploiting Prolific Types for Memory Management and Optimizations

Results: Space Saving

Page 14: Exploiting Prolific Types for Memory Management and Optimizations

Application 3: Object Co-allocation

• Properties– Objects of prolific types tend to access together– The large number of prolific objects denote potential

benefit

• Co-allocate objects of prolific types– Improve spatial locality– Reduce GC times with improved GC-time locality– Reduce memory fragmentation

• Objects born together tend to die together

Page 15: Exploiting Prolific Types for Memory Management and Optimizations

The Co-allocation Algorithm

• Create a directed graph– Nodes: types– Edges: from a (source) type to a type of the source’s reference

field• P-edge: prolific type to prolific type • NP-edge: non prolific type to non prolific-type• Others

• Co-allocation– Partition the graph into clusters– Each cluster is a set of nodes linked by P-edges– When one node (representative node) of a cluster is allocated,

reserve enough space for other nodes in cluster– In practice, each cluster consists of two nodes

Page 16: Exploiting Prolific Types for Memory Management and Optimizations

Locality-based Traversal

• Divide heap into chunks

• Visit the objects in to same chunk before those in other chunks– Improve GC locality– Can improve locality when combined with a

copy collector

Page 17: Exploiting Prolific Types for Memory Management and Optimizations

The Locality-based Traversal Algorithm

Page 18: Exploiting Prolific Types for Memory Management and Optimizations

Implementation Issues

• Choice of chunk size– No bigger than the physical memory of a process

• Which chunk to collect first?– Last chunk allocated (may still in cache)

• Which pointer to choose from LP?– Choose an object close to the one visited recently

• Which chunk next?– With most reachable objects by sampling– A pointer into the chunk closest to the current chunk

Page 19: Exploiting Prolific Types for Memory Management and Optimizations

Results: non-copy GC

Page 20: Exploiting Prolific Types for Memory Management and Optimizations

Results: Copying GC

Page 21: Exploiting Prolific Types for Memory Management and Optimizations

Conclusions

• Prolific type based GC perform better than a generational GC

• With encode prolific types, heap space reduced

• Proliflic objects co-allocation improve performance with non-copying GC

• Locality-based GC traversal has positive impacts on copying GC