1570 /*non-public*/
1571 void updateForm(LambdaForm newForm) {
1572 assert(newForm.customized == null || newForm.customized == this);
1573 if (form == newForm) return;
1574 newForm.prepare(); // as in MethodHandle.<init>
1575 UNSAFE.putObject(this, FORM_OFFSET, newForm);
1576 UNSAFE.fullFence();
1577 }
1578
1579 /** Craft a LambdaForm customized for this particular MethodHandle */
1580 /*non-public*/
1581 void customize() {
1582 if (form.customized == null) {
1583 LambdaForm newForm = form.customize(this);
1584 updateForm(newForm);
1585 } else {
1586 assert(form.customized == this);
1587 }
1588 }
1589
1590 private static final long FORM_OFFSET;
1591 static {
1592 try {
1593 FORM_OFFSET = UNSAFE.objectFieldOffset(MethodHandle.class.getDeclaredField("form"));
1594 } catch (ReflectiveOperationException ex) {
1595 throw newInternalError(ex);
1596 }
1597 }
1598 }
|
1570 /*non-public*/
1571 void updateForm(LambdaForm newForm) {
1572 assert(newForm.customized == null || newForm.customized == this);
1573 if (form == newForm) return;
1574 newForm.prepare(); // as in MethodHandle.<init>
1575 UNSAFE.putObject(this, FORM_OFFSET, newForm);
1576 UNSAFE.fullFence();
1577 }
1578
1579 /** Craft a LambdaForm customized for this particular MethodHandle */
1580 /*non-public*/
1581 void customize() {
1582 if (form.customized == null) {
1583 LambdaForm newForm = form.customize(this);
1584 updateForm(newForm);
1585 } else {
1586 assert(form.customized == this);
1587 }
1588 }
1589
1590 private static final long FORM_OFFSET
1591 = UNSAFE.objectFieldOffset(MethodHandle.class, "form");
1592 }
|