1 /*
  2  * Copyright (c) 2021, 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.
  8  *
  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_CLASSFILE_VMCLASSMACROS_HPP
 26 #define SHARE_CLASSFILE_VMCLASSMACROS_HPP
 27 
 28 // _VM_CLASS_ENUM - internal: should be used only by vmClass*.{hpp,cpp}
 29 #define _VM_CLASS_ENUM(kname)    kname##_knum
 30 
 31 #define VM_CLASS_ID(kname)      vmClassID::_VM_CLASS_ENUM(kname)
 32 
 33 // VM_CLASSES_DO iterates the classes that are directly referenced
 34 // by the VM, suhch as java.lang.Object and java.lang.String. These
 35 // classes are resolved at VM bootstrap, before any Java code is executed,
 36 // so no class loader is able to provide a different definition.
 37 //
 38 // Each VM class has a short klass name (like Object_klass),
 39 // and a vmSymbol name (like java_lang_Object). Both of these can
 40 // be used to find the vmClassID for this class. The following two
 41 // macros will evaluate to the same value:
 42 //
 43 //    VM_CLASS_ID(Object_klass)
 44 //    VM_CLASS_ID(java_lang_Object)
 45 //
 46 // The order of these definitions is significant: the classes are
 47 // resolved by vmClasses::resolve_all() in this order. Changing the
 48 // order may require careful restructuring of the VM start-up sequence.
 49 //
 50 #define VM_CLASSES_DO(do_klass)                                                                                 \
 51   /* well-known classes */                                                                                      \
 52   do_klass(Object_klass,                                java_lang_Object                                      ) \
 53   do_klass(String_klass,                                java_lang_String                                      ) \
 54   do_klass(Class_klass,                                 java_lang_Class                                       ) \
 55   do_klass(Cloneable_klass,                             java_lang_Cloneable                                   ) \
 56   do_klass(ClassLoader_klass,                           java_lang_ClassLoader                                 ) \
 57   do_klass(Serializable_klass,                          java_io_Serializable                                  ) \
 58   do_klass(System_klass,                                java_lang_System                                      ) \
 59   do_klass(Throwable_klass,                             java_lang_Throwable                                   ) \
 60   do_klass(Error_klass,                                 java_lang_Error                                       ) \
 61   do_klass(ThreadDeath_klass,                           java_lang_ThreadDeath                                 ) \
 62   do_klass(Exception_klass,                             java_lang_Exception                                   ) \
 63   do_klass(RuntimeException_klass,                      java_lang_RuntimeException                            ) \
 64   do_klass(SecurityManager_klass,                       java_lang_SecurityManager                             ) \
 65   do_klass(ProtectionDomain_klass,                      java_security_ProtectionDomain                        ) \
 66   do_klass(AccessControlContext_klass,                  java_security_AccessControlContext                    ) \
 67   do_klass(AccessController_klass,                      java_security_AccessController                        ) \
 68   do_klass(SecureClassLoader_klass,                     java_security_SecureClassLoader                       ) \
 69   do_klass(ClassNotFoundException_klass,                java_lang_ClassNotFoundException                      ) \
 70   do_klass(Record_klass,                                java_lang_Record                                      ) \
 71   do_klass(NoClassDefFoundError_klass,                  java_lang_NoClassDefFoundError                        ) \
 72   do_klass(LinkageError_klass,                          java_lang_LinkageError                                ) \
 73   do_klass(ClassCastException_klass,                    java_lang_ClassCastException                          ) \
 74   do_klass(ArrayStoreException_klass,                   java_lang_ArrayStoreException                         ) \
 75   do_klass(VirtualMachineError_klass,                   java_lang_VirtualMachineError                         ) \
 76   do_klass(InternalError_klass,                         java_lang_InternalError                               ) \
 77   do_klass(OutOfMemoryError_klass,                      java_lang_OutOfMemoryError                            ) \
 78   do_klass(StackOverflowError_klass,                    java_lang_StackOverflowError                          ) \
 79   do_klass(IllegalMonitorStateException_klass,          java_lang_IllegalMonitorStateException                ) \
 80   do_klass(Reference_klass,                             java_lang_ref_Reference                               ) \
 81                                                                                                                 \
 82   /* ref klasses and set reference types */                                                                     \
 83   do_klass(SoftReference_klass,                         java_lang_ref_SoftReference                           ) \
 84   do_klass(WeakReference_klass,                         java_lang_ref_WeakReference                           ) \
 85   do_klass(FinalReference_klass,                        java_lang_ref_FinalReference                          ) \
 86   do_klass(PhantomReference_klass,                      java_lang_ref_PhantomReference                        ) \
 87   do_klass(Finalizer_klass,                             java_lang_ref_Finalizer                               ) \
 88                                                                                                                 \
 89   do_klass(Thread_klass,                                java_lang_Thread                                      ) \
 90   do_klass(ThreadGroup_klass,                           java_lang_ThreadGroup                                 ) \
 91   do_klass(Properties_klass,                            java_util_Properties                                  ) \
 92   do_klass(Module_klass,                                java_lang_Module                                      ) \
 93   do_klass(reflect_AccessibleObject_klass,              java_lang_reflect_AccessibleObject                    ) \
 94   do_klass(reflect_Field_klass,                         java_lang_reflect_Field                               ) \
 95   do_klass(reflect_Parameter_klass,                     java_lang_reflect_Parameter                           ) \
 96   do_klass(reflect_Method_klass,                        java_lang_reflect_Method                              ) \
 97   do_klass(reflect_Constructor_klass,                   java_lang_reflect_Constructor                         ) \
 98                                                                                                                 \
 99   /* NOTE: needed too early in bootstrapping process to have checks based on JDK version */                     \
100   /* It's okay if this turns out to be NULL in non-1.4 JDKs. */                                                 \
101   do_klass(reflect_MagicAccessorImpl_klass,             reflect_MagicAccessorImpl                             ) \
102   do_klass(reflect_MethodAccessorImpl_klass,            reflect_MethodAccessorImpl                            ) \
103   do_klass(reflect_ConstructorAccessorImpl_klass,       reflect_ConstructorAccessorImpl                       ) \
104   do_klass(reflect_DelegatingClassLoader_klass,         reflect_DelegatingClassLoader                         ) \
105   do_klass(reflect_ConstantPool_klass,                  reflect_ConstantPool                                  ) \
106   do_klass(reflect_UnsafeStaticFieldAccessorImpl_klass, reflect_UnsafeStaticFieldAccessorImpl                 ) \
107   do_klass(reflect_CallerSensitive_klass,               reflect_CallerSensitive                               ) \
108   do_klass(reflect_NativeConstructorAccessorImpl_klass, reflect_NativeConstructorAccessorImpl                 ) \
109                                                                                                                 \
110   /* support for dynamic typing; it's OK if these are NULL in earlier JDKs */                                   \
111   do_klass(DirectMethodHandle_klass,                    java_lang_invoke_DirectMethodHandle                   ) \
112   do_klass(MethodHandle_klass,                          java_lang_invoke_MethodHandle                         ) \
113   do_klass(VarHandle_klass,                             java_lang_invoke_VarHandle                            ) \
114   do_klass(MemberName_klass,                            java_lang_invoke_MemberName                           ) \
115   do_klass(ResolvedMethodName_klass,                    java_lang_invoke_ResolvedMethodName                   ) \
116   do_klass(MethodHandleNatives_klass,                   java_lang_invoke_MethodHandleNatives                  ) \
117   do_klass(LambdaForm_klass,                            java_lang_invoke_LambdaForm                           ) \
118   do_klass(MethodType_klass,                            java_lang_invoke_MethodType                           ) \
119   do_klass(BootstrapMethodError_klass,                  java_lang_BootstrapMethodError                        ) \
120   do_klass(CallSite_klass,                              java_lang_invoke_CallSite                             ) \
121   do_klass(NativeEntryPoint_klass,                      jdk_internal_invoke_NativeEntryPoint                  ) \
122   do_klass(Context_klass,                               java_lang_invoke_MethodHandleNatives_CallSiteContext  ) \
123   do_klass(ConstantCallSite_klass,                      java_lang_invoke_ConstantCallSite                     ) \
124   do_klass(MutableCallSite_klass,                       java_lang_invoke_MutableCallSite                      ) \
125   do_klass(VolatileCallSite_klass,                      java_lang_invoke_VolatileCallSite                     ) \
126   /* Note: MethodHandle must be first, and VolatileCallSite last in group */                                    \
127                                                                                                                 \
128   do_klass(AssertionStatusDirectives_klass,             java_lang_AssertionStatusDirectives                   ) \
129   do_klass(StringBuffer_klass,                          java_lang_StringBuffer                                ) \
130   do_klass(StringBuilder_klass,                         java_lang_StringBuilder                               ) \
131   do_klass(UnsafeConstants_klass,                       jdk_internal_misc_UnsafeConstants                     ) \
132   do_klass(internal_Unsafe_klass,                       jdk_internal_misc_Unsafe                              ) \
133   do_klass(module_Modules_klass,                        jdk_internal_module_Modules                           ) \
134                                                                                                                 \
135   /* support for CDS */                                                                                         \
136   do_klass(ByteArrayInputStream_klass,                  java_io_ByteArrayInputStream                          ) \
137   do_klass(URL_klass,                                   java_net_URL                                          ) \
138   do_klass(URLClassLoader_klass,                        java_net_URLClassLoader                               ) \
139   do_klass(Jar_Manifest_klass,                          java_util_jar_Manifest                                ) \
140   do_klass(jdk_internal_loader_BuiltinClassLoader_klass,jdk_internal_loader_BuiltinClassLoader                ) \
141   do_klass(jdk_internal_loader_ClassLoaders_klass,      jdk_internal_loader_ClassLoaders                      ) \
142   do_klass(jdk_internal_loader_ClassLoaders_AppClassLoader_klass,      jdk_internal_loader_ClassLoaders_AppClassLoader) \
143   do_klass(jdk_internal_loader_ClassLoaders_PlatformClassLoader_klass, jdk_internal_loader_ClassLoaders_PlatformClassLoader) \
144   do_klass(CodeSource_klass,                            java_security_CodeSource                              ) \
145   do_klass(ConcurrentHashMap_klass,                     java_util_concurrent_ConcurrentHashMap                ) \
146   do_klass(ArrayList_klass,                             java_util_ArrayList                                   ) \
147                                                                                                                 \
148   do_klass(StackTraceElement_klass,                     java_lang_StackTraceElement                           ) \
149                                                                                                                 \
150   /* It's okay if this turns out to be NULL in non-1.4 JDKs. */                                                 \
151   do_klass(nio_Buffer_klass,                            java_nio_Buffer                                       ) \
152                                                                                                                 \
153   /* Stack Walking */                                                                                           \
154   do_klass(StackWalker_klass,                           java_lang_StackWalker                                 ) \
155   do_klass(AbstractStackWalker_klass,                   java_lang_StackStreamFactory_AbstractStackWalker      ) \
156   do_klass(StackFrameInfo_klass,                        java_lang_StackFrameInfo                              ) \
157   do_klass(LiveStackFrameInfo_klass,                    java_lang_LiveStackFrameInfo                          ) \
158                                                                                                                 \
159   /* support for stack dump lock analysis */                                                                    \
160   do_klass(java_util_concurrent_locks_AbstractOwnableSynchronizer_klass, java_util_concurrent_locks_AbstractOwnableSynchronizer) \
161                                                                                                                 \
162   /* boxing klasses */                                                                                          \
163   do_klass(Boolean_klass,                               java_lang_Boolean                                     ) \
164   do_klass(Character_klass,                             java_lang_Character                                   ) \
165   do_klass(Float_klass,                                 java_lang_Float                                       ) \
166   do_klass(Double_klass,                                java_lang_Double                                      ) \
167   do_klass(Byte_klass,                                  java_lang_Byte                                        ) \
168   do_klass(Short_klass,                                 java_lang_Short                                       ) \
169   do_klass(Integer_klass,                               java_lang_Integer                                     ) \
170   do_klass(Long_klass,                                  java_lang_Long                                        ) \
171                                                                                                                 \
172   /* force inline of iterators */                                                                               \
173   do_klass(Iterator_klass,                              java_util_Iterator                                    ) \
174                                                                                                                 \
175   /* support for records */                                                                                     \
176   do_klass(RecordComponent_klass,                       java_lang_reflect_RecordComponent                     ) \
177                                                                                                                 \
178   /* support for vectors*/                                                                                      \
179   do_klass(vector_VectorSupport_klass,                  jdk_internal_vm_vector_VectorSupport                  ) \
180   do_klass(vector_VectorPayload_klass,                  jdk_internal_vm_vector_VectorPayload                  ) \
181   do_klass(vector_Vector_klass,                         jdk_internal_vm_vector_Vector                         ) \
182   do_klass(vector_VectorMask_klass,                     jdk_internal_vm_vector_VectorMask                     ) \
183   do_klass(vector_VectorShuffle_klass,                  jdk_internal_vm_vector_VectorShuffle                  ) \
184                                                                                                                 \
185   /*end*/
186 
187 #endif // SHARE_CLASSFILE_VMCLASSMACROS_HPP
188