计算机科学 ›› 2025, Vol. 52 ›› Issue (6): 82-87.doi: 10.11896/jsjkx.240800128
蔡淳豪, 梁淑萍, 姜军, 邵宁远
CAI Chunhao, LIANG Shuping, JIANG Jun, SHAO Ningyuan
摘要: 在国产多核处理器申威平台上,申威JDK的C2即时编译器通过图着色寄存器分配算法完成寄存器分配工作。即时编译器在分配寄存器时并没有考虑国产处理器的指令特征,导致编译器生成了过多的访存代码,从而无法更全面地发挥国产处理器的性能。为了更充分地发挥申威国产处理器的性能,提出了一种减少图着色寄存器分配时溢出代码的编译优化策略。优化策略基于图着色寄存器分配算法,根据在申威平台上特殊信息的寄存器规律,构造先验模型,并按照先验模型调整溢出策略,从而减少访存代码的生成。该策略在申威JDK上实现了优化,并基于基准测试集SPECjbb2015和SPECjvm2008验证了优化的效果。实验结果表明,优化后SPECjbb2015的max-jOPS 和critical-jOPS分数分别提升了4.20%和5.98%,SPECjvm2008的总分数提升了2.02%。
中图分类号:
[1]ULRICH D.What every programmer should know about memory[EB/OL].https://people.freebsd.org/~lstewart/articles/cpumemory.pdf. [2]COOPER K D,TORCZON L.Engineering a compiler(2nd ed.)[M].Beijing:Posts & Telecom Press,2020:499-527. [3]ALFRED V A,MONICA S L,JEFFREY D U.Compilers Principles,Techniques & Tools[M].Singapore:Pearson Education,2007:237-265. [4]BRIGGS P,COOPER K,TORCZON L.Improvements to Graph Coloring Register Allocation[J].ACM Transactions on Programming Languages and Systems,1994,16(3):428-455. [5]CHAITIN G J.Register allocation & spilling via graph coloring[J].ACM SIGPLAN Notices,1982,17(6):98-101. [6]KEMPE A B.On the geographical problem of the four colours[J].American Journal of Mathematics,1879,2(3):193-200. [7]BRIGGS P,COOPER K D,KENNEDY K,et al.Coloring heuristics for register allocation [C]//Proceedings of the ACM SIGPLAN 1989 Conference on Programming Language Design and Implementation.New York:ACM,1989:275-284. [8]SPECjbb2015 Benchmark User Guide [EB/OL].(2017-05-25) [2024-04-14].https://www.spec.org/jbb2015/docs/userguide.pdf. [9]BERNSTEIN D,GOLUMBIC M,MANSOUR Y,et al.Spillcode minimization techniques for optimizing compliers[J].ACM SIGPLAN Notices,1989,24(7):258-263. [10]BRIGGS P,COOPER K D,TORCZON L.Rematerialization[C]//Proceedings of the ACM SIGPLAN 1992 Conference on Programming Language Design and Implementation.1992:311-321. [11]KURLANDER S M,FISCHER C N.Zero-cost range splitting[C]//Proceedings of the ACM SIGPLAN 1994 Conference on Programming Language Design and Implementation.1994:257-265. [12]KOSEKI A,KOMATSU H,NAKATANI T.Spill code minimization by spill code motion[C]//2003 12th International Confe-rence on Parallel Architectures and Compilation Techniques.IEEE,2003:125-134. [13]BERGNER P,DAHL P,ENGEBRETSEN D,et al.Spill codeminimization via interference region spilling[J].ACM SIGPLAN Notices,1997,32(5):287-295. [14]SPECjvm2008 User's Guide [EB/OL].(2008-04-16) [2024-04-14].https://www.spec.org/jvm2008/docs/UserGuide.html. [15]NARIHIRO N.Tetteikaibou g1gc algorithm hen[M].Beijing:Posts & Telecom Press,2016:155-173. [16]CHAITIN G.Register allocation and spilling via graph coloring[J].ACMSIGPLAN Notices,2004,39(4):66-74. [17]BRIAN G,JOSHUA B,DOUG L.Java concurrency in practice [M].Beijing:China Machine Press,2012:128-135. [18]CYTRON R,FERRANTE J,ROSEN B K,et al.Efficientlycomputing static single assignment form and the control dependence graph[J].ACM Transactions on Programming Languages and Systems,1991,13(4):451-490. [19]CLICK C.From quads to graphs:An intermediate representation's journey:CRPC-TR93366-S [R].Technical Report Center for Resesearch on Parallel Computation,Rice University,1993. [20]GEORGE L,APPEL A W.Iterated register coalescing[J].ACMTransactions on Programming Languages and Systems,1996,18(3):300-324. [21]JOHANSSON E,SAGONAS K.Linear scan register allocation in a high-performance erlang compiler[C]//International Symposium on Practical Aspects of Declarative Languages.Berlin:Springer,2001:101-119. [22]PELEGRI-LLOPART E,GRAHAM S L.Optimal code generation for expression trees:an application burs theory[C]//Proceedings of the 15th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages.1988:294-308. [23]PALECZNY M,VICK C,CLICK C.The Java HotSpotTM server compiler[C]//JavaTM Virtual Machine Research and Technology Symposium(JVM 01).2001. [24]GALINIER P,HAO J K.Hybrid evolutionary algorithms forgraph coloring[J].Journal of Combinatorial Optimization,1999,3:379-397. |
|