Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

re: CVS commit: src/sys/arch/sparc



> >Modified Files:
> >     src/sys/arch/sparc/dev: if_ie_obio.c kd.c tctrl.c ts102.c
> >     src/sys/arch/sparc/include: pmap.h
> >     src/sys/arch/sparc/sparc: cpuvar.h memecc.c timer.c
> >
> >Log Message:
> >- remove unused but set variables.
> >- use __USE() where necessary.
> >- remove useless 'volatile' markers
> 
> I am not sure that those volatile markers are useless.
> 
> For example:
> 
> > #define raise_ipi(cpi,lvl)  do {                    \
> >-    volatile int x;                                 \
> >+    int x;                                          \
> >     (cpi)->intreg_4m->pi_set = PINTR_SINTRLEV(lvl); \
> >-    x = (cpi)->intreg_4m->pi_pend;                  \
> >+    x = (cpi)->intreg_4m->pi_pend; __USE(x);        \
> > } while (0)
> 
> I think that the change from the use of volatile to the use of 
> __USE() is a change from reliance on the C standard's guarantee 
> that the memory location behind (cpi)->intreg_4m->pi_pend really 
> will be accessed, to a reliance on what a particular compiler 
> happens to do in this situation.

the volatile applies to the access to pi_pend, which is
marked a volatile (via the whole intreg_4m pointer.)

i'm not sure that "volatile int x;" actually means
anything useful.  it's pointer accesses that matter.
i could be wrong; volatile is a pretty tricky area.

certainly, the generated code is fine (and in most
cases, identical).


.mrg.


Home | Main Index | Thread Index | Old Index