Automatic Object Colocation Based on Read Barriers
Object colocation is an optimization that reduces memory access costs by grouping together heap objects so that their order in memory matches their access order in the program. We implemented this optimization for Sun Microsystems’ Java HotSpotTM VM. The garbage collector, which moves objects during collection, assigns consecutive addresses to connected objects and handles them as atomic units.
We use read barriers inserted by the just-in-time compiler to detect the most frequently accessed fields per class. These “hot fields” are added to so-called hot-field tables, which are then used by the garbage collector for colocation decisions. Read barriers that are no longer needed are removed in order to reduce the overhead. Our analysis is performed automatically at run time and requires no actions on the side of the programmer.
We measured the impact of object colocation on the young and the old generation of the garbage collector, as well as the difference between dynamic colocation using read barriers and a static colocation strategy where colocation decisions are done at compile time. Our measurements show that object colocation works best for the young generation using a read-barrier-based approach.
KeywordsGarbage Collection Cache Line Garbage Collector Live Object Parent Object
Unable to display preview. Download preview PDF.
- 3.Chilimbi, T.M., Larus, J.R.: Using generational garbage collection to implement cache-conscious data placement. In: Proceedings of the 1st international symposium on Memory management, pp. 37–48. ACM Press, New York (1998)Google Scholar
- 4.Griesemer, R., Mitrovic, S.: A compiler for the Java HotSpotTM virtual machine. In: Böszörményi, L., Gutknecht, J., Pomberger, G. (eds.) The School of Niklaus Wirth: The Art of Simplicity, pp. 133–152. dpunkt.verlag (2000)Google Scholar
- 5.Huang, X., Blackburn, S.M., McKinley, K.S., Moss, J.E.B., Wang, Z., Cheng, P.: The garbage collection advantage: improving program locality. In: Proceedings of the 19th annual ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications, pp. 69–80. ACM Press, New York (2004)CrossRefGoogle Scholar
- 6.Intel Corporation: IA-32 Intel Architecture Software Developer’s Manual, vol. 1: Basic Architecture, Order Number 253665-018 (2006)Google Scholar
- 9.Kotzmann, T., Mössenböck, H.: Reallocation and garbage collection support for scalar-replaced and stack-allocated objects. Technical report, Institute for System Software, Johannes Kepler University Linz (2006)Google Scholar
- 11.Pozo, R., Miller, B.: SciMark 2.0 (1999), http://math.nist.gov/scimark2/
- 12.Standard Performance Evaluation Corporation: The SPEC JVM98 Benchmarks (1998), http://www.spec.org/jvm98/
- 13.Standard Performance Evaluation Corporation: The SPEC JBB 2005, Benchmark (2005), http://www.spec.org/jbb2005/
- 14.Sun Microsystems, Inc.: Java SE 6: Mustang Snapshot Releases (2006), https://mustang.dev.java.net/