fix crossref and make-image

cvs
Slava Pestov 2005-03-27 01:40:29 +00:00
parent 286813e992
commit 4e3a5b3d1a
10 changed files with 32 additions and 17 deletions

View File

@ -241,11 +241,8 @@ The \texttt{usages.} word finds all words that refer to a given word. This word
\begin{alltt}
\textbf{ok} \ttbs string-map usages.
\textbf{IN: gadgets
filter-nulls
IN: html
chars>entities
IN: url-encoding
\textbf{schars>entities
filter-null
url-encode}
\end{alltt}
@ -616,10 +613,7 @@ bootstrap:
\textbf{bash\$} ./f boot.image.le32 -no-compile
\end{alltt}
The compiler has some limitations you must be aware of. The most important one is that if you
redefine
a word that is called from a compiled word, the change will not take effect until the caller words are themselves recompiled.
The second limitation is that if an exception is thrown in compiled code, the return stack will be incomplete, since compiled words do not push themselves there. Finally, compiled code cannot be profiled, either. All of these limitations will be resolved in a future release.
The compiler has two limitations you must be aware of. First, if an exception is thrown in compiled code, the return stack will be incomplete, since compiled words do not push themselves there. Second, compiled code cannot be profiled. These limitations will be resolved in a future release.
The compiler consists of multiple stages -- first, a dataflow graph is inferred, then various optimizations are done on this graph, then it is transformed into a linear representation, further optimizations are done, and finally, machine code is generated from the linear representation. To perform everything except for the machine code generation, use the \texttt{precompile} word. This will dump the optimized linear IR instead of generating code, which can be useful sometimes.

View File

@ -18,6 +18,7 @@ classes
<namespace> vocabularies set
<namespace> classes set
<namespace> crossref set
vocabularies get [
reveal

View File

@ -57,9 +57,17 @@ M: compound (compile) ( word -- )
] ifte ;
: decompile ( word -- )
[ word-primitive ] keep set-word-primitive ;
dup compiled? [
"Decompiling " write dup . flush
[ word-primitive ] keep set-word-primitive
] [
drop
] ifte ;
M: compound (undefine) decompile ;
M: compound (undefine)
dup f "infer-effect" set-word-prop
dup f "no-effect" set-word-prop
decompile ;
: recompile ( word -- )
dup decompile compile ;

View File

@ -149,5 +149,5 @@ M: tuple-class class.
M: word class. drop ;
: see ( word -- )
dup prettyprint-IN: dup definer. dup word.
dup prettyprint-IN: dup definer.
dup stack-effect. terpri dup (see) class. ;

View File

@ -57,7 +57,7 @@ USING: gadgets kernel lists math namespaces test ;
[ 20 ] [ 110 110 -100 -200 <line> [ 20 30 rot move-shape ] keep shape-x ] unit-test
[ 30 ] [ 110 110 -100 -200 <line> [ 20 30 rot move-shape ] keep shape-y ] unit-test
[ 10 ] [ 110 110 -100 -200 <line> [ 400 400 rot resize-shape ] keep shape-x ] unit-test
[ 401 ] [ 110 110 -100 -200 <line> [ 400 400 rot resize-shape ] keep shape-w ] unit-test
[ 400 ] [ 110 110 -100 -200 <line> [ 400 400 rot resize-shape ] keep shape-w ] unit-test
[ t ] [
[

View File

@ -122,12 +122,12 @@ TUPLE: another-one ;
[ << another-one f >> ] [ <another-one> empty-method-test ] unit-test
! Test generic see and parsing
[ "IN: scratchpad\nSYMBOL: bah\nUNION: bah fixnum alien ;\n" ]
[ "IN: scratchpad\nSYMBOL: bah \nUNION: bah fixnum alien ;\n" ]
[ [ \ bah see ] with-string ] unit-test
[ t ] [
DEFER: not-fixnum
"IN: scratchpad\nSYMBOL: not-fixnum\nCOMPLEMENT: not-fixnum fixnum\n"
"IN: scratchpad\nSYMBOL: not-fixnum \nCOMPLEMENT: not-fixnum fixnum\n"
dup eval
[ \ not-fixnum see ] with-string =
] unit-test

View File

@ -28,7 +28,7 @@ USE: math
[
boot-quot off
"/library/bootstrap/boot.factor" run-resource
"/library/bootstrap/boot-stage1.factor" run-resource
] with-image drop
[ fixnum ] [ 4 class ] unit-test

View File

@ -0,0 +1,11 @@
IN: scratchpad
USING: compiler inference math ;
USE: test
: foo 1 2 ;
: bar foo foo ; compiled
: foo 1 2 3 ;
[ 1 2 3 1 2 3 ] [ bar ] unit-test
[ [ [ ] [ fixnum fixnum fixnum ] ] ] [ [ foo ] infer ] unit-test

View File

@ -93,6 +93,7 @@ prettyprint stdio strings words vectors unparser ;
"line-editor"
"gadgets"
"memory"
"redefine"
] [
test
] each

View File

@ -89,7 +89,7 @@ GENERIC: (undefine) ( word -- )
M: word (undefine) drop ;
: undefine ( word -- )
usages [ (undefine) ] each ;
dup (undefine) usages [ (undefine) ] each ;
! The word primitive combined with the word def specify what the
! word does when invoked.