Date: Sun, 18 Aug 2002 17:05:00 -0700 (PDT) From: Julian Elischer <julian@elischer.org> To: Matthew Dillon <dillon@apollo.backplane.com> Cc: Ian Dowse <iedowse@maths.tcd.ie>, Bruce Evans <bde@zeta.org.au>, arch@FreeBSD.ORG Subject: Re: Solving the stack gap issue Message-ID: <Pine.BSF.4.21.0208181659440.42036-100000@InterJet.elischer.org> In-Reply-To: <200208181933.g7IJXYC5072982@apollo.backplane.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 18 Aug 2002, Matthew Dillon wrote: > I would consider this to be more expensive: > > proc1() > { > struct thread *td = curthread; > ... > proc2(td) > } > > proc2(td) > { > ... > } > > And this to be less expensive: > > proc1() > { > proc2(); > } > > proc2() > { > struct thread *td = curthread; > > ... use td several times ... > } yes but what about: proc1() { struct thread *td = curthread; ... someotherfn(td) proc2(td) } proc2(td) { ... ... use td several times ... } vs proc1() { struct thread *td = curthread; ... someotherfn(td) proc2() } proc2() { struct thread *td = curthread; ... ... use td several times ... } so that proc1 needs td anyhow.. > > At least for I386. Ultimately I think this will be generally true on > any architecture. If a procedure uses 'curthread' multiple times loading > it into a local at the top of the procedure should be a sufficient > optimization. Passing td around to dozens or hundreds of procedures > just for the sake of avoiding accessing 'curthread' is bad design. > > -Matt > Matthew Dillon > <dillon@backplane.com> > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0208181659440.42036-100000>