javaClasses.hpp contains the C++ wrappers for a few dozens of Java classes. As more new features are developed using a combination of Java and C++, the list of classes is expected to grow.
(For example, recent addition of Loom classes not only increased the size of this header, but also caused more dependent header files to be included. SeeJDK-8288623.)
To improve modularity of the source code and reduce C++ build time, we should split the monolithic javaClasses.hpp into a new source directory under src/hotspot/share, where the wrapper classes are grouped by functional areas:
javaClasses/continuationClasses.hpp
jdk_internal_vm_Continuation
jdk_internal_vm_ContinuationScope
jdk_internal_vm_StackChunk
javaClasses/coreClasses.hpp
java_lang_AssertionStatusDirectives
java_lang_Boolean
java_lang_boxing_object
java_lang_Byte
java_lang_Byte_ByteCache
java_lang_Character
java_lang_Character_CharacterCache
java_lang_Class
java_lang_ClassLoader
java_lang_Integer
java_lang_Integer_IntegerCache
java_lang_InternalError
java_lang_Long
java_lang_Long_LongCache
java_lang_Object
java_lang_Short
java_lang_Short_ShortCache
java_lang_String
java_lang_System
java_lang_Throwable
java_security_AccessControlContext
java_util_concurrent_locks_AbstractOwnableSynchronizer
jdk_internal_misc_UnsafeConstants
javaClasses/foreignClasses.hpp
jdk_internal_foreign_abi_ABIDescriptor
jdk_internal_foreign_abi_CallConv
jdk_internal_foreign_abi_NativeEntryPoint
jdk_internal_foreign_abi_VMStorage
javaClasses/invokeClasses.hpp
java_lang_invoke_CallSite
java_lang_invoke_ConstantCallSite
java_lang_invoke_DirectMethodHandle
java_lang_invoke_LambdaForm
java_lang_invoke_MemberName
java_lang_invoke_MethodHandle
java_lang_invoke_MethodHandleNatives_CallSiteContext
java_lang_invoke_MethodType
java_lang_invoke_ResolvedMethodName
javaClasses/referenceClasses.hpp
java_lang_ref_Reference
java_lang_ref_SoftReference
javaClasses/reflectionClasses.hpp
java_lang_reflect_AccessibleObject
java_lang_reflect_Constructor
java_lang_reflect_Field
java_lang_reflect_Method
java_lang_reflect_RecordComponent
javaClasses/stackClasses.hpp
java_lang_LiveStackFrameInfo
java_lang_StackFrameInfo
java_lang_StackTraceElement
javaClasses/threadClasses.hpp
java_lang_Thread
java_lang_Thread_Constants
java_lang_Thread_FieldHolder
java_lang_ThreadGroup
java_lang_VirtualThread
================================================
Alternatives:
We could use a single header file per wrapper class, like javaClasses/java_lang_String.hpp, but having 50+ little header files may be excessive.
================================================
Risks:
- Source code change history may be lost.
- Backports may be more difficult
However, most of these classes just perform mechanical marshalling of parameters between C++ and Java, so the above risks may be minimal.
(For example, recent addition of Loom classes not only increased the size of this header, but also caused more dependent header files to be included. See
To improve modularity of the source code and reduce C++ build time, we should split the monolithic javaClasses.hpp into a new source directory under src/hotspot/share, where the wrapper classes are grouped by functional areas:
javaClasses/continuationClasses.hpp
jdk_internal_vm_Continuation
jdk_internal_vm_ContinuationScope
jdk_internal_vm_StackChunk
javaClasses/coreClasses.hpp
java_lang_AssertionStatusDirectives
java_lang_Boolean
java_lang_boxing_object
java_lang_Byte
java_lang_Byte_ByteCache
java_lang_Character
java_lang_Character_CharacterCache
java_lang_Class
java_lang_ClassLoader
java_lang_Integer
java_lang_Integer_IntegerCache
java_lang_InternalError
java_lang_Long
java_lang_Long_LongCache
java_lang_Object
java_lang_Short
java_lang_Short_ShortCache
java_lang_String
java_lang_System
java_lang_Throwable
java_security_AccessControlContext
java_util_concurrent_locks_AbstractOwnableSynchronizer
jdk_internal_misc_UnsafeConstants
javaClasses/foreignClasses.hpp
jdk_internal_foreign_abi_ABIDescriptor
jdk_internal_foreign_abi_CallConv
jdk_internal_foreign_abi_NativeEntryPoint
jdk_internal_foreign_abi_VMStorage
javaClasses/invokeClasses.hpp
java_lang_invoke_CallSite
java_lang_invoke_ConstantCallSite
java_lang_invoke_DirectMethodHandle
java_lang_invoke_LambdaForm
java_lang_invoke_MemberName
java_lang_invoke_MethodHandle
java_lang_invoke_MethodHandleNatives_CallSiteContext
java_lang_invoke_MethodType
java_lang_invoke_ResolvedMethodName
javaClasses/referenceClasses.hpp
java_lang_ref_Reference
java_lang_ref_SoftReference
javaClasses/reflectionClasses.hpp
java_lang_reflect_AccessibleObject
java_lang_reflect_Constructor
java_lang_reflect_Field
java_lang_reflect_Method
java_lang_reflect_RecordComponent
javaClasses/stackClasses.hpp
java_lang_LiveStackFrameInfo
java_lang_StackFrameInfo
java_lang_StackTraceElement
javaClasses/threadClasses.hpp
java_lang_Thread
java_lang_Thread_Constants
java_lang_Thread_FieldHolder
java_lang_ThreadGroup
java_lang_VirtualThread
================================================
Alternatives:
We could use a single header file per wrapper class, like javaClasses/java_lang_String.hpp, but having 50+ little header files may be excessive.
================================================
Risks:
- Source code change history may be lost.
- Backports may be more difficult
However, most of these classes just perform mechanical marshalling of parameters between C++ and Java, so the above risks may be minimal.