GC-safe points, mutator suspension and barriers
Reading the section about "GC-safe points and mutator suspension" in Richard Jones' excellent GC Handbook made me realize that HLVM 's approach is both unusually simple and yet still very effective and, therefore, deserves to be described. GC safe points are apparently regarded as a tricky subject by many people. Jones says that approaches to safe points may be classified into (effectively) eager and lazy preparation. He goes on to say that thread suspension complicates matters by interrupting the thread at uncontrolled points and mentions probabilistic advancement to the next safe point. Attention is given to the problem of devising stack maps expressive enough to convey locally-held references. Even the idea of compressing stack maps to save space is covered. Self-modifying code or "patching" as an alternative to polling is mentioned. The section describing where GC check points can go is particularly interesting: " Beyond the minimal points needed f...