Deutsch English Français Italiano |
<2024Sep16.212601@mips.complang.tuwien.ac.at> View for Bookmarking (what is this?) Look up another Usenet article |
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: anton@mips.complang.tuwien.ac.at (Anton Ertl) Newsgroups: comp.lang.forth Subject: Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!] Date: Mon, 16 Sep 2024 19:26:01 GMT Organization: Institut fuer Computersprachen, Technische Universitaet Wien Lines: 44 Message-ID: <2024Sep16.212601@mips.complang.tuwien.ac.at> References: <nnd$61e0ad9a$48ed61c2@b4d945e456041481> <2024Sep15.181634@mips.complang.tuwien.ac.at> <vc7ju4$2cu8t$1@dont-email.me> <87o74o1thp.fsf@nightsong.com> <vc97od$2r97o$1@dont-email.me> <2024Sep16.193719@mips.complang.tuwien.ac.at> <e2d54b78169fdb62b22cacd72aee1f2d@www.novabbs.com> Injection-Date: Mon, 16 Sep 2024 21:49:40 +0200 (CEST) Injection-Info: dont-email.me; posting-host="30716ef6ab1ebd867530a5bb0a7c7e47"; logging-data="3188995"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18rNu2p6Q17ZKM5YD7fikbm" Cancel-Lock: sha1:liGAXduMAYRht142PisV4SQFn0s= X-newsreader: 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.html comp.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