1. 51
  1.  

  2. 13

    LLVM’s built-in unordered containers have a mode where iteration order is reversed. This was added to catch exactly this kind of bug: LLVM aims to support deterministic compilation and this isn’t possible if the output depends on the order of things in an unordered collection (which might be stable on some platforms, but may depend on ASLR, malloc randomisation, or other factors elsewhere). Some of the LLVM buildbots run the tests with the flag set that reverses the order. In Verona, we go a step further for systematic testing and introduce a shuffle in a few places to give things a (deterministic, based on the random seed for that test run, so reproduceable locally when things fail in CI) pseudorandom permutation.

    It sounds as if this would have been prevented if Serenity had had:

    • A mode where HashTable iteration order was nondeterministic (reversed would have been fine, random permutation is better).
    • A test that tried decoding a JPEG image and comparing the result against a final version.
    • A CI job that ran this the test in this mode.

    Serenity, with complete control of its own standard library, is in a much better place to provide this kind of testing infrastructure than projects that depend on a host platform’s standard library. It would be great to see them add something like this.

    1. 6
      1. 12

        Fuck, Lenna? Could we stop alienating women in tech? Don’t take my word for it, the AV1 folks are pleading with the field to stop using Lenna too.

        “If a professor makes a sexist joke, a female student might well find it so disturbing that she is unable to listen to the rest of the lecture. Suggestive pictures used in lectures on image processing are similarly distracting to the women listeners and convey the message that the lecturer caters to the males only. For example, it is amazing that the Lena pin-up image is still used as an example in courses and published as a test image in journals today.” ~D. P. O’Leary, 1999

        1. 6

          Yeah I always find it uncomfortable to keep seeing this same image. It goes back to college times in computer graphics class. I didn’t know why back then, but now I do. Btw, the professor back then even suggested we search the full pic after class.

          It’s about time we use other images in place of lenna.

          1. 4

            the professor back then even suggested we search the full pic after class

            🤮

            1. 6

              Speaking as a woman here, I honestly didn’t get the problem with the image; I thought she might just be wearing a shoulderless outfit or something. Then this comment prompted me to search the full image, and… oh, it’s a fucking Playboy pinup. Yeah.

          2. 3

            Suggestive, is the crux of it. The pretext of sex in the image requires an investment in identifying the image.

            Lenna is technical.

            From a technical standpoint, apropos Imaging systems, identification and composition algorithms, and so on: Lenna is industrial.

            Alas, we might ought to have used the Mona Lisa or some other such classic art, perhaps dismantled and re-assembled, over time, as ‘treasure’. Lenna is truly a beautiful pic, seeing her everywhere deep in the binaries is .. indeed .. a treat.

            However, there are also rainbows.

            1. 5

              seeing her everywhere deep in the binaries is .. indeed .. a treat.

              Lenna is also the male gaze; that’s why it’s problematic. https://en.wikipedia.org/wiki/Male_gaze

            2. 3

              Here are some alternatives (both PDF articles).

              1. 1

                I like the pic of Fabio in the second one. Because Fabio.

              2. 3

                We really need to move away from the pic in this industry.

                There’s this wonderful tool, https://rawpixels.net. It’s so useful when working with raw images. But I really don’t feel comfortable using it at work, because the default image is the Lenna photo, and I don’t feel comfortable with suggestive pictures of naked women on my screen in an open floor plan office setting.

              3. 2

                However, this is a double edged sword when it comes to C++; because everyone includes the standard library (even if you don’t include it, your includes will), and because C++’s template system means that everything that’s templated has to include the definitions in the header as well, this means that anytime someone touches AK in a commit, the entire operating system has to be rebuilt (~3400 files at the time of writing).

                Amusingly, Common Lisp has a similar issue - if you redefine a macro, you have to manually recompile all of the other macros and functions that instantiate it.

                1. 1

                  Imagine if lisp implementations allowed you to use late bindings for macros, too, triggering an eval on every application of one. Performance would suffer, but it would be hella convenient for this use case.

                  1. 1

                    Well, the solution that I had in mind was for Lisp implementations to keep a dependency graph of functions and macros, and automatically recompile out-of-date functions and macros when the macros that they depended on were updated. This might be the same as what you’re suggesting, but I’m not sure.

                    1. 1

                      I meant that you would transform something like

                      (defmacro m (...)
                        ...)
                      (defun f (...)
                        (m ...))
                      

                      into

                      (defun f (...)
                        ...)
                      (defun f (...)
                        (eval (m '...)))
                      

                      That is, every time you evaluate code that uses a macro, you re-evaluate the macro.