Sysop: | Amessyroom |
---|---|
Location: | Fayetteville, NC |
Users: | 28 |
Nodes: | 6 (1 / 5) |
Uptime: | 57:34:25 |
Calls: | 424 |
Calls today: | 2 |
Files: | 1,025 |
Messages: | 90,841 |
Posted today: | 1 |
Programmers use value-flavoured words for various reasons. In some
cases they want to have the address of the data otherwise accessed by
calling the value-flavoured word V or by using TO V. Popular systems
have ADDR V or &OF V for taking the address.
However, taking the address of the data means that (in the absence of complicated, expensive, and unreliable alias analysis) any memory
access can access the data, so we are very limited in
register-allocating the data and/or in reordering the accesses to the
data.
On 12 May 2025 at 09:40:32 CEST, "Anton Ertl" <Anton Ertl> wrote:
Programmers use value-flavoured words for various reasons. In some
cases they want to have the address of the data otherwise accessed by
calling the value-flavoured word V or by using TO V. Popular systems
have ADDR V or &OF V for taking the address.
However, taking the address of the data means that (in the absence of
complicated, expensive, and unreliable alias analysis) any memory
access can access the data, so we are very limited in
register-allocating the data and/or in reordering the accesses to the
data.
VFX Forth and other MPE/W&P Forths have had ADDR for decades.
I think that there two flaws in the argument above
1) The use of ADDR or &OF is quite rare and often specialised,
2) All uses that require ADDR can be satisfied using a buffer.
My use of ADDR has significantly reduced over the last ten years.
I would propose that a more satidfying solution is to add local
buffers, which are decades old in MPE/W&P Forths. MPE uses
a notation that others object to for local buffers, but AFAIR someone
had a good notation and implementation that was published.
Why does this name end with a colon?
Just `addressable` (without a colon) looks better.
: bar {: addressable: x -- y :}
5 addr x +! x ;
This declaration of `x` does not look good regardless of the colon.