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

Remove MetaspaceShared::exit_after_static_dump()

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 22
    • 21
    • hotspot
    • b09

      We can remove the following function if we avoid modifying global VM states during CDS static dump.

      // We have finished dumping the static archive. At this point, there may be pending VM
      // operations. We have changed some global states (such as vmClasses::_klasses) that
      // may cause these VM operations to fail. For safety, forget these operations and
      // exit the VM directly.
      void MetaspaceShared::exit_after_static_dump() {
        os::_exit(0);
      }

      =============================
      For example, before JDK-8307567, the following function may be called to update vmClasses::_klasses[i] to point to the "buffered copy" of the InstanceKlass.

      void vmClasses::metaspace_pointers_do(MetaspaceClosure* it) {
        for (auto id : EnumRange<vmClassID>{}) {
          it->push(klass_addr_at(id));
        }
      }

      After JDK-8307567, vmClasses::_klasses id no longer modified by -Xshare:dump. However, there still seems to be some important VM states that are modified, making it impossible to exit the VM normally.

      =================
      Benefits of this RFE:
      [1] After this RFE is implemented, we can remove some of the MetaspaceShared::unrecoverable_writing_error() calls mentioned in JDK-8306580. This makes the error handling more in-line with other JVM code.
      [2] We can perform further ahead-of-time optimization after the CDS archive is created. For example, we could run an AOT compiler to created compiled methods for the classes in the CDS archive.


            matsaave Matias Saavedra Silva
            iklam Ioi Lam
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: