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

Hans-Peter Diettrich DrDiettrich1 at aol.com
Wed Dec 28 06:28:24 CET 2011


Skybuck Flying schrieb:

> My assumptions for this idea are:
>  
> 1. Pointers to classes are mostly stored on the heap, in slow RAM.

What's fast RAM?

> 2. Nested/delegated classes incur a pointer access penalty, the deeper 
> the nesting the higher the penalty.

Why? Nested classes are not a problem in OPL, more in C++ (multiple 
inheritance!).

> 3. Pointers are rarely if ever stored in constant values in the 
> instruction encoding ?? Could you give an example of a “constant pointer 
> in an instruction” ?

E.g. address of a non-virtual method.

> 4. Pointers are probably frequently pushed out of data cache by other data.

More frequently than what? A pointer can be used to access multiple 
(different) items, so that pointers are more frequently used than other 
data.

> 5. CPUs/GPUs do not have pointer caches yet or anything else that 
> detects data as being pointers ?!

This indicates that there exists no need or no chance to improve the 
current design.

> 6. And finally the pointer cache would speed up Free Pascal/Delphi 
> application execution speed because of less stalls for pointer 
> retrieval. (Free Pascal/Delphi could then rival C/C++ or perhaps even 
> exceed it because of other smart Delphi features like Strings (no null 
> terminator searching required)).
>  
> Are these assumptions valid ?

Not really. Pointers rarely are used by themselves, instead they are 
mostly used to access data in other memory areas (pointed to). It's more 
important to keep related data together, e.g. in the same memory page.

DoDi




More information about the fpc-devel mailing list