Rename compiled slot of words to optimized, to reflect what it really means (all words are compiled)

db4
Slava Pestov 2009-01-23 00:37:02 -06:00
parent 6e9f0dbfdd
commit a8d1459c08
9 changed files with 35 additions and 37 deletions

View File

@ -15,7 +15,7 @@ IN: alien.remote-control
"void" { "long" } "cdecl" [ sleep ] alien-callback ; "void" { "long" } "cdecl" [ sleep ] alien-callback ;
: ?callback ( word -- alien ) : ?callback ( word -- alien )
dup compiled>> [ execute ] [ drop f ] if ; inline dup optimized>> [ execute ] [ drop f ] if ; inline
: init-remote-control ( -- ) : init-remote-control ( -- )
\ eval-callback ?callback 16 setenv \ eval-callback ?callback 16 setenv

View File

@ -1,4 +1,4 @@
! Copyright (C) 2007, 2008 Slava Pestov. ! Copyright (C) 2007, 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors compiler cpu.architecture vocabs.loader system USING: accessors compiler cpu.architecture vocabs.loader system
sequences namespaces parser kernel kernel.private classes sequences namespaces parser kernel kernel.private classes
@ -25,8 +25,8 @@ IN: bootstrap.compiler
enable-compiler enable-compiler
: compile-uncompiled ( words -- ) : compile-unoptimized ( words -- )
[ compiled>> not ] filter compile ; [ optimized>> not ] filter compile ;
nl nl
"Compiling..." write flush "Compiling..." write flush
@ -48,70 +48,70 @@ nl
wrap probe wrap probe
namestack* namestack*
} compile-uncompiled } compile-unoptimized
"." write flush "." write flush
{ {
bitand bitor bitxor bitnot bitand bitor bitxor bitnot
} compile-uncompiled } compile-unoptimized
"." write flush "." write flush
{ {
+ 1+ 1- 2/ < <= > >= shift + 1+ 1- 2/ < <= > >= shift
} compile-uncompiled } compile-unoptimized
"." write flush "." write flush
{ {
new-sequence nth push pop peek flip new-sequence nth push pop peek flip
} compile-uncompiled } compile-unoptimized
"." write flush "." write flush
{ {
hashcode* = get set hashcode* = get set
} compile-uncompiled } compile-unoptimized
"." write flush "." write flush
{ {
memq? split harvest sift cut cut-slice start index clone memq? split harvest sift cut cut-slice start index clone
set-at reverse push-all class number>string string>number set-at reverse push-all class number>string string>number
} compile-uncompiled } compile-unoptimized
"." write flush "." write flush
{ {
lines prefix suffix unclip new-assoc update lines prefix suffix unclip new-assoc update
word-prop set-word-prop 1array 2array 3array ?nth word-prop set-word-prop 1array 2array 3array ?nth
} compile-uncompiled } compile-unoptimized
"." write flush "." write flush
{ {
malloc calloc free memcpy malloc calloc free memcpy
} compile-uncompiled } compile-unoptimized
"." write flush "." write flush
{ build-tree } compile-uncompiled { build-tree } compile-unoptimized
"." write flush "." write flush
{ optimize-tree } compile-uncompiled { optimize-tree } compile-unoptimized
"." write flush "." write flush
{ optimize-cfg } compile-uncompiled { optimize-cfg } compile-unoptimized
"." write flush "." write flush
{ (compile) } compile-uncompiled { (compile) } compile-unoptimized
"." write flush "." write flush
vocabs [ words compile-uncompiled "." write flush ] each vocabs [ words compile-unoptimized "." write flush ] each
" done" print flush " done" print flush

View File

@ -42,7 +42,7 @@ SYMBOL: bootstrap-time
"Core bootstrap completed in " write core-bootstrap-time get print-time "Core bootstrap completed in " write core-bootstrap-time get print-time
"Bootstrap completed in " write bootstrap-time get print-time "Bootstrap completed in " write bootstrap-time get print-time
[ compiled>> ] count-words " compiled words" print [ optimized>> ] count-words " compiled words" print
[ symbol? ] count-words " symbol words" print [ symbol? ] count-words " symbol words" print
[ ] count-words " words total" print [ ] count-words " words total" print

View File

@ -24,7 +24,7 @@ SYMBOL: compiled
} cond drop ; } cond drop ;
: maybe-compile ( word -- ) : maybe-compile ( word -- )
dup compiled>> [ drop ] [ queue-compile ] if ; dup optimized>> [ drop ] [ queue-compile ] if ;
SYMBOL: +failed+ SYMBOL: +failed+

View File

@ -32,17 +32,14 @@ H{ } clone sub-primitives set
! Now we have ( syntax-quot arch-quot layouts-quot ) on the stack ! Now we have ( syntax-quot arch-quot layouts-quot ) on the stack
! Bring up a bare cross-compiling vocabulary. ! Bring up a bare cross-compiling vocabulary.
"syntax" vocab vocab-words bootstrap-syntax set "syntax" vocab vocab-words bootstrap-syntax set {
H{ } clone dictionary set dictionary
H{ } clone new-classes set new-classes
H{ } clone changed-definitions set changed-definitions changed-generics
H{ } clone changed-generics set remake-generics forgotten-definitions
H{ } clone remake-generics set root-cache source-files update-map implementors-map
H{ } clone forgotten-definitions set } [ H{ } clone swap set ] each
H{ } clone root-cache set
H{ } clone source-files set
H{ } clone update-map set
H{ } clone implementors-map set
init-caches init-caches
! Vocabulary for slot accessors ! Vocabulary for slot accessors
@ -264,7 +261,7 @@ bi
"vocabulary" "vocabulary"
{ "def" { "quotation" "quotations" } initial: [ ] } { "def" { "quotation" "quotations" } initial: [ ] }
"props" "props"
{ "compiled" read-only } { "optimized" read-only }
{ "counter" { "fixnum" "math" } } { "counter" { "fixnum" "math" } }
{ "sub-primitive" read-only } { "sub-primitive" read-only }
} define-builtin } define-builtin

View File

@ -315,7 +315,7 @@ void set_word_code(F_WORD *word, F_COMPILED *compiled)
critical_error("bad param to set_word_xt",(CELL)compiled); critical_error("bad param to set_word_xt",(CELL)compiled);
word->code = compiled; word->code = compiled;
word->compiledp = T; word->optimizedp = T;
} }
/* Allocates memory */ /* Allocates memory */
@ -326,7 +326,7 @@ void default_word_code(F_WORD *word, bool relocate)
UNREGISTER_UNTAGGED(word); UNREGISTER_UNTAGGED(word);
word->code = untag_quotation(word->def)->code; word->code = untag_quotation(word->def)->code;
word->compiledp = F; word->optimizedp = F;
} }
void primitive_modify_code_heap(void) void primitive_modify_code_heap(void)

View File

@ -125,8 +125,9 @@ typedef struct {
CELL def; CELL def;
/* TAGGED property assoc for library code */ /* TAGGED property assoc for library code */
CELL props; CELL props;
/* TAGGED t or f, depending on if the word is compiled or not */ /* TAGGED t or f, t means its compiled with the optimizing compiler,
CELL compiledp; f means its compiled with the non-optimizing compiler */
CELL optimizedp;
/* TAGGED call count for profiling */ /* TAGGED call count for profiling */
CELL counter; CELL counter;
/* TAGGED machine code for sub-primitive */ /* TAGGED machine code for sub-primitive */

View File

@ -535,7 +535,7 @@ void compile_all_words(void)
{ {
F_WORD *word = untag_word(array_nth(untag_array(words),i)); F_WORD *word = untag_word(array_nth(untag_array(words),i));
REGISTER_UNTAGGED(word); REGISTER_UNTAGGED(word);
if(word->compiledp == F) if(word->optimizedp == F)
default_word_code(word,false); default_word_code(word,false);
UNREGISTER_UNTAGGED(word); UNREGISTER_UNTAGGED(word);
update_word_xt(word); update_word_xt(word);

View File

@ -48,7 +48,7 @@ F_WORD *allot_word(CELL vocab, CELL name)
word->def = userenv[UNDEFINED_ENV]; word->def = userenv[UNDEFINED_ENV];
word->props = F; word->props = F;
word->counter = tag_fixnum(0); word->counter = tag_fixnum(0);
word->compiledp = F; word->optimizedp = F;
word->subprimitive = F; word->subprimitive = F;
word->profiling = NULL; word->profiling = NULL;
word->code = NULL; word->code = NULL;