RFR(S): 8214773: Replace use of thread unsafe strtok
David Holmes
david.holmes at oracle.com
Tue Dec 4 21:57:01 UTC 2018
Hi Nils,
On 5/12/2018 4:15 am, Nils Eliasson wrote:
> Hi David,
>
> Thanks for your suggestion, I got much better this way:
>
> http://cr.openjdk.java.net/~neliasso/8214773/webrev.02/
That looks good to me!
Can you just add a comment in os_windows.hpp before the #define:
// strtok_s is the Windows thread-safe equivalent of POSIX strtok_r
No need for updated webrev.
Thanks,
David
> Regards,
>
> Nils
>
>
> On 2018-12-04 13:47, David Holmes wrote:
>> <re-send as the original email addresses are mangled>
>>
>> Hi Nils,
>>
>> Can you just define one version in os_posix.cpp and one in
>> os_windows.cpp?
>>
>> This per-os function really seems like overkill in this case. You
>> could just add a Windows specific #define to convert strtok_r to
>> strtok_s.
>>
>> Thanks,
>> David
>>
>>
>> On 4/12/2018 8:01 pm, Nils Eliasson wrote:
>>> Hi,
>>>
>>> Hotspot has a few uses of the thread unsafe strtok function. Most of
>>> the them are probably benign since they happen during startup. The
>>> use in compilerDirectives however has been reported to cause errors
>>> in user applications that also use strtok though jni. (See bug report
>>> or mail to compiler list.)
>>>
>>> In this patch I replace all uses of strtok. The call need to go
>>> through the os specific files since windows uses a different function
>>> (strtok_s) than the rest of the platforms (strtok_r).
>>>
>>> Bug: https://bugs.openjdk.java.net/browse/JDK-8214773
>>>
>>> Webrev: http://cr.openjdk.java.net/~neliasso/8214773/webrev.01/
>>>
>>> Thanks to Andre Gillet at Nuance who reported the bug.
>>>
>>> Regards,
>>>
>>> Nils Eliasson
>>>
More information about the hotspot-compiler-dev
mailing list