RFR: 8217450: Add PackageEntry::locked_lookup_only

Claes Redestad claes.redestad at oracle.com
Tue Jan 22 13:27:41 UTC 2019



On 2019-01-22 13:27, Aleksey Shipilev wrote:
> On 1/22/19 11:53 AM, Claes Redestad wrote:
>> http://cr.openjdk.java.net/~redestad/8217450/open.00/
> 
> *) "this" seems to be the superfluous change and/or bad grammar here?
> 
>   211         // Some of java.base's packages were added early in bootstrapping, this ignore duplicates.

Reverted - I was trying to point out that

> 
> *) "Pookup" ;)
> 
>   253   // Pookup Package with loader's package entry table, add it if not found.

Wretched typos!

> 
> *) The logic in duplicate finding loop is confusing, because it ignores "pkg" that might be NULL
> when package exists? I think it can be clearer if we move "PackageEntry* pkg;" down to actual
> intialization at L212. It seems to me the assert at L213 can "just" check the value returned by
> locked_lookup_only? Checking "pkg != NULL" is probably makes a tad faster fastdebug build, though.
> 
>   208       // loop through and add any new packages for java.base
>   209       PackageEntry* pkg;
>   210       for (int x = 0; x < pkg_list->length(); x++) {
>   211         // Some of java.base's packages were added early in bootstrapping, this ignore duplicates.
> 
>   212         pkg = package_table->locked_create_entry_or_null(pkg_list->at(x),
> ModuleEntryTable::javabase_moduleEntry());
>   213         assert(pkg != NULL || package_table->locked_lookup_only(pkg_list->at(x)) != NULL,
>   214                "Unable to create a " JAVA_BASE_NAME " package entry");
>   215         // Unable to have a GrowableArray of TempNewSymbol.  Must decrement the refcount of
>   216         // the Symbol* that was created above for each package. The refcount was incremented
>   217         // by SymbolTable::new_symbol and as well by the PackageEntry creation.
>   218         pkg_list->at(x)->decrement_refcount();
>   219       }

Might as well remove PackageEntry* pkg and simplify:

211        package_table->locked_create_entry_or_null(pkg_list->at(x), 
ModuleEntryTable::javabase_moduleEntry());
212        assert(package_table->locked_lookup_only(pkg_list->at(x)) != 
NULL,
213               "Unable to create a " JAVA_BASE_NAME " package entry");

http://cr.openjdk.java.net/~redestad/8217450/open.01/

/Claes


More information about the hotspot-runtime-dev mailing list