1 ! Copyright (C) 2009 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors kernel sequences assocs fry
7 compiler.cfg.instructions
8 compiler.cfg.stacks.uninitialized ;
9 IN: compiler.cfg.gc-checks
11 ! Garbage collection check insertion. This pass runs after representation
12 ! selection, so it must keep track of representations.
14 : insert-gc-check? ( bb -- ? )
15 instructions>> [ ##allocation? ] any? ;
17 : blocks-with-gc ( cfg -- bbs )
18 post-order [ insert-gc-check? ] filter ;
20 : insert-gc-check ( bb -- )
24 f f _ uninitialized-locs \ ##gc new-insn
26 ] change-instructions drop ;
28 : insert-gc-checks ( cfg -- cfg' )
30 over compute-uninitialized-sets
31 [ insert-gc-check ] each