Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2008-02

membar instruction

6 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Micha Nelissen
to Dariusz Mazur
Dariusz Mazur wrote
Hi is there in FPC a membar instruction, like #StoreLoad macro or smp_mb();

ReadBarrier, ReadDependencyBarrier, ReadWriteBarrier, WriteBarrier; in system unit.

and second need instruction is NOOP

Don't know about this one, can't you use a do nothing loop?

Micha

Reply by email

Dariusz Mazur
to Micha Nelissen

Micha Nelissen pisze:

Show quoted text 9 lines
Dariusz Mazur wrote: > Hi > is there in FPC a membar instruction, like #StoreLoad macro or smp_mb(); > ReadBarrier, ReadDependencyBarrier, ReadWriteBarrier, WriteBarrier; in system unit.

thx

Show quoted text 6 lines
> and second need instruction is NOOP > Don't know about this one, can't you use a do nothing loop?

in spin-lock there is NOOP used, I think that is instruction, that every processor do nothing but not avoid (duration is very small but not zero)

Darek

Reply by email

Micha Nelissen
to Dariusz Mazur
Dariusz Mazur wrote
> Don't know about this one, can't you use a do nothing loop? > in spin-lock there is NOOP used, I think that is instruction, that every processor do nothing but not avoid (duration is very small but not zero)

Why do you use a NOP in a spin-lock?

Micha

Reply by email

Dariusz Mazur
to Micha Nelissen

Micha Nelissen pisze:

Show quoted text 11 lines
Dariusz Mazur wrote: >> Don't know about this one, can't you use a do nothing loop? >> >> > in spin-lock there is NOOP used, I think that is instruction, that every > processor do nothing but not avoid (duration is very small but not zero) > Why do you use a NOP in a spin-lock?

its only exaple form sparc manual, I need (I want to test) it to in my FIFO algo.

form SPARCV9.PDF:

LockWithLDSTUB(lock)
retry:
ldstub [lock],%l0
tst %l0
be out
nop
loop:
ldub [lock],%l0
tst %l0
bne loop
nop
ba,a retry
out:
membar #LoadLoad | #LoadStore
UnLockWithLDSTUB(lock)
membar #StoreStore !RMO and PSO only
membar #LoadStore !RMO only
stub %g0,[lock]

Example 7---Lock and Unlock Using LDSTUB

Darek

Reply by email