Work in progress

db4
Slava Pestov 2007-12-26 20:21:46 -05:00
parent f624726e8e
commit 2a24567546
4 changed files with 22 additions and 23 deletions

View File

@ -13,15 +13,12 @@ IN: bootstrap.compiler
0 profiler-prologue set-global 0 profiler-prologue set-global
] when ] when
: compile* [ compiled? not ] subset compile ; ! Compile a set of words ahead of the full compile.
! This set of words was determined semi-empirically
! Compile a set of words ahead of our general ! using the profiler. It improves bootstrap time
! compile-all. This set of words was determined ! significantly, because frequenly called words
! semi-empirically using the profiler. It improves ! which are also quick to compile are replaced by
! bootstrap time significantly, because frequenly ! compiled definitions as soon as possible.
! called words which are also quick to compile
! are replaced by compiled definitions as soon as
! possible.
{ {
roll -roll declare not roll -roll declare not
@ -39,24 +36,22 @@ IN: bootstrap.compiler
find-pair-next namestack* find-pair-next namestack*
bitand bitor bitxor bitnot bitand bitor bitxor bitnot
} compile* } compile
{ {
+ 1+ 1- 2/ < <= > >= shift min + 1+ 1- 2/ < <= > >= shift min
} compile* } compile
{ {
new nth push pop peek hashcode* = get set new nth push pop peek hashcode* = get set
} compile* } compile
{ {
. lines . lines
} compile* } compile
{ {
malloc free memcpy malloc free memcpy
} compile* } compile
[ compile ] recompile-hook set-global [ recompile ] recompile-hook set-global
FORGET: compile*

View File

@ -44,7 +44,7 @@ SYMBOL: compiler-hook
dup assoc-empty? dup assoc-empty?
[ drop ] [ dup delete-any (compile) compile-loop ] if ; [ drop ] [ dup delete-any (compile) compile-loop ] if ;
: compile ( words -- ) : recompile ( words -- )
[ [
H{ } clone compile-queue set H{ } clone compile-queue set
H{ } clone compiled set H{ } clone compiled set
@ -53,13 +53,16 @@ SYMBOL: compiler-hook
compiled get >alist modify-code-heap compiled get >alist modify-code-heap
] with-scope ; inline ] with-scope ; inline
: compile ( words -- )
[ compiled? not ] subset recompile ;
: compile-quot ( quot -- word ) : compile-quot ( quot -- word )
H{ } clone changed-words [ H{ } clone changed-words [
define-temp dup 1array compile define-temp dup 1array recompile
] with-variable ; ] with-variable ;
: compile-call ( quot -- ) : compile-call ( quot -- )
compile-quot execute ; compile-quot execute ;
: compile-all ( -- ) : compile-all ( -- )
all-words compile ; all-words recompile ;

View File

@ -21,7 +21,8 @@ SYMBOL: compiled
: queue-compile ( word -- ) : queue-compile ( word -- )
{ {
{ [ dup compiled get key? ] [ drop ] } { [ dup compiled get key? ] [ drop ] }
{ [ dup compound? not ] [ f swap compiled get set-at ] } { [ dup primitive? ] [ drop ] }
{ [ dup deferred? ] [ drop ] }
{ [ t ] [ dup compile-queue get set-at ] } { [ t ] [ dup compile-queue get set-at ] }
} cond ; } cond ;
@ -49,7 +50,7 @@ t compiled-stack-traces? set-global
pick begin-compiling [ pick begin-compiling [
roll compiling-word set roll compiling-word set
pick compiling-label set pick compiling-label set
init-generator compiling-word get init-generator
call call
literal-table get >array literal-table get >array
word-table get >array word-table get >array

View File

@ -10,7 +10,7 @@ namespaces namespaces.private parser prettyprint quotations
quotations.private sbufs sbufs.private sequences quotations.private sbufs sbufs.private sequences
sequences.private slots.private strings strings.private system sequences.private slots.private strings strings.private system
threads.private tuples tuples.private vectors vectors.private threads.private tuples tuples.private vectors vectors.private
words assocs ; words words.private assocs ;
! Shuffle words ! Shuffle words
: infer-shuffle-inputs ( shuffle node -- ) : infer-shuffle-inputs ( shuffle node -- )