RFR: 8218675: Reduce verification overhead in ClassFileParser

Claes Redestad claes.redestad at oracle.com
Mon Feb 11 08:37:07 UTC 2019


On 2019-02-11 02:50, David Holmes wrote:
>>
>> - Symbol names are routinely copied into stack- or heap-allocated
>> buffers.
> 
> These changes seem okay. I think you will find that with your changes 
> as_utf8_flexible_buffer and it's helper as_C_string_flexible_buffer, are 
> now dead code.

Yes, I have a follow-up patch to remove these and a few other things in
the neighborhood.

> 
>> - In verify_unqualified_name we unnecessarily test to detect non-ASCII
>> characters: each byte in multi-byte characters will be over > 127, so
>> it's faster to keep the loop simple. Rewriting as a switch improves it
>> further (this code is exercised by some internal calls independent of
>> -Xverify mode)s 
> 
> I don't see how this can be true. With the switch we will generate a 
> test for every character against all 6 special characters. With the 
> existing code we will bail out for non-ascii characters after one 
> comparison.

No, the old non-ASCII path only skips over the codepoint and starts
over, i.e., UTF8::next increments p 1 to 3. There's no bail out
happening.

All of the modified UTF8-encoded bytes UTF8::next would skip over will
have values >= 128 (assuming legal UTF-8, which UTF8::next already 
assumes), so they can't match the special characters we're looking for 
anyway, so the switch will never match any of them. Thus the new method
is semantically equivalent, but measurably faster.

/Claes


More information about the hotspot-runtime-dev mailing list