Re: thread static

mercier@cinenet.net (Bob Mercier)
Thu, 24 Aug 1995 04:31:50 GMT

          From comp.compilers

Related articles
[3 earlier articles]
Re: thread static stefan.monnier@epfl.ch (Stefan Monnier) (1995-08-21)
Re: thread static pardo@cs.washington.edu (1995-08-21)
Re: thread static Roger@natron.demon.co.uk (Roger Barnett) (1995-08-21)
Re: thread static pardo@cs.washington.edu (1995-08-21)
Re: thread static mfinney@inmind.com (1995-08-22)
Re: thread static erik@kroete2.freinet.de (1995-08-22)
Re: thread static mercier@cinenet.net (1995-08-24)
Re: thread static meissner@cygnus.com (Michael Meissner) (1995-08-24)
Re: thread static stefan.monnier@epfl.ch (Stefan Monnier) (1995-08-28)
Re: thread static johnr@numega.com (1995-08-28)
| List of all articles for this month |

Newsgroups: comp.compilers
From: mercier@cinenet.net (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 (pardo@cs.washington.edu) wrote:
: >Michael McNamara <mac@verilog.com, mac@giraffe.asd.sgi.com> wrote:
: >>[Dedicating a register to point to the thread hurts register allocation.]


: Stefan Monnier <stefan.monnier@epfl.ch> 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...


Bob
[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.