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

Use trampolines for i2i and i2c entries in Methods that are stored in CDS archive

    Details

    • Subcomponent:
    • Resolved In Build:
      b116
    • CPU:
      generic
    • OS:
      generic

      Description

      (This is an alternative proposal than JDK-8026297).

      When a CDS-archived class is loaded, the following 4 fields are unconditionally modified for every Method in this class:

      Method::_i2i_entry
      Method::_from_interpreted_entry
      Method::_from_compiled_entry
      Method::_adapter

      This causes a lot of copy-on-write on the Methods. If we can avoid these modifications, more data in the "RW" section of the CDS archive can be shared across processes.

      The proposal is to change the first 3 fields into trampoline calls. E.g.,

      Method::_i2i_entry points to a function F at a fixed location inside the CDS archive's "MC" section. In turn, F contains an unconditional branch to the real destination of the i2i entry.

      For the 4th field, the proposal is

        union {
          AdapterHandlerEntry* _adapter;
          AdapterHandlerEntry** _adapter_trampoline;
        };

        AdapterHandlerEntry* adapter() {
          if (is_shared()) {
            return *_adapter_trampoline;
          } else {
            return _adapter;
          }
        }

      _adapter_trampoline points to a fixed location A inside the CDS archive's "MD" section. In turn, A points to the real location of the AdapterHandlerEntry.

      When the class is loaded, the contents of F and A will be modified, but the contents of the Method no longer need to be modified.

      With this change, Method::_adapter can be moved to ConstMethod, since it never changes for archived Methods.

      We can also move Method::i2i_entry to ConstMethod. However, I am not sure about the performance impact, so this will be done in a separate RFE (JDK-8145234).

        Attachments

        1. aarch64_int_results3.txt
          6 kB
          Calvin Cheung
        2. macosx_xint_results2.txt
          6 kB
          Calvin Cheung
        3. refworkload_linux_x64.txt
          6 kB
          Ioi Lam
        4. sparcv9_results.txt
          6 kB
          Calvin Cheung

          Issue Links

            Activity

              People

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

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved: