技术控

    今日:82| 主题:49211
收藏本版 (1)
最新软件应用技术尽在掌握

[其他] Ahead-Of-Time (AOT) Compilation May Come to OpenJDK HotSpot in Java 9

[复制链接]
穿高跟鞋俯视 发表于 2016-10-1 16:31:11
67 2

立即注册CoLaBug.com会员,免费获得投稿人的专业资料,享用更多功能,玩转个人品牌!

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
As covered in the article “    What the JIT!? Anatomy of the OpenJDK HotSpot VM”, HotSpot’s execution engine has a Just-in-Time (JIT) compiler. In order to improve startup times, the tiered compilation starts interpreting the code and then quickly moves to tiers 1, 2, or 3 where the methods are compiled at the client compilation level (but with different profiling information) and then finally moves to the server compilation level. (For more information on this please refer the above article). But even with the improvements in the compilation levels, HotSpot still starts interpreting its bytecode and then moves on to JIT-ting it.  
  This September, a    proposalwas submitted to add Ahead-of-Time (AOT) compilation to HotSpot. AOT helps with improving the startup time by loading pre-compiled classes. This helps avoid running those classes in the interpretated mode or at a sub-optimized compilation level.  
  AOT compilation is not new to dynamic compilers;    IBM’s J9 VM supports AOT, so does    Excelsior JETand others. AOT has helped many dynamic compilers achieve better startup/warmup times by using (shared) libraries that have already been compiled to native code.  
  Similar to the JIT compiler, the AOT compilation proposed in the JEP will have a tiered and a non-tiered mode. The difference being in the collection of profiling information and JIT recompilation. As mentioned in thearticle, with tiered compilation, simple profiling information is gathered at tier 2 – the same goes for tiered AOT compiled code. And when the AOT invocation thresholds are crossed, those methods get recompiled by the client compiler at tier 3, so that full profiling information can be captured for the server recompilation that will happen at tier 4.  
  The proposal as laid by Valdimir Kozlov, lead of the HotSpot compiler team, mentions that for the first release, only    java.basemodule will be supported as tiered AOT, since the base module is well known and can help with thorough internal testing.  
  AOT brings about a new tool called    ‘jaotc'which uses    Graalas the backend (to generate code). The Graal dynamic compiler integrates with the HotSpot VM and depends on the    JVM Compiler Interface (JVMCI), hence the JDK (that supports Graal or AOT) should also support JVMCI. There are some JVMCI enabled builds available on the    Oracle technetwork site.  
  According to the proposal, the    jaotctool supports various flags:  
  1. --module <name> Module to compile
  2. --output <file> Output file name
  3. --compile-commands <file> Name of file with compile commands
  4. --compile-for-tiered Generated profiling code for tiered compilation
  5. --classpath <path> Specify where to find user class files
  6. --threads <number> Number of compilation threads to be used
  7. --ignore-errors Ignores all exceptions thrown during class loading
  8. --exit-on-error Exit on compilation errors
  9. --info Print information during compilation
  10. --verbose Print verbose information
  11. --debug Print debug information
  12. --help Print this usage message
  13. --version Version information
  14. -J<flag> Pass <flag> directly to the runtime system
复制代码
Also, the JVM product will have the following flags:
  1. +/-UseAOT            - Use AOT-compiled files
  2. +/-PrintAOT          - Print used AOT klasses and methods
  3. AOTLibrary=<file>    - Specify the AOT library file
复制代码
A few notproduct/develop flags will also be made available for users:
  1. PrintAOTStatistics   - Print AOT statistics
  2. UseAOTStrictLoading  - Exit the VM if any of the AOT libraries has invalid config
复制代码
The proposal also states that the logging of AOT runtime events will be integrated with the    unified GC loggingand the following tags will be supported:  
  1. aotclassfingerprint
  2. aotclassload
  3. aotclassresolve
复制代码
No proposal is complete without listing the risks and assumptions made, and the risk with the AOT proposal is highlighted as follows:
  It’s possible that the use of pre-compiled code could result in less-than-optimal code being used, resulting in a loss of performance. Performance testing shows that some applications benefit from AOT-compiled code while others clearly show regressions. Since the AOT feature is an opt-in feature, possible performance regressions with user applications are avoidable. If a user finds that an application starts up more slowly, or doesn't reach the expected peak performance, they can just rebuild a new JDK without AOT libraries.
友荐云推荐




上一篇:Zsh vs Bash
下一篇:IDG Contributor Network: Best practices in .Net asynchronous programming
酷辣虫提示酷辣虫禁止发表任何与中华人民共和国法律有抵触的内容!所有内容由用户发布,并不代表酷辣虫的观点,酷辣虫无法对用户发布内容真实性提供任何的保证,请自行验证并承担风险与后果。如您有版权、违规等问题,请通过"联系我们"或"违规举报"告知我们处理。

广有丙xm 发表于 2016-10-1 18:18:05
回帖无节操
回复 支持 反对

使用道具 举报

流年似水 发表于 2016-10-10 20:25:29
支持,赞一个
回复 支持 反对

使用道具 举报

*滑动验证:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

我要投稿

推荐阅读

扫码访问 @iTTTTT瑞翔 的微博
回页顶回复上一篇下一篇回列表手机版
手机版/CoLaBug.com ( 粤ICP备05003221号 | 文网文[2010]257号 )|网站地图 酷辣虫

© 2001-2016 Comsenz Inc. Design: Dean. DiscuzFans.

返回顶部 返回列表