ShenandoahOptimizeFinals is an illegal optimization
Roman Kennke
rkennke at redhat.com
Wed Oct 18 13:04:19 UTC 2017
Am 18.10.2017 um 14:58 schrieb Roland Westrelin:
>> I wonder: if it's broken for instance fields, is it broken for static
>> fields too, for the same reasons? Replace the constructor with the
>> <clinit> in your example above and get the same problem, if the Class
>> instance is evacuated during clinit ? Or is that not possible?
> I'm not sure how that would break with static fields.
> What about stable fields?
> Also there could be well known classes for which we could leave this on
> (such a String) because we know they are unaffected. Do we want to?
>
> Roland.
You are right, it would be difficult (impossible?) to do this with
static fields.
There is all sorts of gray area around final fields, that is supported
by hotspot (and thus expected by nasty applications). For example
writing to final fields using reflection or JNI. It is deliberately not
specified, but works 'as expected'. Now we've hit such a nasty case for
the first time... I don't know what to do. Turn that optimization off by
default?
Roman
More information about the shenandoah-dev
mailing list