RFR: 8261479: CDS runtime code should check exceptions [v2]

Ioi Lam iklam at openjdk.java.net
Mon Mar 22 22:23:40 UTC 2021


On Mon, 22 Mar 2021 21:05:58 GMT, Calvin Cheung <ccheung at openjdk.org> wrote:

>> Proposed changes include:
>> 
>> - For the functions which could throw exceptions, the callers should pass in CHECK instead of THREAD.
>> 
>> - For the functions which won't throw exceptions, put THREAD as the first parameter.
>>       E.g.`static bool add_unregistered_class(Thread* current, InstanceKlass* k);`
>> 
>> - For the functions which won't throw exceptions and don't use THREAD, just simply get rid of the TRAPS parameter.
>> 
>> Testing: passed tiers 1 and 2, in-progress tiers 3 and 4.
>
> Calvin Cheung has updated the pull request incrementally with one additional commit since the last revision:
> 
>   update per review comments

I think this should also be be changed to a `CHECK`: 

void MetaspaceShared::post_initialize(TRAPS) {
  if (UseSharedSpaces) {
    int size = FileMapInfo::get_number_of_shared_paths();
    if (size > 0) {
      SystemDictionaryShared::allocate_shared_data_arrays(size, THREAD); <<<<

src/hotspot/share/memory/metaspaceShared.cpp line 714:

> 712:     if (use_full_module_graph()) {
> 713:       HeapShared::reset_archived_object_states(THREAD);
> 714:       if (HAS_PENDING_EXCEPTION) {

I think this is not necessary. If an exception is thrown, it will be be printed by `MetaspaceShared::preload_and_dump()`

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

Changes requested by iklam (Reviewer).

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


More information about the hotspot-runtime-dev mailing list