lkml.org 
[lkml]   [2000]   [Jan]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: (*(unsigned long *)&jiffies)++;
Date
On Thu, 06 Jan 2000, Richard B. Johnson wrote:
> On Thu, 6 Jan 2000, Tigran Aivazian wrote:
>
> > Hi,
> >
> > Why does do_timer() do:
> >
> > (*(unsigned long *)&jiffies)++;
> >
> > why not just jiffies++; ? It works fine with jiffies++ but I assume there
> > is a reason...
> >
> > Thanks,
> > Tigran.
> >
>
> It looks to me like there was an attempt to prevent the 'C' compiler
> from doing:
>
> movl jiffies, %eax ! Read
> incl %eax ! Modify
> movl %eax, jiffies ! Write back
>
> ....and such attempts are rarely sucessful.
>
> Ideally, you'd want:
> incl jiffies
>
> ...and you'd have to do it in assembly to make sure the next 'C' compiler
> ddoesn't out-guess you.
>

AFAIK the generated code is the same on intel.
Having a single instruction to increment a memory location ( in any
architecture ? ) why the compiler should split the operation ?

Cheers,
Davide.

--
"Debian, the freedom in freedom."


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:55    [W:0.096 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site