RFR JDK-8059510 Compact symbol table layout inside shared archive

Jiangli Zhou jiangli.zhou at oracle.com
Tue Oct 21 18:45:48 UTC 2014


Hi Gerard,

Thanks for following up with this.

On 10/21/2014 09:17 AM, Gerard Ziemski wrote:
> hi Jiangli,
>
> Still going through your web rev, but I have one additional question 
> so far regarding: "SymbolTable::lookup”
>
>  Symbol* SymbolTable::lookup(int index, const char* name,
>
>                                int len, unsigned int hash) {
>
> +  Symbol* s = _shared_table.lookup(name, hash, len);
>
> +  if (s != NULL) {
>
> +    return s;
>
> +  }
>
> +
>
> Instead of statically allocating _shared_table could we declare it as 
> a NULL pointer and only allocate it in
> SymbolTable::init_shared_table as needed? Then we could have:
>
>  Symbol* SymbolTable::lookup(int index, const char* name,
>
>                                int len, unsigned int hash) {
>
> +  if (_shared_table != NULL) {
>
> +    Symbol* s = _shared_table.lookup(name, hash, len);
>
> +    if (s != NULL) {
>
> +      return s;
>
> +    }
>
> +  }
>
> +
>
> and avoid a NOP call to _shared_table in case where CDS is not used - 
> that would also
> make it easy to see that there is no lookup penalty while sharing is off.
>
>

There are pros and cons for both dynamically and statically allocating 
the _shared_table. Dynamically allocating the _shared_table as you 
suggested adds overhead of the memory allocation and the overhead of the 
extra NULL check when the _shared_table is in use. When doing 
optimization, we try to have the least overhead for the fast case, so we 
could make the fast case faster (that's when CDS is used).

Maybe we could make _shared_table.lookup() inlined and reduce the 
overhead of the function call when CDS is not used.

Thanks,
Jiangli

>
>
> cheers



More information about the hotspot-runtime-dev mailing list