9fans archive / 1999 / 06 / 44 /    prev next

From: Nigel Roles ngr@sym...
Subject: [9fans] TAS
Date: Sat, 19 Jun 1999 10:20:42 +0100

Why implement as a call? Because inlining is not supported by the compiler,
and
anyway the instruction sequence has a very strong chance of being cached as
it is
used a lot, so performance is not really an issue.

Does this make it less atomic? No. The assembler instruction is just as
atomic as
it was before. This is all that matters. 

-----Original Message-----
From: pip [mailto:pip@cpu...]
Sent: Friday, June 18, 1999 5:56 PM
To: 9fans@cse...
Subject: [9fans] TAS



My brief perusal of the source seems to indicate that tas(), called in 
sys/src/9/port/taslock.c, is implemented in the architecture specific l.s.
There it seems, we splhi then issue a TAS instruction. For the SPARC
architecture for example, it seems TAS maps onto a `swap' instruction,
going from the plan9 asm to the underlying V8 asm, or something along
those lines.

Why implement tas() as a function, rather than do what it does inline.
Does the additional overhead of doing a function call make this act less
atomic ?