Pre-compute next-methods when deploying

db4
Slava Pestov 2008-11-22 19:58:23 -06:00
parent f5513877ec
commit 323f95d3f4
4 changed files with 35 additions and 21 deletions

View File

@ -106,3 +106,8 @@ M: quit-responder call-responder*
"tools.deploy.test.6" shake-and-bake "tools.deploy.test.6" shake-and-bake
run-temp-image run-temp-image
] unit-test ] unit-test
[ ] [
"tools.deploy.test.7" shake-and-bake
run-temp-image
] unit-test

View File

@ -0,0 +1,4 @@
USING: words ;
IN: generic
: next-method-quot ( method -- quot ) "next-method-quot" word-prop ;

View File

@ -5,7 +5,7 @@ namespaces make assocs kernel parser lexer strings.parser
tools.deploy.config vocabs sequences words words.private memory tools.deploy.config vocabs sequences words words.private memory
kernel.private continuations io prettyprint vocabs.loader kernel.private continuations io prettyprint vocabs.loader
debugger system strings sets vectors quotations byte-arrays debugger system strings sets vectors quotations byte-arrays
sorting compiler.units definitions ; sorting compiler.units definitions generic generic.standard ;
QUALIFIED: bootstrap.stage2 QUALIFIED: bootstrap.stage2
QUALIFIED: classes QUALIFIED: classes
QUALIFIED: command-line QUALIFIED: command-line
@ -14,7 +14,6 @@ QUALIFIED: continuations
QUALIFIED: definitions QUALIFIED: definitions
QUALIFIED: init QUALIFIED: init
QUALIFIED: layouts QUALIFIED: layouts
QUALIFIED: listener
QUALIFIED: prettyprint.config QUALIFIED: prettyprint.config
QUALIFIED: source-files QUALIFIED: source-files
QUALIFIED: vocabs QUALIFIED: vocabs
@ -95,20 +94,13 @@ IN: tools.deploy.shaker
: stripped-word-props ( -- seq ) : stripped-word-props ( -- seq )
[ [
strip-dictionary? deploy-compiler? get and [
{
"combination"
"members"
"methods"
} %
] when
strip-dictionary? [ strip-dictionary? [
{ {
"alias" "alias"
"boa-check" "boa-check"
"cannot-infer" "cannot-infer"
"coercer" "coercer"
"combination"
"compiled-effect" "compiled-effect"
"compiled-generic-uses" "compiled-generic-uses"
"compiled-uses" "compiled-uses"
@ -138,7 +130,9 @@ IN: tools.deploy.shaker
"local-writer?" "local-writer?"
"local?" "local?"
"macro" "macro"
"members"
"memo-quot" "memo-quot"
"methods"
"mixin" "mixin"
"method-class" "method-class"
"method-generic" "method-generic"
@ -201,17 +195,13 @@ IN: tools.deploy.shaker
: stripped-globals ( -- seq ) : stripped-globals ( -- seq )
[ [
"callbacks" "alien.compiler" lookup ,
"inspector-hook" "inspector" lookup , "inspector-hook" "inspector" lookup ,
{ {
bootstrap.stage2:bootstrap-time
continuations:error continuations:error
continuations:error-continuation continuations:error-continuation
continuations:error-thread continuations:error-thread
continuations:restarts continuations:restarts
listener:error-hook
init:init-hooks init:init-hooks
source-files:source-files source-files:source-files
input-stream input-stream
@ -234,6 +224,10 @@ IN: tools.deploy.shaker
"tools" "tools"
"io.launcher" "io.launcher"
"random" "random"
"compiler"
"stack-checker"
"bootstrap"
"listener"
} strip-vocab-globals % } strip-vocab-globals %
strip-dictionary? [ strip-dictionary? [
@ -244,6 +238,7 @@ IN: tools.deploy.shaker
{ {
gensym gensym
name>char-hook name>char-hook
classes:next-method-quot-cache
classes:class-and-cache classes:class-and-cache
classes:class-not-cache classes:class-not-cache
classes:class-or-cache classes:class-or-cache
@ -304,10 +299,7 @@ IN: tools.deploy.shaker
"ui-error-hook" "ui.gadgets.worlds" lookup , "ui-error-hook" "ui.gadgets.worlds" lookup ,
] when ] when
"<value>" "stack-checker.state" lookup [ , ] when*
"windows-messages" "windows.messages" lookup [ , ] when* "windows-messages" "windows.messages" lookup [ , ] when*
] { } make ; ] { } make ;
: strip-globals ( stripped-globals -- ) : strip-globals ( stripped-globals -- )
@ -368,11 +360,21 @@ SYMBOL: deploy-vocab
t "quiet" set-global t "quiet" set-global
f output-stream set-global ; f output-stream set-global ;
: compute-next-methods ( -- )
[ standard-generic? ] instances [
"methods" word-prop [
nip
dup next-method-quot "next-method-quot" set-word-prop
] assoc-each
] each
"resource:basis/tools/deploy/shaker/next-methods.factor" run-file ;
: strip ( -- ) : strip ( -- )
init-stripper init-stripper
strip-libc strip-libc
strip-cocoa strip-cocoa
strip-debugger strip-debugger
compute-next-methods
strip-init-hooks strip-init-hooks
strip-c-io strip-c-io
f 5 setenv ! we can't use the Factor debugger or Factor I/O anymore f 5 setenv ! we can't use the Factor debugger or Factor I/O anymore
@ -382,8 +384,7 @@ SYMBOL: deploy-vocab
r> strip-words r> strip-words
compress-byte-arrays compress-byte-arrays
compress-quotations compress-quotations
compress-strings compress-strings ;
H{ } clone classes:next-method-quot-cache set-global ;
: (deploy) ( final-image vocab config -- ) : (deploy) ( final-image vocab config -- )
#! Does the actual work of a deployment in the slave #! Does the actual work of a deployment in the slave

View File

@ -1,9 +1,13 @@
USING: compiler.units words vocabs kernel threads.private ; USING: compiler.units words vocabs kernel threads.private ;
IN: debugger IN: debugger
: print-error ( error -- ) die drop ; : consume ( error -- )
#! We don't want DCE to drop the error before the die call!
drop ;
: error. ( error -- ) die drop ; : print-error ( error -- ) die consume ;
: error. ( error -- ) die consume ;
"threads" vocab [ "threads" vocab [
[ [