Merge branch 'master' of git://factorcode.org/git/factor

Doug Coleman 2008-03-20 15:36:19 -05:00
commit 0d4032707c
15 changed files with 109 additions and 71 deletions

View File

@ -12,7 +12,7 @@ SYMBOL: bootstrap-time
: default-image-name ( -- string )
vm file-name windows? [ "." split1 drop ] when
".image" append ;
".image" append resource-path ;
: do-crossref ( -- )
"Cross-referencing..." print flush
@ -106,5 +106,5 @@ f error-continuation set-global
millis r> - dup bootstrap-time set-global
print-report
"output-image" get resource-path save-image-and-exit
"output-image" get save-image-and-exit
] if

View File

@ -190,7 +190,7 @@ DEFER: copy-tree-into
! Special paths
: resource-path ( path -- newpath )
\ resource-path get [ image parent-directory ] unless*
"resource-path" get [ image parent-directory ] unless*
prepend-path ;
: ?resource-path ( path -- newpath )

View File

@ -1,14 +1,15 @@
USING: tools.deploy.config ;
H{
{ deploy-math? t }
{ deploy-reflection 1 }
{ deploy-word-defs? f }
{ deploy-random? f }
{ deploy-name "Bunny" }
{ deploy-threads? t }
{ deploy-word-props? f }
{ "stop-after-last-window?" t }
{ deploy-ui? t }
{ deploy-io 3 }
{ deploy-compiler? t }
{ deploy-word-defs? f }
{ deploy-math? t }
{ deploy-c-types? f }
{ deploy-io 3 }
{ deploy-reflection 1 }
{ deploy-ui? t }
{ "stop-after-last-window?" t }
{ deploy-word-props? f }
}

View File

@ -1,14 +1,15 @@
USING: tools.deploy.config ;
H{
{ deploy-io 1 }
{ deploy-compiler? t }
{ deploy-word-defs? f }
{ deploy-word-props? f }
{ deploy-math? t }
{ deploy-random? t }
{ deploy-name "Hello world" }
{ deploy-c-types? f }
{ deploy-ui? t }
{ deploy-threads? t }
{ deploy-compiler? t }
{ deploy-math? t }
{ deploy-c-types? f }
{ deploy-io 1 }
{ deploy-reflection 1 }
{ deploy-ui? t }
{ "stop-after-last-window?" t }
{ deploy-word-props? f }
}

View File

@ -1,14 +1,15 @@
USING: tools.deploy.config ;
H{
{ deploy-word-defs? f }
{ deploy-random? f }
{ deploy-name "Hello world (console)" }
{ deploy-threads? f }
{ deploy-c-types? f }
{ deploy-compiler? f }
{ deploy-ui? f }
{ deploy-math? f }
{ deploy-reflection 1 }
{ deploy-word-defs? f }
{ deploy-c-types? f }
{ deploy-io 2 }
{ deploy-word-props? f }
{ deploy-reflection 1 }
{ deploy-ui? f }
{ "stop-after-last-window?" t }
{ deploy-word-props? f }
}

View File

@ -1,14 +1,15 @@
USING: tools.deploy.config ;
H{
{ deploy-word-defs? f }
{ deploy-random? f }
{ deploy-name "Sudoku" }
{ deploy-threads? f }
{ deploy-c-types? f }
{ deploy-compiler? t }
{ deploy-ui? f }
{ deploy-math? f }
{ deploy-reflection 1 }
{ deploy-word-defs? f }
{ deploy-c-types? f }
{ deploy-io 2 }
{ deploy-word-props? f }
{ deploy-reflection 1 }
{ deploy-ui? f }
{ "stop-after-last-window?" t }
{ deploy-word-props? f }
}

View File

@ -40,42 +40,57 @@ IN: tools.deploy.backend
"compiler" deploy-compiler? get ?,
"ui" deploy-ui? get ?,
"io" native-io? ?,
"random" deploy-random? get ?,
] { } make ;
: staging-image-name ( -- name )
: staging-image-name ( profile -- name )
"staging."
bootstrap-profile strip-word-names? [ "strip" add ] when
"-" join ".image" 3append ;
swap strip-word-names? [ "strip" add ] when
"-" join ".image" 3append temp-file ;
: staging-command-line ( config -- flags )
DEFER: ?make-staging-image
: staging-command-line ( profile -- flags )
[
[
dup empty? [
"-i=" my-boot-image-name append ,
] [
dup 1 head* ?make-staging-image
"-output-image=" staging-image-name append ,
"-resource-path=" "" resource-path append ,
"-include=" bootstrap-profile " " join append ,
"-i=" over 1 head* staging-image-name append ,
strip-word-names? [ "-no-stack-traces" , ] when
"-run=tools.deploy.restage" ,
] if
"-no-user-init" ,
] { } make
] bind ;
"-output-image=" over staging-image-name append ,
"-include=" swap " " join append ,
strip-word-names? [ "-no-stack-traces" , ] when
"-no-user-init" ,
] { } make ;
: run-factor ( vm flags -- )
swap add* dup . run-with-output ; inline
: make-staging-image ( config -- )
: make-staging-image ( profile -- )
vm swap staging-command-line run-factor ;
: ?make-staging-image ( config -- )
dup [ staging-image-name ] bind exists?
: ?make-staging-image ( profile -- )
dup staging-image-name exists?
[ drop ] [ make-staging-image ] if ;
: deploy-command-line ( image vocab config -- flags )
[
bootstrap-profile ?make-staging-image
[
"-i=" staging-image-name append ,
"-i=" bootstrap-profile staging-image-name append ,
"-resource-path=" "" resource-path append ,
"-run=tools.deploy.shaker" ,
@ -89,7 +104,6 @@ IN: tools.deploy.backend
: make-deploy-image ( vm image vocab config -- )
make-boot-image
dup ?make-staging-image
deploy-command-line run-factor ;
SYMBOL: deploy-implementation

View File

@ -16,6 +16,8 @@ ARTICLE: "deploy-flags" "Deployment flags"
"There are two sets of deployment flags. The first set controls the major subsystems which are to be included in the deployment image:"
{ $subsection deploy-math? }
{ $subsection deploy-compiler? }
{ $subsection deploy-random? }
{ $subsection deploy-threads? }
{ $subsection deploy-ui? }
"The second set of flags controls the level of stripping to be performed on the deployment image; there is a trade-off between image size, and retaining functionality which is required by the application:"
{ $subsection deploy-io }
@ -66,16 +68,21 @@ HELP: deploy-math?
$nl
"On by default. Often the programmer will use rationals without realizing it. A small amount of space can be saved by stripping these features out, but some code may require changes to work properly." } ;
HELP: deploy-threads?
{ $description "Deploy flag. If set, the deployed image will contain support for threads."
$nl
"On by default. Often the programmer will use threads without realizing it. A small amount of space can be saved by stripping this feature out, but some code may require changes to work properly." } ;
HELP: deploy-compiler?
{ $description "Deploy flag. If set, words in the deployed image will be compiled with the optimizing compiler when possible."
$nl
"On by default. Most programs should be compiled, not only for performance but because features which depend on the C library interface only function after compilation." } ;
HELP: deploy-random?
{ $description "Deploy flag. If set, the random number generator protocol is included, together with two implementations: a native OS-specific random number generator, and the Mersenne Twister."
$nl
"On by default. If your program does not generate random numbers you can disable this to save some space." } ;
HELP: deploy-threads?
{ $description "Deploy flag. If set, thread support will be included in the final image."
$nl
"On by default. Most programs depend on libraries which use threads even if they don't use threads directly; for example, alarms, non-blocking I/O, and the UI are built on top of threads. If after testing your program still works without threads, you can disable this feature to save some space." } ;
HELP: deploy-ui?
{ $description "Deploy flag. If set, the Factor UI will be included in the deployed image."
$nl

View File

@ -10,6 +10,7 @@ SYMBOL: deploy-name
SYMBOL: deploy-ui?
SYMBOL: deploy-compiler?
SYMBOL: deploy-math?
SYMBOL: deploy-random?
SYMBOL: deploy-threads?
SYMBOL: deploy-io
@ -57,6 +58,7 @@ SYMBOL: deploy-image
{ deploy-reflection 1 }
{ deploy-compiler? t }
{ deploy-threads? t }
{ deploy-random? t }
{ deploy-math? t }
{ deploy-word-props? f }
{ deploy-word-defs? f }

View File

@ -0,0 +1,8 @@
IN: tools.deploy.restage
USING: bootstrap.stage2 namespaces memory ;
: restage ( -- )
load-components
"output-image" get save-image-and-exit ;
MAIN: restage

View File

@ -19,7 +19,6 @@ QUALIFIED: libc.private
QUALIFIED: libc.private
QUALIFIED: listener
QUALIFIED: prettyprint.config
QUALIFIED: random
QUALIFIED: source-files
QUALIFIED: threads
QUALIFIED: vocabs
@ -108,8 +107,6 @@ IN: tools.deploy.shaker
: stripped-globals ( -- seq )
[
random:random-generator ,
{
bootstrap.stage2:bootstrap-time
continuations:error
@ -145,12 +142,14 @@ IN: tools.deploy.shaker
vocabs:dictionary
lexer-factory
vocabs:load-vocab-hook
root-cache
layouts:num-tags
layouts:num-types
layouts:tag-mask
layouts:tag-numbers
layouts:type-numbers
classes:typemap
classes:class-map
vocab-roots
definitions:crossref
compiled-crossref

View File

@ -1,14 +1,15 @@
USING: tools.deploy.config ;
H{
{ deploy-word-defs? f }
{ deploy-random? f }
{ deploy-name "tools.deploy.test.1" }
{ deploy-threads? t }
{ deploy-compiler? t }
{ deploy-math? t }
{ deploy-c-types? f }
{ deploy-io 2 }
{ deploy-reflection 1 }
{ deploy-threads? t }
{ deploy-word-props? f }
{ deploy-word-defs? f }
{ deploy-name "tools.deploy.test.1" }
{ deploy-math? t }
{ deploy-compiler? t }
{ "stop-after-last-window?" t }
{ deploy-ui? f }
{ "stop-after-last-window?" t }
{ deploy-word-props? f }
}

View File

@ -1,14 +1,15 @@
USING: tools.deploy.config ;
H{
{ deploy-word-defs? f }
{ deploy-random? f }
{ deploy-name "tools.deploy.test.2" }
{ deploy-threads? t }
{ deploy-compiler? t }
{ deploy-math? t }
{ deploy-c-types? f }
{ deploy-io 2 }
{ deploy-reflection 1 }
{ deploy-threads? t }
{ deploy-word-props? f }
{ deploy-word-defs? f }
{ deploy-name "tools.deploy.test.2" }
{ deploy-math? t }
{ deploy-compiler? t }
{ "stop-after-last-window?" t }
{ deploy-ui? f }
{ "stop-after-last-window?" t }
{ deploy-word-props? f }
}

View File

@ -1,14 +1,15 @@
USING: tools.deploy.config ;
H{
{ deploy-math? t }
{ deploy-reflection 1 }
{ deploy-word-defs? f }
{ deploy-random? f }
{ deploy-name "tools.deploy.test.3" }
{ deploy-threads? t }
{ deploy-word-props? f }
{ "stop-after-last-window?" t }
{ deploy-ui? f }
{ deploy-io 3 }
{ deploy-compiler? t }
{ deploy-word-defs? f }
{ deploy-math? t }
{ deploy-c-types? f }
{ deploy-io 3 }
{ deploy-reflection 1 }
{ deploy-ui? f }
{ "stop-after-last-window?" t }
{ deploy-word-props? f }
}

View File

@ -35,6 +35,7 @@ TUPLE: deploy-gadget vocab settings ;
deploy-compiler? get "Use optimizing compiler" <checkbox> gadget,
deploy-math? get "Rational and complex number support" <checkbox> gadget,
deploy-threads? get "Threading support" <checkbox> gadget,
deploy-random? get "Random number generator support" <checkbox> gadget,
deploy-word-props? get "Retain all word properties" <checkbox> gadget,
deploy-word-defs? get "Retain all word definitions" <checkbox> gadget,
deploy-c-types? get "Retain all C types" <checkbox> gadget, ;