Open Bug 1588528 Opened 5 years ago Updated 2 years ago

[hazards] Predicate function in std::all always considered as a GC function

Categories

(Core :: JavaScript: GC, enhancement, P3)

enhancement

Tracking

()

Tracking Status
firefox71 --- affected

People

(Reporter: anba, Unassigned)

References

(Blocks 1 open bug)

Details

In https://searchfox.org/mozilla-central/source/js/src/builtin/intl/LanguageTag.cpp I've added a handful of JS::AutoSuppressGCAnalysis to be able to use std::all while being in a JS::AutoCheckCannotGC guarded block. This is currently needed to avoid hazard failures like in [1]. It'd be neat if the hazard analysis can get taught that std::all won't GC as long as the predicate function doesn't GC.

Excerpt from the hazards log:

Function '_ZN2js4intlL21IsAsciiLowercaseAlphaEP14JSLinearString$LanguageTag.cpp:uint8 js::intl::IsAsciiLowercaseAlpha(JSLinearString*)' has unrooted 'nogc' of type 'JS::AutoCheckCannotGC' live across GC call '_ZN2js4intlL21IsAsciiLowercaseAlphaIDsEEbRKN7mozilla5RangeIKT_EE$LanguageTag.cpp:uint8 js::intl::IsAsciiLowercaseAlpha(mozilla::Range<const char16_t>*) [with CharT = char16_t]' at js/src/builtin/intl/LanguageTag.cpp:1606
    LanguageTag.cpp:1604: Call(1,2, nogc.__ct_comp (0))
    LanguageTag.cpp:1605: Call(2,3, __temp_1 := str*.field:0.hasLatin1Chars())
    LanguageTag.cpp:1605: Assume(3,6, __temp_1*, false)
    LanguageTag.cpp:1606: Call(6,7, __temp_3 := str*.twoByteRange(nogc))
    LanguageTag.cpp:1606: Call(7,8, return := IsAsciiLowercaseAlpha(__temp_3)) [[GC call]]
    LanguageTag.cpp:1605: Call(8,9, nogc.~__dt_comp ())
GC Function: _ZN2js4intlL21IsAsciiLowercaseAlphaIDsEEbRKN7mozilla5RangeIKT_EE$LanguageTag.cpp:uint8 js::intl::IsAsciiLowercaseAlpha(mozilla::Range<const char16_t>*) [with CharT = char16_t]
    uint8 std::all_of(uint16*, uint16*, (uint8)(uint16)*) [with _IIter = const char16_t*; _Predicate = bool (*)(char16_t)]
    uint16* std::find_if_not(uint16*, uint16*, (uint8)(uint16)*) [with _IIter = const char16_t*; _Predicate = bool (*)(char16_t)]
    uint16* std::__find_if_not(uint16*, uint16*, __gnu_cxx::__ops::_Iter_pred<bool (*)(char16_t)>) [with _InputIterator = const char16_t*; _Predicate = __gnu_cxx::__ops::_Iter_pred<bool (*)(char16_t)>]
    uint16* std::__find_if(uint16*, uint16*, __gnu_cxx::__ops::_Iter_negate<bool (*)(char16_t)>, std::iterator_traits::iterator_category) [with _RandomAccessIterator = const char16_t*; _Predicate = __gnu_cxx::__ops::_Iter_negate<bool (*)(char16_t)>]
    bool __gnu_cxx::__ops::_Iter_negate<_Predicate>::operator()(_Iterator) [with _Iterator = const char16_t*; _Predicate = bool (*)(char16_t)]
    __gnu_cxx::__ops::_Iter_negate<bool (*)(char16_t)>._M_pred
    unresolved __gnu_cxx::__ops::_Iter_negate<bool (*)(char16_t)>._M_pred

[1] https://treeherder.mozilla.org/#/jobs?repo=try&revision=336c781eccb4ecc8cb836644a79728aac9bc6c31&selectedJob=270918586

Blocks: hazard
Priority: -- → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.