From 8c60595b26fc7353e5cb3bc6695d07c635277f0e Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Mon, 8 Dec 2008 19:14:38 -0600 Subject: [PATCH] Strip out default methods; ~40kb savings on hello-world and maze demos --- basis/tools/deploy/shaker/shaker.factor | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/basis/tools/deploy/shaker/shaker.factor b/basis/tools/deploy/shaker/shaker.factor index 01cc80e90d..3c458f0a55 100755 --- a/basis/tools/deploy/shaker/shaker.factor +++ b/basis/tools/deploy/shaker/shaker.factor @@ -185,6 +185,19 @@ IN: tools.deploy.shaker strip-word-names? [ dup strip-word-names ] when 2drop ; +: strip-default-methods ( -- ) + strip-debugger? [ + "Stripping default methods" show + [ + [ generic? ] instances + [ "No method" throw ] define-temp + dup t "default" set-word-prop + '[ + [ _ "default-method" set-word-prop ] [ make-generic ] bi + ] each + ] with-compilation-unit + ] when ; + : strip-vocab-globals ( except names -- words ) [ child-vocabs [ words ] map concat ] map concat swap diff ; @@ -370,6 +383,7 @@ SYMBOL: deploy-vocab : strip ( -- ) init-stripper + strip-default-methods strip-libc strip-cocoa strip-debugger @@ -395,7 +409,7 @@ SYMBOL: deploy-vocab deploy-vocab get require strip finish-deploy - ] [ die 1 exit ] recover + ] [ error-continuation get call>> callstack>array die 1 exit ] recover ] bind ; : do-deploy ( -- )