[fpc-devel] Re: Comparison FPC 2.6.2 - Kylix 3

Mattias Gaertner nc-gaertnma at netcologne.de
Mon Mar 4 14:48:43 CET 2013


On Mon, 4 Mar 2013 14:37:40 +0100 (CET)
Daniƫl Mantione <daniel.mantione at freepascal.org> wrote:

> 
> 
> Op Mon, 4 Mar 2013, schreef Mattias Gaertner:
> 
> > Can this be cached?
> > Maybe the compiler can reuse some results?
> 
> No. The symtable lookups can be parsed, but the candidate selection, which 
> I believe is actually more compute intensive, is dependend on the actual 
> situation where the operator is called, for example the types of the left 
> and right part, which would not yield very high hit rates.

Why not?
I guess that a high percentage are only a few type,operator,type
combinations.

 
> Originally the compiler was doing the candidate selection with a simple 
> loop through the parameters that took the first suitable match. When the 
> type conversion matters became more complex the "Unable to determine 
> overloaded procedure" error became increasingle annoying.
> 
> At some point I did redesign it with scoring system: Each candidate that 
> is compatible gets assigned a score how well the overloaded procedure 
> matches the parameters. The best match is selected.
> 
> At that point, the compiler became highly intelligent in finding the 
> correct overloaded procedure/operator, but the amount of computing power 
> involved with overloading went up: Instead of selecting the first 
> candidate, we need to compute the score for all candidates. This even 
> requires floating point arithmetic.

Yes, it really helped. Nice work.

I'm just wondering why these scores should be different for each
operator in a unit.

Mattias



More information about the fpc-devel mailing list