[8u20] [9] RFR (S): 8043546: C1 optimizes @Stable instance fields with default values

John Rose john.r.rose at oracle.com
Thu Jul 10 02:16:24 UTC 2014


On Jul 9, 2014, at 11:47 AM, Vladimir Ivanov <vladimir.x.ivanov at oracle.com> wrote:

> http://cr.openjdk.java.net/~vlivanov/8043546/webrev.00/
> https://bugs.openjdk.java.net/browse/JDK-8043546
> (not public because contains internal links)
> 
> C1 doesn't respect @Stable contract and constant folds loads from stable instance fields w/ default values. The fix is to add missing check.
> 
> C1 already optimizes stable static fields and after this change it also optimizes stable instance fields. C1 doesn't support stable array, so tests are changed to distiguish 3 outcomes: no @Stable support, C1 & C2. I'll try to extend C1 support to arrays in the future.

The same "non default value" check is needed for getstatic as well as getfield.  I don't see how the existing getstatic is already correct.

— John

> The fix is very focused, since it's targeted for 8u20. I want to refactor the code for 9 & 8u40 and separate is_constant() and is_stable() properties for instance fields. Current implementation is error-prone, since it requires every place where is_constant() for instance field is used to have a check for stable. It's safer to miss optimization opportunity rather than doing wrong optimization.
> 
> Improved unit tests to test C1 as well. Also, removed dependency on JMX.
> 
> Testing: regression tests
> 
> Thanks!
> 
> Best regards,
> Vladimir Ivanov



More information about the hotspot-compiler-dev mailing list