Loading Makefile.in +9 −10 Original line number Diff line number Diff line Loading @@ -391,16 +391,15 @@ FORTH_SRC = $(KERN_SRC) $(GFORTH_FI_DIST_SRC) $(EC_SRC) $(LIBCC_FORTH_SRC) \ make-app.fs doc/makedoc.fs locate.fs locate1.fs more.fs onebench.fs \ fft-bench.fs other.fs prims2x.fs prims2x0.6.2.fs proxy.fs random.fs \ regexp.fs regexp-test.fs sokoban.fs string.fs table.fs tags.fs tt.fs \ quotations.fs unbuffer.fs wordsets.fs 2012words.fs $(patsubst %, \ test/%, $(TEST_SRC)) bubble.fs siev.fs matrix.fs fib.fs oof.fs \ oofsampl.fs objects.fs objexamp.fs mini-oof.fs moof-exm.fs \ moofglos.fs fixpath.fs mini-oof2.fs moof2-example.fs callable.fs \ add.fs lib.fs oldlib.fs sieve.fs list.fs endtry-iferror.fs \ recover-endtry.fs $(patsubst %, unix/%, $(UNIX_SRC)) date.fs \ script.fs wf.fs traceall.fs rec-scope.fs rec-env.fs rec-meta.fs \ notfound.fs utf16.fs archive.fs cilk.fs sections.fs fixfiles.fs \ bits.fs reverse-words.fs config.fs set-compsem.fs coverage.fs \ tokenize.fs unbuffer.fs wordsets.fs 2012words.fs $(patsubst %, test/%, \ $(TEST_SRC)) bubble.fs siev.fs matrix.fs fib.fs oof.fs oofsampl.fs \ objects.fs objexamp.fs mini-oof.fs moof-exm.fs moofglos.fs fixpath.fs \ mini-oof2.fs moof2-example.fs callable.fs add.fs lib.fs oldlib.fs \ sieve.fs list.fs endtry-iferror.fs recover-endtry.fs $(patsubst %, \ unix/%, $(UNIX_SRC)) date.fs script.fs wf.fs traceall.fs rec-scope.fs \ rec-env.fs rec-meta.fs notfound.fs utf16.fs archive.fs cilk.fs \ sections.fs fixfiles.fs bits.fs reverse-words.fs config.fs \ set-compsem.fs coverage.fs tokenize.fs COMPAT = compat/README \ compat/anslocal.fs \ Loading closures.fs +8 −8 Original line number Diff line number Diff line Loading @@ -48,7 +48,7 @@ Variable extra-locals ( additional hidden locals size ) locals-types definitions : :}* ( vtaddr u latest latestxt wid 0 a-addr1 u1 ... xt -- ) \ gforth close-brace-dictionary : :}* ( vtaddr u latest latestnt wid 0 a-addr1 u1 ... xt -- ) \ gforth close-brace-dictionary 0 lit, lits, here cell- >r compile, ]] >lp [[ :} Loading @@ -57,19 +57,19 @@ locals-types definitions ['] execute is end-d ['] noop is endref, extra-locals off ; : :}xt ( vtaddr u latest latestxt wid 0 a-addr1 u1 ... -- ) \ gforth close-brace-xt : :}xt ( vtaddr u latest latestnt wid 0 a-addr1 u1 ... -- ) \ gforth close-brace-xt \G end a closure's locals declaration. The closure will be allocated by \G the xt on the stack, so the closure's run-time stack effect is @code{( \G xt-alloc -- xt-closure}. \ run-time: ( xt size -- ... ) [: swap execute ;] :}* ; : :}d ( vtaddr u latest latestxt wid 0 a-addr1 u1 ... -- ) \ gforth close-brace-dictionary : :}d ( vtaddr u latest latestnt wid 0 a-addr1 u1 ... -- ) \ gforth close-brace-dictionary \G end a closure's locals declaration. The closure will be allocated in \G the dictionary. ['] allocd :}* ; : :}h ( vtaddr u latest latestxt wid 0 a-addr1 u1 ... -- ) \ gforth close-brace-heap : :}h ( vtaddr u latest latestnt wid 0 a-addr1 u1 ... -- ) \ gforth close-brace-heap \G end a closure's locals declaration. The closure will be allocated on \G the heap. ['] alloch :}* ; Loading @@ -86,7 +86,7 @@ forth definitions locals-types definitions : :}l ( vtaddr u latest latestxt wid 0 a-addr1 u1 ... -- ) \ gforth close-brace-locals : :}l ( vtaddr u latest latestnt wid 0 a-addr1 u1 ... -- ) \ gforth close-brace-locals \G end a closure's locals declaration. The closure will be allocated on \G the local's stack. :} Loading @@ -108,7 +108,7 @@ forth definitions : closure-:-hook ( sys -- sys addr xt n ) \ addr is the nfa of the defined word, xt its xt latest latestxt latest latestnt clear-leave-stack dead-code off defstart ; Loading @@ -130,7 +130,7 @@ forth definitions endcase ['] (closure-;]) colon-sys-xt-offset stick ; : [{: ( -- vtaddr u latest latestxt wid 0 ) \ gforth-experimental start-closure : [{: ( -- vtaddr u latest latestnt wid 0 ) \ gforth-experimental start-closure \G starts a closure. Closures first declare the locals frame they are \G going to use, and then the code that is executed with those locals. \G Closures end like quotations with a @code{;]}. The locals declaration Loading @@ -147,7 +147,7 @@ forth definitions postpone {: ; immediate compile-only : <{: ( -- vtaddr u latest latestxt wid 0 ) \ gforth-experimental start-homelocation : <{: ( -- vtaddr u latest latestnt wid 0 ) \ gforth-experimental start-homelocation \G starts a home location #0. push-locals postpone {: ; immediate compile-only Loading code.fs +4 −4 Original line number Diff line number Diff line Loading @@ -57,7 +57,7 @@ vocabulary assembler ( -- ) \ tools-ext : (;code) ( -- ) \ gforth \ execution semantics of @code{;code} r> latestxt code-address! ; r> latestnt code-address! ; [ifundef] ?colon-sys : ?colon-sys ( ... xt tag -- ) Loading @@ -65,7 +65,7 @@ vocabulary assembler ( -- ) \ tools-ext [then] :noname ( -- colon-sys ) align here latestxt code-address! align here latestnt code-address! defstart init-asm ; :noname ( colon-sys1 -- colon-sys2 ) \ tools-ext semicolon-code ( create the [;code] part of a low level defining word ) Loading @@ -80,7 +80,7 @@ interpret/compile: ;code ( compilation. colon-sys1 -- colon-sys2 ) \ tools-ext s [ifdef] do;abicode: : !;abi-code ( addr -- ) latestxt do;abicode: any-code! ; latestnt do;abicode: any-code! ; : ;abi-code ( -- ) \ gforth semicolon-abi-code ['] !;abi-code does>-like postpone [ init-asm ; immediate Loading @@ -91,5 +91,5 @@ interpret/compile: ;code ( compilation. colon-sys1 -- colon-sys2 ) \ tools-ext s \G return from the ABI call (for @code{abi-code}) or the dispatch \G to the next VM instruction (for @code{code} and @code{;code}) \G yourself. latestxt here over - flush-icache latestnt here over - flush-icache previous ?struc reveal ; debug.fs +1 −1 Original line number Diff line number Diff line Loading @@ -220,7 +220,7 @@ set-current ' NestXT IF EXIT THEN (debug) Leave-D ; : break:, ( -- ) latestxt postpone literal ; latestnt postpone literal ; : break: ( -- ) \ gforth break:, postpone (break:) ; immediate Loading glocals.fs +8 −8 Original line number Diff line number Diff line Loading @@ -457,22 +457,22 @@ create new-locals-map ( -- wordlist-map ) new-locals-map mappedwordlist Constant new-locals-wl \ and now, finally, the user interface words : { ( -- vtaddr u latest latestxt wid 0 ) \ gforth open-brace : { ( -- vtaddr u latest latestnt wid 0 ) \ gforth open-brace ( >docolloc ) vtsave \ as locals will mess with their own vttemplate latest latestxt get-current latest latestnt get-current get-order new-locals-wl swap 1+ set-order also locals definitions locals-types val-part off 0 TO locals-wordlist 0 postpone [ ; immediate synonym {: { ( -- vtaddr u latest latestxt wid 0 ) \ forth-2012 open-brace-colon synonym {: { ( -- vtaddr u latest latestnt wid 0 ) \ forth-2012 open-brace-colon \G Start standard locals declaration. All Gforth locals extensions are \G supported by Gforth, though the standard only supports the subset of cells. locals-types definitions : } ( vtaddr u latest latestxt wid 0 a-addr1 u1 ... -- ) \ gforth close-brace : } ( vtaddr u latest latestnt wid 0 a-addr1 u1 ... -- ) \ gforth close-brace \ ends locals definitions ] begin Loading @@ -483,13 +483,13 @@ locals-types definitions drop vt, locals-size @ alignlp-f locals-size ! \ the strictest alignment previous previous set-current lastcfa ! last ! set-current lastnt ! last ! vtrestore locals-list 0 wordlist-id - TO locals-wordlist ; synonym :} } : -- ( vtaddr u latest latestxt wid 0 ... -- ) \ gforth dash-dash : -- ( vtaddr u latest latestnt wid 0 ... -- ) \ gforth dash-dash } BEGIN '}' parse dup WHILE + 1- c@ dup bl = swap ':' = or UNTIL Loading Loading @@ -611,7 +611,7 @@ is adjust-locals-list : locals-:-hook ( sys -- sys addr xt n ) \ addr is the nfa of the defined word, xt its xt DEFERS :-hook latest latestxt latest latestnt clear-leave-stack 0 locals-size ! 0 locals-list! Loading @@ -628,7 +628,7 @@ is free-old-local-names : locals-;-hook ( sys addr xt sys -- sys ) ?struc 0 TO locals-wordlist lastcfa ! last ! lastnt ! last ! DEFERS ;-hook ; \ THEN (another control flow from before joins the current one): Loading Loading
Makefile.in +9 −10 Original line number Diff line number Diff line Loading @@ -391,16 +391,15 @@ FORTH_SRC = $(KERN_SRC) $(GFORTH_FI_DIST_SRC) $(EC_SRC) $(LIBCC_FORTH_SRC) \ make-app.fs doc/makedoc.fs locate.fs locate1.fs more.fs onebench.fs \ fft-bench.fs other.fs prims2x.fs prims2x0.6.2.fs proxy.fs random.fs \ regexp.fs regexp-test.fs sokoban.fs string.fs table.fs tags.fs tt.fs \ quotations.fs unbuffer.fs wordsets.fs 2012words.fs $(patsubst %, \ test/%, $(TEST_SRC)) bubble.fs siev.fs matrix.fs fib.fs oof.fs \ oofsampl.fs objects.fs objexamp.fs mini-oof.fs moof-exm.fs \ moofglos.fs fixpath.fs mini-oof2.fs moof2-example.fs callable.fs \ add.fs lib.fs oldlib.fs sieve.fs list.fs endtry-iferror.fs \ recover-endtry.fs $(patsubst %, unix/%, $(UNIX_SRC)) date.fs \ script.fs wf.fs traceall.fs rec-scope.fs rec-env.fs rec-meta.fs \ notfound.fs utf16.fs archive.fs cilk.fs sections.fs fixfiles.fs \ bits.fs reverse-words.fs config.fs set-compsem.fs coverage.fs \ tokenize.fs unbuffer.fs wordsets.fs 2012words.fs $(patsubst %, test/%, \ $(TEST_SRC)) bubble.fs siev.fs matrix.fs fib.fs oof.fs oofsampl.fs \ objects.fs objexamp.fs mini-oof.fs moof-exm.fs moofglos.fs fixpath.fs \ mini-oof2.fs moof2-example.fs callable.fs add.fs lib.fs oldlib.fs \ sieve.fs list.fs endtry-iferror.fs recover-endtry.fs $(patsubst %, \ unix/%, $(UNIX_SRC)) date.fs script.fs wf.fs traceall.fs rec-scope.fs \ rec-env.fs rec-meta.fs notfound.fs utf16.fs archive.fs cilk.fs \ sections.fs fixfiles.fs bits.fs reverse-words.fs config.fs \ set-compsem.fs coverage.fs tokenize.fs COMPAT = compat/README \ compat/anslocal.fs \ Loading
closures.fs +8 −8 Original line number Diff line number Diff line Loading @@ -48,7 +48,7 @@ Variable extra-locals ( additional hidden locals size ) locals-types definitions : :}* ( vtaddr u latest latestxt wid 0 a-addr1 u1 ... xt -- ) \ gforth close-brace-dictionary : :}* ( vtaddr u latest latestnt wid 0 a-addr1 u1 ... xt -- ) \ gforth close-brace-dictionary 0 lit, lits, here cell- >r compile, ]] >lp [[ :} Loading @@ -57,19 +57,19 @@ locals-types definitions ['] execute is end-d ['] noop is endref, extra-locals off ; : :}xt ( vtaddr u latest latestxt wid 0 a-addr1 u1 ... -- ) \ gforth close-brace-xt : :}xt ( vtaddr u latest latestnt wid 0 a-addr1 u1 ... -- ) \ gforth close-brace-xt \G end a closure's locals declaration. The closure will be allocated by \G the xt on the stack, so the closure's run-time stack effect is @code{( \G xt-alloc -- xt-closure}. \ run-time: ( xt size -- ... ) [: swap execute ;] :}* ; : :}d ( vtaddr u latest latestxt wid 0 a-addr1 u1 ... -- ) \ gforth close-brace-dictionary : :}d ( vtaddr u latest latestnt wid 0 a-addr1 u1 ... -- ) \ gforth close-brace-dictionary \G end a closure's locals declaration. The closure will be allocated in \G the dictionary. ['] allocd :}* ; : :}h ( vtaddr u latest latestxt wid 0 a-addr1 u1 ... -- ) \ gforth close-brace-heap : :}h ( vtaddr u latest latestnt wid 0 a-addr1 u1 ... -- ) \ gforth close-brace-heap \G end a closure's locals declaration. The closure will be allocated on \G the heap. ['] alloch :}* ; Loading @@ -86,7 +86,7 @@ forth definitions locals-types definitions : :}l ( vtaddr u latest latestxt wid 0 a-addr1 u1 ... -- ) \ gforth close-brace-locals : :}l ( vtaddr u latest latestnt wid 0 a-addr1 u1 ... -- ) \ gforth close-brace-locals \G end a closure's locals declaration. The closure will be allocated on \G the local's stack. :} Loading @@ -108,7 +108,7 @@ forth definitions : closure-:-hook ( sys -- sys addr xt n ) \ addr is the nfa of the defined word, xt its xt latest latestxt latest latestnt clear-leave-stack dead-code off defstart ; Loading @@ -130,7 +130,7 @@ forth definitions endcase ['] (closure-;]) colon-sys-xt-offset stick ; : [{: ( -- vtaddr u latest latestxt wid 0 ) \ gforth-experimental start-closure : [{: ( -- vtaddr u latest latestnt wid 0 ) \ gforth-experimental start-closure \G starts a closure. Closures first declare the locals frame they are \G going to use, and then the code that is executed with those locals. \G Closures end like quotations with a @code{;]}. The locals declaration Loading @@ -147,7 +147,7 @@ forth definitions postpone {: ; immediate compile-only : <{: ( -- vtaddr u latest latestxt wid 0 ) \ gforth-experimental start-homelocation : <{: ( -- vtaddr u latest latestnt wid 0 ) \ gforth-experimental start-homelocation \G starts a home location #0. push-locals postpone {: ; immediate compile-only Loading
code.fs +4 −4 Original line number Diff line number Diff line Loading @@ -57,7 +57,7 @@ vocabulary assembler ( -- ) \ tools-ext : (;code) ( -- ) \ gforth \ execution semantics of @code{;code} r> latestxt code-address! ; r> latestnt code-address! ; [ifundef] ?colon-sys : ?colon-sys ( ... xt tag -- ) Loading @@ -65,7 +65,7 @@ vocabulary assembler ( -- ) \ tools-ext [then] :noname ( -- colon-sys ) align here latestxt code-address! align here latestnt code-address! defstart init-asm ; :noname ( colon-sys1 -- colon-sys2 ) \ tools-ext semicolon-code ( create the [;code] part of a low level defining word ) Loading @@ -80,7 +80,7 @@ interpret/compile: ;code ( compilation. colon-sys1 -- colon-sys2 ) \ tools-ext s [ifdef] do;abicode: : !;abi-code ( addr -- ) latestxt do;abicode: any-code! ; latestnt do;abicode: any-code! ; : ;abi-code ( -- ) \ gforth semicolon-abi-code ['] !;abi-code does>-like postpone [ init-asm ; immediate Loading @@ -91,5 +91,5 @@ interpret/compile: ;code ( compilation. colon-sys1 -- colon-sys2 ) \ tools-ext s \G return from the ABI call (for @code{abi-code}) or the dispatch \G to the next VM instruction (for @code{code} and @code{;code}) \G yourself. latestxt here over - flush-icache latestnt here over - flush-icache previous ?struc reveal ;
debug.fs +1 −1 Original line number Diff line number Diff line Loading @@ -220,7 +220,7 @@ set-current ' NestXT IF EXIT THEN (debug) Leave-D ; : break:, ( -- ) latestxt postpone literal ; latestnt postpone literal ; : break: ( -- ) \ gforth break:, postpone (break:) ; immediate Loading
glocals.fs +8 −8 Original line number Diff line number Diff line Loading @@ -457,22 +457,22 @@ create new-locals-map ( -- wordlist-map ) new-locals-map mappedwordlist Constant new-locals-wl \ and now, finally, the user interface words : { ( -- vtaddr u latest latestxt wid 0 ) \ gforth open-brace : { ( -- vtaddr u latest latestnt wid 0 ) \ gforth open-brace ( >docolloc ) vtsave \ as locals will mess with their own vttemplate latest latestxt get-current latest latestnt get-current get-order new-locals-wl swap 1+ set-order also locals definitions locals-types val-part off 0 TO locals-wordlist 0 postpone [ ; immediate synonym {: { ( -- vtaddr u latest latestxt wid 0 ) \ forth-2012 open-brace-colon synonym {: { ( -- vtaddr u latest latestnt wid 0 ) \ forth-2012 open-brace-colon \G Start standard locals declaration. All Gforth locals extensions are \G supported by Gforth, though the standard only supports the subset of cells. locals-types definitions : } ( vtaddr u latest latestxt wid 0 a-addr1 u1 ... -- ) \ gforth close-brace : } ( vtaddr u latest latestnt wid 0 a-addr1 u1 ... -- ) \ gforth close-brace \ ends locals definitions ] begin Loading @@ -483,13 +483,13 @@ locals-types definitions drop vt, locals-size @ alignlp-f locals-size ! \ the strictest alignment previous previous set-current lastcfa ! last ! set-current lastnt ! last ! vtrestore locals-list 0 wordlist-id - TO locals-wordlist ; synonym :} } : -- ( vtaddr u latest latestxt wid 0 ... -- ) \ gforth dash-dash : -- ( vtaddr u latest latestnt wid 0 ... -- ) \ gforth dash-dash } BEGIN '}' parse dup WHILE + 1- c@ dup bl = swap ':' = or UNTIL Loading Loading @@ -611,7 +611,7 @@ is adjust-locals-list : locals-:-hook ( sys -- sys addr xt n ) \ addr is the nfa of the defined word, xt its xt DEFERS :-hook latest latestxt latest latestnt clear-leave-stack 0 locals-size ! 0 locals-list! Loading @@ -628,7 +628,7 @@ is free-old-local-names : locals-;-hook ( sys addr xt sys -- sys ) ?struc 0 TO locals-wordlist lastcfa ! last ! lastnt ! last ! DEFERS ;-hook ; \ THEN (another control flow from before joins the current one): Loading