That seems fair - thanks for the advice Jonas.  Now I just have to decide where best to store this linked list of records. I'm sensing the best place would be the TAsmOptimizer object that gets created and released with each procedure that's optimised, if I remember correctly.

Gareth aka. Kit

On 05/10/2021 19:54, Jonas Maebe via fpc-devel wrote:
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
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


--
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to