RFR: 8301106 allow cds interned strings to be moved by gc [v2]

Ioi Lam iklam at openjdk.org
Tue Feb 21 21:51:42 UTC 2023


On Tue, 21 Feb 2023 08:12:36 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> It should never fail. I could've used an assert but made it a guarantee since this is rather new code and I am paranoid.
>
> So what stops us from hitting this:
> 
>         // Don't archive a subgraph root that's too big. For archives static fields, that's OK
>         // as the Java code will take care of initializing this field dynamically.
>         return false;
> 
> in `HeapShared::archive_reachable_objects_from`?

I have updated the code to make it structurally impossibly to reach this point, and added asserts to check for that. Explanations are here: 

void HeapShared::archive_strings() {
  oop shared_strings_array = StringTable::init_shared_table(_dumped_interned_strings);
  bool success = archive_reachable_objects_from(1, _default_subgraph_info, shared_strings_array, /*is_closed_archive=*/ false);
  // We must succeed because:
  // - _dumped_interned_strings do not contain any large strings.
  // - StringTable::init_shared_table() doesn't create any large arrays.
  assert(success, "shared strings array must not point to arrays or strings that are too large to archive");
  StringTable::set_shared_strings_array_index(append_root(shared_strings_array));
}


There are other asserts in the handling of `_dumped_interned_strings` and `shared_strings_array` to check their object sizes.

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

PR: https://git.openjdk.org/jdk/pull/12607


More information about the hotspot-runtime-dev mailing list