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

[REDO] Avoid repeated calls to JavaThread::last_frame in InterpreterRuntime

    Details

    • Subcomponent:
    • Resolved In Build:
      b33

      Description

      There are many cases in InterpreterRuntime that look like this:

      IRT_ENTRY(void, InterpreterRuntime::resolve_ldc(JavaThread* thread, Bytecodes::Code bytecode)) {
        ...
        methodHandle m (thread, method(thread));
        Bytecode_loadconstant ldc(m, bci(thread));

      Where method(thread) and bci(thread) each would issue a call to thread->last_frame():

        static frame last_frame(JavaThread *thread) { return thread->last_frame(); }
        static Method* method(JavaThread *thread) { return last_frame(thread).interpreter_frame_method(); }
        static address bcp(JavaThread *thread) { return last_frame(thread).interpreter_frame_bcp(); }

      However, JavaThread::last_frame() is expensive. E.g., the x86 version would search for a code blob in the code cache.

      ---

      The proposed enhancement is to call thread->last_frame() only once and reuse it:

        frame last_frame = thread->last_frame();
        methodHandle m (thread, method(last_frame));
        Bytecode_loadconstant ldc(m, bci(last_frame));

      Preliminary benchmarking shows significant VM start-up improvement:

      java -version:
      no CDS = 80.35 ms -> 79.14ms (-1.5%)
      w/ CDS = 53.89ms -> 52.62ms (-2.36%)

      clojure sample app:
      no CDS = 1442.46ms -> 1436.11ms (-0.44%)
      w/ CDS = 695.78ms -> 679.52ms (-2.34%)



        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                iklam Ioi Lam
                Reporter:
                iklam Ioi Lam
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: