1 /*
   2  * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package jdk.internal.module;
  27 
  28 import java.io.File;
  29 import java.io.PrintStream;
  30 import java.lang.module.Configuration;
  31 import java.lang.module.ModuleDescriptor;
  32 import java.lang.module.ModuleFinder;
  33 import java.lang.module.ModuleReference;
  34 import java.lang.module.ResolvedModule;
  35 import java.lang.reflect.Layer;
  36 import java.lang.reflect.Module;
  37 import java.net.URI;
  38 import java.nio.file.Path;
  39 import java.nio.file.Paths;
  40 import java.util.ArrayList;
  41 import java.util.Collections;
  42 import java.util.HashMap;
  43 import java.util.HashSet;
  44 import java.util.List;
  45 import java.util.Map;
  46 import java.util.Optional;
  47 import java.util.Set;
  48 import java.util.function.Function;
  49 
  50 import jdk.internal.loader.BootLoader;
  51 import jdk.internal.loader.BuiltinClassLoader;
  52 import jdk.internal.misc.SharedSecrets;
  53 import jdk.internal.perf.PerfCounter;
  54 
  55 /**
  56  * Initializes/boots the module system.
  57  *
  58  * The {@link #boot() boot} method is called early in the startup to initialize
  59  * the module system. In summary, the boot method creates a Configuration by
  60  * resolving a set of module names specified via the launcher (or equivalent)
  61  * -m and --add-modules options. The modules are located on a module path that
  62  * is constructed from the upgrade module path, system modules, and application
  63  * module path. The Configuration is instantiated as the boot Layer with each
  64  * module in the the configuration defined to one of the built-in class loaders.
  65  */
  66 
  67 public final class ModuleBootstrap {
  68     private ModuleBootstrap() { }
  69 
  70     private static final String JAVA_BASE = "java.base";
  71 
  72     private static final String JAVA_SE = "java.se";
  73 
  74     // the token for "all default modules"
  75     private static final String ALL_DEFAULT = "ALL-DEFAULT";
  76 
  77     // the token for "all unnamed modules"
  78     private static final String ALL_UNNAMED = "ALL-UNNAMED";
  79 
  80     // the token for "all system modules"
  81     private static final String ALL_SYSTEM = "ALL-SYSTEM";
  82 
  83     // the token for "all modules on the module path"
  84     private static final String ALL_MODULE_PATH = "ALL-MODULE-PATH";
  85 
  86     // The ModulePatcher for the initial configuration
  87     private static final ModulePatcher patcher = initModulePatcher();
  88 
  89     // ModuleFinder for the initial configuration
  90     private static ModuleFinder initialFinder;
  91 
  92     /**
  93      * Returns the ModulePatcher for the initial configuration.
  94      */
  95     public static ModulePatcher patcher() {
  96         return patcher;
  97     }
  98 
  99     /**
 100      * Returns the ModuleFinder for the initial configuration
 101      */
 102     public static ModuleFinder finder() {
 103         assert initialFinder != null;
 104         return initialFinder;
 105     }
 106 
 107     /**
 108      * Initialize the module system, returning the boot Layer.
 109      *
 110      * @see java.lang.System#initPhase2()
 111      */
 112     public static Layer boot() {
 113 
 114         long t0 = System.nanoTime();
 115 
 116         // system modules (may be patched)
 117         ModuleFinder systemModules = ModuleFinder.ofSystem();
 118 
 119         PerfCounters.systemModulesTime.addElapsedTimeFrom(t0);
 120 
 121 
 122         long t1 = System.nanoTime();
 123 
 124         // Once we have the system modules then we define the base module to
 125         // the VM. We do this here so that java.base is defined as early as
 126         // possible and also that resources in the base module can be located
 127         // for error messages that may happen from here on.
 128         ModuleReference base = systemModules.find(JAVA_BASE).orElse(null);
 129         if (base == null)
 130             throw new InternalError(JAVA_BASE + " not found");
 131         URI baseUri = base.location().orElse(null);
 132         if (baseUri == null)
 133             throw new InternalError(JAVA_BASE + " does not have a location");
 134         BootLoader.loadModule(base);
 135         Modules.defineModule(null, base.descriptor(), baseUri);
 136 
 137         PerfCounters.defineBaseTime.addElapsedTimeFrom(t1);
 138 
 139 
 140         long t2 = System.nanoTime();
 141 
 142         // --upgrade-module-path option specified to launcher
 143         ModuleFinder upgradeModulePath
 144             = createModulePathFinder("jdk.module.upgrade.path");
 145         if (upgradeModulePath != null)
 146             systemModules = ModuleFinder.compose(upgradeModulePath, systemModules);
 147 
 148         // --module-path option specified to the launcher
 149         ModuleFinder appModulePath = createModulePathFinder("jdk.module.path");
 150 
 151         // The module finder: [--upgrade-module-path] system [--module-path]
 152         ModuleFinder finder = systemModules;
 153         if (appModulePath != null)
 154             finder = ModuleFinder.compose(finder, appModulePath);
 155 
 156         // The root modules to resolve
 157         Set<String> roots = new HashSet<>();
 158 
 159         // launcher -m option to specify the main/initial module
 160         String mainModule = System.getProperty("jdk.module.main");
 161         if (mainModule != null)
 162             roots.add(mainModule);
 163 
 164         // additional module(s) specified by --add-modules
 165         boolean addAllDefaultModules = false;
 166         boolean addAllSystemModules = false;
 167         boolean addAllApplicationModules = false;
 168         for (String mod: getExtraAddModules()) {
 169             switch (mod) {
 170                 case ALL_DEFAULT:
 171                     addAllDefaultModules = true;
 172                     break;
 173                 case ALL_SYSTEM:
 174                     addAllSystemModules = true;
 175                     break;
 176                 case ALL_MODULE_PATH:
 177                     addAllApplicationModules = true;
 178                     break;
 179                 default :
 180                     roots.add(mod);
 181             }
 182         }
 183 
 184         // --limit-modules
 185         String propValue = getAndRemoveProperty("jdk.module.limitmods");
 186         if (propValue != null) {
 187             Set<String> mods = new HashSet<>();
 188             for (String mod: propValue.split(",")) {
 189                 mods.add(mod);
 190             }
 191             finder = limitFinder(finder, mods, roots);
 192         }
 193 
 194         // If there is no initial module specified then assume that the initial
 195         // module is the unnamed module of the application class loader. This
 196         // is implemented by resolving "java.se" and all (non-java.*) modules
 197         // that export an API. If "java.se" is not observable then all java.*
 198         // modules are resolved. Modules that have the DO_NOT_RESOLVE_BY_DEFAULT
 199         // bit set in their ModuleResolution attribute flags are excluded from
 200         // the default set of roots.
 201         if (mainModule == null || addAllDefaultModules) {
 202             boolean hasJava = false;
 203             if (systemModules.find(JAVA_SE).isPresent()) {
 204                 // java.se is a system module
 205                 if (finder == systemModules || finder.find(JAVA_SE).isPresent()) {
 206                     // java.se is observable
 207                     hasJava = true;
 208                     roots.add(JAVA_SE);
 209                 }
 210             }
 211 
 212             for (ModuleReference mref : systemModules.findAll()) {
 213                 String mn = mref.descriptor().name();
 214                 if (hasJava && mn.startsWith("java."))
 215                     continue;
 216 
 217                 if (ModuleResolution.doNotResolveByDefault(mref))
 218                     continue;
 219 
 220                 // add as root if observable and exports at least one package
 221                 if ((finder == systemModules || finder.find(mn).isPresent())) {
 222                     ModuleDescriptor descriptor = mref.descriptor();
 223                     for (ModuleDescriptor.Exports e : descriptor.exports()) {
 224                         if (!e.isQualified()) {
 225                             roots.add(mn);
 226                             break;
 227                         }
 228                     }
 229                 }
 230             }
 231         }
 232 
 233         // If `--add-modules ALL-SYSTEM` is specified then all observable system
 234         // modules will be resolved.
 235         if (addAllSystemModules) {
 236             ModuleFinder f = finder;  // observable modules
 237             systemModules.findAll()
 238                 .stream()
 239                 .filter(mref -> !ModuleResolution.doNotResolveByDefault(mref))
 240                 .map(ModuleReference::descriptor)
 241                 .map(ModuleDescriptor::name)
 242                 .filter(mn -> f.find(mn).isPresent())  // observable
 243                 .forEach(mn -> roots.add(mn));
 244         }
 245 
 246         // If `--add-modules ALL-MODULE-PATH` is specified then all observable
 247         // modules on the application module path will be resolved.
 248         if (appModulePath != null && addAllApplicationModules) {
 249             ModuleFinder f = finder;  // observable modules
 250             appModulePath.findAll()
 251                 .stream()
 252                 .map(ModuleReference::descriptor)
 253                 .map(ModuleDescriptor::name)
 254                 .filter(mn -> f.find(mn).isPresent())  // observable
 255                 .forEach(mn -> roots.add(mn));
 256         }
 257 
 258         PerfCounters.optionsAndRootsTime.addElapsedTimeFrom(t2);
 259 
 260 
 261         long t3 = System.nanoTime();
 262 
 263         // determine if post resolution checks are needed
 264         boolean needPostResolutionChecks = true;
 265         if (baseUri.getScheme().equals("jrt")   // toLowerCase not needed here
 266                 && (upgradeModulePath == null)
 267                 && (appModulePath == null)
 268                 && (patcher.isEmpty())) {
 269             needPostResolutionChecks = false;
 270         }
 271 
 272         PrintStream traceOutput = null;
 273         if (Boolean.getBoolean("jdk.launcher.traceResolver"))
 274             traceOutput = System.out;
 275 
 276         // run the resolver to create the configuration
 277         Configuration cf = SharedSecrets.getJavaLangModuleAccess()
 278                 .resolveRequiresAndUses(finder,
 279                                         roots,
 280                                         needPostResolutionChecks,
 281                                         traceOutput);
 282 
 283         // time to create configuration
 284         PerfCounters.resolveTime.addElapsedTimeFrom(t3);
 285 
 286         // check module names and incubating status
 287         checkModuleNamesAndStatus(cf);
 288 
 289         // mapping of modules to class loaders
 290         Function<String, ClassLoader> clf = ModuleLoaderMap.mappingFunction(cf);
 291 
 292         // check that all modules to be mapped to the boot loader will be
 293         // loaded from the runtime image
 294         if (needPostResolutionChecks) {
 295             for (ResolvedModule resolvedModule : cf.modules()) {
 296                 ModuleReference mref = resolvedModule.reference();
 297                 String name = mref.descriptor().name();
 298                 ClassLoader cl = clf.apply(name);
 299                 if (cl == null) {
 300 
 301                     if (upgradeModulePath != null
 302                             && upgradeModulePath.find(name).isPresent())
 303                         fail(name + ": cannot be loaded from upgrade module path");
 304 
 305                     if (!systemModules.find(name).isPresent())
 306                         fail(name + ": cannot be loaded from application module path");
 307                 }
 308             }
 309         }
 310 
 311 
 312         long t4 = System.nanoTime();
 313 
 314         // define modules to VM/runtime
 315         Layer bootLayer = Layer.empty().defineModules(cf, clf);
 316 
 317         PerfCounters.layerCreateTime.addElapsedTimeFrom(t4);
 318 
 319 
 320         long t5 = System.nanoTime();
 321 
 322         // define the module to its class loader, except java.base
 323         for (ResolvedModule resolvedModule : cf.modules()) {
 324             ModuleReference mref = resolvedModule.reference();
 325             String name = mref.descriptor().name();
 326             ClassLoader cl = clf.apply(name);
 327             if (cl == null) {
 328                 if (!name.equals(JAVA_BASE)) BootLoader.loadModule(mref);
 329             } else {
 330                 ((BuiltinClassLoader)cl).loadModule(mref);
 331             }
 332         }
 333 
 334         PerfCounters.loadModulesTime.addElapsedTimeFrom(t5);
 335 
 336 
 337         // --add-reads, -add-exports/-add-opens
 338         addExtraReads(bootLayer);
 339         addExtraExportsAndOpens(bootLayer);
 340 
 341         // total time to initialize
 342         PerfCounters.bootstrapTime.addElapsedTimeFrom(t0);
 343 
 344         // remember the ModuleFinder
 345         initialFinder = finder;
 346 
 347         return bootLayer;
 348     }
 349 
 350     /**
 351      * Returns a ModuleFinder that limits observability to the given root
 352      * modules, their transitive dependences, plus a set of other modules.
 353      */
 354     private static ModuleFinder limitFinder(ModuleFinder finder,
 355                                             Set<String> roots,
 356                                             Set<String> otherMods)
 357     {
 358         // resolve all root modules
 359         Configuration cf = Configuration.empty()
 360                 .resolveRequires(finder,
 361                                  ModuleFinder.of(),
 362                                  roots);
 363 
 364         // module name -> reference
 365         Map<String, ModuleReference> map = new HashMap<>();
 366 
 367         // root modules and their transitive dependences
 368         cf.modules().stream()
 369             .map(ResolvedModule::reference)
 370             .forEach(mref -> map.put(mref.descriptor().name(), mref));
 371 
 372         // additional modules
 373         otherMods.stream()
 374             .map(finder::find)
 375             .flatMap(Optional::stream)
 376             .forEach(mref -> map.putIfAbsent(mref.descriptor().name(), mref));
 377 
 378         // set of modules that are observable
 379         Set<ModuleReference> mrefs = new HashSet<>(map.values());
 380 
 381         return new ModuleFinder() {
 382             @Override
 383             public Optional<ModuleReference> find(String name) {
 384                 return Optional.ofNullable(map.get(name));
 385             }
 386             @Override
 387             public Set<ModuleReference> findAll() {
 388                 return mrefs;
 389             }
 390         };
 391     }
 392 
 393     /**
 394      * Creates a finder from the module path that is the value of the given
 395      * system property.
 396      */
 397     private static ModuleFinder createModulePathFinder(String prop) {
 398         String s = System.getProperty(prop);
 399         if (s == null) {
 400             return null;
 401         } else {
 402             String[] dirs = s.split(File.pathSeparator);
 403             Path[] paths = new Path[dirs.length];
 404             int i = 0;
 405             for (String dir: dirs) {
 406                 paths[i++] = Paths.get(dir);
 407             }
 408             return ModuleFinder.of(paths);
 409         }
 410     }
 411 
 412 
 413     /**
 414      * Initialize the module patcher for the initial configuration passed on the
 415      * value of the --patch-module options.
 416      */
 417     private static ModulePatcher initModulePatcher() {
 418         Map<String, List<String>> map = decode("jdk.module.patch.",
 419                                                File.pathSeparator,
 420                                                false);
 421         return new ModulePatcher(map);
 422     }
 423 
 424     /**
 425      * Returns the set of module names specified via --add-modules options
 426      * on the command line
 427      */
 428     private static Set<String> getExtraAddModules() {
 429         String prefix = "jdk.module.addmods.";
 430         int index = 0;
 431 
 432         // the system property is removed after decoding
 433         String value = getAndRemoveProperty(prefix + index);
 434         if (value == null) {
 435             return Collections.emptySet();
 436         }
 437 
 438         Set<String> modules = new HashSet<>();
 439         while (value != null) {
 440             for (String s : value.split(",")) {
 441                 if (s.length() > 0) modules.add(s);
 442             }
 443             index++;
 444             value = getAndRemoveProperty(prefix + index);
 445         }
 446 
 447         return modules;
 448     }
 449 
 450     /**
 451      * Process the --add-reads options to add any additional read edges that
 452      * are specified on the command-line.
 453      */
 454     private static void addExtraReads(Layer bootLayer) {
 455 
 456         // decode the command line options
 457         Map<String, List<String>> map = decode("jdk.module.addreads.");
 458         if (map.isEmpty())
 459             return;
 460 
 461         for (Map.Entry<String, List<String>> e : map.entrySet()) {
 462 
 463             // the key is $MODULE
 464             String mn = e.getKey();
 465             Optional<Module> om = bootLayer.findModule(mn);
 466             if (!om.isPresent()) {
 467                 warn("Unknown module: " + mn);
 468                 continue;
 469             }
 470             Module m = om.get();
 471 
 472             // the value is the set of other modules (by name)
 473             for (String name : e.getValue()) {
 474                 if (ALL_UNNAMED.equals(name)) {
 475                     Modules.addReadsAllUnnamed(m);
 476                 } else {
 477                     om = bootLayer.findModule(name);
 478                     if (om.isPresent()) {
 479                         Modules.addReads(m, om.get());
 480                     } else {
 481                         warn("Unknown module: " + name);
 482                     }
 483                 }
 484             }
 485         }
 486     }
 487 
 488     /**
 489      * Process the --add-exports and --add-opens options to export/open
 490      * additional packages specified on the command-line.
 491      */
 492     private static void addExtraExportsAndOpens(Layer bootLayer) {
 493 
 494         // --add-exports
 495         String prefix = "jdk.module.addexports.";
 496         Map<String, List<String>> extraExports = decode(prefix);
 497         if (!extraExports.isEmpty()) {
 498             addExtraExportsOrOpens(bootLayer, extraExports, false);
 499         }
 500 
 501         // --add-opens
 502         prefix = "jdk.module.addopens.";
 503         Map<String, List<String>> extraOpens = decode(prefix);
 504         if (!extraOpens.isEmpty()) {
 505             addExtraExportsOrOpens(bootLayer, extraOpens, true);
 506         }
 507     }
 508 
 509     private static void addExtraExportsOrOpens(Layer bootLayer,
 510                                                Map<String, List<String>> map,
 511                                                boolean opens)
 512     {
 513         for (Map.Entry<String, List<String>> e : map.entrySet()) {
 514 
 515             // the key is $MODULE/$PACKAGE
 516             String key = e.getKey();
 517             String[] s = key.split("/");
 518             if (s.length != 2)
 519                 fail("Unable to parse as <module>/<package>: " + key);
 520 
 521             String mn = s[0];
 522             String pn = s[1];
 523             if (mn.isEmpty() || pn.isEmpty())
 524                 fail("Module and package name must be specified: " + key);
 525 
 526             // The exporting module is in the boot layer
 527             Module m;
 528             Optional<Module> om = bootLayer.findModule(mn);
 529             if (!om.isPresent()) {
 530                 warn("Unknown module: " + mn);
 531                 continue;
 532             }
 533 
 534             m = om.get();
 535 
 536             if (!m.getDescriptor().packages().contains(pn)) {
 537                 warn("package " + pn + " not in " + mn);
 538                 continue;
 539             }
 540 
 541             // the value is the set of modules to export to (by name)
 542             for (String name : e.getValue()) {
 543                 boolean allUnnamed = false;
 544                 Module other = null;
 545                 if (ALL_UNNAMED.equals(name)) {
 546                     allUnnamed = true;
 547                 } else {
 548                     om = bootLayer.findModule(name);
 549                     if (om.isPresent()) {
 550                         other = om.get();
 551                     } else {
 552                         warn("Unknown module: " + name);
 553                         continue;
 554                     }
 555                 }
 556                 if (allUnnamed) {
 557                     if (opens) {
 558                         Modules.addOpensToAllUnnamed(m, pn);
 559                     } else {
 560                         Modules.addExportsToAllUnnamed(m, pn);
 561                     }
 562                 } else {
 563                     if (opens) {
 564                         Modules.addOpens(m, pn, other);
 565                     } else {
 566                         Modules.addExports(m, pn, other);
 567                     }
 568                 }
 569 
 570             }
 571         }
 572     }
 573 
 574     /**
 575      * Decodes the values of --add-reads, -add-exports, --add-opens or
 576      * --patch-modules options that are encoded in system properties.
 577      *
 578      * @param prefix the system property prefix
 579      * @praam regex the regex for splitting the RHS of the option value
 580      */
 581     private static Map<String, List<String>> decode(String prefix,
 582                                                     String regex,
 583                                                     boolean allowDuplicates) {
 584         int index = 0;
 585         // the system property is removed after decoding
 586         String value = getAndRemoveProperty(prefix + index);
 587         if (value == null)
 588             return Collections.emptyMap();
 589 
 590         Map<String, List<String>> map = new HashMap<>();
 591 
 592         while (value != null) {
 593 
 594             int pos = value.indexOf('=');
 595             if (pos == -1)
 596                 fail("Unable to parse as <module>=<value>: " + value);
 597             if (pos == 0)
 598                 fail("Missing module name in: " + value);
 599 
 600             // key is <module> or <module>/<package>
 601             String key = value.substring(0, pos);
 602 
 603             String rhs = value.substring(pos+1);
 604             if (rhs.isEmpty())
 605                 fail("Unable to parse as <module>=<value>: " + value);
 606 
 607             // value is <module>(,<module>)* or <file>(<pathsep><file>)*
 608             if (!allowDuplicates && map.containsKey(key))
 609                 fail(key + " specified more than once");
 610             List<String> values = map.computeIfAbsent(key, k -> new ArrayList<>());
 611             for (String s : rhs.split(regex)) {
 612                 if (s.length() > 0) values.add(s);
 613             }
 614 
 615             index++;
 616             value = getAndRemoveProperty(prefix + index);
 617         }
 618 
 619         return map;
 620     }
 621 
 622     /**
 623      * Decodes the values of --add-reads, -add-exports or --add-opens
 624      * which use the "," to separate the RHS of the option value.
 625      */
 626     private static Map<String, List<String>> decode(String prefix) {
 627         return decode(prefix, ",", true);
 628     }
 629 
 630     /**
 631      * Gets and remove the named system property
 632      */
 633     private static String getAndRemoveProperty(String key) {
 634         return (String)System.getProperties().remove(key);
 635     }
 636 
 637     /**
 638      * Checks the names and resolution bit of each module in the configuration,
 639      * emitting warnings if needed.
 640      */
 641     private static void checkModuleNamesAndStatus(Configuration cf) {
 642         String incubating = null;
 643         for (ResolvedModule rm : cf.modules()) {
 644             ModuleReference mref = rm.reference();
 645             String mn = mref.descriptor().name();
 646 
 647             // emit warning if module name ends with a non-Java letter
 648             if (!Checks.hasLegalModuleNameLastCharacter(mn))
 649                 warn("Module name \"" + mn + "\" may soon be illegal");
 650 
 651             // emit warning if the WARN_INCUBATING module resolution bit set
 652             if (ModuleResolution.hasIncubatingWarning(mref)) {
 653                 if (incubating == null) {
 654                     incubating = mn;
 655                 } else {
 656                     incubating += ", " + mn;
 657                 }
 658             }
 659         }
 660         if (incubating != null)
 661             warn("Using incubator modules: " + incubating);
 662     }
 663 
 664     /**
 665      * Throws a RuntimeException with the given message
 666      */
 667     static void fail(String m) {
 668         throw new RuntimeException(m);
 669     }
 670 
 671     static void warn(String m) {
 672         System.err.println("WARNING: " + m);
 673     }
 674 
 675     static class PerfCounters {
 676 
 677         static PerfCounter systemModulesTime
 678             = PerfCounter.newPerfCounter("jdk.module.bootstrap.systemModulesTime");
 679         static PerfCounter defineBaseTime
 680             = PerfCounter.newPerfCounter("jdk.module.bootstrap.defineBaseTime");
 681         static PerfCounter optionsAndRootsTime
 682             = PerfCounter.newPerfCounter("jdk.module.bootstrap.optionsAndRootsTime");
 683         static PerfCounter resolveTime
 684             = PerfCounter.newPerfCounter("jdk.module.bootstrap.resolveTime");
 685         static PerfCounter layerCreateTime
 686             = PerfCounter.newPerfCounter("jdk.module.bootstrap.layerCreateTime");
 687         static PerfCounter loadModulesTime
 688             = PerfCounter.newPerfCounter("jdk.module.bootstrap.loadModulesTime");
 689         static PerfCounter bootstrapTime
 690             = PerfCounter.newPerfCounter("jdk.module.bootstrap.totalTime");
 691     }
 692 }