Automatic Object Colocation Based on Read Barriers

Christian Wimmer
Institute for System Software

Hanspeter Mössenböck
Institute for System Software
Christian Doppler Laboratory for Automated Software Engineering


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.

Download as PDF

© Springer-Verlag, 2006. This is the author's version of the work. It is posted here for your personal use. Not for redistribution.
Published in the Proceedings of the Joint Modular Languages Conference 2006, Oxford, UK, September 2006, Lecture Notes in Computer Science, Volume 4228, pp. 326-345. Springer-Verlag, 2006.