RFR: 8220366: Optimize Symbol handling in ClassVerifier and SignatureStream

Lois Foltan lois.foltan at oracle.com
Thu Mar 14 15:47:28 UTC 2019

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

Hi Claes,

Looks like a good improvement!  A couple of comments:

- src/hotspot/share/oops/symbol.cpp - new method Symbol::make_permanent()
   I have a concern that the while (true) loop could be infinite, can 
you have Coleen ok this part of the change since she is the expert in 
regards to Symbol refcounts?

- src/hotspot/share/runtime/signature.cpp
   The removal of SignatureVerifier::invalid_name_char(char c) method 
seems fine except that the new switch at line #496 does not include the 
';' case, why?

- copyrights need to be updated in various files


More information about the hotspot-runtime-dev mailing list