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

View File

@ -1,9 +1,13 @@
USING: compiler.units words vocabs kernel threads.private ;
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 [
[