Segment Register use penalty?



I'm using Thread Local Storage (TLS_...) under the Win32 API extremely
heavily.
It is accessible via the FS: pointer.

On a number of occasions, I can either compute the address of
an TLS variable and manipulate it directly:
mov edi,FS:[TIB_ADDRESS] ; get address of thread information
block
lea edi,tlsvar+TLS_OFFSET[edi]
<code modifying 0[edi] several times>
mov 0[edi],...
...
mov ...,0[edi]

or I can manipulate the tlsvar directly, an equal number of times:
mov FS:[tlsvar+TLS_OFFSET],...
....
mov ...,FS:[tlsvar+TLS_OFFSET],...

Is there an execution penalty to using the FS: register several times?
What is the penalty?

I mostly only care about running on x64 machines
from this point on. (I expect to be moving this code
to 64 bit world, but for the moment I'm stuck for legacy
reasons with 32 bit code, even in this 64 bit world).

--
Ira Baxter
www.semanticdesigns.com

.



Relevant Pages

  • Re: wm_message
    ... invoke the dialog with DoModal, and if it exits with IDOK, I will obtain the values from ... void GetParameters; ... I try to avoid ever having a pointer to a document in a dialog. ... If you want to be able to manipulate the object in both the dialog and the document, ...
    (microsoft.public.vc.mfc)
  • Re: wm_message
    ... Well I have decided to initialize the pointers from the view without using ... messaging. ... I try to avoid ever having a pointer to a document in a dialog. ... If you want to be able to manipulate the object in both the dialog and the document, ...
    (microsoft.public.vc.mfc)
  • Re: Pointer operations
    ... > Macca wrote: ... This pointer is of type Class B and does various data processing. ... is a variable in Class B that i want to be able to manipulate from another ... then you will need to protect the variable with ...
    (microsoft.public.vc.mfc)
  • Re: Adding the ability to add functions into structures?
    ... Wouldn't it be useful to also have the ability to collect variable and functions? ... methods to manipulate the objects. ... structure using a pointer to a function, ... When you create the object, you save the pointer to the "ADD" function then you assign a pointer to a new function "Add1", and store it in the same place: ...
    (comp.lang.c)