JDK-8252526 : Remove excessive inclusion of jvmti.h and jvmtiExport.hpp
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: jvmti
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2020-08-28
  • Updated: 2020-11-19
  • Resolved: 2020-11-12
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 16
16 b25Fixed
Related Reports
Relates :  
Relates :  
Description
jvmti.h is included 905 times and jvmtiExport.hpp is included 776 times (by 971 hotspot .o files). Most of these are unnecessarily included by the following 3 popular header files:

javaClasses.hpp: ThreadStatus is rarely used, and should be moved to a separate header file. The enum is also changed to an enum class for better type safety (see JDK-8247938).

os.hpp: No need to include jvmti.h. Use forward declaration for "struct jvmtiTimerInfo;" instead.

thread.hpp: No need to include jvmExport.hpp. Use forward declaration for JvmtiSampledObjectAllocEventCollector and JvmtiVMObjectAllocEventCollector instead.

Comments
Changeset: 2f06893a Author: Ioi Lam <iklam@openjdk.org> Date: 2020-11-12 01:45:27 +0000 URL: https://github.com/openjdk/jdk/commit/2f06893a
12-11-2020

[before fixing] $ find hotspot -name \*.d | grep -v LIBJVM.d | xargs cat | wc -l 252033 $ find hotspot -name \*.d | grep -v LIBJVM.d | xargs grep -l jvmti.h | wc -l 905 $ find hotspot -name \*.d | grep -v LIBJVM.d | xargs grep -l jvmtiExport.hpp | wc -l 776 [after fixing] 250001 $ find hotspot -name \*.d | grep -v LIBJVM.d | xargs grep -l jvmti.h | wc -l 143 $ find hotspot -name \*.d | grep -v LIBJVM.d | xargs grep -l jvmtiExport.hpp | wc -l 129 About 0.8% reduction of total included files (252033 / 250001 = 1.00813)
31-08-2020

Moving from hotspot/runtime -> hotspot/jvmti.
28-08-2020