On Jun 10, 2013, at 8:47 AM, Aleksey Shipilev <aleksey.shipi...@oracle.com> wrote:
> On 06/09/2013 12:17 AM, Peter Levart wrote: >> In case the loop retries, there's no need to construct another WeakEntry... >> >> T interned; >> WeakEntry<T> e = new WeakEntry<>(elem, stale); >> do { >> expungeStaleElements(); >> WeakEntry<T> exist = map.putIfAbsent(e, e); >> interned = (exist == null)? elem: exist.get(); >> } while (interned == null); >> return interned; > > That's right, thanks! > > The update is here: > http://cr.openjdk.java.net/~shade/7177472/webrev.02/ > > Testing: > - Linux x86_64 builds OK > - Linux x86_64 java/lang/invoke/ jtreg passes OK > - The microbenchmark scores in the original note are still the same This looks good to me. One thing I mentioned in the bug report is that V8's RegExp shows some MethodType related methods in a -Xprof run: Compiled + native Method 11.9% 2455 + 0 java.util.regex.Pattern$GroupTail.match 11.5% 2382 + 0 java.util.regex.Pattern$Start.match 10.2% 2110 + 0 java.util.regex.Pattern$5.isSatisfiedBy 8.5% 1765 + 0 java.util.regex.Pattern$Branch.match 7.1% 1461 + 0 java.lang.invoke.MethodType$WeakInternSet.get 3.4% 709 + 0 java.util.regex.Pattern$CharProperty.match 2.9% 597 + 1 java.lang.invoke.MethodType.makeImpl Could you run RegExp with Nashorn again with and without your changes? -- Chris > > -Aleksey. >