JDK-8074345 : Enable RewriteBytecodes when VM runs with CDS
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2015-03-03
  • Updated: 2018-03-22
  • Resolved: 2015-03-26
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b64Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Description
The ConstMethods in a CDS image are mapped read-only. Currently when CDS is enabled, RewriteBytecodes and RewriteFrequentPairs are disabled to avoid modifying bytecodes in the CDS image. However, this causes the interpreter to run more slowly, for all methods, even those that are not located inside CDS.

Interpreter speed is important for C2 compiler, which tends to execute more bytecodes in interpreter mode before compiling them. As a result, some benchmarks showed 2% degradation when running under C2 and with CDS enabled.

We should try to enable RewriteBytecodes and RewriteFrequentPairs, at least for methods that are not stored in CDS, to improve interpreter speed.

The fix is to add new bytecodes such as _nofast_getfield. All _getfield bytecodes in CDS are rewritten to _nofast_getfield during CDS dump time. During run time, when a _getfield bytecode is encountered by the interpreter, we know that this bytecode is stored outside of CDS, and thus can be rewritten at runtime.

In the interpreter, the bytecode handler for _nofast_getfield works exactly as the handler for _getfield; the only exception is that the former does not rewrite the bytecode at runtime.