The following functions where changed to make use of the kernel helper
kuser_cmpxchg:
InterLockedDecrement
InterLockedIncrement
InterLockedExchangeAdd
InterLockedCompareExchange
The previous implementation using a spinlock had a couple of drawbacks:
1.) The functions could not be used safely on values not completly managed
by the process itself, because the spinlock did not protect data but the
functions. For example, think about two processes using shared memory.
They would not be able to share fpc_system_lock, making it unsafe to use
these functions.
2.) With many active threads, there was a high chance that the scheduler
would interrupt a thread while fpc_system_lock was taken, which would
result in the following threads using one of these functions to spinlock till
the end of its timeslice. This could result in unwanted and unnecessary
latencies.
3.) Every function contained a pointer to fpc_system_lock. Resulting in
two polluted DCache-Lines per call and possible latencies through dcache
misses.
The new implementation only works on Linux Kernel >= 2.6.16
The functions are implemented in a way which tries to minimize cache pollution
and load latencies.
Even without Multithreading the new functions are a lot faster. I've did
comparisons on my Kirkwood 1.2GHz with the following template code:
var X: longint;
begin
X := 0;
while X < longint(100*1000000) do
FUNCTION(X);
Writeln(X);
end.
Function New Old
InterLockedIncrement: 0m3.696s 0m23.220s
InterLockedExchangeAdd: 0m4.034s 0m23.242s
InterLockedCompareExchange: 0m4.703s 0m24.006s
This speedup is most probably because of the reduced memory access,
which resulted in lots of cache misses.
git-svn-id: trunk@20491 -
in a compilation module parsed using a different code page, because this
changes the default ansistring type and {$codepage xxx} is also not
allowed in the middle of a unit (mantis #21445)
git-svn-id: trunk@20488 -
(mantis #21323)
* don't print a message about the ppc binary exiting with an error if no
source file is specified (if a no option or -h is used, the help message
will be printed; in other cases, a source file may not have been specified
but that's an error like any other in that case -- that message only
existed because the compiler binary also exits with a non-zero exit code
in case the help is printed)
- removed alpha and ia64 support for selecting ppc binary
+ added mips and mipsel support for selecting ppc binary
git-svn-id: trunk@20487 -
if expr1 has sideeffects. This can't be done safely even in case of
short boolean evaluation, because expr1 may return the inverse the
second time its called (and "0 or 1" is not the same as "0", and
neither is "1 and 0"), based on comment by Michael Karcher
* perform a full string compare when comparing stringconstnodes
before the string constant labels have been generated (patch by
Michael Karcher, mantis #21255)
git-svn-id: trunk@20485 -
Pierre's regen of the makefile with a newer fpcmake probably didn't
propagate indirect dependencies (through CHM) on these packages as a
result of the fpmake system.
git-svn-id: trunk@20450 -