#ifndef SMP_H
#define SMP_H
-/* THREADED_RTS is currently not compatible with the following options:
- *
- * PROFILING (but only 1 CPU supported)
- * TICKY_TICKY
- * Unregisterised builds are ok, but only 1 CPU supported.
- */
-
#if defined(THREADED_RTS)
-#if defined(TICKY_TICKY)
-#error Build options incompatible with THREADED_RTS.
-#endif
-
/* ----------------------------------------------------------------------------
Atomic operations
------------------------------------------------------------------------- */
-#if !IN_STG_CODE
-// We only want write_barrier() declared in .hc files. Defining the
-// other inline functions here causes type mismatch errors from gcc,
-// because the generated C code is assuming that there are no
-// prototypes in scope.
+#if !IN_STG_CODE || IN_STGCRUN
+// We only want the barriers, e.g. write_barrier(), declared in .hc
+// files. Defining the other inline functions here causes type
+// mismatch errors from gcc, because the generated C code is assuming
+// that there are no prototypes in scope.
/*
* The atomic exchange operation: xchg(p,w) exchanges the value
Implementations
------------------------------------------------------------------------- */
-#if !IN_STG_CODE
+#if !IN_STG_CODE || IN_STGCRUN
-/*
- * NB: the xchg instruction is implicitly locked, so we do not need
- * a lock prefix here.
- */
EXTERN_INLINE StgWord
xchg(StgPtr p, StgWord w)
{
#if i386_HOST_ARCH || x86_64_HOST_ARCH
result = w;
__asm__ __volatile__ (
+ // NB: the xchg instruction is implicitly locked, so we do not
+ // need a lock prefix here.
"xchg %1,%0"
:"+r" (result), "+m" (*p)
: /* no input-only operands */