Java HotSpot虚拟机的基于跟踪的编译

Christian Häubl, H. Mössenböck
{"title":"Java HotSpot虚拟机的基于跟踪的编译","authors":"Christian Häubl, H. Mössenböck","doi":"10.1145/2093157.2093176","DOIUrl":null,"url":null,"abstract":"Traditional method-based just-in-time (JIT) compilation translates whole methods to optimized machine code. Trace-based compilation only generates machine code for frequently executed paths, so-called traces, that may span multiple methods.\n In this paper, we present our implementation of a trace-based JIT compiler in which we modified the mature, method-based Java HotSpot client compiler. To simplify trace recording, we added a bytecode preprocessing step that detects and directly marks loops within the bytecodes. We duplicated the existing bytecode interpreter and instrumented it for trace recording. In our implementation, traces can be anchored both at loop headers and at method entries. When a trace anchor has been executed frequently enough, trace recording is started. After several times of trace recording, our modified JIT compiler merges the recorded traces into a structure suitable for compilation. During compilation, trace-specific optimizations are applied and guarded with runtime checks if necessary. The generated machine code is then invoked by the interpreter or by already compiled traces. If a method part must be executed that was not covered by traces and therefore not compiled, or if a runtime guard fails, execution falls back to the interpreter.\n Benchmarks show an improved performance, less generated machine code and faster compilation compared to the method-based Java HotSpot client compiler. The peak performance of the SPECjvm2008 benchmarks is increased by 9% on average, while 29% less machine code is generated. Similarly, the performance of the SPECjbb2005 benchmark is increased by 13% and the DaCapo 9.12 Bach benchmarks show a peak performance increase of 5% on average.","PeriodicalId":169989,"journal":{"name":"Principles and Practice of Programming in Java","volume":"36 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2011-08-24","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"26","resultStr":"{\"title\":\"Trace-based compilation for the Java HotSpot virtual machine\",\"authors\":\"Christian Häubl, H. Mössenböck\",\"doi\":\"10.1145/2093157.2093176\",\"DOIUrl\":null,\"url\":null,\"abstract\":\"Traditional method-based just-in-time (JIT) compilation translates whole methods to optimized machine code. Trace-based compilation only generates machine code for frequently executed paths, so-called traces, that may span multiple methods.\\n In this paper, we present our implementation of a trace-based JIT compiler in which we modified the mature, method-based Java HotSpot client compiler. To simplify trace recording, we added a bytecode preprocessing step that detects and directly marks loops within the bytecodes. We duplicated the existing bytecode interpreter and instrumented it for trace recording. In our implementation, traces can be anchored both at loop headers and at method entries. When a trace anchor has been executed frequently enough, trace recording is started. After several times of trace recording, our modified JIT compiler merges the recorded traces into a structure suitable for compilation. During compilation, trace-specific optimizations are applied and guarded with runtime checks if necessary. The generated machine code is then invoked by the interpreter or by already compiled traces. If a method part must be executed that was not covered by traces and therefore not compiled, or if a runtime guard fails, execution falls back to the interpreter.\\n Benchmarks show an improved performance, less generated machine code and faster compilation compared to the method-based Java HotSpot client compiler. The peak performance of the SPECjvm2008 benchmarks is increased by 9% on average, while 29% less machine code is generated. Similarly, the performance of the SPECjbb2005 benchmark is increased by 13% and the DaCapo 9.12 Bach benchmarks show a peak performance increase of 5% on average.\",\"PeriodicalId\":169989,\"journal\":{\"name\":\"Principles and Practice of Programming in Java\",\"volume\":\"36 1\",\"pages\":\"0\"},\"PeriodicalIF\":0.0000,\"publicationDate\":\"2011-08-24\",\"publicationTypes\":\"Journal Article\",\"fieldsOfStudy\":null,\"isOpenAccess\":false,\"openAccessPdf\":\"\",\"citationCount\":\"26\",\"resultStr\":null,\"platform\":\"Semanticscholar\",\"paperid\":null,\"PeriodicalName\":\"Principles and Practice of Programming in Java\",\"FirstCategoryId\":\"1085\",\"ListUrlMain\":\"https://doi.org/10.1145/2093157.2093176\",\"RegionNum\":0,\"RegionCategory\":null,\"ArticlePicture\":[],\"TitleCN\":null,\"AbstractTextCN\":null,\"PMCID\":null,\"EPubDate\":\"\",\"PubModel\":\"\",\"JCR\":\"\",\"JCRName\":\"\",\"Score\":null,\"Total\":0}","platform":"Semanticscholar","paperid":null,"PeriodicalName":"Principles and Practice of Programming in Java","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/2093157.2093176","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 26

摘要

传统的基于方法的即时(JIT)编译将整个方法转换为优化的机器码。基于跟踪的编译仅为经常执行的路径(即所谓的跟踪)生成机器代码,这些路径可能跨越多个方法。在本文中,我们介绍了基于跟踪的JIT编译器的实现,其中我们修改了成熟的、基于方法的Java HotSpot客户机编译器。为了简化跟踪记录,我们添加了一个字节码预处理步骤,用于检测并直接标记字节码中的循环。我们复制了现有的字节码解释器,并对其进行了检测以进行跟踪记录。在我们的实现中,跟踪可以锚定在循环头和方法项处。当跟踪锚足够频繁地执行时,就开始跟踪记录。经过多次跟踪记录后,我们修改的JIT编译器将记录的跟踪合并到适合编译的结构中。在编译期间,将应用特定于跟踪的优化,并在必要时通过运行时检查加以保护。然后由解释器或已编译的跟踪调用生成的机器码。如果必须执行的方法部分没有被跟踪覆盖,因此没有被编译,或者如果运行时保护失败,则执行将返回到解释器。与基于方法的Java HotSpot客户机编译器相比,基准测试显示性能得到了改进,生成的机器码更少,编译速度更快。SPECjvm2008基准测试的峰值性能平均提高了9%,而生成的机器代码减少了29%。同样,SPECjbb2005基准测试的性能提高了13%,DaCapo 9.12 Bach基准测试的峰值性能平均提高了5%。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
Trace-based compilation for the Java HotSpot virtual machine
Traditional method-based just-in-time (JIT) compilation translates whole methods to optimized machine code. Trace-based compilation only generates machine code for frequently executed paths, so-called traces, that may span multiple methods. In this paper, we present our implementation of a trace-based JIT compiler in which we modified the mature, method-based Java HotSpot client compiler. To simplify trace recording, we added a bytecode preprocessing step that detects and directly marks loops within the bytecodes. We duplicated the existing bytecode interpreter and instrumented it for trace recording. In our implementation, traces can be anchored both at loop headers and at method entries. When a trace anchor has been executed frequently enough, trace recording is started. After several times of trace recording, our modified JIT compiler merges the recorded traces into a structure suitable for compilation. During compilation, trace-specific optimizations are applied and guarded with runtime checks if necessary. The generated machine code is then invoked by the interpreter or by already compiled traces. If a method part must be executed that was not covered by traces and therefore not compiled, or if a runtime guard fails, execution falls back to the interpreter. Benchmarks show an improved performance, less generated machine code and faster compilation compared to the method-based Java HotSpot client compiler. The peak performance of the SPECjvm2008 benchmarks is increased by 9% on average, while 29% less machine code is generated. Similarly, the performance of the SPECjbb2005 benchmark is increased by 13% and the DaCapo 9.12 Bach benchmarks show a peak performance increase of 5% on average.
求助全文
通过发布文献求助,成功后即可免费获取论文全文。 去求助
来源期刊
自引率
0.00%
发文量
0
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:604180095
Book学术官方微信