Added support for Sun Studio 12 C compiler.

build:
  - configure step will generate relevant CFLAGS.
  - build profiles are for convenience (developers can use themu
    for cross-compilation).

regressions:
  - Renamed ck_barrier unit tests to work-around behavior
    of Solaris linker.
  - Adopted use of a PTHREAD_CFLAGS variable.

ck_cc:
  - Added internal CK_CC_IMM macro for compilers that are
    verbose against impossible inline constraints (or limited
    optimizers).

ck_pr/x86*:
  - Adopted CK_CC_IMM macro.
  - Dropped redundant constraints.

This work was mostly completed by Theo Schlossnagle
<jesus@omniti.com>, much thanks to him. He has
also provided access to a machine with Sun Studio 12.
ck_pring
sbahra 14 years ago
parent 2754038882
commit 49a2820000

10
.gitignore vendored

@ -7,11 +7,11 @@ build/regressions.build
*.so
*.dSYM
regressions/ck_barrier/benchmark/throughput
regressions/ck_barrier/validate/ck_barrier_centralized
regressions/ck_barrier/validate/ck_barrier_combining
regressions/ck_barrier/validate/ck_barrier_dissemination
regressions/ck_barrier/validate/ck_barrier_mcs
regressions/ck_barrier/validate/ck_barrier_tournament
regressions/ck_barrier/validate/barrier_centralized
regressions/ck_barrier/validate/barrier_combining
regressions/ck_barrier/validate/barrier_dissemination
regressions/ck_barrier/validate/barrier_mcs
regressions/ck_barrier/validate/barrier_tournament
regressions/ck_bytelock/benchmark/latency
regressions/ck_bytelock/validate/validate
regressions/ck_epoch/validate/ck_stack

@ -7,13 +7,13 @@ HEADERS=@HEADERS@
PKGCONFIG_DATA=@LIBRARY@/pkgconfig
all:
make -C src all || exit
$(MAKE) -C src all || exit
@echo
@echo
@echo ---[ Concurrency Kit has built successfully. You may now \"make install\".
regressions:
make -C regressions all || exit
$(MAKE) -C regressions all || exit
@echo ---[ Regressions have built successfully.
install: all
@ -39,8 +39,8 @@ uninstall:
rm -f $(PKGCONFIG_DATA)/ck.pc
clean:
make -C src clean
make -C regressions clean
$(MAKE) -C src clean
$(MAKE) -C regressions clean
rm -f *~ *.o
distribution: clean

@ -1,5 +1,7 @@
CC=@CC@
MAKE=make
CFLAGS=-D_XOPEN_SOURCE=600 -D_BSD_SOURCE -I../include -std=gnu99 -pedantic -Wall -W -Wundef -Wendif-labels -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wdisabled-optimization -fstrict-aliasing -O2 -pipe -Wno-parentheses @CFLAGS@
CFLAGS=@CFLAGS@ -I../include
LDFLAGS=@LDFLAGS@
LD=@LD@
include ../build/ck.build.@PROFILE@

@ -1,5 +1,8 @@
CC=@CC@
MAKE=make
CFLAGS=-D_XOPEN_SOURCE=600 -D_BSD_SOURCE -I../../../include -std=gnu99 -pedantic -Wall -W -Wundef -Wendif-labels -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wdisabled-optimization -fstrict-aliasing -O2 -pipe -Wno-parentheses @CFLAGS@
CFLAGS=@CFLAGS@ -I../../../include
LD=@LD@
LDFLAGS=@LDFLAGS@
PTHREADS_LDFLAGS=@PTHREADS_CFLAGS@
include ../../../build/ck.build.@PROFILE@

34
configure vendored

@ -82,6 +82,9 @@ generate()
-e "s#@HEADERS@#$HEADERS#g" \
-e "s#@LIBRARY@#$LIBRARY#g" \
-e "s#@PREFIX@#$PREFIX#g" \
-e "s#@LD@#$LD#g" \
-e "s#@LDFLAGS@#$LDFLAGS#g" \
-e "s#@PTHREAD_CFLAGS@#$PTHREAD_CFLAGS#g" \
$1 > $2
}
@ -91,7 +94,11 @@ generate_stdout()
echo
echo " PROFILE = $PROFILE"
echo " CC = $CC"
echo " Additional CFLAGS = $CFLAGS"
echo " COMPILER = $COMPILER"
echo " CFLAGS = $CFLAGS"
echo " PTHREAD_CFLAGS = $PTHREAD_CFLAGS"
echo " LD = $LD"
echo " LDFLAGS = $LDFLAGS"
echo
echo "Headers will be installed in $HEADERS"
echo "Libraries will be installed in $LIBRARY"
@ -285,6 +292,7 @@ assert "$PLATFORM" "$PLATFORM" "unsupported"
# Platform will be used as a macro.
PROFILE="${PROFILE:-$PLATFORM}"
PLATFORM="__${PLATFORM}__"
LDFLAGS="-shared -fPIC"
printf "Finding suitable compiler........"
@ -312,8 +320,13 @@ assert "$CC" "not found"
# Make sure GCC 4.X, the only supported compiler, is being used.
cat << EOF > .1.c
#include <stdio.h>
int main(void) {
#if defined(__GNUC__) && (__GNUC__ >= 4)
puts("gcc");
return (0);
#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5110)
puts("suncc");
return (0);
#else
return (1);
@ -322,7 +335,7 @@ int main(void) {
EOF
$CC -o .1 .1.c
./.1
COMPILER=`./.1`
r=$?
rm -f .1.c .1
@ -332,6 +345,23 @@ else
echo "success [$CC]"
fi
if test "$COMPILER" = "suncc"; then
LD=/bin/ld
LDFLAGS="-G"
CFLAGS="-xO5"
PTHREAD_CFLAGS="-mt -lpthread"
elif test "$COMPILER" = "gcc"; then
LD=$CC
LDFLAGS="-shared -fPIC"
CFLAGS="-D_XOPEN_SOURCE=600 -D_BSD_SOURCE -std=gnu99 -pedantic -Wall -W -Wundef" \
"-Wendif-labels -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align" \
"-Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs" \
"-Winline -Wdisabled-optimization -fstrict-aliasing -O2 -pipe -Wno-parentheses"
PTHREAD_CFLAGS="-pthread"
else
assert "" "unknown compiler"
fi
for i in $REQUIRE_HEADER; do
printf "Checking header file usability..."

@ -27,7 +27,7 @@
#ifndef _CK_CC_H
#define _CK_CC_H
#ifdef __GNUC__
#if defined(__GNUC__) || defined(__SUNPRO_C)
#include "gcc/ck_cc.h"
#endif

@ -1,5 +1,5 @@
/*
* Copyright 2009, 2010 Samy Al Bahra.
* Copyright 2009-2011 Samy Al Bahra.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -29,11 +29,15 @@
#include <ck_md.h>
/*
* Suppress unused warnings.
*/
#ifdef __SUNPRO_C
#define CK_CC_UNUSED
#define CK_CC_USED
#define CK_CC_IMM
#else
#define CK_CC_UNUSED __attribute__((unused))
#define CK_CC_USED __attribute__((used))
#define CK_CC_IMM "i"
#endif
/*
* If optimizations are turned on, then force inlining.

@ -96,9 +96,9 @@ CK_PR_FENCE(memory, "mfence")
ck_pr_fas_##S(M *target, T v) \
{ \
__asm__ __volatile__(I " %0, %1" \
: "=m" (*(C *)target), \
: "+m" (*(C *)target), \
"+q" (v) \
: "m" (*(C *)target) \
: \
: "memory"); \
return v; \
}
@ -149,7 +149,7 @@ CK_PR_LOAD_S(8, uint8_t, "movb")
{ \
__asm__ __volatile__(I " %1, %0" \
: "=m" (*(C *)target) \
: "iq" (v) \
: CK_CC_IMM "q" (v) \
: "memory"); \
return; \
}
@ -263,7 +263,7 @@ CK_PR_GENERATE(not)
{ \
__asm__ __volatile__(CK_PR_LOCK_PREFIX I " %1, %0" \
: "+m" (*(C *)target) \
: "iq" (d) \
: CK_CC_IMM "q" (d) \
: "memory", "cc"); \
return; \
}

@ -1,5 +1,5 @@
/*
* Copyright 2009, 2010 Samy Al Bahra.
* Copyright 2009-2011 Samy Al Bahra.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -95,9 +95,9 @@ CK_PR_FENCE(memory, "mfence")
ck_pr_fas_##S(M *target, T v) \
{ \
__asm__ __volatile__(I " %0, %1" \
: "=m" (*(C *)target), \
: "+m" (*(C *)target), \
"+q" (v) \
: "m" (*(C *)target) \
: \
: "memory"); \
return v; \
}
@ -194,7 +194,7 @@ CK_PR_LOAD_2(8, 16, uint8_t)
{ \
__asm__ __volatile__(I " %1, %0" \
: "=m" (*(C *)target) \
: "iq" (v) \
: CK_CC_IMM "q" (v) \
: "memory"); \
return; \
}
@ -311,7 +311,7 @@ CK_PR_GENERATE(not)
{ \
__asm__ __volatile__(CK_PR_LOCK_PREFIX I " %1, %0" \
: "+m" (*(C *)target) \
: "iq" (d) \
: CK_CC_IMM "q" (d) \
: "memory", "cc"); \
return; \
}

@ -1,40 +1,40 @@
.PHONY: all clean
all:
make -C ./ck_spinlock/validate all
make -C ./ck_spinlock/benchmark all
make -C ./ck_fifo/validate all
make -C ./ck_fifo/benchmark all
make -C ./ck_pr/validate all
make -C ./ck_pr/benchmark all
make -C ./ck_barrier/validate all
make -C ./ck_barrier/benchmark all
make -C ./ck_bytelock/validate all
make -C ./ck_bytelock/benchmark all
make -C ./ck_epoch/validate all
make -C ./ck_sequence/validate all
make -C ./ck_stack/validate all
make -C ./ck_stack/benchmark all
make -C ./ck_ring/validate all
make -C ./ck_hp/validate all
make -C ./ck_hp/benchmark all
$(MAKE) -C ./ck_spinlock/validate all
$(MAKE) -C ./ck_spinlock/benchmark all
$(MAKE) -C ./ck_fifo/validate all
$(MAKE) -C ./ck_fifo/benchmark all
$(MAKE) -C ./ck_pr/validate all
$(MAKE) -C ./ck_pr/benchmark all
$(MAKE) -C ./ck_barrier/validate all
$(MAKE) -C ./ck_barrier/benchmark all
$(MAKE) -C ./ck_bytelock/validate all
$(MAKE) -C ./ck_bytelock/benchmark all
$(MAKE) -C ./ck_epoch/validate all
$(MAKE) -C ./ck_sequence/validate all
$(MAKE) -C ./ck_stack/validate all
$(MAKE) -C ./ck_stack/benchmark all
$(MAKE) -C ./ck_ring/validate all
$(MAKE) -C ./ck_hp/validate all
$(MAKE) -C ./ck_hp/benchmark all
clean:
make -C ./ck_spinlock/validate clean
make -C ./ck_spinlock/benchmark clean
make -C ./ck_fifo/validate clean
make -C ./ck_fifo/benchmark clean
make -C ./ck_pr/validate clean
make -C ./ck_pr/benchmark clean
make -C ./ck_barrier/validate clean
make -C ./ck_barrier/benchmark clean
make -C ./ck_bytelock/validate clean
make -C ./ck_bytelock/benchmark clean
make -C ./ck_epoch/validate clean
make -C ./ck_sequence/validate clean
make -C ./ck_stack/validate clean
make -C ./ck_stack/benchmark clean
make -C ./ck_ring/validate clean
make -C ./ck_hp/validate clean
make -C ./ck_hp/benchmark clean
$(MAKE) -C ./ck_spinlock/validate clean
$(MAKE) -C ./ck_spinlock/benchmark clean
$(MAKE) -C ./ck_fifo/validate clean
$(MAKE) -C ./ck_fifo/benchmark clean
$(MAKE) -C ./ck_pr/validate clean
$(MAKE) -C ./ck_pr/benchmark clean
$(MAKE) -C ./ck_barrier/validate clean
$(MAKE) -C ./ck_barrier/benchmark clean
$(MAKE) -C ./ck_bytelock/validate clean
$(MAKE) -C ./ck_bytelock/benchmark clean
$(MAKE) -C ./ck_epoch/validate clean
$(MAKE) -C ./ck_sequence/validate clean
$(MAKE) -C ./ck_stack/validate clean
$(MAKE) -C ./ck_stack/benchmark clean
$(MAKE) -C ./ck_ring/validate clean
$(MAKE) -C ./ck_hp/validate clean
$(MAKE) -C ./ck_hp/benchmark clean

@ -11,5 +11,4 @@ clean:
rm -rf *.dSYM *~ *.o $(OBJECTS)
include ../../../build/regressions.build
CFLAGS+=-D_GNU_SOURCE -pthread
CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE

@ -1,26 +1,26 @@
.PHONY: clean distribution
OBJECTS=ck_barrier_centralized ck_barrier_combining ck_barrier_dissemination ck_barrier_tournament ck_barrier_mcs
OBJECTS=barrier_centralized barrier_combining barrier_dissemination barrier_tournament barrier_mcs
all: $(OBJECTS)
ck_barrier_centralized: ck_barrier_centralized.c ../../../include/ck_barrier.h ../../../src/ck_barrier_centralized.c
$(CC) $(CFLAGS) -o ck_barrier_centralized ck_barrier_centralized.c ../../../src/ck_barrier_centralized.c
barrier_centralized: barrier_centralized.c ../../../include/ck_barrier.h ../../../src/ck_barrier_centralized.c
$(CC) $(CFLAGS) -o barrier_centralized barrier_centralized.c ../../../src/ck_barrier_centralized.c
ck_barrier_combining: ck_barrier_combining.c ../../../include/ck_barrier.h ../../../src/ck_barrier_combining.c
$(CC) $(CFLAGS) -o ck_barrier_combining ck_barrier_combining.c ../../../src/ck_barrier_combining.c
barrier_combining: barrier_combining.c ../../../include/ck_barrier.h ../../../src/ck_barrier_combining.c
$(CC) $(CFLAGS) -o barrier_combining barrier_combining.c ../../../src/ck_barrier_combining.c
ck_barrier_dissemination: ck_barrier_dissemination.c ../../../include/ck_barrier.h ../../../src/ck_barrier_dissemination.c
$(CC) $(CFLAGS) -o ck_barrier_dissemination ck_barrier_dissemination.c ../../../src/ck_barrier_dissemination.c
barrier_dissemination: barrier_dissemination.c ../../../include/ck_barrier.h ../../../src/ck_barrier_dissemination.c
$(CC) $(CFLAGS) -o barrier_dissemination barrier_dissemination.c ../../../src/ck_barrier_dissemination.c
ck_barrier_tournament: ck_barrier_tournament.c ../../../include/ck_barrier.h ../../../src/ck_barrier_tournament.c
$(CC) $(CFLAGS) -o ck_barrier_tournament ck_barrier_tournament.c ../../../src/ck_barrier_tournament.c
barrier_tournament: barrier_tournament.c ../../../include/ck_barrier.h ../../../src/ck_barrier_tournament.c
$(CC) $(CFLAGS) -o barrier_tournament barrier_tournament.c ../../../src/ck_barrier_tournament.c
ck_barrier_mcs: ck_barrier_mcs.c ../../../include/ck_barrier.h ../../../src/ck_barrier_mcs.c
$(CC) $(CFLAGS) -o ck_barrier_mcs ck_barrier_mcs.c ../../../src/ck_barrier_mcs.c
barrier_mcs: barrier_mcs.c ../../../include/ck_barrier.h ../../../src/ck_barrier_mcs.c
$(CC) $(CFLAGS) -o barrier_mcs barrier_mcs.c ../../../src/ck_barrier_mcs.c
clean:
rm -rf *.dSYM *~ *.o $(OBJECTS)
include ../../../build/regressions.build
CFLAGS+=-D_GNU_SOURCE -pthread
CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE

@ -5,10 +5,10 @@ OBJECTS=latency
all: $(OBJECTS)
latency: latency.c
$(CC) $(CFLAGS) -o latency latency.c -pthread
$(CC) $(CFLAGS) -o latency latency.c
clean:
rm -rf *.dSYM *~ *.o $(OBJECTS)
include ../../../build/regressions.build
CFLAGS+=-ggdb -D_GNU_SOURCE
CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE

@ -5,10 +5,10 @@ OBJECTS=validate
all: $(OBJECTS)
validate: validate.c
$(CC) $(CFLAGS) -o validate validate.c -pthread
$(CC) $(CFLAGS) -o validate validate.c
clean:
rm -rf *.dSYM *~ *.o $(OBJECTS)
include ../../../build/regressions.build
CFLAGS+=-D_GNU_SOURCE
CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE

@ -14,4 +14,4 @@ clean:
rm -rf *~ *.o $(OBJECTS) *.dSYM
include ../../../build/regressions.build
CFLAGS+=-pthread -D_GNU_SOURCE
CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE

@ -11,4 +11,4 @@ clean:
rm -rf *~ *.o *.dSYM $(OBJECTS)
include ../../../build/regressions.build
CFLAGS+=-pthread -D_GNU_SOURCE
CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE

@ -20,4 +20,4 @@ clean:
rm -rf *.dSYM *~ *.o $(OBJECTS)
include ../../../build/regressions.build
CFLAGS+=-pthread -D_GNU_SOURCE
CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE

@ -14,4 +14,4 @@ clean:
rm -rf *~ *.o *.dSYM $(OBJECTS)
include ../../../build/regressions.build
CFLAGS+=-pthread -D_GNU_SOURCE
CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE

@ -20,4 +20,4 @@ clean:
rm -rf *~ *.o *.dSYM $(OBJECTS)
include ../../../build/regressions.build
CFLAGS+=-pthread -D_GNU_SOURCE
CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE

@ -15,4 +15,4 @@ clean:
rm -rf ck_pr_cas_64 ck_pr_fas_64 ck_pr_cas_64_2 *.dSYM
include ../../../build/regressions.build
CFLAGS+=-pthread -D_GNU_SOURCE -lm
CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE -lm

@ -75,4 +75,3 @@ clean:
rm -rf *~ *.o $(OBJECTS) *.dSYM
include ../../../build/regressions.build
CFLAGS+=-fno-strict-aliasing

@ -14,4 +14,4 @@ clean:
rm -rf *~ *.o $(OBJECTS) *.dSYM
include ../../../build/regressions.build
CFLAGS+=-pthread -D_GNU_SOURCE
CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE

@ -12,4 +12,4 @@ clean:
rm -rf *~ *.o $(OBJECTS) *.dSYM
include ../../../build/regressions.build
CFLAGS+=-pthread -D_GNU_SOURCE -ggdb
CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE

@ -70,4 +70,4 @@ clean:
rm -rf *.dSYM $(OBJECTS)
include ../../../build/regressions.build
CFLAGS+=-D_GNU_SOURCE -pthread -lm
CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE -lm

@ -35,4 +35,4 @@ clean:
ck_anderson test_and_set *.dSYM
include ../../../build/regressions.build
CFLAGS+=-pthread -D_GNU_SOURCE -lm
CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE -lm

@ -11,4 +11,4 @@ clean:
rm -rf *~ *.o *.dSYM $(OBJECTS)
include ../../../build/regressions.build
CFLAGS+=-pthread -D_GNU_SOURCE
CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE

@ -17,19 +17,19 @@ mpnc_push mpmc_push upmc_push spinlock_push spinlock_eb_push: push.c
$(CC) -DSPINLOCK -DEB $(CFLAGS) -o spinlock_eb_push push.c
mpmc_pop upmc_pop spinlock_pop spinlock_eb_pop: pop.c
$(CC) -pthread -DMPMC $(CFLAGS) -o mpmc_pop pop.c
$(CC) -pthread -DUPMC $(CFLAGS) -o upmc_pop pop.c
$(CC) -pthread -DSPINLOCK $(CFLAGS) -o spinlock_pop pop.c
$(CC) -pthread -DEB -DSPINLOCK $(CFLAGS) -o spinlock_eb_pop pop.c
$(CC) -DMPMC $(CFLAGS) -o mpmc_pop pop.c
$(CC) -DUPMC $(CFLAGS) -o upmc_pop pop.c
$(CC) -DSPINLOCK $(CFLAGS) -o spinlock_pop pop.c
$(CC) -DEB -DSPINLOCK $(CFLAGS) -o spinlock_eb_pop pop.c
mpmc_pair spinlock_pair spinlock_eb_pair pthreads_pair: pair.c
$(CC) -pthread -DMPMC $(CFLAGS) -o mpmc_pair pair.c
$(CC) -pthread -DSPINLOCK $(CFLAGS) -o spinlock_pair pair.c
$(CC) -pthread -DEB -DSPINLOCK $(CFLAGS) -o spinlock_eb_pair pair.c
$(CC) -pthread -DPTHREADS $(CFLAGS) -o pthreads_pair pair.c
$(CC) -DMPMC $(CFLAGS) -o mpmc_pair pair.c
$(CC) -DSPINLOCK $(CFLAGS) -o spinlock_pair pair.c
$(CC) -DEB -DSPINLOCK $(CFLAGS) -o spinlock_eb_pair pair.c
$(CC) -DPTHREADS $(CFLAGS) -o pthreads_pair pair.c
clean:
rm -rf *~ *.o *.dSYM $(OBJECTS)
include ../../../build/regressions.build
CFLAGS+=-pthread -D_GNU_SOURCE
CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE

@ -10,7 +10,7 @@ OBJECTS=ck_hp.o \
all: libck.so libck.a
libck.so: $(OBJECTS)
$(CC) $(CFLAGS) -shared -fPIC -o libck.so $(OBJECTS)
$(LD) $(LDFLAGS) -o libck.so $(OBJECTS)
libck.a: $(OBJECTS)
ar rcs libck.a $(OBJECTS)

Loading…
Cancel
Save