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

Optimize SystemDictionary::resolve_well_known_classes for CDS



      Profiling shows that when CDS is enabled, SystemDictionary::resolve_well_known_classes() can cost up to 7% of the total time for running "java -cp . HelloWorld" (3.3ms out of 43ms -- see details in comments).

      There's no way for the user to affect how these well-known classes are loaded -- we will always end up loading the classes from the CDS archive. Therefore, it should be possible to store a pre-populated system dictionary in the CDS archive, where all of these classes are already loaded and linked. This avoids the complex work of looking up these classes and building the system dictionary at run time.

      Note that when this function is called, the JVM is in JVMTI_PHASE_PRIMORDIAL state (i.e., JvmtiExport::is_early_phase() == true). Before JDK-8212200, the user could replace some of these classes with a JVMTI agent that requests the can_generate_all_class_hook_events or can_generate_early_class_hook_events capabilities. However, since JDK-8212200, CDS is automatically disabled when such an agent exists.

      We might have to fake JFR class loading events and -Xlog:class+load messages to make the 'loading' of these classes observable.


          Issue Links



              • Assignee:
                minqi Yumin Qi
                iklam Ioi Lam
              • Votes:
                0 Vote for this issue
                1 Start watching this issue


                • Created: