[fpc-devel] Peephole optimizer tai class change proposals
Jonas Maebe
jonas at freepascal.org
Tue Oct 5 20:54:47 CEST 2021
On 03/10/2021 23:32, J. Gareth Moreton via fpc-devel wrote:
> One drawback I've noticed is that there's no clean way to free the
> optinfo pointer when the tai object is destroyed,
The best way to handle this is by allocating the optinfo's from a pool
(linked list of more or less arrays of whatever your TOptinfo type is),
storing the pointers to the pool entries in the field, and free the
entire pool in one go when done. Don't bother with freeing entries of
removed instructions to reuse for added instructions, since not that
many instructions get added and that would result in extra complexity
and overhead for very little memory gain.
> plus there's the
> danger of the pointer being used as a plain integer instead of pointing
> to an actual structure
Such a change to the compiler would/should never be accepted.
Jonas
More information about the fpc-devel
mailing list