2015-01-01 05:12:58 -05:00
|
|
|
USING: accessors arrays assocs compiler.cfg.instructions
|
2015-05-09 09:32:05 -04:00
|
|
|
compiler.cfg.linearization compiler.cfg.stacks.padding fry kernel math
|
|
|
|
sequences ;
|
2014-08-13 07:06:34 -04:00
|
|
|
IN: compiler.cfg.stacks.vacant
|
|
|
|
|
2014-08-25 16:33:54 -04:00
|
|
|
: vacant>bits ( vacant -- bits )
|
2014-08-25 12:55:27 -04:00
|
|
|
[ { } ] [
|
2014-08-13 07:06:34 -04:00
|
|
|
dup supremum 1 + 1 <array>
|
2014-08-25 12:55:27 -04:00
|
|
|
[ '[ _ 0 -rot set-nth ] each ] keep
|
2014-08-13 07:06:34 -04:00
|
|
|
] if-empty ;
|
|
|
|
|
2014-08-25 16:33:54 -04:00
|
|
|
: state>gc-data ( state -- gc-data )
|
2015-05-12 18:35:13 -04:00
|
|
|
[ second vacant>bits ] map ;
|
2014-08-13 07:06:34 -04:00
|
|
|
|
2014-08-25 16:33:54 -04:00
|
|
|
: set-gc-map ( state gc-map -- )
|
2015-05-09 09:32:05 -04:00
|
|
|
swap state>gc-data first2 -rot >>scrub-d swap >>scrub-r drop ;
|
2014-08-13 07:06:34 -04:00
|
|
|
|
2015-01-01 05:12:58 -05:00
|
|
|
: fill-gc-maps ( cfg -- )
|
2015-05-09 09:32:05 -04:00
|
|
|
[ trace-stack-state2 ] [ cfg>insns [ gc-map-insn? ] filter ] bi
|
2015-01-19 05:08:06 -05:00
|
|
|
[ [ insn#>> of ] [ gc-map>> ] bi set-gc-map ] with each ;
|