(copying hotspot-dev@ back, the patch is theirs)

Thanks Remi!

On 06/08/2013 02:21 PM, Remi Forax wrote:
> in add, the do/while does something a little weird, if putIfAbsent 
> returns null, interned is equals to elem, there is no need to do a
> e.get() in that case,

Oh yes, that a nice micro-optimization, relying on the fact $elem is
still strongly reachable.

> The cast to WeakEntry in expungeStaleElements is not needed.

Yup.

> In WeakEntry.equals, the null check is not needed because null 
> instanceof WeakEntry returns false, and you don't need to cast
> obj.get() to a WeakEntry<T> given you only to call equals on
> entry.get().

Yup, thanks for the nit-picking this.

> Otherwise, it looks good.

I had also renamed the class to ConcurrentWeakInternSet, to emphasize it
should do interning, not only the caching. The new webrev is here:
  http://cr.openjdk.java.net/~shade/7177472/webrev.01/

Testing:
  - Linux x86_64 builds OK
  - Linux x86_64 java/lang/invoke/ jtreg passes OK
  - The microbenchmark scores in the original note are still in effect.

-Aleksey.

Reply via email to