Sujet : Re: Actually... why not?
De : anton (at) *nospam* mips.complang.tuwien.ac.at (Anton Ertl)
Groupes : comp.lang.forthDate : 11. Jun 2025, 22:16:06
Autres entêtes
Organisation : Institut fuer Computersprachen, Technische Universitaet Wien
Message-ID : <2025Jun11.231606@mips.complang.tuwien.ac.at>
References : 1
User-Agent : xrn 10.11
zbigniew2011@gmail.com (LIT) writes:
I mean: when a variable if found,
instead of its CFA - 'LIT PFA' should
be compiled directly. When a constant
is found — 'LIT <value>' should be compiled,
instead of constant's CFA.
That's what you get in Gforth since before 0.7:
variable v ok
5 constant c ok
: foo v c ; ok
simple-see foo
$7FCBB58A0DF8 lit 0->0
$7FCBB58A0E00 v
$7FCBB58A0E08 lit 0->0
$7FCBB58A0E10 #5
$7FCBB58A0E18 ;s 0->0 ok
The disassembly varies a little by version.
Do I miss anything, any eventual problem?
It requires more work in COMPILE, than just doing a ",". But having a
user-extensible intelligent COMPILE, (like Gforth) offers a number of
advantages, especially for native-code compilers.
- 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 2023 proceedings: http://www.euroforth.org/ef23/papers/EuroForth 2024 proceedings:
http://www.euroforth.org/ef24/papers/