RFR: 8258408: SystemDictionary passes TRAPS to functions that don't throw exceptions [v2]

Coleen Phillimore coleenp at openjdk.java.net
Fri Dec 18 02:18:02 UTC 2020


On Fri, 18 Dec 2020 02:13:04 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> src/hotspot/share/classfile/systemDictionary.cpp line 1797:
>> 
>>> 1795:   {
>>> 1796:     MutexLocker mu(THREAD, SystemDictionary_lock);
>>> 1797:     PlaceholderEntry* probe = placeholders()->get_entry(name_hash, name_h, loader_data);
>> 
>> This rethrows the exception at the end of the function.
>
> // definer must notify any waiting threads
>   {
>     MutexLocker mu(THREAD, SystemDictionary_lock);
>     PlaceholderEntry* probe = placeholders()->get_entry(p_index, p_hash, name_h, loader_data);
>     assert(probe != NULL, "DEFINE_CLASS placeholder lost?");
>     if (probe != NULL) {
>       if (HAS_PENDING_EXCEPTION) {
>         linkage_exception = Handle(THREAD,PENDING_EXCEPTION);
>         CLEAR_PENDING_EXCEPTION;
>       } else {
>         probe->set_instance_klass(k);
>       }
>       probe->set_definer(NULL);
>       placeholders()->find_and_remove(p_index, p_hash, name_h, loader_data, PlaceholderTable::DEFINE_CLASS, THREAD);
>       SystemDictionary_lock->notify_all();
>     }
>   }
> 
>   // Can't throw exception while holding lock due to rank ordering
>   if (linkage_exception() != NULL) {
>     THROW_OOP_(linkage_exception(), NULL); // throws exception and returns
>   }

// definer must notify any waiting threads
  {
    MutexLocker mu(THREAD, SystemDictionary_lock);
    PlaceholderEntry* probe = placeholders()->get_entry(name_hash, name_h, loader_data);
    assert(probe != NULL, "DEFINE_CLASS placeholder lost?");
    if (!HAS_PENDING_EXCEPTION) {
      probe->set_instance_klass(k);
    }
    probe->set_definer(NULL);
    placeholders()->find_and_remove(name_hash, name_h, loader_data, PlaceholderTable::DEFINE_CLASS, THREAD);
    SystemDictionary_lock->notify_all();
  }

-------------

PR: https://git.openjdk.java.net/jdk/pull/1808


More information about the hotspot-dev mailing list