Escape Analysis & Owner Escape Analysis
IchorDev
zxinsworld at gmail.com
Thu Sep 5 09:53:26 UTC 2024
On Wednesday, 4 September 2024 at 03:02:10 UTC, Richard (Rikki)
Andrew Cattermole wrote:
> owner escape analysis only kicks in and forces effectively
> const on the owner if:
>
> 1. You take a pointer to stack memory
> 2. You receive memory that has a strong relationship (perhaps
> done explicitly for reference counting!)
> 3. You take a pointer to a field of struct/class/union
>
> […]
>
> In a way its a hole in the design, but an intentional one as it
> makes for a very good user experience and doesn't really have a
> lot of down sides.
>
> I was going to fill in that hole, but ``@system`` variables
> covers it enough that I kinda just went meh.
Wait, so how would one force owner escape analysis to be enabled
for manually heap-allocated memory? This DIP is meant to replace
@live, after all.
>> - `@escape` is the opposite of `@escape()`, which could be
>> confusing
>
> Originally I was going to make this to mean 'inferred', but
> it's better if everything gets inferred by default.
>
> It needs to mean something, so got an alternative?
Maybe add a special case for something like `@escape(false)`?
More information about the dip.ideas
mailing list