< prev index next >

src/hotspot/share/classfile/systemDictionary.hpp

Print this page


   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_CLASSFILE_SYSTEMDICTIONARY_HPP
  26 #define SHARE_VM_CLASSFILE_SYSTEMDICTIONARY_HPP
  27 
  28 #include "classfile/classLoader.hpp"
  29 #include "classfile/systemDictionary_ext.hpp"
  30 #include "jvmci/systemDictionary_jvmci.hpp"
  31 #include "oops/objArrayOop.hpp"
  32 #include "oops/symbol.hpp"
  33 #include "runtime/java.hpp"
  34 #include "runtime/reflectionUtils.hpp"
  35 #include "runtime/signature.hpp"
  36 #include "utilities/hashtable.hpp"
  37 
  38 // The dictionary in each ClassLoaderData stores all loaded classes, either
  39 // initiatied by its class loader or defined by its class loader:
  40 //
  41 //   class loader -> ClassLoaderData -> [class, protection domain set]
  42 //
  43 // Classes are loaded lazily. The default VM class loader is
  44 // represented as NULL.
  45 
  46 // The underlying data structure is an open hash table (Dictionary) per
  47 // ClassLoaderData with a fixed number of buckets. During loading the
  48 // class loader object is locked, (for the VM loader a private lock object is used).
  49 // The global SystemDictionary_lock is held for all additions into the ClassLoaderData


 169   do_klass(MethodType_klass,                            java_lang_invoke_MethodType,               Pre                 ) \
 170   do_klass(BootstrapMethodError_klass,                  java_lang_BootstrapMethodError,            Pre                 ) \
 171   do_klass(CallSite_klass,                              java_lang_invoke_CallSite,                 Pre                 ) \
 172   do_klass(Context_klass,                               java_lang_invoke_MethodHandleNatives_CallSiteContext, Pre      ) \
 173   do_klass(ConstantCallSite_klass,                      java_lang_invoke_ConstantCallSite,         Pre                 ) \
 174   do_klass(MutableCallSite_klass,                       java_lang_invoke_MutableCallSite,          Pre                 ) \
 175   do_klass(VolatileCallSite_klass,                      java_lang_invoke_VolatileCallSite,         Pre                 ) \
 176   /* Note: MethodHandle must be first, and VolatileCallSite last in group */                                             \
 177                                                                                                                          \
 178   do_klass(AssertionStatusDirectives_klass,             java_lang_AssertionStatusDirectives,       Pre                 ) \
 179   do_klass(StringBuffer_klass,                          java_lang_StringBuffer,                    Pre                 ) \
 180   do_klass(StringBuilder_klass,                         java_lang_StringBuilder,                   Pre                 ) \
 181   do_klass(internal_Unsafe_klass,                       jdk_internal_misc_Unsafe,                  Pre                 ) \
 182   do_klass(module_Modules_klass,                        jdk_internal_module_Modules,               Pre                 ) \
 183                                                                                                                          \
 184   /* support for CDS */                                                                                                  \
 185   do_klass(ByteArrayInputStream_klass,                  java_io_ByteArrayInputStream,              Pre                 ) \
 186   do_klass(File_klass,                                  java_io_File,                              Pre                 ) \
 187   do_klass(URL_klass,                                   java_net_URL,                              Pre                 ) \
 188   do_klass(Jar_Manifest_klass,                          java_util_jar_Manifest,                    Pre                 ) \

 189   do_klass(jdk_internal_loader_ClassLoaders_AppClassLoader_klass,      jdk_internal_loader_ClassLoaders_AppClassLoader,       Pre ) \
 190   do_klass(jdk_internal_loader_ClassLoaders_PlatformClassLoader_klass, jdk_internal_loader_ClassLoaders_PlatformClassLoader,  Pre ) \
 191   do_klass(CodeSource_klass,                            java_security_CodeSource,                  Pre                 ) \
 192   do_klass(ParseUtil_klass,                             sun_net_www_ParseUtil,                     Pre                 ) \
 193                                                                                                                          \
 194   do_klass(StackTraceElement_klass,                     java_lang_StackTraceElement,               Opt                 ) \
 195                                                                                                                          \
 196   /* It's okay if this turns out to be NULL in non-1.4 JDKs. */                                                          \
 197   do_klass(nio_Buffer_klass,                            java_nio_Buffer,                           Opt                 ) \
 198                                                                                                                          \
 199   /* Stack Walking */                                                                                                    \
 200   do_klass(StackWalker_klass,                           java_lang_StackWalker,                     Opt                 ) \
 201   do_klass(AbstractStackWalker_klass,                   java_lang_StackStreamFactory_AbstractStackWalker, Opt          ) \
 202   do_klass(StackFrameInfo_klass,                        java_lang_StackFrameInfo,                  Opt                 ) \
 203   do_klass(LiveStackFrameInfo_klass,                    java_lang_LiveStackFrameInfo,              Opt                 ) \
 204                                                                                                                          \
 205   /* Preload boxing klasses */                                                                                           \
 206   do_klass(Boolean_klass,                               java_lang_Boolean,                         Pre                 ) \
 207   do_klass(Character_klass,                             java_lang_Character,                       Pre                 ) \
 208   do_klass(Float_klass,                                 java_lang_Float,                           Pre                 ) \
 209   do_klass(Double_klass,                                java_lang_Double,                          Pre                 ) \
 210   do_klass(Byte_klass,                                  java_lang_Byte,                            Pre                 ) \
 211   do_klass(Short_klass,                                 java_lang_Short,                           Pre                 ) \
 212   do_klass(Integer_klass,                               java_lang_Integer,                         Pre                 ) \
 213   do_klass(Long_klass,                                  java_lang_Long,                            Pre                 ) \
 214                                                                                                                          \
 215   /* Extensions */                                                                                                       \
 216   WK_KLASSES_DO_EXT(do_klass)                                                                                            \
 217   /* JVMCI classes. These are loaded on-demand. */                                                                       \
 218   JVMCI_WK_KLASSES_DO(do_klass)                                                                                          \
 219                                                                                                                          \
 220   /*end*/
 221 
 222 
 223 class SystemDictionary : AllStatic {
 224   friend class VMStructs;
 225   friend class SystemDictionaryHandles;
 226   friend class SharedClassUtil;
 227 
 228  public:
 229   enum WKID {
 230     NO_WKID = 0,
 231 
 232     #define WK_KLASS_ENUM(name, symbol, ignore_o) WK_KLASS_ENUM_NAME(name), WK_KLASS_ENUM_NAME(symbol) = WK_KLASS_ENUM_NAME(name),
 233     WK_KLASSES_DO(WK_KLASS_ENUM)
 234     #undef WK_KLASS_ENUM
 235 
 236     WKID_LIMIT,
 237 
 238 #if INCLUDE_JVMCI
 239     FIRST_JVMCI_WKID = WK_KLASS_ENUM_NAME(JVMCI_klass),
 240     LAST_JVMCI_WKID  = WK_KLASS_ENUM_NAME(Value_klass),
 241 #endif
 242 
 243     FIRST_WKID = NO_WKID + 1
 244   };
 245 
 246   enum InitOption {




   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_CLASSFILE_SYSTEMDICTIONARY_HPP
  26 #define SHARE_VM_CLASSFILE_SYSTEMDICTIONARY_HPP
  27 
  28 #include "classfile/classLoader.hpp"

  29 #include "jvmci/systemDictionary_jvmci.hpp"
  30 #include "oops/objArrayOop.hpp"
  31 #include "oops/symbol.hpp"
  32 #include "runtime/java.hpp"
  33 #include "runtime/reflectionUtils.hpp"
  34 #include "runtime/signature.hpp"
  35 #include "utilities/hashtable.hpp"
  36 
  37 // The dictionary in each ClassLoaderData stores all loaded classes, either
  38 // initiatied by its class loader or defined by its class loader:
  39 //
  40 //   class loader -> ClassLoaderData -> [class, protection domain set]
  41 //
  42 // Classes are loaded lazily. The default VM class loader is
  43 // represented as NULL.
  44 
  45 // The underlying data structure is an open hash table (Dictionary) per
  46 // ClassLoaderData with a fixed number of buckets. During loading the
  47 // class loader object is locked, (for the VM loader a private lock object is used).
  48 // The global SystemDictionary_lock is held for all additions into the ClassLoaderData


 168   do_klass(MethodType_klass,                            java_lang_invoke_MethodType,               Pre                 ) \
 169   do_klass(BootstrapMethodError_klass,                  java_lang_BootstrapMethodError,            Pre                 ) \
 170   do_klass(CallSite_klass,                              java_lang_invoke_CallSite,                 Pre                 ) \
 171   do_klass(Context_klass,                               java_lang_invoke_MethodHandleNatives_CallSiteContext, Pre      ) \
 172   do_klass(ConstantCallSite_klass,                      java_lang_invoke_ConstantCallSite,         Pre                 ) \
 173   do_klass(MutableCallSite_klass,                       java_lang_invoke_MutableCallSite,          Pre                 ) \
 174   do_klass(VolatileCallSite_klass,                      java_lang_invoke_VolatileCallSite,         Pre                 ) \
 175   /* Note: MethodHandle must be first, and VolatileCallSite last in group */                                             \
 176                                                                                                                          \
 177   do_klass(AssertionStatusDirectives_klass,             java_lang_AssertionStatusDirectives,       Pre                 ) \
 178   do_klass(StringBuffer_klass,                          java_lang_StringBuffer,                    Pre                 ) \
 179   do_klass(StringBuilder_klass,                         java_lang_StringBuilder,                   Pre                 ) \
 180   do_klass(internal_Unsafe_klass,                       jdk_internal_misc_Unsafe,                  Pre                 ) \
 181   do_klass(module_Modules_klass,                        jdk_internal_module_Modules,               Pre                 ) \
 182                                                                                                                          \
 183   /* support for CDS */                                                                                                  \
 184   do_klass(ByteArrayInputStream_klass,                  java_io_ByteArrayInputStream,              Pre                 ) \
 185   do_klass(File_klass,                                  java_io_File,                              Pre                 ) \
 186   do_klass(URL_klass,                                   java_net_URL,                              Pre                 ) \
 187   do_klass(Jar_Manifest_klass,                          java_util_jar_Manifest,                    Pre                 ) \
 188   do_klass(jdk_internal_loader_ClassLoaders_klass,      jdk_internal_loader_ClassLoaders,          Pre                 ) \
 189   do_klass(jdk_internal_loader_ClassLoaders_AppClassLoader_klass,      jdk_internal_loader_ClassLoaders_AppClassLoader,       Pre ) \
 190   do_klass(jdk_internal_loader_ClassLoaders_PlatformClassLoader_klass, jdk_internal_loader_ClassLoaders_PlatformClassLoader,  Pre ) \
 191   do_klass(CodeSource_klass,                            java_security_CodeSource,                  Pre                 ) \
 192   do_klass(ParseUtil_klass,                             sun_net_www_ParseUtil,                     Pre                 ) \
 193                                                                                                                          \
 194   do_klass(StackTraceElement_klass,                     java_lang_StackTraceElement,               Opt                 ) \
 195                                                                                                                          \
 196   /* It's okay if this turns out to be NULL in non-1.4 JDKs. */                                                          \
 197   do_klass(nio_Buffer_klass,                            java_nio_Buffer,                           Opt                 ) \
 198                                                                                                                          \
 199   /* Stack Walking */                                                                                                    \
 200   do_klass(StackWalker_klass,                           java_lang_StackWalker,                     Opt                 ) \
 201   do_klass(AbstractStackWalker_klass,                   java_lang_StackStreamFactory_AbstractStackWalker, Opt          ) \
 202   do_klass(StackFrameInfo_klass,                        java_lang_StackFrameInfo,                  Opt                 ) \
 203   do_klass(LiveStackFrameInfo_klass,                    java_lang_LiveStackFrameInfo,              Opt                 ) \
 204                                                                                                                          \
 205   /* Preload boxing klasses */                                                                                           \
 206   do_klass(Boolean_klass,                               java_lang_Boolean,                         Pre                 ) \
 207   do_klass(Character_klass,                             java_lang_Character,                       Pre                 ) \
 208   do_klass(Float_klass,                                 java_lang_Float,                           Pre                 ) \
 209   do_klass(Double_klass,                                java_lang_Double,                          Pre                 ) \
 210   do_klass(Byte_klass,                                  java_lang_Byte,                            Pre                 ) \
 211   do_klass(Short_klass,                                 java_lang_Short,                           Pre                 ) \
 212   do_klass(Integer_klass,                               java_lang_Integer,                         Pre                 ) \
 213   do_klass(Long_klass,                                  java_lang_Long,                            Pre                 ) \
 214                                                                                                                          \


 215   /* JVMCI classes. These are loaded on-demand. */                                                                       \
 216   JVMCI_WK_KLASSES_DO(do_klass)                                                                                          \
 217                                                                                                                          \
 218   /*end*/
 219 
 220 
 221 class SystemDictionary : AllStatic {
 222   friend class VMStructs;
 223   friend class SystemDictionaryHandles;

 224 
 225  public:
 226   enum WKID {
 227     NO_WKID = 0,
 228 
 229     #define WK_KLASS_ENUM(name, symbol, ignore_o) WK_KLASS_ENUM_NAME(name), WK_KLASS_ENUM_NAME(symbol) = WK_KLASS_ENUM_NAME(name),
 230     WK_KLASSES_DO(WK_KLASS_ENUM)
 231     #undef WK_KLASS_ENUM
 232 
 233     WKID_LIMIT,
 234 
 235 #if INCLUDE_JVMCI
 236     FIRST_JVMCI_WKID = WK_KLASS_ENUM_NAME(JVMCI_klass),
 237     LAST_JVMCI_WKID  = WK_KLASS_ENUM_NAME(Value_klass),
 238 #endif
 239 
 240     FIRST_WKID = NO_WKID + 1
 241   };
 242 
 243   enum InitOption {


< prev index next >