albert@spenarnc.xs4all.nl writes:
R EXECUTE doesn't work for ciforth.
There is no guarantee that a saved interpreter pointer on the
stack is an execution token.
In development Gforth, if you use the xt of a colon definition as a
return address, you get the same effect as EXECUTE. E.g.
: colon-execute >r ;
1 ' . colon-execute \ prints "1"
I have recently had a puzzling bug syndrome in the following word
(buggy version shown):
: reverse-sections-execute ( xt -- )
>r sections $@ cell mem-do
j i @ section-execute
loop ;
[: current-section @ cr h. ;] reverse-sections-execute
The output is:
$7FF5F428F000
$7FF5F3F1A000
$7FF5F3F3B000
$7FF5E5BFD000
$7FF5E5DFE040
$7FF5F4298000
$7FF5E5DFE040 ok
The last line should not be output. What happens is that the xt
passed to REVERSE-SECTIONS-EXECUTE is pushed on the return stack, and
I then forgot to drop it. But instead of that resulting in a crash
(as you would get in Gforth up to around 2020), with the new xt
implementation the ; at the end COLON-EXECUTEs the xt. And because
the xt is a colon definition, this calls the xt again.
xt=pfa has it's advantages, but here a disadvantage showed up.
- 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 2023 proceedings:
http://www.euroforth.org/ef23/papers/
EuroForth 2024 proceedings:
http://www.euroforth.org/ef24/papers/
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)