Deutsch   English   Français   Italiano  
<0549fc7874a0e47c7da5715b99b89b1c@www.novabbs.com>

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

Path: ...!eternal-september.org!feeder3.eternal-september.org!i2pn.org!i2pn2.org!.POSTED!not-for-mail
From: zbigniew2011@gmail.com (LIT)
Newsgroups: comp.lang.forth
Subject: Re: Stack vs stackless operation
Date: Tue, 25 Feb 2025 07:04:26 +0000
Organization: novaBBS
Message-ID: <0549fc7874a0e47c7da5715b99b89b1c@www.novabbs.com>
References: <591e7bf58ebb1f90bd34fba20c730b83@www.novabbs.com> <ed682d52512c43c6697c16dede02ebfad9a74ad8@i2pn2.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: i2pn2.org;
	logging-data="1676854"; mail-complaints-to="usenet@i2pn2.org";
	posting-account="ovTHZ/VLht/KDF1nKqB7PmGhjiyfUdv/DKd8kGKFjRY";
User-Agent: Rocksolid Light
X-Rslight-Posting-User: 8e58c9b6d1da98b6162b84d03d2307a6516add15
X-Rslight-Site: $2y$10$Szf5ug7RCobyryEXpJbK6OuB0JFW0M5qwyVc7FP0/2Vtzp5i0Z4NC
X-Spam-Checker-Version: SpamAssassin 4.0.0
Bytes: 1884
Lines: 38

>> : +> ( addr1 addr2 addr3 -- )
>>  rot @ rot @ + swap ! ;
>>
>> Of course the above is just an illustration; I mean coding
>> such word directly in ML. It should be significantly
>> faster than going through stack usual way.
>
> A set of three addresses on the stack is messy even before
> one does anything with them.

Yep, but I meant the case of, for example:

var1 @ var2 @ + var3 !

The above isn't messy at all.

So IMHO by using such OOS (out-of-stack) operation - coded
directly in ML - we can replace the above by:

var1 var2 var3 +>

Or we can create increment-by-one operation (and its
counterpart):

var1 ++
var1 --

Or "multiply/divide by two a number of times":

var1 2 lshift ( multiply by 4 )

etc.

In case of slower ITC non-optimizing Forths - like
fig-Forth, as the most obvious example - the "boost"
may be noticeable.
I'll check that.

--