Automatic Feedback-Directed Object Inlining in the Java HotSpot™ Virtual MachineChristian Wimmer, Hanspeter Mössenböck: Automatic Feedback-Directed Object Inlining in the Java HotSpot™ Virtual Machine. In Proceedings of the International Conference on Virtual Execution Environments, pages 12–21. ACM Press, 2007. doi:10.1145/1254810.1254813
Download as PDF
© ACM, 2007.
Object inlining is an optimization that embeds certain referenced objects into their referencing object. It reduces the costs of field accesses by eliminating unnecessary field loads. The order of objects in the heap is changed in such a way that objects that are accessed together are placed next to each other in memory so that their offset is fixed, i.e. the objects are colocated. This allows field loads to be replaced by address arithmetic. We implemented this optimization for Sun Microsystems' Java HotSpot™ VM. The analysis is performed automatically at run time, requires no actions on the part of the programmer and supports dynamic class loading.
We use read barriers to detect the most frequently accessed fields that are worth being optimized. To safely eliminate a field load, the colocation of the object that holds the field and the object that is referenced by the field must be guaranteed. Two preconditions must be satisfied for a field before it is optimized: the objects must be allocated together, and the field must not be overwritten later. These preconditions are checked by the just-in-time compiler to avoid a global data flow analysis. The garbage collector ensures that groups of colocated objects are not split: it copies groups as a whole to their new locations.
The evaluation shows that our dynamic approach successfully identifies and optimizes frequently accessed fields for several benchmarks. The improved peak performance of 9% in average for SPECjvm98 (with a maximum speedup of 51%) justifies the startup overhead of 3% in average (with a maximum slowdown of 11%) that is caused mainly by the read barriers and the additional compilation of methods.