Re: thread static (Bob Mercier)
Thu, 24 Aug 1995 04:31:50 GMT

          From comp.compilers

Related articles
[3 earlier articles]
Re: thread static (Stefan Monnier) (1995-08-21)
Re: thread static (1995-08-21)
Re: thread static (Roger Barnett) (1995-08-21)
Re: thread static (1995-08-21)
Re: thread static (1995-08-22)
Re: thread static (1995-08-22)
Re: thread static (1995-08-24)
Re: thread static (Michael Meissner) (1995-08-24)
Re: thread static (Stefan Monnier) (1995-08-28)
Re: thread static (1995-08-28)
| List of all articles for this month |

Newsgroups: comp.compilers
From: (Bob Mercier)
Keywords: parallel, architecture, 386, comment
Organization: Cinenet Communications,Internet Access,Los Angeles;310-301-4500
References: 95-08-078 95-08-159
Date: Thu, 24 Aug 1995 04:31:50 GMT

David Keppel ( wrote:
: >Michael McNamara <,> wrote:
: >>[Dedicating a register to point to the thread hurts register allocation.]

: Stefan Monnier <> writes:
: >Registers are not *that* scarce !

: A huge fraction of the machines people use every day are 80x86-family
: machines, which have maybe 8 general-purpose 32-bit registers. With
: %ESP used as a stack pointer, you're down to seven; you need about two
: registers for short-lived temporaries, leaving you with five; some
: operations always place their result in a particular register,
: complicating register allocation further. Bottom line: registers can
: be scarce.

We did a nifty trick for the threads library on Solaris/x86 that used
one of the (often unused) extra segment registers. When the thread is
created a new ldt entry is allocated and the segment value is stored
in %gs. While it incurs a memory reference each thread can reference its
thread pointer via %gs:0, very convenient and it saved using a register.

This technique could easily extend to thread specific data, simply have
the compiler generate code for TSD via offsets from %gs and have the
runtime system allocate an appropriately sized block when the thread
is created...

[That's the first actual use I've ever heard of for the GS register. -John]

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.