This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Inheritance of gfc_symbol / gfc_component


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]