RFR (L) JDK-8230199: consolidate signature parsing code in HotSpot sources

David Holmes david.holmes at oracle.com
Wed Feb 5 06:30:01 UTC 2020


On 5/02/2020 3:04 pm, John Rose wrote:
> On Feb 4, 2020, at 2:46 PM, David Holmes <david.holmes at oracle.com 
> <mailto:david.holmes at oracle.com>> wrote:
>>
>> Klass* SignatureStream::as_klass(Handle class_loader, Handle 
>> protection_domain,
>>                                 FailureMode failure_mode, TRAPS) {
>>  if (!is_reference())  return NULL;
>>  Symbol* name = as_symbol();
>>  if (name == NULL) {
>>    assert(failure_mode == CachedOrNull, "signature incorrect failure 
>> mode");
>>    return NULL;
>>  }
> 
> That looks like partially evolved code.  The failure_mode
> argument allows the user to ask for NULL if the symbol
> isn’t resolved, and if the symbol in fact isn’t in the string
> table it cannot be resolved.  Perhaps an earlier version of
> that code said something like “name = as_symbol_or_null()”?

No, I missed the fact the NULL check was added in this change:

   Klass* SignatureStream::as_klass(Handle class_loader, Handle 
protection_domain,
                                    FailureMode failure_mode, TRAPS) {
!   if (!is_reference())  return NULL;
     Symbol* name = as_symbol();
+   if (name == NULL) {
+     assert(failure_mode == CachedOrNull, "signature incorrect failure 
mode");
+     return NULL;
+   }

David
-----

> — John


More information about the hotspot-runtime-dev mailing list