RFR: 8220366: Optimize Symbol handling in ClassVerifier and SignatureStream

Claes Redestad claes.redestad at oracle.com
Fri Mar 8 18:01:04 UTC 2019


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

- 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.



More information about the hotspot-runtime-dev mailing list