• Re: Forth dictionary headers

    From Marcel Hendrix@21:1/5 to none albert on Tue Apr 12 00:51:25 2022
    On Tuesday, April 12, 2022 at 9:25:48 AM UTC+2, none albert wrote:
    An indirect threaded Forth header contains the following elements:
    [..]
    SFA : Optional:identifies the source
    [..]

    The SFA is unlikely to be a constant, e.g. the source might be on
    a network drive and the user accesses it from various accounts on
    various operating systems, over a period of many years (i.e.
    hardware revisions).

    In iForth, we "install" the kernel sources, and the database of SFAs
    for user source codes is dynamically adjusted/rebuild when loading.

    -marcel

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From none) (albert@21:1/5 to All on Tue Apr 12 09:25:43 2022
    An indirect threaded Forth header contains the following elements:
    CFA : contains the address to jump to during EXECUTE
    DFA : is a pointer to mutable data, in rare cases a constant
    FFA : contains flags, properties of the word
    LFA : identifies the wordlist, probably linking
    NFA : Address of where the name of the word resides
    SFA : Optional:identifies the source

    These fields are constant. They need never be changed
    once the word is created. It is amenable to be placed
    in flash.

    A VARIABLE and a BUFFER contains a pointer to
    after the header or to an area in mutable RAM.
    Though the content changes, the pointer needs not to.

    Comes CREATE. The standard requires that there are two
    mutable areas involved CREATE.
    - DOES> identifies the action to be done by the CREATEd words
    ISO require that it is possible to redefine indefinitely.
    - The data field in the ISO sense. This is the run of the
    mill data and is by nature mutable.
    This is easily accommodated with a pointer to RAM that
    contains two fields.

    Implementors may choose this system to separate the immutable and the
    mutable fields over baroque ad hoc headers where special cases
    abound. Demanding that a CONSTANT is a CREATEd items,
    is reminiscent of Java where even a simple integer is an object,
    imposing overhead where it is no necessary.

    [These insight came to me AD 2001. My impression is that
    Ting, implementing a Forth in C++ comes to similar conclusions.]

    P.S.
    Code Data Link Flag Name Source
    Note that this is in alphabetic order, as well of the
    order of importance.
    --
    "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 minforth@arcor.de@21:1/5 to none albert on Tue Apr 12 01:09:13 2022
    none albert schrieb am Dienstag, 12. April 2022 um 09:25:48 UTC+2:

    Implementors may choose this system to separate the immutable and the
    mutable fields over baroque ad hoc headers where special cases
    abound. Demanding that a CONSTANT is a CREATEd items,
    is reminiscent of Java where even a simple integer is an object,
    imposing overhead where it is no necessary.

    Constants need not be CREATEd necessarily. However the Forth compiler
    must know its value somehow. For this introspection CREATE is a cheap way.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Anton Ertl@21:1/5 to albert@cherry. on Tue Apr 12 08:50:14 2022
    albert@cherry.(none) (albert) writes:
    An indirect threaded Forth header contains the following elements:
    CFA : contains the address to jump to during EXECUTE
    DFA : is a pointer to mutable data, in rare cases a constant
    FFA : contains flags, properties of the word
    LFA : identifies the wordlist, probably linking
    NFA : Address of where the name of the word resides
    SFA : Optional:identifies the source

    These fields are constant. They need never be changed
    once the word is created.

    The only thing specific to indirect threading is the code field (and
    with code separated from headers you a code field is a good idea even
    on a native-code system.

    Flags are changed with IMMEDIATE, and on SMUDGE systems with SMUDGE.

    On REVEAL systems the link field is changed on REVEAL.

    Systems tend to use either SMUDGE or REVEAL (any exceptions?).

    Comes CREATE. The standard requires that there are two
    mutable areas involved CREATE.
    - DOES> identifies the action to be done by the CREATEd words
    ISO require that it is possible to redefine indefinitely.
    - The data field in the ISO sense. This is the run of the
    mill data and is by nature mutable.
    This is easily accommodated with a pointer to RAM that
    contains two fields.

    Which means one indirection more for implementing dodoes.
    Direct-to-flash systems have preferred to put the does-action address
    into flash, foregoing standards compliance.

    One thing to note is that IMMEDIATE, DOES>, and the unsmudging or
    revealing of the current word all happen in Forth-2012 before the next
    word is defined (locals and (non-2012) quotations muddle the picture a
    little), so you can construct the current header in RAM, and create it
    in flash when starting the next header. Issues: How to implement
    RECURSE, ' and FIND (of the most recently defined word); anything
    else?

    Demanding that a CONSTANT is a CREATEd items,
    is reminiscent of Java where even a simple integer is an object,
    imposing overhead where it is no necessary.

    Actually Java has so-called base types (e.g., int and long), which are
    not objects. Many of the things you can do with objects you cannot do
    with base types. Therefore Java also has a class Integer which boxes
    int up as object (including object overhead), so you can use it where
    an object is expected (e.g., with the collection classes).

    - 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: http://www.forth200x.org/forth200x.html
    EuroForth 2021: https://euro.theforth.net/2021

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