diff --git a/src/hotspot/share/classfile/javaClasses.hpp b/src/hotspot/share/classfile/javaClasses.hpp index 44d74a20aa96b..e6cfaed0c8749 100644 --- a/src/hotspot/share/classfile/javaClasses.hpp +++ b/src/hotspot/share/classfile/javaClasses.hpp @@ -25,6 +25,7 @@ #ifndef SHARE_CLASSFILE_JAVACLASSES_HPP #define SHARE_CLASSFILE_JAVACLASSES_HPP +#include "classfile/stringTable.hpp" #include "classfile/vmClasses.hpp" #include "oops/instanceKlass.hpp" #include "oops/oopsHierarchy.hpp" @@ -197,7 +198,7 @@ class java_lang_String : AllStatic { // Debugging static void print(oop java_string, outputStream* st); friend class JavaClasses; - friend class StringTable; + friend class hotspot_jvm::StringTable; }; diff --git a/src/hotspot/share/classfile/stringTable.cpp b/src/hotspot/share/classfile/stringTable.cpp index 89381b1a785f1..8c37324fb64b3 100644 --- a/src/hotspot/share/classfile/stringTable.cpp +++ b/src/hotspot/share/classfile/stringTable.cpp @@ -63,6 +63,8 @@ #include "gc/g1/g1CollectedHeap.hpp" #endif +namespace hotspot_jvm { + // We prefer short chains of avg 2 const double PREF_AVG_LIST_LEN = 2.0; // 2^24 is max size @@ -764,6 +766,8 @@ void StringTable::dump(outputStream* st, bool verbose) { } } +} // namespace hotspot_jvm + // Utility for dumping strings StringtableDCmd::StringtableDCmd(outputStream* output, bool heap) : DCmdWithParser(output, heap), @@ -778,6 +782,8 @@ void StringtableDCmd::execute(DCmdSource source, TRAPS) { VMThread::execute(&dumper); } +namespace hotspot_jvm { + // Sharing #if INCLUDE_CDS_JAVA_HEAP size_t StringTable::shared_entry_count() { @@ -935,3 +941,5 @@ void StringTable::serialize_shared_table_header(SerializeClosure* soc) { soc->do_int(&_shared_strings_array_root_index); } #endif //INCLUDE_CDS_JAVA_HEAP + +} // namespace hotspot_jvm diff --git a/src/hotspot/share/classfile/stringTable.hpp b/src/hotspot/share/classfile/stringTable.hpp index 1b41c12ffedb4..2ce02cdb07635 100644 --- a/src/hotspot/share/classfile/stringTable.hpp +++ b/src/hotspot/share/classfile/stringTable.hpp @@ -37,6 +37,8 @@ class DumpedInternedStrings; class JavaThread; class SerializeClosure; +namespace hotspot_jvm { + class StringTable; class StringTableConfig; class StringTableCreateEntry; @@ -158,4 +160,6 @@ class StringTable : public CHeapObj{ static void verify(); }; +} // namespace hotspot_jvm + #endif // SHARE_CLASSFILE_STRINGTABLE_HPP diff --git a/src/hotspot/share/precompiled/precompiled.hpp b/src/hotspot/share/precompiled/precompiled.hpp index c6b8668010ed3..e8ecfaa851b1f 100644 --- a/src/hotspot/share/precompiled/precompiled.hpp +++ b/src/hotspot/share/precompiled/precompiled.hpp @@ -25,6 +25,12 @@ // Precompiled headers are turned off if the user passes // --disable-precompiled-headers to configure. +// The hotspot_jvm namespace using directive must be placed outside +// #ifndef DONT_USE_PRECOMPILED_HEADER. That ensures it works with and +// without precompiled headers. +namespace hotspot_jvm {} +using namespace hotspot_jvm; + #ifndef DONT_USE_PRECOMPILED_HEADER // These header files are included in at least 130 C++ files, as of