Inheritance of gfc_symbol / gfc_component
Tobias Burnus
burnus@net-b.de
Thu Aug 16 13:48:00 GMT 2012
On 08/16/2012 02:59 PM, Tobias Schlüter wrote:
> A place where C++ inheritance is a trivial improvement is the
> red-black tree used for storing various objects (gfc_symtree,
> gfc_gsymbol, gfc_st_label, I think). This is currently implemented
> with macro-based inheritance. It is trivial to replace the macro with
> C++ inheritance, but if one touches this code, it might make more
> sense to do a real job instead and to convert the symbol-keeping code
> to the compiler's hash-table implementation, which as a benefit should
> make the compiler faster by get rid of lots of string comparisons.
Well, most string comparisons in gfortran are of the type ..->name ==
...->name, which is fast. The reason is that those are obtained via
gfc_get_string, which in turn calls:
ident = get_identifier (temp_name);
return IDENTIFIER_POINTER (ident);
Thus, same name == same pointer. (I think in some cases we do call
strcmp even when a normal comparison would do.)
(I haven't carefully looked at the patch and thus cannot comment on it.)
Tobias
More information about the Fortran
mailing list