Strip out default methods; ~40kb savings on hello-world and maze demos

db4
Slava Pestov 2008-12-08 19:14:38 -06:00
parent 640b37cb70
commit 8c60595b26
1 changed files with 15 additions and 1 deletions

View File

@ -185,6 +185,19 @@ IN: tools.deploy.shaker
strip-word-names? [ dup strip-word-names ] when strip-word-names? [ dup strip-word-names ] when
2drop ; 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 ) : strip-vocab-globals ( except names -- words )
[ child-vocabs [ words ] map concat ] map concat swap diff ; [ child-vocabs [ words ] map concat ] map concat swap diff ;
@ -370,6 +383,7 @@ SYMBOL: deploy-vocab
: strip ( -- ) : strip ( -- )
init-stripper init-stripper
strip-default-methods
strip-libc strip-libc
strip-cocoa strip-cocoa
strip-debugger strip-debugger
@ -395,7 +409,7 @@ SYMBOL: deploy-vocab
deploy-vocab get require deploy-vocab get require
strip strip
finish-deploy finish-deploy
] [ die 1 exit ] recover ] [ error-continuation get call>> callstack>array die 1 exit ] recover
] bind ; ] bind ;
: do-deploy ( -- ) : do-deploy ( -- )