Sujet : Re: Stack vs stackless operation
De : zbigniew2011 (at) *nospam* gmail.com (LIT)
Groupes : comp.lang.forthDate : 25. Feb 2025, 08:04:26
Autres entêtes
Organisation : novaBBS
Message-ID : <0549fc7874a0e47c7da5715b99b89b1c@www.novabbs.com>
References : 1 2
User-Agent : Rocksolid Light
: +> ( 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.
--