< prev index next >

src/java.base/share/classes/java/lang/invoke/MethodHandle.java

Print this page
8145371: ClassCastException thrown in LambdaFormEditor.getInCache
Reviewed-by: mhaupt

@@ -1658,17 +1658,17 @@
     /*non-public*/
     void updateForm(LambdaForm newForm) {
         assert(newForm.customized == null || newForm.customized == this);
         if (form == newForm)  return;
         newForm.prepare();  // as in MethodHandle.<init>
-        UNSAFE.putObject(this, FORM_OFFSET, newForm);
-        UNSAFE.fullFence();
+        UNSAFE.putObjectVolatile(this, FORM_OFFSET, newForm);
     }
 
     /** Craft a LambdaForm customized for this particular MethodHandle */
     /*non-public*/
     void customize() {
+        final LambdaForm form = this.form;
         if (form.customized == null) {
             LambdaForm newForm = form.customize(this);
             updateForm(newForm);
         } else {
             assert(form.customized == this);
< prev index next >