Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

GNU Forth, documentation confusion

186 views
Skip to first unread message

Sean Charles (emacstheviking)

unread,
Mar 1, 2023, 4:34:17 PM3/1/23
to
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.

Anton Ertl

unread,
Mar 1, 2023, 5:03:47 PM3/1/23
to
"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

Sean Charles (emacstheviking)

unread,
Mar 1, 2023, 5:25:48 PM3/1/23
to
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.

Anton Ertl

unread,
Mar 2, 2023, 1:49:54 AM3/2/23
to
"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.

dxforth

unread,
Mar 2, 2023, 4:08:35 AM3/2/23
to
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 :)

Sean Charles (emacstheviking)

unread,
Mar 2, 2023, 7:13:06 AM3/2/23
to
Yes, I put it down to tinnitus.

Sean Charles (emacstheviking)

unread,
Mar 2, 2023, 7:31:15 AM3/2/23
to
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.

Anton Ertl

unread,
Mar 2, 2023, 1:15:33 PM3/2/23
to
"Sean Charles (emacstheviking)" <obj...@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.

Stephen Pelc

unread,
May 8, 2023, 12:59:33 PM5/8/23
to
The x64 versions of most MacOS Forths (including VFX) run under Rosetta, but suffer significant slowdowns, much dependent on the application domains. x64 code on Apple Silicon seems to suffer the same issues as can be found by Googling for JIT compilation on Apple Silicon or some such. There's a whole load of stuff to be done.

We'll get round to it after we have done VFX for ARM64 Linux (in development).

No idea about timescale.
0 new messages