Introduce a New DRuntime Hook Lowering Pass to Unify the Logic for All Hooks

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Thu Feb 8 15:08:05 UTC 2024


On 09/02/2024 3:58 AM, Teodor Dutu wrote:
> Hence what I am proposing as a global solution to both a and b and also 
> applicable to other hooks is to create another pass just for lowering, 
> after semantic analysis has finished and has produced a definitive AST. 
> This will provide a unified place to introduce all DRuntime lowerings, 
> thus leading to more readable and maintainable code in the long run. 
> Traversing the AST in this manner will hurt performance, which is why it 
> would be enough to just store the nodes that require lowerings in an 
> array so that this new pass just iterates this much smaller array 
> instead of the whole AST.

It might be a good idea to question if a linked list wouldn't be a 
better solution than an array to store the nodes.

It depends how often lowering has to take place. If its often then the 
extra ram usage would be worth the linked list.


More information about the Digitalmars-d mailing list