๐Ÿ“mprotect to implement a write barrier (GC)

The write barrier can be implemented with VM page protection. The page is marked as old and the first write to it will trigger a SIGSEGV. It is possible to catch it with userfaultfd and modify the necessary GC structures.

Good because mutator does not need to be instrumented, so the performance in the normal case is not affected.

See also

Backlinks