[fpc-devel] Pointer cache for fast class/pointer access.

Jonas Maebe jonas.maebe at elis.ugent.be
Sun Jan 22 15:10:12 CET 2012


On 22 Jan 2012, at 11:04, Sven Barth wrote:

> Ah... inside the compiler's sources. I thought you meant "the compiler inserts calls to prefetch in specific situations". ^^

It can also do that, if you compile it with -dprefetchnext (at least if that still works, it's been a long time since I implemented and tried that). In that case, it will look for constructs like this:

while assigned(hp) do
  begin
    ...
    hp:=hp^.next;
  end;

and it will insert prefetch instructions like this:

while assigned(hp) do
  begin
    prefetch(hp^.next^);
    ...
    hp:=hp^.next;
  end;

I don't remember exactly, but I think it will also consider class fields as implicit pointers and insert the transformation there. At least for the compiler cycle this optimization does not change anything though.


Jonas


More information about the fpc-devel mailing list