Save bootstrap time in a global variable
parent
548e6dce47
commit
38b4f67b70
|
|
@ -8,25 +8,63 @@ definitions assocs compiler.errors compiler.units
|
||||||
math.parser generic ;
|
math.parser generic ;
|
||||||
IN: bootstrap.stage2
|
IN: bootstrap.stage2
|
||||||
|
|
||||||
|
SYMBOL: bootstrap-time
|
||||||
|
|
||||||
|
: default-image-name ( -- string )
|
||||||
|
vm file-name windows? [ "." split1 drop ] when
|
||||||
|
".image" append ;
|
||||||
|
|
||||||
|
: do-crossref ( -- )
|
||||||
|
"Cross-referencing..." print flush
|
||||||
|
H{ } clone crossref set-global
|
||||||
|
xref-words
|
||||||
|
xref-generics
|
||||||
|
xref-sources ;
|
||||||
|
|
||||||
|
: load-components ( -- )
|
||||||
|
"exclude" "include"
|
||||||
|
[ get-global " " split [ empty? not ] subset ] 2apply
|
||||||
|
seq-diff
|
||||||
|
[ "bootstrap." swap append require ] each ;
|
||||||
|
|
||||||
|
: compile-remaining ( -- )
|
||||||
|
"Compiling remaining words..." print flush
|
||||||
|
vocabs [
|
||||||
|
words "compile" "compiler" lookup execute
|
||||||
|
] each ;
|
||||||
|
|
||||||
|
: count-words ( pred -- )
|
||||||
|
all-words swap subset length number>string write ;
|
||||||
|
|
||||||
|
: print-report ( time -- )
|
||||||
|
1000 /i
|
||||||
|
60 /mod swap
|
||||||
|
"Bootstrap completed in " write number>string write
|
||||||
|
" minutes and " write number>string write " seconds." print
|
||||||
|
|
||||||
|
[ compiled? ] count-words " compiled words" print
|
||||||
|
[ symbol? ] count-words " symbol words" print
|
||||||
|
[ ] count-words " words total" print
|
||||||
|
|
||||||
|
"Bootstrapping is complete." print
|
||||||
|
"Now, you can run Factor:" print
|
||||||
|
vm write " -i=" write "output-image" get print flush ;
|
||||||
|
|
||||||
! Wrap everything in a catch which starts a listener so
|
! Wrap everything in a catch which starts a listener so
|
||||||
! you can see what went wrong, instead of dealing with a
|
! you can see what went wrong, instead of dealing with a
|
||||||
! fep
|
! fep
|
||||||
[
|
[
|
||||||
vm file-name windows? [ "." split1 drop ] when
|
! We time bootstrap
|
||||||
".image" append "output-image" set-global
|
millis >r
|
||||||
|
|
||||||
|
default-image-name "output-image" set-global
|
||||||
|
|
||||||
"math help compiler tools ui ui.tools io" "include" set-global
|
"math help compiler tools ui ui.tools io" "include" set-global
|
||||||
"" "exclude" set-global
|
"" "exclude" set-global
|
||||||
|
|
||||||
parse-command-line
|
parse-command-line
|
||||||
|
|
||||||
"-no-crossref" cli-args member? [
|
"-no-crossref" cli-args member? [ do-crossref ] unless
|
||||||
"Cross-referencing..." print flush
|
|
||||||
H{ } clone crossref set-global
|
|
||||||
xref-words
|
|
||||||
xref-generics
|
|
||||||
xref-sources
|
|
||||||
] unless
|
|
||||||
|
|
||||||
! Set dll paths
|
! Set dll paths
|
||||||
wince? [ "windows.ce" require ] when
|
wince? [ "windows.ce" require ] when
|
||||||
|
|
@ -40,19 +78,12 @@ IN: bootstrap.stage2
|
||||||
] if
|
] if
|
||||||
|
|
||||||
[
|
[
|
||||||
"exclude" "include"
|
load-components
|
||||||
[ get-global " " split [ empty? not ] subset ] 2apply
|
|
||||||
seq-diff
|
|
||||||
[ "bootstrap." swap append require ] each
|
|
||||||
|
|
||||||
run-bootstrap-init
|
run-bootstrap-init
|
||||||
|
|
||||||
"Compiling remaining words..." print flush
|
|
||||||
|
|
||||||
"bootstrap.compiler" vocab [
|
"bootstrap.compiler" vocab [
|
||||||
vocabs [
|
compile-remaining
|
||||||
words "compile" "compiler" lookup execute
|
|
||||||
] each
|
|
||||||
] when
|
] when
|
||||||
] with-compiler-errors
|
] with-compiler-errors
|
||||||
:errors
|
:errors
|
||||||
|
|
@ -74,16 +105,8 @@ IN: bootstrap.stage2
|
||||||
] [ print-error 1 exit ] recover
|
] [ print-error 1 exit ] recover
|
||||||
] set-boot-quot
|
] set-boot-quot
|
||||||
|
|
||||||
: count-words ( pred -- )
|
millis r> - dup bootstrap-time set-global
|
||||||
all-words swap subset length number>string write ;
|
print-report
|
||||||
|
|
||||||
[ compiled? ] count-words " compiled words" print
|
|
||||||
[ symbol? ] count-words " symbol words" print
|
|
||||||
[ ] count-words " words total" print
|
|
||||||
|
|
||||||
"Bootstrapping is complete." print
|
|
||||||
"Now, you can run Factor:" print
|
|
||||||
vm write " -i=" write "output-image" get print flush
|
|
||||||
|
|
||||||
"output-image" get resource-path save-image-and-exit
|
"output-image" get resource-path save-image-and-exit
|
||||||
] if
|
] if
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue