RFR: 8220366: Optimize Symbol handling in ClassVerifier and SignatureStream

Harold Seigel harold.seigel at oracle.com
Wed Mar 13 18:02:17 UTC 2019

Hi Claes,

Could you change the first ClassVerifier::create_temporary_symbol() 
function to just extract the name and length and then call the other one?

Also, can you move the setting of 'len' in Symbol::make_permanent() to 
just before calling cmpxchg() ?

Thanks, Harold

On 3/8/2019 1:01 PM, Claes Redestad wrote:
> Hi,
> in ClassVerifier and SignatureStream, we currently do a lot of Symbol
> lookups. These Symbols are then kept alive incrementing refcount when
> necessary, adding them to a GrowableArray and decrementing refcount in
> each respective destructor.
> A few optimizations have been identified which improve things in this
> area:
> - do not add permanent symbols to the keep alive lists -- this is helped
> along by ensuring all permanent symbols actually return true when
> calling is_permanent (add Symbol::make_permanent)
> - maintain a one-element lookup cache to avoid a fraction of all lookups
> (experimental data shows that back-to-back repeated Symbols in
> signatures are quite common, and the number of avoided lookups for a
> single class can reach hundreds)
> - lazily allocate the GrowableArrays: ~24% of ClassVerifier::_symbols
> and up to 75% of SignatureStream::_names are allocated unnecessarily.
> - narrow down the initial sizes of the GrowableArrays since we'll only
> add a fraction of the number of Symbols to them compared to before
> - a few misc. cleanups and improvements...
> Webrev: http://cr.openjdk.java.net/~redestad/8220366/open.00/
> Bug:    https://bugs.openjdk.java.net/browse/JDK-8220366
> Testing: tier1-3; verified 10-25% reductions in instructions retired
> in a range of bytecode verification methods, and improvement synergizes
> nicely with JDK-8219579. The SignatureStream optimizations crop up in
> a number of places, e.g., Method::link_method sees a 1.2x speed-up.
> Thanks!
> /Claes

More information about the hotspot-runtime-dev mailing list