eclipse-openj9 / openj9

Eclipse OpenJ9: A Java Virtual Machine for OpenJDK that's optimized for small footprint, fast start-up, and high throughput. Builds on Eclipse OMR (https://github.com/eclipse/omr) and combines with the Extensions for OpenJDK for OpenJ9 repo.
Other
3.28k stars 720 forks source link

New CML option to exclude classes from SCC #18991

Open hangshao0 opened 8 months ago

hangshao0 commented 8 months ago

Currently there is no command line option that could prevent specific classes from being stored into and returned from the shared class cache. For diagnostic purpose, it is helpful to allow users to exclude certain classes from SCC by specifying the class name.

OpenJ9 provided an interface SharedClassFilter. User can implement this filter to control which classes are found and stored in the shared cache. Note that SharedClassFilter affects class sharing through package com.ibm.oti.shared, so it has no effect on bootstrap classes and annon classes. The SharedClassFilter requires the user to put the implemented filter class into the class path of the application, which might not always be possible. It is more desirable that user can specify the unwanted classes by name through the command line option.

The command line option can be sth like -Xshareclasses:exclude=<class_specification>[,<class_specification>] The syntax for <class_specification> is: {[!][*][<package>/]<class>[*]}.

User can pass in more than one class specifications. User can use an asterisk (*) as a wildcard. User can use an exclamation point (!) before the specification to mean "everything except this".

Examples are: -Xshareclasses:exclude={java/util/HashMap} ------ exclude HashMap from sharing -Xshareclasses:exclude={java/io/*,java/net/*} ----- exclude packages java/io and java/net from sharing -Xshareclasses:exclude={java/util/HashMap,java/lang/invoke/LambdaForm*} -----exclude HashMap and LamdaForm classes from sharing

hangshao0 commented 8 months ago

FYI @vijaysun-omr

vijaysun-omr commented 8 months ago

Thanks, Hang. This would have been great to have in an investigation we were engaged in over the past month for measuring InstantOn startup with different SCC contents. I look forward to when this item is implemented.