• We were talking about the case where you have a union of a pointer and an int—that obviously can’t trap and die, right? (That said, I don’t understand why you would trap and die anyway; what are ‘boxed integers’ for if not this sort of thing?)

    That traps and dies in Fil-C.

    Lots of different designs, though you’re right they usually only target pointer stores; but they generally cost a little bit more than that. The main designs I know are: 1) card-mark: unconditional ‘card_table[pointee >> k] = 0’, 2) g1-style region check: ‘if ((pointer ^ pointee) >> k) goto slow’.

    I’m a GC designer. Usually the good barriers are much cheaper than what you say. And they cost nothing (the overhead gets lots in the spare bandwidth of the CPU’s pipe).


    score 3 · canonical

    • traps and dies

      why?

      good barriers

      What do you call a ‘good barrier’? G1 is a rather well-regarded gc and uses the second barrier type I indicated.

      cost nothing (the overhead gets lots in the spare bandwidth of the CPU’s pipe)

      Costs nothing on the backend, sure. Very little code is backend-bottlenecked. But yes barriers are rather cheap in practice.


      score 2 · canonical

        • You will have to be more specific. The most popular java implementation is hotspot, and hotspot’s default gc is g1; g1’s write barrier is, as I said, if ((pointer ^ pointee) >> k) goto slow—remset maintenance iff pointer and pointee belong to different regions.


          score 4 · canonical