Object-oriented Programming has become one of the most dominant design paradigms as the separation of concerns and adaptability of design reduce development and maintenance costs. However, the convenience is not without cost. The added indirection inherent in such designs causes excessive pointer chasing, negatively affecting locality, which in turn degrades the performance of cache structures. Furthermore, modern hardware prefetchers are mostly stride prefetchers that are ill-equipped to handle the unpredictability of access patterns generated by pointer chasing. Most software approaches that seek to address this problem resort to profiling the program as it runs, which comes with a significant run-time overhead or requires data from previous runs. In this paper, we propose the use of compile-time static analysis to predict the most common access patterns displayed by a program during run time. Since Java is one of the most popular object-oriented languages, we implement our prototype within the OpenJ9 JVM, inside the OMR optimizer infrastructure. The outputs of our proposed predictor are Markov chains that model the expected behavior of the program. The effectiveness of the proposed predictor is evaluated by comparing the model with the actual run-time behavior of the program measured using an instrumented interpreter. Our experiments show that the proposed predictor exhibits good accuracy and can be used to inform minimally intrusive load stall mitigation strategies, e.g. informing copying GCs on more locality-friendly copying orders
翻译:面向对象编程已成为最主流的设计范式之一,其关注点分离和设计适应性降低了开发与维护成本。然而,这种便利性并非没有代价。此类设计中固有的间接寻址会导致过度的指针追踪,对局部性产生负面影响,进而降低缓存结构的性能。此外,现代硬件预取器多为步幅预取器,难以有效处理指针追踪产生的不可预测访问模式。多数试图解决该问题的软件方法依赖于程序运行时的性能分析,这会带来显著的运行时开销或需要依赖历史运行数据。本文提出利用编译时静态分析来预测程序在运行时最常见访问模式的方法。鉴于Java是最流行的面向对象语言之一,我们在OpenJ9 JVM的OMR优化器基础设施中实现了原型系统。所提出预测器的输出是建模程序预期行为的马尔可夫链。通过将模型与基于插桩解释器测量的程序实际运行时行为进行对比,评估了该预测器的有效性。实验表明,所提出的预测器具有良好准确性,可用于指导侵入性最小的负载停顿缓解策略,例如为复制式垃圾回收器提供更有利于局部性的复制顺序建议。