JDK-8145371 ClassCastException thrown in LambdaFormEditor.getInCache (original) (raw)

Martin Buchholz martinrb at google.com
Wed Jan 3 21:40:45 UTC 2018


Here at Google we tried to fix JDK-8145371 because it looked like it was causing rare problems in production. But after looking at the code, I'm not sure... Anyways,

http://cr.openjdk.java.net/~martin/webrevs/jdk/MethodHandle.form/ https://bugs.openjdk.java.net/browse/JDK-8145371 Copying to a local in customize() must be an improvement. The UNSAFE publication in updateForm looks fishy, as does that comment in MethodHandleImpl.java. Is there something the fullFence() is supposed to do that isn't taken care of by putObjectVolatile ?

Feel free to take ownership of this bug from me.

--- a/src/java.base/share/classes/java/lang/invoke/MethodHandle.java +++ b/src/java.base/share/classes/java/lang/invoke/MethodHandle.java @@ -1660,13 +1660,13 @@ assert(newForm.customized == null || newForm.customized == this); if (form == newForm) return; newForm.prepare(); // as in MethodHandle.

diff --git a/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java b/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java --- a/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java +++ b/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java @@ -909,7 +909,7 @@ int c = count; maybeCustomizeTarget(); if (c <= 1) {

MethodHandle.updateForm() doesn't guarantee LF update visibility.



More information about the core-libs-dev mailing list