On 2018-08-09 18:38, Peter Levart wrote:
On 08/09/2018 06:28 PM, Claes Redestad wrote:
On 2018-08-09 17:41, Peter Levart wrote:
There's danger when you overwrite a non-null @Stable field with
another value that this new value will not be seen. Or is <clinit>
code an exception where @Stable is not honored yet...
Typically IntegerCache::<clinit> runs before JIT has even started, so
I think we're OK even though the double-assignment is undefined. But
it's a good question what happens in cases we're running AOTd code,
so perhaps this pattern might be problematic in some future..
What if you run it with -Xcomp ?
Works.
Would still be run by interpreter at startup?
Yes, -Xcomp doesn't change when JIT threads start running; verified on a
debug build that IntegerCache.<clinit> is executed by the interpreter
even with -Xcomp
/Claes