On constant folding of final field loads
paul.sandoz at oracle.com
Mon Jun 29 12:13:39 UTC 2015
On Jun 29, 2015, at 2:00 PM, Vladimir Ivanov <vladimir.x.ivanov at oracle.com> wrote:
>> For MHs it's not possible to lookup a MH (via MH.L.findSetter/unreflectSetter) to a final field.
>> Although i cannot find any such explicit mention in JavaDoc, so i guess it can be considered under the umbrella of "access checks".
> Though you can't lookup a setter for al final field directly, you can use Lookup.unreflectSetter:
> Field f = T.class.getDeclaredField("t");
> MethodHandle setter = MethodHandles.lookup().unreflectSetter(f);
Oh, yes, i see now, i missed the switch to use IMPL_LOOKUP if the field is set to accessible.
> But it doesn't matter much, since MH field getters/setters are baseon on Unsafe. So, if final field value tracking works for Unsafe, it works for j.l.i as well.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 841 bytes
Desc: Message signed with OpenPGP using GPGMail
More information about the hotspot-compiler-dev