8169734: Update uses of string "java.base" to macro
authorrprotacio
Mon, 05 Dec 2016 16:08:20 -0500
changeset 42636 aafc434ba580
parent 42635 da364e57250c
child 42637 a9b83a4de25b
8169734: Update uses of string "java.base" to macro Summary: Replaced instances of "java.base" string with JAVA_BASE_NAME macro Reviewed-by: sspitsyn, dcubed
hotspot/src/share/vm/classfile/classLoader.cpp
hotspot/src/share/vm/classfile/javaClasses.cpp
hotspot/src/share/vm/classfile/moduleEntry.cpp
hotspot/src/share/vm/classfile/modules.cpp
hotspot/src/share/vm/classfile/packageEntry.cpp
hotspot/src/share/vm/classfile/vmSymbols.hpp
hotspot/src/share/vm/oops/arrayKlass.cpp
hotspot/src/share/vm/oops/instanceKlass.cpp
hotspot/src/share/vm/runtime/arguments.cpp
--- a/hotspot/src/share/vm/classfile/classLoader.cpp	Mon Dec 05 18:00:34 2016 +0000
+++ b/hotspot/src/share/vm/classfile/classLoader.cpp	Mon Dec 05 16:08:20 2016 -0500
@@ -504,7 +504,7 @@
 
     if (pkg_name != NULL) {
       if (!Universe::is_module_initialized()) {
-        location = (*JImageFindResource)(_jimage, "java.base", get_jimage_version_string(), name, &size);
+        location = (*JImageFindResource)(_jimage, JAVA_BASE_NAME, get_jimage_version_string(), name, &size);
 #if INCLUDE_CDS
         // CDS uses the boot class loader to load classes whose packages are in
         // modules defined for other class loaders.  So, for now, get their module
@@ -786,8 +786,8 @@
     // what the base or core piece of the boot loader search is.  Either a java runtime
     // image is present or this is an exploded module build situation.
     if (set_base_piece) {
-      assert(string_ends_with(path, MODULES_IMAGE_NAME) || string_ends_with(path, "java.base"),
-             "Incorrect boot loader search path, no java runtime image or java.base exploded build");
+      assert(string_ends_with(path, MODULES_IMAGE_NAME) || string_ends_with(path, JAVA_BASE_NAME),
+             "Incorrect boot loader search path, no java runtime image or " JAVA_BASE_NAME " exploded build");
       struct stat st;
       if (os::stat(path, &st) == 0) {
         // Directory found
@@ -1156,7 +1156,7 @@
 
   ResourceMark rm;
   jlong size;
-  JImageLocationRef location = (*JImageFindResource)(jimage, "java.base", get_jimage_version_string(), MODULE_LOADER_MAP, &size);
+  JImageLocationRef location = (*JImageFindResource)(jimage, JAVA_BASE_NAME, get_jimage_version_string(), MODULE_LOADER_MAP, &size);
   if (location == 0) {
     vm_exit_during_initialization(
       "Cannot find ModuleLoaderMap location from modules jimage.", NULL);
@@ -1839,7 +1839,7 @@
     MutexLocker ml(Module_lock, THREAD);
     ModuleEntry* jb_module = null_cld_modules->locked_create_entry_or_null(Handle(NULL), vmSymbols::java_base(), NULL, NULL, null_cld);
     if (jb_module == NULL) {
-      vm_exit_during_initialization("Unable to create ModuleEntry for java.base");
+      vm_exit_during_initialization("Unable to create ModuleEntry for " JAVA_BASE_NAME);
     }
     ModuleEntryTable::set_javabase_moduleEntry(jb_module);
   }
--- a/hotspot/src/share/vm/classfile/javaClasses.cpp	Mon Dec 05 18:00:34 2016 +0000
+++ b/hotspot/src/share/vm/classfile/javaClasses.cpp	Mon Dec 05 16:08:20 2016 -0500
@@ -802,7 +802,7 @@
     if (javabase_was_defined) {
       ModuleEntry *javabase_entry = ModuleEntryTable::javabase_moduleEntry();
       assert(javabase_entry != NULL && javabase_entry->module() != NULL,
-             "Setting class module field, java.base should be defined");
+             "Setting class module field, " JAVA_BASE_NAME " should be defined");
       Handle javabase_handle(THREAD, JNIHandles::resolve(javabase_entry->module()));
       set_module(mirror(), javabase_handle());
     }
--- a/hotspot/src/share/vm/classfile/moduleEntry.cpp	Mon Dec 05 18:00:34 2016 +0000
+++ b/hotspot/src/share/vm/classfile/moduleEntry.cpp	Mon Dec 05 16:08:20 2016 -0500
@@ -373,12 +373,12 @@
   assert(module_table != NULL, "boot loader's ModuleEntryTable not defined");
 
   if (module_handle.is_null()) {
-    fatal("Unable to finalize module definition for java.base");
+    fatal("Unable to finalize module definition for " JAVA_BASE_NAME);
   }
 
   // Set java.lang.reflect.Module, version and location for java.base
   ModuleEntry* jb_module = javabase_moduleEntry();
-  assert(jb_module != NULL, "java.base ModuleEntry not defined");
+  assert(jb_module != NULL, JAVA_BASE_NAME " ModuleEntry not defined");
   jb_module->set_version(version);
   jb_module->set_location(location);
   // Once java.base's ModuleEntry _module field is set with the known
@@ -395,7 +395,8 @@
 // Their module field is set once java.base's java.lang.reflect.Module is known to the VM.
 void ModuleEntryTable::patch_javabase_entries(Handle module_handle) {
   if (module_handle.is_null()) {
-    fatal("Unable to patch the module field of classes loaded prior to java.base's definition, invalid java.lang.reflect.Module");
+    fatal("Unable to patch the module field of classes loaded prior to "
+          JAVA_BASE_NAME "'s definition, invalid java.lang.reflect.Module");
   }
 
   // Do the fixups for the basic primitive types
--- a/hotspot/src/share/vm/classfile/modules.cpp	Mon Dec 05 18:00:34 2016 +0000
+++ b/hotspot/src/share/vm/classfile/modules.cpp	Mon Dec 05 16:08:20 2016 -0500
@@ -177,18 +177,18 @@
 
     if (string_obj == NULL || !string_obj->is_a(SystemDictionary::String_klass())) {
       THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
-                "Bad package name for module: java.base");
+                "Bad package name for module: " JAVA_BASE_NAME);
     }
     char *package_name = java_lang_String::as_utf8_string(string_obj);
     if (!Modules::verify_package_name(package_name)) {
       THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
-                err_msg("Invalid package name: %s for module: java.base", package_name));
+                err_msg("Invalid package name: %s for module: " JAVA_BASE_NAME, package_name));
     }
     Symbol* pkg_symbol = SymbolTable::new_symbol(package_name, CHECK);
     // append_if_missing() returns FALSE if entry already exists.
     if (!pkg_list->append_if_missing(pkg_symbol)) {
       THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
-                err_msg("Duplicate package name: %s for module java.base",
+                err_msg("Duplicate package name: %s for module " JAVA_BASE_NAME,
                         package_name));
     }
   }
@@ -206,7 +206,7 @@
   assert(pkg_list->length() == 0 || package_table != NULL, "Bad package_table");
 
   // Ensure java.base's ModuleEntry has been created
-  assert(ModuleEntryTable::javabase_moduleEntry() != NULL, "No ModuleEntry for java.base");
+  assert(ModuleEntryTable::javabase_moduleEntry() != NULL, "No ModuleEntry for " JAVA_BASE_NAME);
 
   bool duplicate_javabase = false;
   {
@@ -227,7 +227,7 @@
         // Some of java.base's packages were added early in bootstrapping, ignore duplicates.
         if (package_table->lookup_only(pkg_list->at(x)) == NULL) {
           pkg = package_table->locked_create_entry_or_null(pkg_list->at(x), ModuleEntryTable::javabase_moduleEntry());
-          assert(pkg != NULL, "Unable to create a java.base package entry");
+          assert(pkg != NULL, "Unable to create a " JAVA_BASE_NAME " package entry");
         }
         // Unable to have a GrowableArray of TempNewSymbol.  Must decrement the refcount of
         // the Symbol* that was created above for each package. The refcount was incremented
@@ -241,7 +241,7 @@
   }
   if (duplicate_javabase) {
     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
-              "Module java.base is already defined");
+              "Module " JAVA_BASE_NAME " is already defined");
   }
 
   // Only the thread that actually defined the base module will get here,
@@ -250,15 +250,15 @@
   // Patch any previously loaded class's module field with java.base's java.lang.reflect.Module.
   ModuleEntryTable::patch_javabase_entries(module_handle);
 
-  log_debug(modules)("define_javabase_module(): Definition of module: java.base,"
-                     " version: %s, location: %s, package #: %d",
+  log_debug(modules)("define_javabase_module(): Definition of module: "
+                     JAVA_BASE_NAME ", version: %s, location: %s, package #: %d",
                      module_version != NULL ? module_version : "NULL",
                      module_location != NULL ? module_location : "NULL",
                      pkg_list->length());
 
   // packages defined to java.base
   for (int x = 0; x < pkg_list->length(); x++) {
-    log_trace(modules)("define_javabase_module(): creation of package %s for module java.base",
+    log_trace(modules)("define_javabase_module(): creation of package %s for module " JAVA_BASE_NAME,
                        (pkg_list->at(x))->as_C_string());
   }
 }
@@ -283,7 +283,7 @@
   }
 
   // Special handling of java.base definition
-  if (strcmp(module_name, "java.base") == 0) {
+  if (strcmp(module_name, JAVA_BASE_NAME) == 0) {
     define_javabase_module(module, version, location, packages, CHECK);
     return;
   }
@@ -713,7 +713,8 @@
 
 // This method is called by JFR and JNI.
 jobject Modules::get_module(jclass clazz, TRAPS) {
-  assert(ModuleEntryTable::javabase_defined(), "Attempt to call get_module before java.base is defined");
+  assert(ModuleEntryTable::javabase_defined(),
+         "Attempt to call get_module before " JAVA_BASE_NAME " is defined");
 
   if (clazz == NULL) {
     THROW_MSG_(vmSymbols::java_lang_NullPointerException(),
@@ -759,7 +760,7 @@
 jobject Modules::get_module_by_package_name(jobject loader, jstring package, TRAPS) {
   ResourceMark rm(THREAD);
   assert(ModuleEntryTable::javabase_defined(),
-         "Attempt to call get_module_from_pkg before java.base is defined");
+         "Attempt to call get_module_from_pkg before " JAVA_BASE_NAME " is defined");
 
   if (NULL == package) {
     THROW_MSG_(vmSymbols::java_lang_NullPointerException(),
@@ -796,7 +797,7 @@
 
 jobject Modules::get_named_module(Handle h_loader, const char* package_str, TRAPS) {
   assert(ModuleEntryTable::javabase_defined(),
-         "Attempt to call get_named_module before java.base is defined");
+         "Attempt to call get_named_module before " JAVA_BASE_NAME " is defined");
   assert(h_loader.is_null() || java_lang_ClassLoader::is_subclass(h_loader->klass()),
          "Class loader is not a subclass of java.lang.ClassLoader");
   assert(package_str != NULL, "the package_str should not be NULL");
--- a/hotspot/src/share/vm/classfile/packageEntry.cpp	Mon Dec 05 18:00:34 2016 +0000
+++ b/hotspot/src/share/vm/classfile/packageEntry.cpp	Mon Dec 05 16:08:20 2016 -0500
@@ -293,7 +293,7 @@
           (module_name->fast_compare(vmSymbols::java_base()) == 0) &&
           !pkg_list->contains(entry->name())) {
         ResourceMark rm;
-        vm_exit_during_initialization("A non-java.base package was loaded prior to module system initialization", entry->name()->as_C_string());
+        vm_exit_during_initialization("A non-" JAVA_BASE_NAME " package was loaded prior to module system initialization", entry->name()->as_C_string());
       }
     }
   }
--- a/hotspot/src/share/vm/classfile/vmSymbols.hpp	Mon Dec 05 18:00:34 2016 +0000
+++ b/hotspot/src/share/vm/classfile/vmSymbols.hpp	Mon Dec 05 16:08:20 2016 -0500
@@ -25,6 +25,7 @@
 #ifndef SHARE_VM_CLASSFILE_VMSYMBOLS_HPP
 #define SHARE_VM_CLASSFILE_VMSYMBOLS_HPP
 
+#include "classfile/moduleEntry.hpp"
 #include "classfile/vmSymbols_ext.hpp"
 #include "oops/symbol.hpp"
 #include "memory/iterator.hpp"
@@ -50,7 +51,7 @@
 
 #define VM_SYMBOLS_DO(template, do_alias)                                                         \
   /* commonly used class, package, module names */                                                \
-  template(java_base,                                 "java.base")                                \
+  template(java_base,                                 JAVA_BASE_NAME)                             \
   template(java_lang_System,                          "java/lang/System")                         \
   template(java_lang_Object,                          "java/lang/Object")                         \
   template(java_lang_Class,                           "java/lang/Class")                          \
--- a/hotspot/src/share/vm/oops/arrayKlass.cpp	Mon Dec 05 18:00:34 2016 +0000
+++ b/hotspot/src/share/vm/oops/arrayKlass.cpp	Mon Dec 05 16:08:20 2016 -0500
@@ -105,7 +105,7 @@
   // These classes will be put on a fixup list and their module fields will be patched once
   // java.base is defined.
   assert((module_entry != NULL) || ((module_entry == NULL) && !ModuleEntryTable::javabase_defined()),
-         "module entry not available post java.base definition");
+         "module entry not available post " JAVA_BASE_NAME " definition");
   oop module = (module_entry != NULL) ? JNIHandles::resolve(module_entry->module()) : (oop)NULL;
   java_lang_Class::create_mirror(k, Handle(THREAD, k->class_loader()), Handle(THREAD, module), Handle(NULL), CHECK);
 }
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp	Mon Dec 05 18:00:34 2016 +0000
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp	Mon Dec 05 16:08:20 2016 -0500
@@ -2247,7 +2247,7 @@
         // the java.base module.  If a non-java.base package is erroneously placed
         // in the java.base module it will be caught later when java.base
         // is defined by ModuleEntryTable::verify_javabase_packages check.
-        assert(ModuleEntryTable::javabase_moduleEntry() != NULL, "java.base module is NULL");
+        assert(ModuleEntryTable::javabase_moduleEntry() != NULL, JAVA_BASE_NAME " module is NULL");
         _package_entry = loader_data->packages()->lookup(pkg_name, ModuleEntryTable::javabase_moduleEntry());
       } else {
         assert(loader_data->modules()->unnamed_module() != NULL, "unnamed module is NULL");
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Mon Dec 05 18:00:34 2016 +0000
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Mon Dec 05 16:08:20 2016 -0500
@@ -25,6 +25,7 @@
 #include "precompiled.hpp"
 #include "classfile/classLoader.hpp"
 #include "classfile/javaAssertions.hpp"
+#include "classfile/moduleEntry.hpp"
 #include "classfile/stringTable.hpp"
 #include "classfile/symbolTable.hpp"
 #include "code/codeCacheExtensions.hpp"
@@ -3427,9 +3428,9 @@
   // This check is only required for java.base, all other duplicate module specifications
   // will be checked during module system initialization.  The module system initialization
   // will throw an ExceptionInInitializerError if this situation occurs.
-  if (strcmp(module_name, "java.base") == 0) {
+  if (strcmp(module_name, JAVA_BASE_NAME) == 0) {
     if (*patch_mod_javabase) {
-      vm_exit_during_initialization("Cannot specify java.base more than once to --patch-module");
+      vm_exit_during_initialization("Cannot specify " JAVA_BASE_NAME " more than once to --patch-module");
     } else {
       *patch_mod_javabase = true;
     }