计算机科学 ›› 2026, Vol. 53 ›› Issue (11A): 260400015-1016.doi: 10.11896/jsjkx.260400015

• 计算机软件&体系结构 • 上一篇    下一篇

基于机器学习的Profile分类方法

张文杰1, 蔡淳豪2, 张海军2, 梁淑萍2, 肖志勇1   

  1. 1 江南大学人工智能与计算机学院 江苏 无锡 214122
    2 无锡先进技术研究院语言编译研发部 江苏 无锡 214122
  • 出版日期:2026-11-16 发布日期:2026-11-16
  • 通讯作者: 肖志勇(zhiyong.xiao@jiangnan.edu.cn)
  • 作者简介:(1628671110@qq.com)
  • 基金资助:
    山东省科技型中小企业创新能力提升工程项目(2025TSGCCZZB0356)

Machine Learning Based Profile Maturity Classification Method

ZHANG Wenjie1, CAI Chunhao2, ZHANG Haijun2, LIANG Shuping2, XIAO Zhiyong1   

  1. 1 School of Artificial Intelligence and Computer Science,Jiangnan University,Wuxi,Jiangsu 214122,China
    2 Department of Language and Compiler Research and Development,Wuxi Institute of Advanced Technology,Wuxi,Jiangsu 214122,China
  • Published:2026-11-16 Online:2026-11-16
  • About author:ZHANG Wenjie,born in 2002,postgra-duate,is a member of CCF(No.A17232G).His main research interests include high-level language virtual machines and just-in-time compilation.
    XIAO Zhiyong,born in 1986,Ph.D,associate professor.His main research interests include big data analytics and cloud computing.
  • Supported by:
    This work was supported by the Shandong Province Science and Technology SME Innovation Capacity Improvement Project(2025TSGCCZZB0356).

摘要: Java虚拟机中的C2编译器依赖运行时性能剖析信息(profile)执行推测优化。目前,C2编译器仅通过启发式规则判断profile是否成熟,并决定是否执行推测优化,而忽略了热点方法的代码结构特征。这可能导致某些方法在profile尚未真正成熟时执行激进的推测优化,导致频繁触发去优化(deoptimization),增加无效编译开销并延长Java虚拟机预热时间。为此,提出PMC(Profile Maturity Classifier)——一种基于机器学习的profile分类器,该分类器将热点方法的profile划分为两类:Mature和Immature。对于Immature profile,禁用推测优化;对于Mature profile,则启用推测优化。将PMC集成至C2编译器的编译流程中,并在DaCapo基准测试套件上进行评估。实验结果表明,在所有工作负载上,PMC在保持峰值性能不变的前提下,平均减少约2.39%的预热时间,最大提升达10.71%。

关键词: 即时编译, JVM, 推测优化, 去优化

Abstract: The C2 compiler in the Java virtual machine relies on runtime profile to perform speculative optimizations.Currently,the C2 compiler determines profile maturity and whether to apply speculative optimizations using only heuristic rules,ignoring the code structure characteristics of hotspot methods.This may cause certain methods to undergo aggressive speculative optimizations before their profiles are truly mature,leading to frequent deoptimizations,increasing unnecessary compilation overhead,and prolonging JVM warm-up time.To address this issue,this paper proposes PMC(Profile Maturity Classifier),a machine-learning-based profile classifier that categorizes hotspot method profiles into two classes:Mature and Immature.Speculative optimizations are disabled for Immature profiles and enabled for Mature profiles.PMC is integrated into the C2 compiler’s compilation workflow and evaluated on the DaCapo benchmark suite.Experimental results show that,across all workloads,PMC reduces JVM warm-up time by an average of approximately 2.39% while maintaining peak performance,with a maximum improvement of 10.71%.

Key words: Just in time compiler, Java virtual machine, Speculative optimization, Deoptimization

中图分类号: 

  • TP314
[1] KOTZMANN T,WIMMER C,MÖSSENBÖCK H,et al.Design of the Java HotSpotTM client compiler for Java 6[J].ACM Transactions on Architecture and Code Optimization(TACO),2008,5(1):1-32.
[2] PALECZNY M,VICK C,CLICK C.The java {HotSpotTM}server compiler[C]//Java(TM) Virtual Machine Research and Technology Symposium(JVM 01).2001.
[3] LION D,CHIU A,SUN H,et al.{Don’t} get caught in the cold,warm-up your {JVM}:Understand and eliminate {JVM} warm-up overhead in {Data-Parallel} systems[C]//12th USENIX Symposium on Operating Systems Design and Implementation(OSDI 16).2016:383-400.
[4] WU Q,JOHN L K.Performance of Java in Function-as-a-Ser-vice Computing[C]//2022 IEEE/ACM 15th International Conference on Utility and Cloud Computing(UCC).IEEE,2022:261-266.
[5] JACKSON D,CLYNCH G.An investigation of the impact oflanguage runtime on the performance and cost of serverless functions[C]//2018 IEEE/ACM International Conference on Utility and Cloud Computing Companion(UCC Companion).IEEE,2018:154-160.
[6] SHIV K,IYER R,NEWBURNC,et al.Impact of JIT/JVM optimizations on Java application performance[C]//Seventh Workshop on Interaction Between Compilers and Computer Architectures(INTERACT-7 2003).IEEE,2003:5-13.
[7] SUGANUMA T,YASUE T,KAWAHITO M,et al.A dynamic optimization framework for a Java just-in-time compiler[J].ACM SIGPLAN Notices,2001,36(11):180-195.
[8] WÜRTHINGER T,WIMMER C,MÖSSENBÖCK H.Arraybounds check elimination in the context of deoptimization[J].Science of Computer Programming,2009,74(5/6):279-295.
[9] FINK S J,QIAN F.Design,implementation and evaluation ofadaptive recompilation with on-stackreplacement[C]//International Symposium on Code Generation and Optimization(CGO 2003).IEEE,2003:241-252.
[10] PROKOPEC A,ROSÀ A,LEOPOLDSEDER D,et al.Renaissance:benchmarking suite for parallel applications on the JVM[C]//Proceedings of the 40th ACM SIGPLAN Conference on Programming Language Design and Implementation.2019:31-47.
[11] ROTEM N,CUMMINS C.Profile guided optimization withoutprofiles:A machine learning approach[J].arXiv:2112.14679,2021.
[12] MILIKIC L,CUGUROVIC M,JOVANOVIC V.GraalNN:Con-text-Sensitive Static Profiling with Graph Neural Networks[C]//Proceedings of the 23rd ACM/IEEE International Symposium on Code Generation and Optimization.2025:123-136.
[13] ĞUGUROVIĆ M,JANIĞIĆ M V,JOVANOVIĆV,et al.GraalSP:Polyglot,efficient,and robust machine learning-based static profiler[J].Journal of Systems and Software,2024,213:112058.
[14] ZHENG Y,BULEJ L,BINDER W.An empirical study on deoptimization in the graal compiler[C]//31st European Conference on Object-Oriented Programming(ECOOP 2017).Schloss Dagstuhl-Leibniz-Zentrum für Informatik,2017:30:1-30:30.
[15] PEDREGOSA F,VAROQUAUX G,GRAMFORT A,et al.Scikit-learn:Machine learning in Python[J].Journal of Machine Learning Research,2011,12:2825-2830.
[16] BLACKBURN S M,GARNER R,HOFFMANN C,et al.TheDaCapo benchmarks:Java benchmarking development and analysis[C]//Proceedings of the 21st Annual ACM IGPLAN Conference on Object-oriented Programming Systems,Languages,and Ppplications.2006:169-190.
[17] BLACKBURN S M,CAI Z,CHEN R,et al.Rethinking Java Performance Analysis[C]//Proceedings of the 30th ACM International Conference on Architectural Support for Programming Languages and Operating Systems,Volume 1.2025:940-954.
[18] WADE A W,KULKARNI P A,JANTZ M R.AOT vs.JIT:im-pact of profile data on code quality[C]//Proceedings of the 18th ACM SIGPLAN/SIGBED Conference on Languages,Compi-lers,and Tools for Embedded Systems.2017:1-10.
[19] WADE A W,KULKARNI P A,JANTZM R.Exploring impact of profile data on code quality in the hotspot JVM[J].ACM Transactions on Embedded Computing Systems(TECS),2020,19(6):1-26.
[20] WIMMER C,STANCU C,HOFER P,et al.Initialize once,startfast:application initialization at build time[J].Proceedings of the ACM on Programming Languages,2019,3(OOPSLA):1-29.
[21] REIJERS N,SHIH C S.Improved ahead-of-time compilation ofstack-based JVM bytecode on resource-constrained devices[J].ACM Transactions on Sensor Networks(TOSN),2019,15(3):1-44.
[22] MAJO Z,HARTMANN T,MOHLER M,et al.Integrating profile caching into the hotspot multi-tier compilation system[C]//Proceedings of the 14th International Conference on Managed Languages and Runtimes.2017:105-118.
[23] ZHANG Y,GU T,ZHENG X,et al.Towards a serverless java runtime[C]//2021 36th IEEE/ACM International Conference on Automated Software Engineering(ASE).IEEE,2021:1156-1160.
[24] KHRABROV A,PIRVU M,SUNDARESAN V,et al.{JIT-Server}:Disaggregated Caching {JIT} Compiler for the {JVM} in the Cloud[C]//2022 USENIX Annual Technical Conference(USENIX ATC 22).2022:869-884.
[25] FLÜCKIGER O,JEČMEN J,KRYNSKI S,et al.Deoptless:speculation with dispatched on-stack replacement and specialized continuations[C]//Proceedings of the 43rd ACM SIGPLAN International Conference on Programming Language Design and Implementation.2022:749-761.
[26] CUGUROVIC M,PROKOPEC A,SPASOJEVIC B,et al.GraalMHC:ML-Based Method-Hotness Classification for Binary-Size Reduction in Optimizing Compi-lers[C]//Proceedings of the 35th ACM SIGPLAN International Conference on Compiler Construction.2026:1-13.
Viewed
Full text


Abstract

Cited

  Shared   
  Discussed   
No Suggested Reading articles found!