Thanks, Paul!
Updated version:
http://cr.openjdk.java.net/~vlivanov/8059877/webrev.01/
...
This is a good example to add to our "stomping on a final field" discussion, i
think here it is definitely a very special case with a careful dance between updating and
inlining (updateForm is also called by a direct method handle to a static method or
field, such a handle initially holds a form with a check to initialize the class and
after that occurs the handle is updated with a new form without the check).
Yes, MethodHandle.updateForm is an inherently unsafe mechanism. It
doesn't allow to arbitrarily change method handle behavior at will.
It is used to evolve a method handle to a more performant version when
possible.
Perhaps isUnblocked is a better name than isActivated since there is no need to
set the initial value and it tracks the same value as that returned from
unblock?
Done.
765 isUnblocked = false;
Should be "isUnblocked = true".
756 MethodHandle newTarget = target.asType(newType);
757 return asTypeCache = isUnblocked ? make(newTarget)
758 : newTarget; // no need for
a wrapper anymore
Should be "return asTypeCache = !isUnblocked ? ? make(newTarget)"
Gosh. Thanks for catching that!
Best regards,
Vladimir Ivanov