Deutsch   English   Français   Italiano  
<66e828ce$1@news.ausics.net>

View for Bookmarking (what is this?)
Look up another Usenet article

Date: Mon, 16 Sep 2024 22:47:10 +1000
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
From: dxf <dxforth@gmail.com>
Subject: Re: Avoid treating the stack as an array [Re: "Back & Forth" is
 back!]
Newsgroups: comp.lang.forth
References: <nnd$61e0ad9a$48ed61c2@b4d945e456041481>
 <vasqjd$icjm$1@dont-email.me> <66d26c4b$1@news.ausics.net>
 <vaubf7$tbke$1@dont-email.me> <nnd$04cff141$0193ba04@301336b8dd8ed69a>
 <vbfqnd$v4c4$1@dont-email.me> <nnd$26b4d59b$27bdb181@ce638e508b04426e>
 <87bk0vbvgk.fsf@nightsong.com> <66e0fa58$1@news.ausics.net>
 <66e11d64$1@news.ausics.net> <877cbh4b6z.fsf@nightsong.com>
 <66e2a497$1@news.ausics.net> <2024Sep14.143207@mips.complang.tuwien.ac.at>
 <e29088cacf765cd0da6519e333fa78f1@www.novabbs.com>
 <2024Sep14.170836@mips.complang.tuwien.ac.at>
 <06f3574dfa63a100a731c944d8e16473@www.novabbs.com>
 <66e69759$1@news.ausics.net>
 <2407b32e4980726ab60611863c3d485e@www.novabbs.com>
 <19ef9c8626b9a9374535476f9073ad03@www.novabbs.com>
 <5631e74e91f46765ffe32945f12b748e@www.novabbs.com>
 <6e80829c88e569bb309120de17818b58@www.novabbs.com>
 <bc18049678801b31614fe87eba889a48@www.novabbs.com>
Content-Language: en-GB
In-Reply-To: <bc18049678801b31614fe87eba889a48@www.novabbs.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
NNTP-Posting-Host: news.ausics.net
Message-ID: <66e828ce$1@news.ausics.net>
Organization: Ausics - https://newsgroups.ausics.net
Lines: 36
X-Complaints: abuse@ausics.net
Path: ...!weretis.net!feeder9.news.weretis.net!news.bbs.nz!news.ausics.net!not-for-mail
Bytes: 2499

On 16/09/2024 8:13 pm, mhx wrote:
> [..]
> FORTH> tnb
> \ no locals:  5ns/call.
> \    locals:  18.2ns/call.
> \    globals: 6ns/call.
> \ no locals2: 21.9ns/call. ok
> 
> This appears not to be a good idea.
> The root cause is piling up too many
> items on the F-stack (exceeding the
> hardware FPU stack limits).

FVALUEs may be the way to go for hardware stack.
Is this any better?

: tri_mf ( f: x a b c -- mv)
  3 fpick ( x) 3 fpick ( x a) f>=
  3 fpick ( x) 2 fpick ( x b) f< and if
    fdrop               \ x a b
    frot 2 fpick  f-    \ a b x-a
    fswap frot f-       \ x-a b-a
    f/ exit
  then
  3 fpick ( x) 2 fpick ( x b) f>=
  3 fpick ( x) 1 fpick ( x c) f< and if
    frot fdrop          \ x b c
    frot fover fswap f- \ b c c-x
    fswap frot f-       \ c-x c-b
    f/ exit
  then
  fdrop fdrop fdrop fdrop  0e
;