[m-rev.] for post-commit review: Fix compatibility issues for the low-level C parallel grades.
Julien Fischer
juliensf at csse.unimelb.edu.au
Tue Mar 23 16:31:12 AEDT 2010
On Mon, 22 Mar 2010, Paul Bone wrote:
> Branches: main, 10.04
>
> Fix a number of errors and warnings in the runtime picked up by GCC 4.x in
> parallel and threadscope grades.
>
> We had been using types with the wrong signedness well calling atomic operations.
> GCC 4.x also picked up an error where #elif was used instead of #else.
>
> While testing these changes on a 32bit system more bugs where found on the i386
> architecture and on AMD brand processors.
>
> runtime/mercury_atomic_ops.h:
> runtime/mercury_atomic_ops.c:
> Add unsigned variants of the following atomic operations:
> increment,
> add,
> add_and_fetch,
> dec_and_is_zero,
>
> Add a signed variant for compare and swap.
>
> Rename the MR_atomic_dec_<type>_and_is_zero operation to move the type to
> the end of the name.
>
> Use volatile storage in the MR_Stats structure.
>
> A 32bit machine cannot do atomic operations on 64bit values and MR_Stats
> must use 64bit values. Therefore 64bit values in the MR_Stats structure
> are now protected by a lock on 32bit machines.
>
> runtime/mercury_atomic_ops.h:
> Fix a typeo in the i386 version of MR_atomic_dec_and_is_zero_uint().
>
> runtime/mercury_atomic_ops.c:
> AMD CPUs do not conform to Intel's specification for being able to
> extract the CPU clock speed from the brand string. When we cannot
> determine the CPU's clock speed then we write out threadscope
> timestamps in raw clock cycles rather than nanoseconds.
>
> On i386 machines the ebx register is used to implement PIC code,
> however the CPUID instruction uses it to output information. Save
> this register on C's stack while we issue CPUID and retrieve the
> result in ebx.
>
> We now pass native machine sized values to the inline assembler code
> that implements RDTSC and RDTSCP.
>
> Fix commenting style in some places.
>
> runtime/mercury_atomic_ops.c:
> Fix some incorrect C preprocessor code for conditional compilation.
>
> runtime/mercury_grade.h:
> Increment binary compatibility number. This should have been done in a
> prior change when the MR_runnext macro changed which broke binary
> compatibility in the parallel low-level C grades.
>
> runtime/mercury_context.h:
> In MR_SyncTerm_Struct use an unsigned value for the number of conjuncts
> remaining before the conjunction is complete.
>
> runtime/mercury_threadscope.c:
> Record raw cpu clock ticks rather than milliseconds when we don't
> know the processor's clock speed.
>
> runtime/mercury_context.c:
> runtime/mercury_wsdeque.h:
> runtime/mercury_wsdeque.c:
> Conform to changes in mercury_atomic_ops.h
The diff looks okay, although I wonder whether the use of the prefixes
_int and _uint might end up causing confusion between C's int type and
MR_Integer etc.
I would also be interested to now if this fixes the problems with
none.par.gc on eris.
Julien.
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to: mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions: mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the reviews
mailing list