This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gomp slowness


skaller <skaller@users.sourceforge.net> writes:

> On Fri, 2007-11-02 at 10:29 -0700, Ian Lance Taylor wrote:
> > skaller <skaller@users.sourceforge.net> writes:
> > 
> > > On Fri, 2007-11-02 at 07:39 -0700, Ian Lance Taylor wrote:
> > > > skaller <skaller@users.sourceforge.net> writes:
> > > 
> > > > In a C executable, TLS requires one extra machine register.  
> > > 
> > > You mean gcc?
> > 
> > I don't understand the question.  I mean in a C/C++ executable which
> > uses TLS.  By TLS I mean __thread, not pthread_get_specific.  In the
> > GNU/Linux world, TLS conventionally means specifically __thread.
> 
> I see why you didn't understand the question .. you're so buried
> in gcc world C=gcc .. whereas for me C=ISO Standard, any compiler.
> TLS = __thread jargon noted, thanks (for me, TLS meant both
> generic 'storage local to a thread=the stack' or 'posix',
> not __thread which is a gcc extension).

I am familiar with other compilers.  TLS (__thread) is not specific to
gcc.  In fact, it was invented by Sun, and first implemented in their
compiler.


> > It only costs a register for code which accesses a TLS variable, of
> > course.
> 
> What do you mean 'code'? Do mean individual function? If so,
> how is the register loaded? 

It depends on the processor.

On the x86 and x86_64 a segment register is used.  The segment
register is set by the OS when context switching to the thread.  (As
mentioned downthread, segment registers are special in the hardware
and are not available for general compiler use.)


> > It's just not plausible to say that a C/C++ program should be written
> > without static variables.  
> 
> Rubbish:) 30 years of programming, never used one in serious code
> unless some brain dead API forced it.

Those brain dead APIs are the ones the rest of us actually work with
every day.  If you can disregard them, that's fine.  The rest of us
will continue to operate in the real world.  Nobody is forcing you to
use TLS for anything at all, so you can continue to ignore it.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]