fix crossref and make-image
parent
286813e992
commit
4e3a5b3d1a
|
@ -241,11 +241,8 @@ The \texttt{usages.} word finds all words that refer to a given word. This word
|
||||||
|
|
||||||
\begin{alltt}
|
\begin{alltt}
|
||||||
\textbf{ok} \ttbs string-map usages.
|
\textbf{ok} \ttbs string-map usages.
|
||||||
\textbf{IN: gadgets
|
\textbf{schars>entities
|
||||||
filter-nulls
|
filter-null
|
||||||
IN: html
|
|
||||||
chars>entities
|
|
||||||
IN: url-encoding
|
|
||||||
url-encode}
|
url-encode}
|
||||||
\end{alltt}
|
\end{alltt}
|
||||||
|
|
||||||
|
@ -616,10 +613,7 @@ bootstrap:
|
||||||
\textbf{bash\$} ./f boot.image.le32 -no-compile
|
\textbf{bash\$} ./f boot.image.le32 -no-compile
|
||||||
\end{alltt}
|
\end{alltt}
|
||||||
|
|
||||||
The compiler has some limitations you must be aware of. The most important one is that if you
|
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.
|
||||||
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 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.
|
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.
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ classes
|
||||||
|
|
||||||
<namespace> vocabularies set
|
<namespace> vocabularies set
|
||||||
<namespace> classes set
|
<namespace> classes set
|
||||||
|
<namespace> crossref set
|
||||||
|
|
||||||
vocabularies get [
|
vocabularies get [
|
||||||
reveal
|
reveal
|
||||||
|
|
|
@ -57,9 +57,17 @@ M: compound (compile) ( word -- )
|
||||||
] ifte ;
|
] ifte ;
|
||||||
|
|
||||||
: decompile ( word -- )
|
: 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 -- )
|
: recompile ( word -- )
|
||||||
dup decompile compile ;
|
dup decompile compile ;
|
||||||
|
|
|
@ -149,5 +149,5 @@ M: tuple-class class.
|
||||||
M: word class. drop ;
|
M: word class. drop ;
|
||||||
|
|
||||||
: see ( word -- )
|
: see ( word -- )
|
||||||
dup prettyprint-IN: dup definer. dup word.
|
dup prettyprint-IN: dup definer.
|
||||||
dup stack-effect. terpri dup (see) class. ;
|
dup stack-effect. terpri dup (see) class. ;
|
||||||
|
|
|
@ -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
|
[ 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
|
[ 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
|
[ 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 ] [
|
[ t ] [
|
||||||
[
|
[
|
||||||
|
|
|
@ -122,12 +122,12 @@ TUPLE: another-one ;
|
||||||
[ << another-one f >> ] [ <another-one> empty-method-test ] unit-test
|
[ << another-one f >> ] [ <another-one> empty-method-test ] unit-test
|
||||||
|
|
||||||
! Test generic see and parsing
|
! 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
|
[ [ \ bah see ] with-string ] unit-test
|
||||||
|
|
||||||
[ t ] [
|
[ t ] [
|
||||||
DEFER: not-fixnum
|
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
|
dup eval
|
||||||
[ \ not-fixnum see ] with-string =
|
[ \ not-fixnum see ] with-string =
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
|
@ -28,7 +28,7 @@ USE: math
|
||||||
|
|
||||||
[
|
[
|
||||||
boot-quot off
|
boot-quot off
|
||||||
"/library/bootstrap/boot.factor" run-resource
|
"/library/bootstrap/boot-stage1.factor" run-resource
|
||||||
] with-image drop
|
] with-image drop
|
||||||
|
|
||||||
[ fixnum ] [ 4 class ] unit-test
|
[ fixnum ] [ 4 class ] unit-test
|
||||||
|
|
|
@ -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
|
|
@ -93,6 +93,7 @@ prettyprint stdio strings words vectors unparser ;
|
||||||
"line-editor"
|
"line-editor"
|
||||||
"gadgets"
|
"gadgets"
|
||||||
"memory"
|
"memory"
|
||||||
|
"redefine"
|
||||||
] [
|
] [
|
||||||
test
|
test
|
||||||
] each
|
] each
|
||||||
|
|
|
@ -89,7 +89,7 @@ GENERIC: (undefine) ( word -- )
|
||||||
M: word (undefine) drop ;
|
M: word (undefine) drop ;
|
||||||
|
|
||||||
: undefine ( word -- )
|
: undefine ( word -- )
|
||||||
usages [ (undefine) ] each ;
|
dup (undefine) usages [ (undefine) ] each ;
|
||||||
|
|
||||||
! The word primitive combined with the word def specify what the
|
! The word primitive combined with the word def specify what the
|
||||||
! word does when invoked.
|
! word does when invoked.
|
||||||
|
|
Loading…
Reference in New Issue