[9] RFR (XS): 8140659: C1: invokedynamic call patching violates JVMS-6.5.invokedynamic
Vladimir Ivanov
vladimir.x.ivanov at oracle.com
Tue Dec 15 19:21:13 UTC 2015
http://cr.openjdk.java.net/~vlivanov/8140659/webrev.00/
https://bugs.openjdk.java.net/browse/JDK-8140659
C1 call site patching for invokedynamic case doesn't comply with the
following statement from the JVMS (6.5.invokedynamic):
"If several threads simultaneously execute the bootstrap method for the
same dynamic call site, the Java Virtual Machine must choose one
returned call site object and install it visibly to all threads. Any
other bootstrap methods executing for the dynamic call site are allowed
to complete, but their results are ignored, and the threads' execution
of the dynamic call site proceeds with the chosen call site object."
The patching logic tries to update corresponding constant pool entry,
but doesn't care about whether it has been already resolved.
The fix is to reload appendix after updating the constant pool instead
of using locally computed one. It guarantees that everybody will see the
same call site object. CPCE::set_method_handle_common() ensures that
initialization happens only once (it is guarded by a lock on
resolved_references array).
Testing: failing test case, JPRT.
Thanks!
Best regards,
Vladimir Ivanov
More information about the hotspot-compiler-dev
mailing list