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

From: forsyth@cal... forsyth@cal...
Subject: [9fans] TAS
Date: Sat, 19 Jun 1999 12:52:43 BST

>>architecture for example, it seems TAS maps onto a `swap' instruction,
>> ...
>>Why implement tas() as a function, rather than do what it does inline.

it needs to use an instruction that guarantees interlock (on a multiprocessor)
and i assume `swap' does that on the sparc.  the instruction needed will be
peculiar to an architecture, hence it's found in a platform-dependent
function separate from the portable code.  the linkers are in a position to
inline things if need be (and do actually do some code shuffling as it is,
though not perhaps in this case -- i haven't looked).