• to branch

    From Alvaro Gomes Sobral Barcellos@21:1/5 to All on Tue Nov 1 06:58:39 2022
    how better implement BRANCH, by offset or by absolute,
    or just use best of ISA ?

    --

    AVISO DE CONFIDENCIALIDADE
    "Esta mensagem da CPRM é enviada exclusivamente
    a seu destinatário e pode conter informações confidenciais, protegidas por sigilo
    profissional. Se você a recebeu indevidamente, a utilização desta
    mensagem é desautorizada e queira, por gentileza, devolvê-la ao emitente, esclarecendo o equívoco."

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dxforth@21:1/5 to Alvaro Gomes Sobral Barcellos on Wed Nov 2 03:02:11 2022
    On 2/11/2022 12:58 am, Alvaro Gomes Sobral Barcellos wrote:
    how better implement BRANCH, by offset or by absolute,
    or just use best of ISA ?

    If you mean threaded-code, there's probably little reason to use relative. There was an article in Forth Dimensions V5N2 on absolute branches. It included the following editorial footnote:

    "There is a trade-off between absolute and relative branches. As the author
    points out, absolute branches are faster. Relative branches are used in the
    FIG model in order to make the LATEST definition relocatable. In practice,
    this feature is almost never used (see Schleisiek, FORML-1980. on separated
    heads). For most users, speed is probably more valuable. As for BACK, it
    is probably good to retain it for uniformity with other systems, even if it
    is only a synonym for COMMA." - Michael Perry

    IIRC polyFORTH used 8-bit relative branches - presumably to save space.

    What is ISA ?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jon Nicoll@21:1/5 to dxforth on Tue Nov 1 09:31:54 2022
    On Tuesday, November 1, 2022 at 4:02:17 PM UTC, dxforth wrote:

    What is ISA ?

    Instruction Set Architecture

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From none) (albert@21:1/5 to dxforth@gmail.com on Tue Nov 1 18:35:50 2022
    In article <tjrfu2$tcc$1@gioia.aioe.org>, dxforth <dxforth@gmail.com> wrote: >On 2/11/2022 12:58 am, Alvaro Gomes Sobral Barcellos wrote:
    how better implement BRANCH, by offset or by absolute,
    or just use best of ISA ?

    If you mean threaded-code, there's probably little reason to use relative. >There was an article in Forth Dimensions V5N2 on absolute branches. It >included the following editorial footnote:

    "There is a trade-off between absolute and relative branches. As the author
    points out, absolute branches are faster. Relative branches are used in the
    FIG model in order to make the LATEST definition relocatable. In practice,
    this feature is almost never used (see Schleisiek, FORML-1980. on separated
    heads). For most users, speed is probably more valuable. As for BACK, it
    is probably good to retain it for uniformity with other systems, even if it
    is only a synonym for COMMA." - Michael Perry

    IIRC polyFORTH used 8-bit relative branches - presumably to save space.

    What is ISA ?

    Relative branches make virtually all indirect threaded code relocatable.
    This has more advantages, this is an example of an inliner in ciforth.

    \ Alias of :, define a word that inlines it code.
    : :I CREATE IMMEDIATE ] LATEST HIDDEN !CSP
    DOES> STATE @ IF BEGIN $@ DUP '(;) <> WHILE , REPEAT 2DROP
    ELSE >R THEN ;

    It creates an immediate word that get some code into the body.
    When executed it copies the body until an EXIT into the word that is
    defined.

    These can also be used as a macro,
    :I R+! R> + >R ; \ Add something to the return stack.
    It is safer than
    : R+! "R> + R>" EVALUATE ; IMMEDIATE

    With the overhead involved in branching, I don't buy the speed advantage.

    Groetjes Albert

    --
    "in our communism country Viet Nam, people are forced to be
    alive and in the western country like US, people are free to
    die from Covid 19 lol" duc ha
    albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lorem Ipsum@21:1/5 to Jon Nicoll on Tue Nov 1 12:15:07 2022
    On Tuesday, November 1, 2022 at 12:31:55 PM UTC-4, Jon Nicoll wrote:
    On Tuesday, November 1, 2022 at 4:02:17 PM UTC, dxforth wrote:

    What is ISA ?

    Instruction Set Architecture

    Many moons ago, it was the expansion card bus in the bog standard PC. I suppose an expansion card bus is still used in desktops, but most PCs these days are laptops. I don't miss desktop computing one bit.

    My point it, we use too many abbreviations without clarifying what we are talking about.

    Instead of ISA, (I've never fully understood why the A is needed, it's the instruction set) we could just write out "instruction set".

    --

    Rick C.

    - Get 1,000 miles of free Supercharging
    - Tesla referral code - https://ts.la/richard11209

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Anton Ertl@21:1/5 to Alvaro Gomes Sobral Barcellos on Wed Nov 2 07:30:10 2022
    Alvaro Gomes Sobral Barcellos <alvaro.barcellos@sgb.gov.br> writes:
    how better implement BRANCH, by offset or by absolute,=20

    In Gforth we started with relative BRANCH (because fig-Forth has it),
    and between Gforth-0.5 (2000) and Gforth-0.6 (2003) switched to
    absolute BRANCH (because of performance). We have not seen a single disadvantage from this change.

    Concerning relocatability, other words are referenced absolutely (even
    in fig-Forth), and xts are absolute (by necessity), so relative
    branches only give you very limited relocation opportunities: Only
    colon definitions that are not called can be relocated; in particular, recursive colon definitions cannot be relocated. We never used this
    relocation opportunity while we had it, and have not missed it
    afterwards.

    - 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 Alvaro Gomes Sobral Barcellos@21:1/5 to All on Thu Nov 3 11:59:12 2022
    Good for me too.

    In Gforth we started with relative BRANCH (because fig-Forth has it),
    and between Gforth-0.5 (2000) and Gforth-0.6 (2003) switched to
    absolute BRANCH (because of performance). We have not seen a single disadvantage from this change.

    Thanks!

    --

    AVISO DE CONFIDENCIALIDADE
    "Esta mensagem da CPRM é enviada exclusivamente
    a seu destinatário e pode conter informações confidenciais, protegidas por sigilo
    profissional. Se você a recebeu indevidamente, a utilização desta
    mensagem é desautorizada e queira, por gentileza, devolvê-la ao emitente, esclarecendo o equívoco."

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