Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8074345

Enable RewriteBytecodes when VM runs with CDS

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: hotspot
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b64
    • CPU:
      generic
    • OS:
      generic

      Backports

        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.

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  minqi Yumin Qi
                  Reporter:
                  minqi Yumin Qi
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: