RFR: 8209120: Archive the Integer.IntegerCache (original) (raw)
Claes Redestad claes.redestad at oracle.com
Thu Aug 9 16:28:14 UTC 2018
- Previous message: RFR: 8209120: Archive the Integer.IntegerCache
- Next message: RFR: 8209120: Archive the Integer.IntegerCache
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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 code an exception where @Stable is not honored yet...
Typically IntegerCache:: 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..
To mitigate this possibility, you could have two fields: static Integer cache[]; static final Integer finalCache[]; The 'cache' field is archived and de-archived. The final result is set to 'cache' by overwriting and to 'finalCache'. The later is then also used in Integer.valueOf().
Right, this would be a cheap way to dispel any concerns here.
/Claes
- Previous message: RFR: 8209120: Archive the Integer.IntegerCache
- Next message: RFR: 8209120: Archive the Integer.IntegerCache
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]