You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When creating Variable nodes for members of derived types, say in a subroutine's body, we use a mechanism to infer the parent symbol and then the type information from the parent:
This uses TypedSymbol.variable_map, which in turn invokes TypedSymbol.variables. The latter creates symbols for all variables declared in a derived type, with the correct scope (i.e., the parent's scope) attached. This ensures we have the correct type information in the local scope's type table for derived type members:
However, this can become costly for large nested derived types (e.g., my%very%deeply%nested%derived%type%var), where it will trigger this expansion for every intermediate symbol. While imho the mechanism of TypedSymbol.variables itself is correct and should remain as is, we should have a secondary mechanism which will allow to look up the relevant type information and instantiate only the required symbol.
This has been discovered as part of #242 and been flagged explicitly here: #242 (comment)
The text was updated successfully, but these errors were encountered:
When creating
Variable
nodes for members of derived types, say in a subroutine's body, we use a mechanism to infer the parent symbol and then the type information from the parent:loki/loki/expression/symbols.py
Lines 875 to 889 in 970e0b6
This uses
TypedSymbol.variable_map
, which in turn invokesTypedSymbol.variables
. The latter creates symbols for all variables declared in a derived type, with the correct scope (i.e., the parent's scope) attached. This ensures we have the correct type information in the local scope's type table for derived type members:loki/loki/expression/symbols.py
Lines 278 to 307 in 970e0b6
However, this can become costly for large nested derived types (e.g.,
my%very%deeply%nested%derived%type%var
), where it will trigger this expansion for every intermediate symbol. While imho the mechanism ofTypedSymbol.variables
itself is correct and should remain as is, we should have a secondary mechanism which will allow to look up the relevant type information and instantiate only the required symbol.This has been discovered as part of #242 and been flagged explicitly here: #242 (comment)
The text was updated successfully, but these errors were encountered: