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

Module image file is opened twice during VM startup

    XMLWordPrintable

Details

    • Enhancement
    • Status: Resolved
    • P4
    • Resolution: Fixed
    • 17
    • 17
    • hotspot
    • b20

    Description

      This is called at VM startup. It opens the module image file, reads a small amount of info from it, and closes it.

      We should save this opened image file, so it doesn't need to be opened again in ClassLoader::create_class_path_entry().

      https://github.com/openjdk/jdk/blob/7988c1d9aa7e3b990c17fdf5e31195e66e7fc5f2/src/hotspot/share/classfile/classLoader.cpp#L1467

      char* ClassLoader::lookup_vm_options() {
        jint error;
        char modules_path[JVM_MAXPATHLEN];
        const char* fileSep = os::file_separator();

        // Initialize jimage library entry points
        load_jimage_library();

        jio_snprintf(modules_path, JVM_MAXPATHLEN, "%s%slib%smodules", Arguments::get_java_home(), fileSep, fileSep);
        JImageFile* jimage =(*JImageOpen)(modules_path, &error);
        if (jimage == NULL) {
          return NULL;
        }

        const char *jimage_version = get_jimage_version_string();
        char *options = lookup_vm_resource(jimage, jimage_version, "jdk/internal/vm/options");

        (*JImageClose)(jimage);
        return options;
      }

      Attachments

        Issue Links

          Activity

            People

              hseigel Harold Seigel (Inactive)
              iklam Ioi Lam
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: