Examples of DFA
Walter Bright
newshound2 at digitalmars.com
Tue Sep 23 06:44:42 UTC 2025
In order to do @nogc DFA, the following is a start:
1. construct an array of all the functions
2. each function gets allocated a bit vector with one bit for each function in (1)
3. each of those (2) bit vectors gets a corresponding bit set for every function
that is called
4. a single bit vector gets a bit set for every function that does a gc operation
5. loop through all the bit vectors, and every function that calls a function
that has a bit set in (4) also gets a bit set in (4)
6. keep looping until no more changes in (4)
7. mark all the functions that don't have a bit set as @nogc
Pruning of the number of functions that need a bit can be done by not
considering any functions already marked as @nogc, and functions that only call
@nogc functions and don't do any other allocations can be eagerly marked @nogc.
More information about the Digitalmars-d
mailing list