Sujet : Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]
De : anton (at) *nospam* mips.complang.tuwien.ac.at (Anton Ertl)
Groupes : comp.lang.forthDate : 16. Sep 2024, 20:26:01
Autres entêtes
Organisation : Institut fuer Computersprachen, Technische Universitaet Wien
Message-ID : <2024Sep16.212601@mips.complang.tuwien.ac.at>
References : 1 2 3 4 5 6 7
User-Agent : xrn 10.11
mhx@iae.nl (mhx) writes:
The experimental PARAMS| a | construct does not support 'OF and tries
to keep integer locals in a register.
Great. And using the same order as {: ... :} is also great. Now if
only (LOCAL) (which is used by the reference implementation of {:
... :}) used the same mechanism.
I just tried VICHECK1 with PARAMS| ... | instead of {: ... :}
401 336 gforth-fast (AMD64)
179 132 lxf 1.6-982-823 (IA-32)
182 119 VFX FX Forth for Linux IA32 Version: 4.72 (IA-32)
241 159 VFX Forth 64 5.43 (AMD64)
163 175 iforth-5.1 mini (AMD64)
182 iforth-5.1 mini using PARAMS|
Looking at the code, you store these registered locals on the locals
stack before the IF, and then load them into registers again after the
IF, and then reload them after every call (so apparently the registers
you use for them are caller-saved in iforth). And the problem in this
code is that ever local is used at most once between calls, so storing
it in a caller-saved register results in no better code than storing
it in memory.
Let's see how the 3DUP.3 example fares:
instr. bytes system
28 103 Gforth AMD64
16 44 iforth 5.0.27 (plus 20 bytes entry and return code)
8 11 iforth 5.0.27 PARAMS| (plus 20 bytes entry and return code)
7 19 lxf 1.6-982-823 32-bit
32 127 SwiftForth 4.0.0-RC89 (calls LSPACE)
26 92 VFX Forth 64 5.11 RC2
Yes, in the right setting PARAMS| is very nice, too bad it's not used
for (LOCAL) (or directly for {:).
- anton
-- M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.htmlcomp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html New standard: https://forth-standard.org/ EuroForth 2024: https://euro.theforth.net