On Fri, Jan 12, 2018 at 11:28 AM Jason Greene <jason.gre...@redhat.com> wrote:
> > > On Jan 12, 2018, at 6:50 AM, Vladimir Ivanov < > vladimir.x.iva...@oracle.com> wrote: > > > > -snip- > > > So, the worst case scenario is: a value written into @Stable > field/array is never visible in some code no matter what you do. It can > lead to nasty bugs when different parts of program don't agree on observed > value. It can happen when user doesn't obey @Stable contract and performs > multiple writes into a @Stable field/array. Current implementation in > HotSpot doesn’t > > forbid that. > > > > > This isn’t much different from the already allowed fine tuning of memory > model effects (e.g., observing stale values from a plain write). In those > scenarios, as is the case with @Stable, developers have to be aware of and > honor the respective contract. It could be argued that bugs arising from > contract violations of @Stable are easier to catch, due to their persistent > nature. Theyre only sort of persistent - they’re persistent only after the code is JIT’d and also stays JIT’d (ie no deopt back to interpreter). But JIT itself is non-deterministic so it could create some really funky behavior, and maybe even heisenbugs. > > > -Jason -- Sent from my phone