1.1 --- a/rt/emul/compact/src/main/java/java/lang/invoke/MethodHandle.java Sat Aug 09 11:11:13 2014 +0200
1.2 +++ b/rt/emul/compact/src/main/java/java/lang/invoke/MethodHandle.java Sun Aug 10 06:13:36 2014 +0200
1.3 @@ -28,7 +28,6 @@
1.4
1.5 import java.util.*;
1.6 import sun.invoke.util.*;
1.7 -import sun.misc.Unsafe;
1.8
1.9 import static java.lang.invoke.MethodHandleStatics.*;
1.10 import java.util.logging.Level;
1.11 @@ -434,7 +433,7 @@
1.12 @interface PolymorphicSignature { }
1.13
1.14 private final MethodType type;
1.15 - /*private*/ final LambdaForm form;
1.16 + /*private*/ LambdaForm form;
1.17 // form is not private so that invokers can easily fetch it
1.18 /*private*/ MethodHandle asTypeCache;
1.19 // asTypeCache is not private so that invokers can easily fetch it
1.20 @@ -1395,7 +1394,7 @@
1.21
1.22 // CURRENT RESTRICTIONS
1.23 // * only for pos 0 and UNSAFE (position is adjusted in MHImpl to make API usable for others)
1.24 - assert pos == 0 && basicType == 'L' && value instanceof Unsafe;
1.25 +// assert pos == 0 && basicType == 'L' && value instanceof Unsafe;
1.26 MethodType type2 = type.dropParameterTypes(pos, pos + 1); // adjustment: ignore receiver!
1.27 LambdaForm form2 = form.bindImmediate(pos + 1, basicType, value); // adjust pos to form-relative pos
1.28 return copyWith(type2, form2);
1.29 @@ -1489,17 +1488,7 @@
1.30 /*non-public*/
1.31 void updateForm(LambdaForm newForm) {
1.32 if (form == newForm) return;
1.33 - // ISSUE: Should we have a memory fence here?
1.34 - UNSAFE.putObject(this, FORM_OFFSET, newForm);
1.35 + this.form = newForm;
1.36 this.form.prepare(); // as in MethodHandle.<init>
1.37 }
1.38 -
1.39 - private static final long FORM_OFFSET;
1.40 - static {
1.41 - try {
1.42 - FORM_OFFSET = UNSAFE.objectFieldOffset(MethodHandle.class.getDeclaredField("form"));
1.43 - } catch (ReflectiveOperationException ex) {
1.44 - throw newInternalError(ex);
1.45 - }
1.46 - }
1.47 }