2009-07-26 22:11:26 -04:00
|
|
|
! Copyright (C) 2009 Slava Pestov.
|
|
|
|
! See http://factorcode.org/license.txt for BSD license.
|
2009-07-27 03:20:45 -04:00
|
|
|
USING: accessors assocs hashtables fry kernel make namespaces
|
|
|
|
sequences compiler.cfg.coalescing.state compiler.cfg.parallel-copy ;
|
2009-07-26 22:11:26 -04:00
|
|
|
IN: compiler.cfg.coalescing.copies
|
|
|
|
|
2009-07-27 03:20:45 -04:00
|
|
|
: compute-copies ( assoc -- assoc' )
|
|
|
|
dup assoc-size <hashtable> [
|
|
|
|
'[
|
2009-07-27 20:24:13 -04:00
|
|
|
[ _ 2dup key? [ "OOPS" throw ] [ set-at ] if ] with each
|
2009-07-27 03:20:45 -04:00
|
|
|
] assoc-each
|
|
|
|
] keep ;
|
2009-07-27 01:31:21 -04:00
|
|
|
|
2009-07-27 20:24:13 -04:00
|
|
|
: insert-copies ( -- )
|
2009-07-27 03:20:45 -04:00
|
|
|
waiting get [
|
|
|
|
[ instructions>> building ] dip '[
|
|
|
|
building get pop
|
|
|
|
_ compute-copies parallel-copy
|
|
|
|
,
|
|
|
|
] with-variable
|
|
|
|
] assoc-each ;
|