Christian Wimmer

Automatic Object Colocation Based on Read Barriers

Christian Wimmer, Hanspeter Mössenböck: Automatic Object Colocation Based on Read Barriers. In Proceedings of the Joint Modular Languages Conference, LNCS 4228, pages 326–345. Springer-Verlag, 2006. doi:10.1007/11860990_20

Download preprint as PDF


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 HotSpot™ 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.