| ' , is compile, |
' , is compile, |
| [THEN] |
[THEN] |
| |
|
| |
defer basic-block-end ( -- ) |
| |
|
| |
: bb-end ( -- ) |
| |
0 last-compiled ! ; |
| |
' bb-end is basic-block-end |
| |
|
| has? peephole [IF] |
has? peephole [IF] |
| : peephole-compile, ( xt -- ) |
|
| \ compile xt, appending its code to the current dynamic superinstruction |
|
| compile-prim , ; |
|
| |
|
| |
\ dynamic only |
| |
\ : peephole-compile, ( xt -- ) |
| |
\ \ compile xt, appending its code to the current dynamic superinstruction |
| |
\ compile-prim , ; |
| |
|
| |
\ static only |
| \ : peephole-compile, ( xt -- ) |
\ : peephole-compile, ( xt -- ) |
| \ \ compile xt, possibly combining it with the previous compiled xt |
\ \ compile xt, possibly combining it with the previous compiled xt |
| \ \ into a superinstruction (static superinstructions) |
\ \ into a superinstruction (static superinstructions) |
| \ here last-compiled ! |
\ here last-compiled ! |
| \ dyn-compile, ; |
\ dyn-compile, ; |
| |
|
| |
: dyn-compile! ( xt -- ) |
| |
\ compile xt, appending its code to the current dynamic superinstruction |
| |
compile-prim last-compiled-here @ ! ; |
| |
|
| |
:noname ( -- ) |
| |
last-compiled @ if |
| |
last-compiled @ dyn-compile! |
| |
0 last-compiled ! |
| |
then ; |
| |
is basic-block-end |
| |
|
| |
: static-compile, ( xt -- ) |
| |
\ compile xt, possibly combining it with the previous compiled xt |
| |
\ into a superinstruction (static superinstructions) |
| |
last-compiled @ ?dup if |
| |
over peeptable peephole-opt ?dup if ( xt comb-xt ) |
| |
last-compiled ! drop EXIT |
| |
then ( xt ) |
| |
last-compiled @ dyn-compile! |
| |
then ( xt ) |
| |
last-compiled ! |
| |
here last-compiled-here ! 0 , ; |
| |
|
| : compile-to-prims, ( xt -- ) |
: compile-to-prims, ( xt -- ) |
| \G compile xt to use primitives (and their peephole optimization) |
\G compile xt to use primitives (and their peephole optimization) |
| \G instead of ","-ing the xt. |
\G instead of ","-ing the xt. |
| ENDOF |
ENDOF |
| dofield: OF >body @ POSTPONE lit+ , EXIT ENDOF |
dofield: OF >body @ POSTPONE lit+ , EXIT ENDOF |
| ENDCASE |
ENDCASE |
| peephole-compile, ; |
static-compile, ; |
| |
|
| ' compile-to-prims, IS compile, |
' compile-to-prims, IS compile, |
| [ELSE] |
[ELSE] |
| \ common factor of : and :noname |
\ common factor of : and :noname |
| docol: cfa, |
docol: cfa, |
| [THEN] |
[THEN] |
| 0 last-compiled ! defstart ] :-hook ; |
defstart ] :-hook ; |
| |
|
| : : ( "name" -- colon-sys ) \ core colon |
: : ( "name" -- colon-sys ) \ core colon |
| Header (:noname) ; |
Header (:noname) ; |