-
|
Forth Draft 19-1 section 12.3.3 Floating-point stack states that the float stack size must hold at least six (6) items. I'm not able to find any similar statements concerning the return and data stacks. From my readings so far, historically in a flat memory model, the return and data stacks grew downwards towards the dictionary. I assume the return stack sat above the data stack and had some maximum size before hitting the data stack. The data stack grew until it ran into the dictionary, essentially allowing for very large, though variable, data stack. Is there a preferred minimum and/or maximum for the return and/or data stack sizes? Or is it something left up to each implementation based on the target operating environment(s)? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
Yes, the standard does not declare a minimal size for the data stack or return stack. It's an implementation defined option. 4.1.3 Other system documentation says:
And an ambiguous condition exists in a case of "insufficient data-stack space or return-stack space (stack overflow)" (4.1.2 Ambiguous conditions). "Implementation defined" is a formal term:
I think, it's much depends on the target environment. A good choice is to provide a way to configure these sizes. For example, Gforth has the following command line options: |
Beta Was this translation helpful? Give feedback.
-
|
On 14/02/2023 at 2:18 PM, "Anthony Howe" ***@***.***> wrote:
> A good choice is to provide a way to configure these sizes.
Yes. I already do similar.
As a side note, I read some where (can't find the article now, so
probably just misremembering) that Charles Moore found he could
work with a very small data stack like 4 or 6 cells. That article
and the fact the standard and draft refrained from "stating a
number" prompted me to ask the question.
Thank you @ruv.
In Chuck's book 'Programming a Problem Oriented Language' on
pages 57 and 58, he gives the minimum as 8 for the Return and
16 for the Parameter stack.
Regards
Paul E. Bennett IEng MIET
Systems Engineer
Lunar Mission One Ambassador
--
********************************************************************
Paul E. Bennett IEng MIET.....
Forth based HIDECS Consultancy.............
Mob: +44 (0)7811-639972
Going Forth Safely ..... EBA. www.electric-boat-association.org.uk..
********************************************************************
|
Beta Was this translation helpful? Give feedback.
-
|
Let me echo Mitch's comment. MPE has used stack defaults ranging from 16 bytes to 4 MegaBytes (or more in special cases). This is all dependent on use case, CPU and operating system. We have systems in the wild that demand error recovery inside nested Windows operating system callbacks. Recovery has occurred at a nesting level of 12. Clients can be very determined. |
Beta Was this translation helpful? Give feedback.
Yes, the standard does not declare a minimal size for the data stack or return stack.
It's an implementation defined option. 4.1.3 Other system documentation says:
And an ambiguous condition exists in a case of "insufficient data-stack space or return-stack space (stack overflow)" (4.1.2 Ambiguous conditions).
"Implementation defined" is a formal term: