JDK-8278325 : excluded class should not be checked again for exclusion
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 17
  • Priority: P4
  • Status: Resolved
  • Resolution: Not an Issue
  • Submitted: 2021-12-07
  • Updated: 2022-02-04
  • Resolved: 2022-02-04
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 19
19Resolved
Related Reports
Relates :  
Relates :  
Relates :  
Description
In JDK-8247536 (JDK 16), we added support for pre-generated java.lang.invoke classes in CDS static archive, so that we can avoid dynamic generation of classes at runtime.

However, we still see classes being generated in this test case:

[1] Download CDSLambdaInvokerTest.sh and CDSLambdaInvokerTest.java from attachments
[2] Run the following:

$ ${JAVA_HOME}/bin/java -version
java version "17" 2021-09-14 LTS
Java(TM) SE Runtime Environment (build 17+35-LTS-2724)
Java HotSpot(TM) 64-Bit Server VM (build 17+35-LTS-2724, mixed mode, sharing)

$ bash CDSLambdaInvokerTest.sh ${JAVA_HOME}
...
============ checking dumping status ==================================================
[0.171s][warning][cds] Preload Warning: Cannot find java/lang/invoke/BoundMethodHandle$Species_J
[0.171s][warning][cds] Preload Warning: Cannot find java/lang/invoke/BoundMethodHandle$Species_JL
[0.171s][warning][cds] Preload Warning: Cannot find java/lang/invoke/BoundMethodHandle$Species_F
[0.171s][warning][cds] Preload Warning: Cannot find java/lang/invoke/BoundMethodHandle$Species_FL
***** FAILED
============ checking if lambda form classes/methods are loaded from CDS ==============
[0.057s][info][class,load] java.lang.invoke.LambdaForm$MH/0x0000000800c00400 source: __JVM_LookupDefineClass__
[0.061s][info][class,load] java.lang.invoke.LambdaForm$MH/0x0000000800c01000 source: __JVM_LookupDefineClass__
[SPECIES_RESOLVE] java.lang.invoke.BoundMethodHandle$Species_J (generated)
[0.065s][info][class,load] java.lang.invoke.BoundMethodHandle$Species_J source: _ClassSpecializer_generateConcreteSpeciesCode
[LF_RESOLVE] java.lang.invoke.DirectMethodHandle$Holder invokeStatic L3J_L (fail)
[0.067s][info][class,load] java.lang.invoke.LambdaForm$MH/0x0000000800c01800 source: __JVM_LookupDefineClass__
[SPECIES_RESOLVE] java.lang.invoke.BoundMethodHandle$Species_JL (generated)
[0.070s][info][class,load] java.lang.invoke.BoundMethodHandle$Species_JL source: _ClassSpecializer_generateConcreteSpeciesCode
[LF_RESOLVE] java.lang.invoke.DirectMethodHandle$Holder invokeStatic L3JL_L (fail)
[0.071s][info][class,load] java.lang.invoke.LambdaForm$MH/0x0000000800c02000 source: __JVM_LookupDefineClass__
[0.073s][info][class,load] java.lang.invoke.LambdaForm$MH/0x0000000800c02400 source: __JVM_LookupDefineClass__
[0.075s][info][class,load] java.lang.invoke.LambdaForm$MH/0x0000000800c02800 source: __JVM_LookupDefineClass__
[SPECIES_RESOLVE] java.lang.invoke.BoundMethodHandle$Species_F (generated)
[0.077s][info][class,load] java.lang.invoke.BoundMethodHandle$Species_F source: _ClassSpecializer_generateConcreteSpeciesCode
[LF_RESOLVE] java.lang.invoke.DirectMethodHandle$Holder invokeStatic L3F_L (fail)
[0.079s][info][class,load] java.lang.invoke.LambdaForm$MH/0x0000000800c03000 source: __JVM_LookupDefineClass__
[LF_RESOLVE] java.lang.invoke.DirectMethodHandle$Holder invokeStatic LF_L (fail)
[SPECIES_RESOLVE] java.lang.invoke.BoundMethodHandle$Species_FL (generated)
[0.081s][info][class,load] java.lang.invoke.BoundMethodHandle$Species_FL source: _ClassSpecializer_generateConcreteSpeciesCode
[LF_RESOLVE] java.lang.invoke.DirectMethodHandle$Holder invokeStatic L3FL_L (fail)
[LF_RESOLVE] java.lang.invoke.DirectMethodHandle$Holder invokeSpecial LLF_L (fail)
[0.084s][info][class,load] java.lang.invoke.LambdaForm$MH/0x0000000800c04000 source: __JVM_LookupDefineClass__
[LF_RESOLVE] java.lang.invoke.DirectMethodHandle$Holder invokeStatic LFDIILJD_V (fail)
[LF_RESOLVE] java.lang.invoke.DirectMethodHandle$Holder invokeSpecial LLFDIILJD_V (fail)
[LF_RESOLVE] java.lang.invoke.Invokers$Holder invokeExact_MT LFDIILJDL_V (fail)
[0.086s][info][class,load] java.lang.invoke.LambdaForm$MH/0x0000000800c04c00 source: __JVM_LookupDefineClass__
***** FAILED

Comments
With 8280767 resolved this no longer an issue.
04-02-2022

A pull request was submitted for review. URL: https://git.openjdk.java.net/jdk/pull/7225 Date: 2022-01-26 03:52:18 +0000
26-01-2022

For dump log: [0.391s][warning][cds] Skipping java/lang/invoke/BoundMethodHandle$Species_JL: Unsupported location The log is for old class which already got regenerated but set excluded already. When do check_exclusion, we first check if it has been checked, which is not, so it is set excluded. The new class is not excluded. The correct check for exclusion should change to: @@ -214,8 +214,10 @@ bool SystemDictionaryShared::check_for_exclusion(InstanceKlass* k, DumpTimeClass } if (!info->has_checked_exclusion()) { - if (check_for_exclusion_impl(k)) { - info->set_excluded(); + if (!info->is_excluded()) { + if (check_for_exclusion_impl(k)) { + info->set_excluded(); + } } info->set_has_checked_exclusion(); } So the already excluded old class will not be checked again. For the runtime in your script: $JAVA -cp CDSLambdaInvokerTest.jar -Xlog:class+load \ -Djava.lang.invoke.MethodHandle.TRACE_RESOLVE=true CDSLambdaInvokerTest 2>&1 | cat > CDSLambdaInvokerTest.run.static.log ) You did not specify -Xshare:on -XX:SharedArchiveFile=CDSLambdaInvokerTest.s.jsa After add this flag (grep Species_ against log): [0.516s][info ][class,load] java.lang.invoke.BoundMethodHandle$Species_L source: shared objects file [SPECIES_RESOLVE] java.lang.invoke.BoundMethodHandle$Species_L (salvaged) [0.536s][info ][class,load] java.lang.invoke.BoundMethodHandle$Species_D source: shared objects file [SPECIES_RESOLVE] java.lang.invoke.BoundMethodHandle$Species_D (salvaged) [0.581s][info ][class,load] java.lang.invoke.BoundMethodHandle$Species_DL source: shared objects file [SPECIES_RESOLVE] java.lang.invoke.BoundMethodHandle$Species_DL (salvaged) [0.592s][info ][class,load] java.lang.invoke.BoundMethodHandle$Species_J source: shared objects file [SPECIES_RESOLVE] java.lang.invoke.BoundMethodHandle$Species_J (salvaged) [0.599s][info ][class,load] java.lang.invoke.BoundMethodHandle$Species_JL source: shared objects file [SPECIES_RESOLVE] java.lang.invoke.BoundMethodHandle$Species_JL (salvaged) [0.608s][info ][class,load] java.lang.invoke.BoundMethodHandle$Species_I source: shared objects file [SPECIES_RESOLVE] java.lang.invoke.BoundMethodHandle$Species_I (salvaged) [0.615s][info ][class,load] java.lang.invoke.BoundMethodHandle$Species_IL source: shared objects file [SPECIES_RESOLVE] java.lang.invoke.BoundMethodHandle$Species_IL (salvaged) [0.624s][info ][class,load] java.lang.invoke.BoundMethodHandle$Species_F source: shared objects file [SPECIES_RESOLVE] java.lang.invoke.BoundMethodHandle$Species_F (salvaged) [0.631s][info ][class,load] java.lang.invoke.BoundMethodHandle$Species_FL source: shared objects file [SPECIES_RESOLVE] java.lang.invoke.BoundMethodHandle$Species_FL (salvaged) There are several classes not found, like: [0.592s][info ][class,load] java.lang.invoke.BoundMethodHandle$Species_J source: shared objects file [0.592s][debug][class,load] klass: 0x0000000800224288 super: 0x0000000800099170 loader: [loader data: 0x00007f6d4013daa0 of 'bootstrap'] [SPECIES_RESOLVE] java.lang.invoke.BoundMethodHandle$Species_J (salvaged) [LF_RESOLVE] java.lang.invoke.DirectMethodHandle$Holder invokeStatic L3J_L (success) [LF_RESOLVE] java.lang.invoke.DirectMethodHandle$Holder getLong LL_J (success) [0.597s][info ][class,load] java.lang.invoke.LambdaForm$MH/0x0000000800801400 source: __JVM_LookupDefineClass__ This is another problem.
08-12-2021

ILW = MLM = P4
07-12-2021

In the latest JDK (18) repo, we see a slightly different error message with BoundMethodHandle$Species_JL, etc. This is due to JDK-8276126 ============ checking dumping status ================================================== [0.391s][warning][cds] Skipping CDSLambdaInvokerTest: Unsupported location [0.391s][warning][cds] Skipping java/lang/invoke/BoundMethodHandle$Species_JL: Unsupported location [0.391s][warning][cds] Skipping java/lang/invoke/BoundMethodHandle$Species_J: Unsupported location [0.391s][warning][cds] Skipping java/lang/invoke/BoundMethodHandle$Species_FL: Unsupported location [0.391s][warning][cds] Skipping java/lang/invoke/BoundMethodHandle$Species_F: Unsupported location ***** FAILED ============ checking if lambda form classes/methods are loaded from CDS ============== [0.060s][info][class,load] java.lang.invoke.LambdaForm$MH/0x0000000800c00400 source: __JVM_LookupDefineClass__ [0.064s][info][class,load] java.lang.invoke.LambdaForm$MH/0x0000000800c01000 source: __JVM_LookupDefineClass__ [SPECIES_RESOLVE] java.lang.invoke.BoundMethodHandle$Species_J (generated) [0.068s][info][class,load] java.lang.invoke.BoundMethodHandle$Species_J source: _ClassSpecializer_generateConcreteSpeciesCode [LF_RESOLVE] java.lang.invoke.DirectMethodHandle$Holder invokeStatic L3J_L (fail) [0.070s][info][class,load] java.lang.invoke.LambdaForm$MH/0x0000000800c01800 source: __JVM_LookupDefineClass__ [SPECIES_RESOLVE] java.lang.invoke.BoundMethodHandle$Species_JL (generated) [0.072s][info][class,load] java.lang.invoke.BoundMethodHandle$Species_JL source: _ClassSpecializer_generateConcreteSpeciesCode [LF_RESOLVE] java.lang.invoke.DirectMethodHandle$Holder invokeStatic L3JL_L (fail) [0.074s][info][class,load] java.lang.invoke.LambdaForm$MH/0x0000000800c02000 source: __JVM_LookupDefineClass__ [0.076s][info][class,load] java.lang.invoke.LambdaForm$MH/0x0000000800c02400 source: __JVM_LookupDefineClass__ [0.077s][info][class,load] java.lang.invoke.LambdaForm$MH/0x0000000800c02800 source: __JVM_LookupDefineClass__ [SPECIES_RESOLVE] java.lang.invoke.BoundMethodHandle$Species_F (generated) [0.080s][info][class,load] java.lang.invoke.BoundMethodHandle$Species_F source: _ClassSpecializer_generateConcreteSpeciesCode [LF_RESOLVE] java.lang.invoke.DirectMethodHandle$Holder invokeStatic L3F_L (fail) [0.082s][info][class,load] java.lang.invoke.LambdaForm$MH/0x0000000800c03000 source: __JVM_LookupDefineClass__ [LF_RESOLVE] java.lang.invoke.DirectMethodHandle$Holder invokeStatic LF_L (fail) [SPECIES_RESOLVE] java.lang.invoke.BoundMethodHandle$Species_FL (generated) [0.084s][info][class,load] java.lang.invoke.BoundMethodHandle$Species_FL source: _ClassSpecializer_generateConcreteSpeciesCode [LF_RESOLVE] java.lang.invoke.DirectMethodHandle$Holder invokeStatic L3FL_L (fail) [LF_RESOLVE] java.lang.invoke.DirectMethodHandle$Holder invokeSpecial LLF_L (fail) [0.087s][info][class,load] java.lang.invoke.LambdaForm$MH/0x0000000800c04000 source: __JVM_LookupDefineClass__ [LF_RESOLVE] java.lang.invoke.DirectMethodHandle$Holder invokeStatic LFDIILJD_V (fail) [LF_RESOLVE] java.lang.invoke.DirectMethodHandle$Holder invokeSpecial LLFDIILJD_V (fail) [LF_RESOLVE] java.lang.invoke.Invokers$Holder invokeExact_MT LFDIILJDL_V (fail) [0.089s][info][class,load] java.lang.invoke.LambdaForm$MH/0x0000000800c04c00 source: __JVM_LookupDefineClass__ ***** FAILED
07-12-2021