lkml.org 
[lkml]   [2008]   [Aug]   [21]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateThu, 21 Aug 2008 19:21:40 +0300
FromAvi Kivity <>
SubjectRe: [ANNOUNCE] mdb: Merkey's Linux Kernel Debugger 2.6.27-rc4 released
Peter Zijlstra wrote:
> Not sure - I think all barrier clobber the full register and memory set.
> So if you access a variable after a barrier it will have to issue a
> load.
> 

IIRC a barrier only clobbers memory.  gcc must reload a variable from 
memory unless it can prove the variable's address has not escaped anywhere.

So:

void f()
{
    int v;
    v = g();
    barrier();
    do_domething_with(v);
}
Need not reload v from memory (indeed, v can be in a register for its 
entire lifetime), but

void f()
{
    int v;
    v = g();
    h(&v);
    barrier();
    do_domething_with(v);
}
Will force v into memory, and reload it after the barrier.

-- 
error compiling committee.c: too many arguments to function



\
 
 \ /
  Last update: 2008-08-21 18:25    [from the cache]
©2003-2008