Re: Need some help understanding array definitions



Ed wrote:
"Elizabeth D Rather" <erather@xxxxxxxxx> wrote in message
news:AbidnWWvVJTSUM_VnZ2dnUVZ_qPinZ2d@xxxxxxxxxxxxxxxx
....
Presumably there is. Both major forth vendors have it in
their Windows product, albeit implemented in different ways.
Checkout R-ALLOC and R-BUF in SwiftForth.
Those words address specific issues regarding building stack frames for
Windows and DLL calls, and I'm sure MPE's equivalents address the same
need. That's a far cry from saying "Forth needs..." which implies a
general requirement in ordinary programming.

The guts of an implementation -- particularly for Windows, which has a
very specific set of problems -- will present special challenges. We
hope that by providing the tools for making the calls in a reasonably
programmer-friendly way we can avoid the necessity for doing these
things in application code.

Ok, since I'm not allowed to use the phrase "what forth needs"
I'll state it differently. I see advantages in this technique beyond
Windows.

Small targets may not have ALLOCATE or local buffers. If they
need a small temp buffer and can't do it the way Marcel suggested
because the compiler isn't resident, then this may be an alternative.

Since it takes less resources to implement and run than the
"Standard" methods currently on offer, it might have a greater
appeal.

Does it have limitations - yes, it's limited by the amount of free
space available on the return stack at any given time. On small
systems that could be quite small. Does that make it useless?
Users can judge for themselves.

I spend most of my life in small systems. We don't have ALLOCATE or local buffers, and never felt the lack. We *do* have "small temporary buffers": typically defined in terms of PAD, which resides in the otherwise unused space below the data stack. Using PAD is far safer than using the Return Stack, and requires *no* additional resources.

It's in the Standard, which also guarantees that no system functions use it, so it's a free application resource.

Cheers,
Elizabeth

--
==================================================
Elizabeth D. Rather (US & Canada) 800-55-FORTH
FORTH Inc. +1 310.999.6784
5959 West Century Blvd. Suite 700
Los Angeles, CA 90045
http://www.forth.com

"Forth-based products and Services for real-time
applications since 1973."
==================================================
.



Relevant Pages

  • Re: singe thread per connection
    ... process is about 2000, with the practical maximum somewhat lower, and performance suffering significantly before that. ... If you use a different stack size than the default, or don't actually allocate one OS thread per Java thread, then the actual limit would be different. ... But in Windows, both in the regular Win32 API and under .NET, there are i/o mechanisms that can be used that allow a single thread to service an arbitrarily large number of i/o tasks. ... This allows a program to create just enough threads to keep all the CPU cores busy, and the Windows scheduler knows to treat those threads specially so that if the only other runnable thread is one that would do the same thing that the currently running thread would do, the currently running thread is allowed to just keep running, rather than being preempted for no good reason. ...
    (comp.lang.java.programmer)
  • Re: Iczelions tutorials revisited.
    ... By "local" variables on the stack I assume something like this? ... access parameters and locals that way. ... The Windows API uses "stdcall" in which "callee cleans up stack" - the Windows functions end with "ret N". ... Being an old dos-head, I'm used to using cx as a "counter", and it annoys me that calling libc or the Windows API is allowed to trash it, but that's life... ...
    (alt.lang.asm)
  • Re: Is MASM32 an evil Microsoft plot?
    ... Now your next blunder is to call the default windows message handler ... > you could use most any assembler and the whole advocacy for MASM disappears. ... C3;; retn ... Is there supposed to be some profundity at addressing the stack ...
    (alt.lang.asm)
  • Re: IPAQs and Bluetooth and Visual Studio 2005 beta 2
    ... Differences between WinCE and Windows Mobile: ... Note that if you don't have a device running the Microsoft Bluetooth stack, ...
    (microsoft.public.pocketpc.developer.networking)
  • Re: RfD - Enhanced local variable syntax, v4 (long)
    ... the buffer extension I would have to write ... to declare 2 local buffers. ... What does this have to do with a stack ... But allocating temporaries in the same phrase as local ...
    (comp.lang.forth)