RFR (L) JDK-8195100: Use a low latency hashtable for SymbolTable
Gerard Ziemski
gerard.ziemski at oracle.com
Thu Aug 2 15:44:45 UTC 2018
> On Aug 2, 2018, at 10:40 AM, Ioi Lam <ioi.lam at oracle.com> wrote:
>
>
>
> On 8/2/18 8:26 AM, Gerard Ziemski wrote:
>>
>>> symbolTable.cpp:
>>>
>>> 342 // Otherwise, add the symbol to table. Copy to a C string first.
>>> 343 char stack_buf[ON_STACK_BUFFER_LENGTH];
>>> 344 ResourceMark rm(THREAD);
>>> 345 if (len <= ON_STACK_BUFFER_LENGTH) {
>>> 346 buffer = stack_buf;
>>> 347 } else {
>>> 348 buffer = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, len);
>>> 349 }
>>> 350 for (int i=0; i<len; i++) {
>>> 351 buffer[i] = name[i];
>>> 352 }
>>> 353 // Make sure there is no safepoint in the code above since name can't move.
>>> 354 // We can't include the code in NoSafepointVerifier because of the
>>> 355 // ResourceMark.
>>>
>>> The above is dead code and should be removed.
>> That’s not dead code, but in fact you did find an issue here - we should be using the “buffer”, not “name” when we add to the table. Thanks!
>>
>>
> Why do you need to make a copy here? buffer and name seems to have the exact same contents.
I didn’t write that code, but I assume the name comes in some temp memory that can go away at any time, so we need a solid copy.
cheers
More information about the hotspot-runtime-dev
mailing list