1 /*
  2  * Copyright (c) 2021, 2023, 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, such 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(Exception_klass,                             java_lang_Exception                                   ) \
 62   do_klass(RuntimeException_klass,                      java_lang_RuntimeException                            ) \
 63   do_klass(SecurityManager_klass,                       java_lang_SecurityManager                             ) \
 64   do_klass(ProtectionDomain_klass,                      java_security_ProtectionDomain                        ) \
 65   do_klass(AccessControlContext_klass,                  java_security_AccessControlContext                    ) \
 66   do_klass(AccessController_klass,                      java_security_AccessController                        ) \
 67   do_klass(SecureClassLoader_klass,                     java_security_SecureClassLoader                       ) \
 68   do_klass(ClassNotFoundException_klass,                java_lang_ClassNotFoundException                      ) \
 69   do_klass(Record_klass,                                java_lang_Record                                      ) \
 70   do_klass(NoClassDefFoundError_klass,                  java_lang_NoClassDefFoundError                        ) \
 71   do_klass(LinkageError_klass,                          java_lang_LinkageError                                ) \
 72   do_klass(ClassCastException_klass,                    java_lang_ClassCastException                          ) \
 73   do_klass(ArrayStoreException_klass,                   java_lang_ArrayStoreException                         ) \
 74   do_klass(VirtualMachineError_klass,                   java_lang_VirtualMachineError                         ) \
 75   do_klass(InternalError_klass,                         java_lang_InternalError                               ) \
 76   do_klass(OutOfMemoryError_klass,                      java_lang_OutOfMemoryError                            ) \
 77   do_klass(StackOverflowError_klass,                    java_lang_StackOverflowError                          ) \
 78   do_klass(IllegalMonitorStateException_klass,          java_lang_IllegalMonitorStateException                ) \
 79   do_klass(Reference_klass,                             java_lang_ref_Reference                               ) \
 80   do_klass(IllegalCallerException_klass,                java_lang_IllegalCallerException                      ) \
 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(Thread_FieldHolder_klass,                    java_lang_Thread_FieldHolder                          ) \
 91   do_klass(Thread_Constants_klass,                      java_lang_Thread_Constants                            ) \
 92   do_klass(ThreadGroup_klass,                           java_lang_ThreadGroup                                 ) \
 93   do_klass(BaseVirtualThread_klass,                     java_lang_BaseVirtualThread                           ) \
 94   do_klass(VirtualThread_klass,                         java_lang_VirtualThread                               ) \
 95   do_klass(BoundVirtualThread_klass,                    java_lang_BoundVirtualThread                          ) \
 96   do_klass(Properties_klass,                            java_util_Properties                                  ) \
 97   do_klass(Module_klass,                                java_lang_Module                                      ) \
 98   do_klass(reflect_AccessibleObject_klass,              java_lang_reflect_AccessibleObject                    ) \
 99   do_klass(reflect_Field_klass,                         java_lang_reflect_Field                               ) \
100   do_klass(reflect_Parameter_klass,                     java_lang_reflect_Parameter                           ) \
101   do_klass(reflect_Method_klass,                        java_lang_reflect_Method                              ) \
102   do_klass(reflect_Constructor_klass,                   java_lang_reflect_Constructor                         ) \
103                                                                                                                 \
104   do_klass(Runnable_klass,                              java_lang_Runnable                                    ) \
105   do_klass(ContinuationScope_klass,                     jdk_internal_vm_ContinuationScope                     ) \
106   do_klass(Continuation_klass,                          jdk_internal_vm_Continuation                          ) \
107   do_klass(StackChunk_klass,                            jdk_internal_vm_StackChunk                            ) \
108                                                                                                                 \
109   do_klass(reflect_MethodAccessorImpl_klass,            reflect_MethodAccessorImpl                            ) \
110   do_klass(reflect_DelegatingClassLoader_klass,         reflect_DelegatingClassLoader                         ) \
111   do_klass(reflect_ConstantPool_klass,                  reflect_ConstantPool                                  ) \
112   do_klass(reflect_CallerSensitive_klass,               reflect_CallerSensitive                               ) \
113   do_klass(reflect_DirectConstructorHandleAccessor_NativeAccessor_klass, reflect_DirectConstructorHandleAccessor_NativeAccessor) \
114   do_klass(reflect_SerializationConstructorAccessorImpl_klass,           reflect_SerializationConstructorAccessorImpl ) \
115                                                                                                                 \
116   /* support for dynamic typing */                                                                              \
117   do_klass(DirectMethodHandle_klass,                    java_lang_invoke_DirectMethodHandle                   ) \
118   do_klass(MethodHandle_klass,                          java_lang_invoke_MethodHandle                         ) \
119   do_klass(VarHandle_klass,                             java_lang_invoke_VarHandle                            ) \
120   do_klass(MemberName_klass,                            java_lang_invoke_MemberName                           ) \
121   do_klass(ResolvedMethodName_klass,                    java_lang_invoke_ResolvedMethodName                   ) \
122   do_klass(MethodHandleNatives_klass,                   java_lang_invoke_MethodHandleNatives                  ) \
123   do_klass(LambdaForm_klass,                            java_lang_invoke_LambdaForm                           ) \
124   do_klass(MethodType_klass,                            java_lang_invoke_MethodType                           ) \
125   do_klass(BootstrapMethodError_klass,                  java_lang_BootstrapMethodError                        ) \
126   do_klass(CallSite_klass,                              java_lang_invoke_CallSite                             ) \
127   do_klass(NativeEntryPoint_klass,                      jdk_internal_foreign_abi_NativeEntryPoint             ) \
128   do_klass(ABIDescriptor_klass,                         jdk_internal_foreign_abi_ABIDescriptor                ) \
129   do_klass(VMStorage_klass,                             jdk_internal_foreign_abi_VMStorage                    ) \
130   do_klass(CallConv_klass,                              jdk_internal_foreign_abi_CallConv                     ) \
131   do_klass(Context_klass,                               java_lang_invoke_MethodHandleNatives_CallSiteContext  ) \
132   do_klass(ConstantCallSite_klass,                      java_lang_invoke_ConstantCallSite                     ) \
133   do_klass(MutableCallSite_klass,                       java_lang_invoke_MutableCallSite                      ) \
134   do_klass(ValueObjectMethods_klass,                    java_lang_runtime_ValueObjectMethods                  ) \
135   do_klass(VolatileCallSite_klass,                      java_lang_invoke_VolatileCallSite                     ) \
136                                                                                                                 \
137   do_klass(AssertionStatusDirectives_klass,             java_lang_AssertionStatusDirectives                   ) \
138   do_klass(StringBuffer_klass,                          java_lang_StringBuffer                                ) \
139   do_klass(StringBuilder_klass,                         java_lang_StringBuilder                               ) \
140   do_klass(UnsafeConstants_klass,                       jdk_internal_misc_UnsafeConstants                     ) \
141   do_klass(internal_Unsafe_klass,                       jdk_internal_misc_Unsafe                              ) \
142   do_klass(module_Modules_klass,                        jdk_internal_module_Modules                           ) \
143                                                                                                                 \
144   /* support for CDS */                                                                                         \
145   do_klass(ByteArrayInputStream_klass,                  java_io_ByteArrayInputStream                          ) \
146   do_klass(URL_klass,                                   java_net_URL                                          ) \
147   do_klass(URLClassLoader_klass,                        java_net_URLClassLoader                               ) \
148   do_klass(Enum_klass,                                  java_lang_Enum                                        ) \
149   do_klass(Jar_Manifest_klass,                          java_util_jar_Manifest                                ) \
150   do_klass(jdk_internal_loader_BuiltinClassLoader_klass,jdk_internal_loader_BuiltinClassLoader                ) \
151   do_klass(jdk_internal_loader_ClassLoaders_klass,      jdk_internal_loader_ClassLoaders                      ) \
152   do_klass(jdk_internal_loader_ClassLoaders_AppClassLoader_klass,      jdk_internal_loader_ClassLoaders_AppClassLoader) \
153   do_klass(jdk_internal_loader_ClassLoaders_PlatformClassLoader_klass, jdk_internal_loader_ClassLoaders_PlatformClassLoader) \
154   do_klass(CodeSource_klass,                            java_security_CodeSource                              ) \
155   do_klass(ConcurrentHashMap_klass,                     java_util_concurrent_ConcurrentHashMap                ) \
156   do_klass(ArrayList_klass,                             java_util_ArrayList                                   ) \
157                                                                                                                 \
158   do_klass(StackTraceElement_klass,                     java_lang_StackTraceElement                           ) \
159                                                                                                                 \
160   do_klass(nio_Buffer_klass,                            java_nio_Buffer                                       ) \
161                                                                                                                 \
162   /* Stack Walking */                                                                                           \
163   do_klass(StackWalker_klass,                           java_lang_StackWalker                                 ) \
164   do_klass(AbstractStackWalker_klass,                   java_lang_StackStreamFactory_AbstractStackWalker      ) \
165   do_klass(ClassFrameInfo_klass,                        java_lang_ClassFrameInfo                              ) \
166   do_klass(StackFrameInfo_klass,                        java_lang_StackFrameInfo                              ) \
167   do_klass(LiveStackFrameInfo_klass,                    java_lang_LiveStackFrameInfo                          ) \
168                                                                                                                 \
169   /* support for stack dump lock analysis */                                                                    \
170   do_klass(java_util_concurrent_locks_AbstractOwnableSynchronizer_klass, java_util_concurrent_locks_AbstractOwnableSynchronizer) \
171                                                                                                                 \
172   /* boxing klasses */                                                                                          \
173   do_klass(Boolean_klass,                               java_lang_Boolean                                     ) \
174   do_klass(Character_klass,                             java_lang_Character                                   ) \
175   do_klass(Float_klass,                                 java_lang_Float                                       ) \
176   do_klass(Double_klass,                                java_lang_Double                                      ) \
177   do_klass(Byte_klass,                                  java_lang_Byte                                        ) \
178   do_klass(Short_klass,                                 java_lang_Short                                       ) \
179   do_klass(Integer_klass,                               java_lang_Integer                                     ) \
180   do_klass(Long_klass,                                  java_lang_Long                                        ) \
181                                                                                                                 \
182   /* force inline of iterators */                                                                               \
183   do_klass(Iterator_klass,                              java_util_Iterator                                    ) \
184                                                                                                                 \
185   /* support for records */                                                                                     \
186   do_klass(RecordComponent_klass,                       java_lang_reflect_RecordComponent                     ) \
187                                                                                                                 \
188   /* support for vectors*/                                                                                      \
189   do_klass(vector_VectorSupport_klass,                  jdk_internal_vm_vector_VectorSupport                  ) \
190   do_klass(vector_VectorPayload_klass,                  jdk_internal_vm_vector_VectorPayload                  ) \
191   do_klass(vector_Vector_klass,                         jdk_internal_vm_vector_Vector                         ) \
192   do_klass(vector_VectorMask_klass,                     jdk_internal_vm_vector_VectorMask                     ) \
193   do_klass(vector_VectorShuffle_klass,                  jdk_internal_vm_vector_VectorShuffle                  ) \
194                                                                                                                 \
195   /* GC support */                                                                                              \
196   do_klass(FillerObject_klass,                          jdk_internal_vm_FillerObject                          ) \
197                                                                                                                 \
198   /*end*/
199 
200 #endif // SHARE_CLASSFILE_VMCLASSMACROS_HPP