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

Cache builtin class loader constraints to avoid re-initializing itable/vtable for shared classes

XMLWordPrintable

    • b22

      We have one start-up benchmark that runs ~10% faster with the following hack which disable loader constraints for all CDS archived classes:

      diff -r 2b1c2d378b0b src/share/vm/oops/instanceKlass.cpp
      --- a/src/share/vm/oops/instanceKlass.cpp Tue Mar 21 14:14:06 2017 +0100
      +++ b/src/share/vm/oops/instanceKlass.cpp Fri Apr 07 05:42:16 2017 -0700
      @@ -619,7 +619,7 @@
             // a shared class if the class is not loaded by the NULL classloader.
             ClassLoaderData * loader_data = class_loader_data();
             if (!(is_shared() &&
      - loader_data->is_the_null_class_loader_data())) {
      + (loader_data->is_the_null_class_loader_data() || UseNewCode))) {
               ResourceMark rm(THREAD);
               vtable()->initialize_vtable(true, CHECK_false);
               itable()->initialize_itable(true, CHECK_false);

      Original: 702ms
      Disabled: 653ms = ~9.2% faster

      Profiling with the Linux "perf" command shows that about 7.5% of time is spent inside the initialize_[iv]table() functions.

      For shared classes, the i/v tables are already initialized at dump time; so, at run time, the initialize_[iv]table() doesn't actually initialize the i/v tables. They just discover the loader constraints and call SystemDictionary::check_signature_loaders. See:
      http://hg.openjdk.java.net/jdk/jdk/file/f280911d3427/src/hotspot/share/oops/klassVtable.cpp#l491
      http://hg.openjdk.java.net/jdk/jdk/file/f280911d3427/src/hotspot/share/oops/klassVtable.cpp#l1229

      The proposal is to save the loader constraints during dump time, so at run time we can call SystemDictionary::check_signature_loaders without executing initialize_[iv]table().

            minqi Yumin Qi
            iklam Ioi Lam
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: