RFR(xs): JDK-8152329: jvm should treat the "Multi-Release" jar manifest attribute name as case insensitive

Calvin Cheung calvin.cheung at oracle.com
Wed Apr 6 00:13:16 UTC 2016



On 4/5/16, 1:29 PM, Jiangli Zhou wrote:
> Hi Calvin,
>
>> On Apr 5, 2016, at 10:53 AM, Calvin Cheung <calvin.cheung at oracle.com 
>> <mailto:calvin.cheung at oracle.com>> wrote:
>>
>>
>>
>> On 4/5/16, 10:44 AM, Jiangli Zhou wrote:
>>> Hi Calvin,
>>>
>>> Have you thought about using strcasecmp()? The 
>>> globalDefinitions_visCPP.hpp defines strcasecmp to _stricmp. So 
>>> compiler dependency is not an issue. We have existing code that uses 
>>> strcasecmp() for case insensitive comparison.
>> I don't think it will work in this situation. It is because the 
>> manifest buffer contains all the jar manifest entries, not just the 
>> "Multi-Release" entry. In other words, "Multi-Release" isn't at the 
>> beginning of the string.
>
> Ok. There is strcasestr(), but it’s a nonstandard extension. I 
> couldn’t find a Windows equivalent for that. Iterating the string to 
> covert each char to lower case is slow although it’s only used in CDS 
> dump time. To make it more efficient, you could add a new field, ‘u1 
> is_multi_versioned' in ClassPathZipEntry to remember the result so you 
> only need to do the case in-senstive strstr once, instead of everytime 
> when ClassPathZipEntry::open_stream() is called. The new field could 
> have three states, ‘unknown’, ‘yes’ and ‘no’. If it’s ‘unknown’, 
> is_multiple_versioned() opens the manifest, otherwise it can return 
> quickly.
I've an updated webrev for the above change.
http://cr.openjdk.java.net/~ccheung/8152329/webrev.02/

Some testing in progress.

thanks,
Calvin
>
> Thanks,
> Jiangli
>
>
>>
>> thanks,
>> Calvin
>>>
>>> // Non-standard stdlib-like stuff:
>>> inline int strcasecmp(const char *s1, const char *s2) { return 
>>> _stricmp(s1,s2); }
>>>
>>> Thanks,
>>> Jiangli
>>>> On Apr 4, 2016, at 2:07 PM, Calvin Cheung <calvin.cheung at oracle.com 
>>>> <mailto:calvin.cheung at oracle.com>> wrote:
>>>>
>>>>
>>>> Please review this small fix for:
>>>> https://bugs.openjdk.java.net/browse/JDK-8152329
>>>>
>>>> The fix is to convert the buffer containing the jar manifest into 
>>>> lower case before performing strstr.
>>>>
>>>> webrev: http://cr.openjdk.java.net/~ccheung/8152329/webrev.01/
>>>>
>>>> Testing:
>>>>    JPRT -testset hotspot
>>>>    The tests under runtime on the platforms built by JPRT.
>>>>
>>>> thanks,
>>>> Calvin
>>>
>


More information about the hotspot-runtime-dev mailing list