RFR(M) 8252526 Remove excessive inclusion of jvmti.h and jvmtiExport.hpp

Ioi Lam ioi.lam at oracle.com
Mon Aug 31 18:13:45 UTC 2020


https://bugs.openjdk.java.net/browse/JDK-8252526
http://cr.openjdk.java.net/~iklam/jdk16/8252526-fix-jvmti-hpp.v01/

(I marked this RFR as "M" because 63 files have changed, but most of the are
just adding a missing #include "prims/jvmtiExport.hpp").

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:

[1] javaClasses.hpp: ThreadStatus is rarely used, and should be moved
     to javaThreadStatus.hpp. I also converted the enum to an C++ 11
     enum class for better type safety. (see also JDK-8247938).

[2] os.hpp: No need to include jvm.h. Use forward declaration
     "typedef struct _jvmtiTimerInfo jvmtiTimerInfo;" instead.

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


The total number of includes have reduced from 252033 to 250001. Build 
time of
slow-debug libjvm.so is reduced from 2:07 to 2:04 on my machine.

Thanks
- Ioi



More information about the hotspot-runtime-dev mailing list