2009-05-31 13:20:46 -04:00
|
|
|
! Copyright (C) 2009 Slava Pestov.
|
|
|
|
! See http://factorcode.org/license.txt for BSD license.
|
|
|
|
USING: accessors kernel sequences assocs
|
2009-07-03 19:45:03 -04:00
|
|
|
compiler.cfg.rpo compiler.cfg.instructions
|
2009-06-02 19:23:47 -04:00
|
|
|
compiler.cfg.hats ;
|
2009-05-31 13:20:46 -04:00
|
|
|
IN: compiler.cfg.gc-checks
|
|
|
|
|
|
|
|
: gc? ( bb -- ? )
|
|
|
|
instructions>> [ ##allocation? ] any? ;
|
|
|
|
|
|
|
|
: insert-gc-check ( basic-block -- )
|
|
|
|
dup gc? [
|
2009-07-04 00:11:23 -04:00
|
|
|
[ i i f \ ##gc new-insn prefix ] change-instructions drop
|
2009-05-31 13:20:46 -04:00
|
|
|
] [ drop ] if ;
|
|
|
|
|
|
|
|
: insert-gc-checks ( cfg -- cfg' )
|
|
|
|
dup [ insert-gc-check ] each-basic-block ;
|