• GNU Forth, documentation confusion

    From Sean Charles (emacstheviking)@21:1/5 to All on Wed Mar 1 13:34:15 2023
    I am currently stuck using ,0.7.3 from a homebrew installation, I have so far not been able to build either 0.7.3 or 0.7.9 from sources on my M1 macmini as I get errors I don't understand. I tried 0.7.3 from Savannah tarball and it ended with

    illegal instruction: 4

    Putting that to one side, I am getting confused by the online GForth manual here,

    https://www.gnu.org/software/gforth/

    It says the current release is 0.7.3, but when I click the User Manual link, it takes me to one place, and click to https://www.complang.tuwien.ac.at/forth/gforth/Docs-html/index.html#Top it says it is for version 0.7.0
    but this site

    https://gforth.org/manual/

    is clearly for 0.7.9

    So where is the documentation for 0.7.3? I am confused, because I can't build the docs for 0.7.3 locally as it seems to be dependant upon the other build steps that don't work for me so I have no choice but to use that site.
    It says it is for version 0.7.9, but I keep finding references to "gforth 1.0" as well, is this another planned release or am I misunderstanding something else?

    For example, on the 0.7.9 page: https://gforth.org/manual/_0024tring-words.html#index-_0024tmp_0028--xt-_002d_002d-addr-u--_0029-gforth_002d1_002e0

    `$[] ( u $[]addr – addr’ ) gforth-1.0 “string-array”`

    What does the gforth-1.0 mean ?

    Thanks for any assistance.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Anton Ertl@21:1/5 to objitsu@gmail.com on Wed Mar 1 21:52:32 2023
    "Sean Charles (emacstheviking)" <objitsu@gmail.com> writes:
    I am currently stuck using ,0.7.3 from a homebrew installation, I have so f= >ar not been able to build either 0.7.3 or 0.7.9 from sources on my M1 macmi= >ni as I get errors I don't understand.

    Gforth 0.7.9 builds fine on an M1 Mac Mini running Linux. MacOS is a
    different story. I have not managed to make it run there. It seems
    that it does not work when we mmap a region with RWX permissions, and
    I have seen documentation that instructs JIT compiler writers to jump
    through some hoops. We have neither jumped through these hoops, nor
    succeeded in adding a workaround for the breakage yet (although both
    look to be just a matter of spending enough time on it; but for that
    MacOS would have to reach the top of our ToDo list).

    Putting that to one side, I am getting confused by the online GForth manual=
    here,

    https://www.gnu.org/software/gforth/

    It says the current release is 0.7.3, but when I click the User Manual link= >, it takes me to one place, and click to https://www.complang.tuwien.ac.at/= >forth/gforth/Docs-html/index.html#Top it says it is for version 0.7.0

    0.7.3 is just a bugfix release for 0.7.0, so the 0.7.0 documentation
    is the same as the 0.7.3 documentation.

    but this site

    https://gforth.org/manual/

    is clearly for 0.7.9

    So where is the documentation for 0.7.3?

    Use the 0.7.0 documentation.

    It says it is for version 0.7.9, but I keep finding references to "gforth 1= >.0" as well, is this another planned release or am I misunderstanding somet= >hing else?

    When 0.7.9 is released, it will be called Gforth 1.0. Every word in
    Gforth that's younger than 0.7.[0-3] is marked as gforth-1.0 in the documentation.

    For example, on the 0.7.9 page: https://gforth.org/manual/_0024tring-words.= >html#index-_0024tmp_0028--xt-_002d_002d-addr-u--_0029-gforth_002d1_002e0

    `$[] ( u $[]addr =E2=80=93 addr=E2=80=99 ) gforth-1.0 =E2=80=9Cstring-arra= >y=E2=80=9D`

    What does the gforth-1.0 mean ?

    It means that $[] is a Gforth-specific word that was added after
    0.7.[0-3].

    - anton
    --
    M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
    comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
    New standard: https://forth-standard.org/
    EuroForth 2022: https://euro.theforth.net

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Sean Charles (emacstheviking)@21:1/5 to Anton Ertl on Wed Mar 1 14:25:46 2023
    On Wednesday, 1 March 2023 at 22:03:47 UTC, Anton Ertl wrote:
    "Sean Charles (emacstheviking)" <obj...@gmail.com> writes:
    I am currently stuck using ,0.7.3 from a homebrew installation, I have so f=
    ar not been able to build either 0.7.3 or 0.7.9 from sources on my M1 macmi= >ni as I get errors I don't understand.
    Gforth 0.7.9 builds fine on an M1 Mac Mini running Linux. MacOS is a different story. I have not managed to make it run there. It seems
    that it does not work when we mmap a region with RWX permissions, and
    I have seen documentation that instructs JIT compiler writers to jump through some hoops. We have neither jumped through these hoops, nor succeeded in adding a workaround for the breakage yet (although both
    look to be just a matter of spending enough time on it; but for that
    MacOS would have to reach the top of our ToDo list).

    Putting that to one side, I am getting confused by the online GForth manual=
    here,

    https://www.gnu.org/software/gforth/

    It says the current release is 0.7.3, but when I click the User Manual link=
    , it takes me to one place, and click to https://www.complang.tuwien.ac.at/= >forth/gforth/Docs-html/index.html#Top it says it is for version 0.7.0
    0.7.3 is just a bugfix release for 0.7.0, so the 0.7.0 documentation
    is the same as the 0.7.3 documentation.
    but this site

    https://gforth.org/manual/

    is clearly for 0.7.9

    So where is the documentation for 0.7.3?
    Use the 0.7.0 documentation.

    It says it is for version 0.7.9, but I keep finding references to "gforth 1=
    .0" as well, is this another planned release or am I misunderstanding somet=
    hing else?

    When 0.7.9 is released, it will be called Gforth 1.0. Every word in
    Gforth that's younger than 0.7.[0-3] is marked as gforth-1.0 in the documentation.

    For example, on the 0.7.9 page: https://gforth.org/manual/_0024tring-words.=
    html#index-_0024tmp_0028--xt-_002d_002d-addr-u--_0029-gforth_002d1_002e0

    `$[] ( u $[]addr =E2=80=93 addr=E2=80=99 ) gforth-1.0 =E2=80=9Cstring-arra= >y=E2=80=9D`

    What does the gforth-1.0 mean ?
    It means that $[] is a Gforth-specific word that was added after
    0.7.[0-3].

    - anton
    --
    M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html New standard: https://forth-standard.org/
    EuroForth 2022: https://euro.theforth.net

    Thank for for your quick reply Anton, and thanks for clearing up my confusion. I do wonder then how the homebrew binary I installed was built and by whom? When I query brew it tells me the formula homepage as that says:

    https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/gforth.rb

    There is a build for ventura, so I assumed that -somebody- managed to build it and that I was just doing something wrong. Now I am confused! When you say 'M1Mac Mini running Linux' are you talking about UTM/Parallels or do you mean on the metal through
    something like Asaha linux?

    I have already built 0.7.9 from source and it runs under UTM fine, but of course, that's not what I ultimately wanted to be able to do, I guess I will continue with 0.7.3 for now as I am still in a learning phase and enjoying it very very much despite
    everything, GNU Forth is a confidence inspiring gem of a world to learn in. I first came across FORTH in about 1986, as a very much younger embedded microprocessor engineer, now, some 37 years later I maybe realise I should have stuck with it.

    Thanks again, and I look forward to 1.0 at some point. I will read up on those points you made regarding mmap() and RWX permissions as that's new to me. Who knows, perhaps I might even be able to solve the problem... one day.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Anton Ertl@21:1/5 to objitsu@gmail.com on Thu Mar 2 06:36:44 2023
    "Sean Charles (emacstheviking)" <objitsu@gmail.com> writes:
    Thank for for your quick reply Anton, and thanks for clearing up my confusi= >on.
    I do wonder then how the homebrew binary I installed was built and by whom?=
    When I query brew it tells me the formula homepage as that says:

    https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/gforth.rb

    There is a build for ventura, so I assumed that -somebody- managed to build=
    it and that I was just doing something wrong.

    I dimly remember succeeding at building 0.7.3, but don't remember
    details. Ah, here we have Benchmark results:

    sieve bubble matrix fib
    0.138 0.118 0.071 0.121 0.7.3; Apple M1, Firestorm 3000MHz, MacOS, gcc-12.2.0 0.254 0.240 0.167 0.272 0.7.3; Apple M1, Firestorm 3000MHz, MacOS, clang-14.0.0

    IIRC 0.7.3 detects that mmap does not work and falls back to not using
    dynamic code generation. In 0.7.9 the logic for that part has been
    changed, and it does not find the fall back on MacOS.

    Now I am confused! When you =
    say 'M1Mac Mini running Linux' are you talking about UTM/Parallels or do yo= >u mean on the metal through something like Asaha linux?

    Asahi Linux.

    I have already built 0.7.9 from source and it runs under UTM fine

    Good to know.

    Thanks again, and I look forward to 1.0 at some point. I will read up on th= >ose points you made regarding mmap() and RWX permissions as that's new to m= >e. Who knows, perhaps I might even be able to solve the problem... one day.

    Don't worry about it (unless you want to do it for the learning
    experience). It probably takes quite a lot more work to understand
    what the code is supposed to do than to fix it.

    - anton
    --
    M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
    comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
    New standard: https://forth-standard.org/
    EuroForth 2022: https://euro.theforth.net

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to All on Thu Mar 2 20:08:33 2023
    On 2/03/2023 9:25 am, Sean Charles (emacstheviking) wrote:

    I first came across FORTH in about 1986, as a very much younger embedded microprocessor engineer, now, some 37 years later I maybe realise I should have stuck with it.

    You were able to resist the Call of Cthulhu for that long :)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Sean Charles (emacstheviking)@21:1/5 to dxforth on Thu Mar 2 04:13:05 2023
    On Thursday, 2 March 2023 at 09:08:35 UTC, dxforth wrote:
    On 2/03/2023 9:25 am, Sean Charles (emacstheviking) wrote:

    I first came across FORTH in about 1986, as a very much younger embedded microprocessor engineer, now, some 37 years later I maybe realise I should have stuck with it.
    You were able to resist the Call of Cthulhu for that long :)
    Yes, I put it down to tinnitus.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Sean Charles (emacstheviking)@21:1/5 to Anton Ertl on Thu Mar 2 04:31:13 2023
    On Thursday, 2 March 2023 at 06:49:54 UTC, Anton Ertl wrote:
    "Sean Charles (emacstheviking)" <obj...@gmail.com> writes:
    Thank for for your quick reply Anton, and thanks for clearing up my confusi= >on.
    I do wonder then how the homebrew binary I installed was built and by whom?=
    When I query brew it tells me the formula homepage as that says:

    https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/gforth.rb

    There is a build for ventura, so I assumed that -somebody- managed to build=
    it and that I was just doing something wrong.
    I dimly remember succeeding at building 0.7.3, but don't remember
    details. Ah, here we have Benchmark results:

    sieve bubble matrix fib
    0.138 0.118 0.071 0.121 0.7.3; Apple M1, Firestorm 3000MHz, MacOS, gcc-12.2.0 0.254 0.240 0.167 0.272 0.7.3; Apple M1, Firestorm 3000MHz, MacOS, clang-14.0.0

    IIRC 0.7.3 detects that mmap does not work and falls back to not using dynamic code generation. In 0.7.9 the logic for that part has been
    changed, and it does not find the fall back on MacOS.

    Now I am confused! When you =
    say 'M1Mac Mini running Linux' are you talking about UTM/Parallels or do yo= >u mean on the metal through something like Asaha linux?
    Asahi Linux.
    I have already built 0.7.9 from source and it runs under UTM fine
    Good to know.

    Thanks again, and I look forward to 1.0 at some point. I will read up on th= >ose points you made regarding mmap() and RWX permissions as that's new to m= >e. Who knows, perhaps I might even be able to solve the problem... one day. Don't worry about it (unless you want to do it for the learning
    experience). It probably takes quite a lot more work to understand
    what the code is supposed to do than to fix it.
    - anton
    --
    M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
    New standard: https://forth-standard.org/
    EuroForth 2022: https://euro.theforth.net

    Sorry Anton,

    just so I am clear, does that mean that the version 0.7.3 I am using on my M1 is not able to compile to machien instructions i.e. no JIT or not ? I don't think it will affect me this year but it's just nice to know where you stand.
    I am planning to write some SDL graphics applications and I thought using Forth would be both interesting (it is) and fast (it is) but know that under the hood that it 'couldn't get any faster' just adds that little je ne sais quoi to the mix! :)

    Thanks again.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Anton Ertl@21:1/5 to objitsu@gmail.com on Thu Mar 2 17:43:40 2023
    "Sean Charles (emacstheviking)" <objitsu@gmail.com> writes:
    just so I am clear, does that mean that the version 0.7.3 I am using on my M1 is not able to compile to machien instructions i.e. no JIT or not ?

    Yes. 0.7.3 (at least as we released it) does not know about Aarch64,
    so it does not do native-code generation even on Linux.

    As for the future, for now I plan to make it run without jumping
    through the MacOS hoops, so that would mean no native code for MacOS.
    Let's see how much that costs by measuring the current version on
    Linux with and without dynamic native code (on Firestorm):

    sieve bubble matrix fib fft
    0.091 0.088 0.053 0.080 0.039 gforth-fast-0.7.9_20230223
    0.104 0.109 0.074 0.105 0.063 gforth-fast-0.7.9_20230223 --no-dynamic

    With Icestorm it's like this:

    sieve bubble matrix fib fft
    0.134 0.159 0.080 0.147 0.079 gforth-fast-0.7.9_20230223
    0.183 0.220 0.128 0.261 0.118 gforth-fast-0.7.9_20230223 --no-dynamic

    The Icestorm difference reflects the difference in executed
    instructions (factor 1.64); Firestorm is apparently good at executing
    the additional threaded-code instructions in parallel with the
    payload.

    - anton
    --
    M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
    comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
    New standard: https://forth-standard.org/
    EuroForth 2022: https://euro.theforth.net

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)