RFR: 8291969: Convert LoaderConstraintsTable to ResourceHashtable [v2]
Ioi Lam
iklam at openjdk.org
Fri Aug 19 05:43:34 UTC 2022
On Wed, 17 Aug 2022 16:31:21 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:
>> This converts the LoaderConstraintTable to ResourceHashtable. It's a bit different than the other conversions in that the LoaderConstraintEntry has to be restructured to hold all the loader constraints for that class name, since the search key is the class name. Also, I replaced the raw arrays with GrowableArray, because it's less code.
>> Tested with tier1-3, and tier 4-7 previously with other changes. I also verified code paths with some temporary asserts with existing tests, including jck tests.
>
> Coleen Phillimore has updated the pull request incrementally with one additional commit since the last revision:
>
> Fix include for minimal build.
Or, maybe it's possible to use (name + loader_data) as the hash key? That way the search will be even faster than today, since you don't need to do the linear look up for constraints with the same name. You also don't need two similarly named classes LoaderConstraint and LoaderConstraintEntry,
Existing code:
unsigned int hash = compute_hash(name);
int index = hash_to_index(hash);
LoaderConstraintEntry** pp = bucket_addr(index);
ClassLoaderData* loader_data = ClassLoaderData::class_loader_data(loader());
while (*pp) {
LoaderConstraintEntry* p = *pp;
if (p->hash() == hash) {
if (p->name() == name) {
for (int i = p->num_loaders() - 1; i >= 0; i--) {
if (p->loader_data(i) == loader_data &&
// skip unloaded klasses
(p->klass() == NULL ||
p->klass()->is_loader_alive())) {
return pp;
}
-------------
PR: https://git.openjdk.org/jdk/pull/9904
More information about the hotspot-runtime-dev
mailing list