Deutsch   English   Français   Italiano  
<2024Sep12.121903@mips.complang.tuwien.ac.at>

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

Path: ...!eternal-september.org!feeder3.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: Thu, 12 Sep 2024 10:19:03 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 23
Message-ID: <2024Sep12.121903@mips.complang.tuwien.ac.at>
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>
Injection-Date: Thu, 12 Sep 2024 12:33:10 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="b3a05cc3d9bbc2cf43d4db2bfea46e1b";
	logging-data="231099"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19G4XW4Ve0ZCWt85YhUmqvP"
Cancel-Lock: sha1:S7eB2FOL1abCJ7XdL6d4c2hVMuQ=
X-newsreader: xrn 10.11
Bytes: 2155

dxf <dxforth@gmail.com> writes:
>Using registers is appealing until
>one realizes a call to an external function necessitates placing it back on
>the stack.

Not if the stack item does not live across the call.  And even if it
lives across the call and cannot be placed in a callee-saved register,
the save before and restore after the call is amortized typically
across more than one register access on each side of the call.

Register allocation is one of the most effective optimizations in
compilers.  That's also true of Forth.

>Costs multiply in the face of many small functions.

Register allocation is also effective for small functions.

- 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