• The stack -- any ideas?

    From Zbig@21:1/5 to All on Thu Sep 21 01:52:58 2023
    It seems that according to formal requirements
    ( https://community.arm.com/arm-community-blogs/b/architectures-and-processors-blog/posts/using-the-stack-in-aarch32-and-aarch64 )
    the stack in the case of ARM systems must be as full of holes
    as Swiss cheese. I wonder if this „excess” space on the stack
    could be (reasonably) used somehow.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From none) (albert@21:1/5 to zbigniew2011@gmail.com on Thu Sep 21 13:04:29 2023
    In article <07173d87-1679-4b55-8b68-863f1094d4d4n@googlegroups.com>,
    Zbig <zbigniew2011@gmail.com> wrote:
    It seems that according to formal requirements
    ( >https://community.arm.com/arm-community-blogs/b/architectures-and-processors-blog/posts/using-the-stack-in-aarch32-and-aarch64 )
    the stack in the case of ARM systems must be as full of holes
    as Swiss cheese. I wonder if this „excess” space on the stack
    could be (reasonably) used somehow.

    You must understand that "the stack" is only relevant if you have
    implemented you Forth in c, on top of the bad choice to
    use the return stack of c for something Forth related, be it
    the return stack of the data stack.

    In my implementation of Forth the choice which of the 32
    registers represent the stack pointer is arbitrary up to the
    point you do system calls. System calls are better separated
    out in a special word. The only time to worry is implementing
    this word.
    The Forth runs in user space in Linux, so getting entangled
    in interrupts is non-existent.

    In 64 bit Windows the situation is a bit different for the i86.
    There you are obliged to use the Windows return stack for
    system calls ('DLL calls'). I had no particular problems to
    cope with the 16 byte alignment of this stack, once I was
    aware of it.

    Most run Forth's on 8 Gbyte memory. Wasting a byte here
    and there is no big deal.
    I have some single board 64 bit arm. Even those come with
    Gbyte ram's.

    Groetjes Albert
    --
    Don't praise the day before the evening. One swallow doesn't make spring.
    You must not say "hey" before you have crossed the bridge. Don't sell the
    hide of the bear until you shot it. Better one bird in the hand than ten in
    the air. First gain is a cat spinning. - the Wise from Antrim -

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Zbig@21:1/5 to All on Thu Sep 21 04:14:02 2023
    You must understand that "the stack" is only relevant if you have implemented you Forth in c, on top of the bad choice to
    use the return stack of c for something Forth related, be it
    the return stack of the data stack.

    I stumbled upon this today, and from what I understood
    (maybe I'm mistaken) seemed, that just any stack implemented
    the way shown in the article:
    // Allocate a variable-length array of bytes on the stack.
    sub sp, sp, x0 // x0 holds the length.
    and sp, sp, #0xfffffffffffffff0 // Align sp.
    …has to be 8-byte aligned (in 32-bit system) for some
    (yet) mysterious reasons.

    If I'm correct (I agree I may be not quite correct) any stack
    implemented on ARM looks exactly like the above?

    Most run Forth's on 8 Gbyte memory.

    …except the ones running on STM32 and similar. ;)

    And actually I didn't mean „memory saving” that much, like
    rather some „smart” stack management, taking advantage
    of that „unexpected free space”.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Zbig@21:1/5 to All on Thu Sep 21 11:46:35 2023