RFR: 8065172: More core reflection final and volatile annotations

Joel Borggrén-Franck joel.franck at oracle.com
Mon Nov 24 20:25:59 UTC 2014


> On 24 Nov 2014, at 16:36, Peter Levart <peter.levart at gmail.com> wrote:
> 
> On 11/24/2014 04:04 PM, Joel Borggrén-Franck wrote:
>> 
>> Btw, has anyone seen the assert for upper/lower bounds == null fail in the wild?
>> 
>> private FieldTypeSignature[] getUpperBoundASTs() {
>>     // check that upper bounds were not evaluated yet
>>     assert(upperBounds == null);
>>     return upperBoundASTs;
>> }
>> 
>> shouldn’t it happen once in a while:
>> 
>> public Type[] getUpperBounds() {
>>     // lazily initialize bounds if necessary
>>     if (upperBounds == null) {
>> 
>> 	// thread gets preempted here, other thread completes init, upperBounds are != null
>> 
>>         FieldTypeSignature[] fts = getUpperBoundASTs(); // get AST
>> 
>> 
>> Is the current code only working because most run without esa?
> 
> ...or because races that would trigger this are very rare, since two consecutive "loads" of upperBounds happen one after the other, so the 2nd load and check might even be optimized away.
> 

I was thinking along the lines of warming up in the interpreter + large search engine infrastructure scale.

cheers
/Joel


More information about the core-libs-dev mailing list