Automatic Feedback-Directed Object Fusing

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


Abstract

Object fusing is an optimization that embeds certain referenced objects into their referencing object. The order of objects on the heap is changed in such a way that objects that are accessed together are placed next to each other in memory. Their offset is then fixed, i.e., the objects are colocated, allowing field loads to be replaced by address arithmetic. Array fusing specifically optimizes arrays, which are frequently used for the implementation of dynamic data structures. Therefore, the length of arrays often varies, and fields referencing such arrays have to be changed. An efficient code pattern detects these changes and allows the optimized access of such fields.

We integrated these optimizations into 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. 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: the objects must be allocated at the same time, and the field must not be overwritten later. These preconditions are checked by the just-in-time compiler to avoid an interprocedural data-flow analysis. The garbage collector ensures that groups of colocated objects are not split by copying groups as a whole. The evaluation shows that the dynamic approach successfully identifies and optimizes frequently accessed fields for several benchmarks with a low compilation and analysis overhead. It leads to a speedup of up to 76% for simple benchmarks and up to 6% for complex workloads.


ACM Transactions on Architecture and Code Optimization (TACO), volume 7, issue 2, pp. 7:1-7:35, September 2010.

Download preprint as PDF

© ACM, 2008. This is the author's version of the work. It is posted here for your personal use. Not for redistribution.
Published in the ACM Transactions on Architecture and Code Optimization (TACO), volume 7, issue 2, article 7, September 2010.
http://dx.doi.org/10.1145/1839667.1839669