[fpc-devel] OO rewrite - technical questions

Hans-Peter Diettrich DrDiettrich1 at aol.com
Sat Jul 24 17:12:35 CEST 2010

Nikolai Zhubr schrieb:

>> IMO the segment register is used implicitly in thread API calls, with
>> no further use by application code.
> Exactly the opposite (at least delphi on windows). See delphi's RTL.

Well, once it's set by the OS, it can be used in hackery ;-)

> In such case of course fs/gs will not map to the same flat address 
> segment (as cs, ds, es, ss) common for the whole process and all of its 
> threads.

I doubt that this address range really is excluded from the 4GB app 
address space, accessible through the other segment registers.

>> Consider a threadvar as a field of a related thread object (instance).
> This might be fine most of the time (for end user in particular), 
> however there still might be some non-OO code which it is 
> impossible/impractical to convert into object-oriented model. See FPC RTL.

Where exactly should I look?

In the meantime I found one possible use for threadvars: when some 
subroutine can be called from different threads, it may want to retrieve 
the thread context, e.g. the thread object itself. Right?


More information about the fpc-devel mailing list