Objects and array inlining are made on a field by field basis at run time. The analysis overhead has to be small and the speedup has to be big so that the optimization is worth it. A heuristic approach to determining this criterion is not sufficient because it is local to the array in nature. The example discussed earlier that uses the access count and a threshold can determine a selection of candidates. But only with a statistic that places this in context of the global total of all the fields in all loaded classes does the criterion become clearer. A count from the global puts into perspective the usefulness of the repetitions of the eliminating field loads by focusing on where they matter more rather than routinely performing each and every one of them until the ones that matter don’t get the optimization.
There are approaches different from Statistics as well which include neurons and a load embedding layer that can perform even better than statistics using neural net and classifiers since each field is isolated. However, the effort to bootstrap, load and accumulate the passes even when done in batches may amount to prohibitive usage of resources of the runtime. Dynamic grouping on the other hand can be an alternative approach to determine the criterion by evaluating groups not with classifiers but with regressors.
This leads us to a brief overview of related work. A static compiler for a variation of C++ was extended earlier to perform automatic object inlining. Its algorithm clones the code of methods that accesses optimized objects. That approach is different from the above mentioned in that all objects of a class are inlined when it meets a criterion. Also, that algorithm moves the object headers and pointers to inlined objects which reduces the object size. It can also convert an array of references to an array of object values. The approach described here is from the paper on Automatic Array Inlining in Java Virtual Machines by Wimmer et al and this approach can inline dynamic arrays
No comments:
Post a Comment