From 8aa41672cac94f0db4e0b98cb9ec2bbd2e6ca1df Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sun, 2 Aug 2009 08:20:50 -0500 Subject: [PATCH] compiler.cfg.ssa.destruction.copies: factor out add-instructions combinator into compiler.cfg.utilities --- .../compiler/cfg/ssa/destruction/copies/copies.factor | 11 ++++------- basis/compiler/cfg/utilities/utilities.factor | 7 +++++++ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/basis/compiler/cfg/ssa/destruction/copies/copies.factor b/basis/compiler/cfg/ssa/destruction/copies/copies.factor index 177793f1a1..74180fe41f 100644 --- a/basis/compiler/cfg/ssa/destruction/copies/copies.factor +++ b/basis/compiler/cfg/ssa/destruction/copies/copies.factor @@ -1,7 +1,8 @@ ! Copyright (C) 2009 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: accessors assocs hashtables fry kernel make namespaces sets -sequences compiler.cfg.ssa.destruction.state compiler.cfg.parallel-copy ; +USING: accessors assocs hashtables fry kernel make namespaces +sets sequences compiler.cfg.ssa.destruction.state +compiler.cfg.parallel-copy compiler.cfg.utilities ; IN: compiler.cfg.ssa.destruction.copies ERROR: bad-copy ; @@ -20,9 +21,5 @@ ERROR: bad-copy ; : insert-copies ( -- ) waiting get [ - [ instructions>> building ] dip '[ - building get pop - _ compute-copies parallel-copy - , - ] with-variable + '[ _ compute-copies parallel-copy ] add-instructions ] assoc-each ; \ No newline at end of file diff --git a/basis/compiler/cfg/utilities/utilities.factor b/basis/compiler/cfg/utilities/utilities.factor index 0b68635d17..9246084325 100644 --- a/basis/compiler/cfg/utilities/utilities.factor +++ b/basis/compiler/cfg/utilities/utilities.factor @@ -43,6 +43,13 @@ SYMBOL: visited to predecessors>> [ dup from eq? [ drop bb ] when ] change-each from successors>> [ dup to eq? [ drop bb ] when ] change-each ; +: add-instructions ( bb quot -- ) + [ instructions>> building ] dip '[ + building get pop + @ + , + ] with-variable ; inline + : ( insns -- bb ) swap >vector