]> gitweb.factorcode.org Git - factor.git/commitdiff
tools.deploy.shaker: more timid global stripping
authorJoe Groff <arcata@gmail.com>
Tue, 13 Dec 2011 00:08:25 +0000 (16:08 -0800)
committerJoe Groff <arcata@gmail.com>
Tue, 13 Dec 2011 00:08:25 +0000 (16:08 -0800)
Strip globals by replacing their value with "f". The list of globals to strip was written with the assumption that the stripped globals would get restored like normal hashtable keys when accessed. This isn't valid anymore with the globals optimization, since creating a new box breaks the foldable invariant between a global name and its associated box. Need to go through the list of globals to strip and find the ones that actually can be entirely removed as opposed to just reset to f. Fixes #445. Fixes #446.

basis/tools/deploy/shaker/shaker.factor

index dd65d6fac9b14cc79ac52481268ce03aa9b60b15..cf53e47b63f24f7c18e0f67399bdf74a33056725 100755 (executable)
@@ -9,7 +9,7 @@ sets vectors quotations byte-arrays sorting compiler.units
 definitions generic generic.standard generic.single
 tools.deploy.config combinators combinators.private classes
 vocabs.loader.private classes.builtin slots.private grouping
-command-line io.pathnames ;
+command-line io.pathnames namespaces.private ;
 QUALIFIED: bootstrap.stage2
 QUALIFIED: classes.private
 QUALIFIED: compiler.crossref
@@ -398,12 +398,14 @@ IN: tools.deploy.shaker
         "windows-messages" "windows.messages" lookup-word [ , ] when*
     ] { } make ;
 
+: strip-global? ( name stripped-globals -- ? )
+    '[ _ member? ] [ string? ] bi or ;
+
 : strip-globals ( stripped-globals -- )
     strip-globals? [
         "Stripping globals" show
         global boxes>> swap
-        '[ drop _ member? not ] assoc-filter!
-        [ drop string? not ] assoc-filter! drop ! strip CLI args
+        '[ swap _ strip-global? [ f swap value<< ] [ drop ] if ] assoc-each
     ] [ drop ] if ;
 
 : strip-c-io ( -- )