aboutsummaryrefslogtreecommitdiff
path: root/libcilkrts
diff options
context:
space:
mode:
Diffstat (limited to 'libcilkrts')
-rw-r--r--libcilkrts/ChangeLog128
-rw-r--r--libcilkrts/Makefile.am35
-rw-r--r--libcilkrts/Makefile.in131
-rw-r--r--libcilkrts/README6
-rw-r--r--libcilkrts/configure2636
-rw-r--r--libcilkrts/configure.ac30
-rw-r--r--libcilkrts/configure.tgt23
-rw-r--r--libcilkrts/include/cilk/cilk.h37
-rw-r--r--libcilkrts/include/cilk/cilk_api.h184
-rw-r--r--libcilkrts/include/cilk/cilk_api_linux.h19
-rw-r--r--libcilkrts/include/cilk/cilk_stub.h28
-rw-r--r--libcilkrts/include/cilk/cilk_undocumented.h21
-rw-r--r--libcilkrts/include/cilk/common.h52
-rw-r--r--libcilkrts/include/cilk/holder.h25
-rw-r--r--libcilkrts/include/cilk/hyperobject_base.h23
-rw-r--r--libcilkrts/include/cilk/metaprogramming.h107
-rw-r--r--libcilkrts/include/cilk/reducer.h1154
-rw-r--r--libcilkrts/include/cilk/reducer_file.h19
-rw-r--r--libcilkrts/include/cilk/reducer_list.h461
-rw-r--r--libcilkrts/include/cilk/reducer_max.h19
-rw-r--r--libcilkrts/include/cilk/reducer_min.h19
-rw-r--r--libcilkrts/include/cilk/reducer_min_max.h1559
-rw-r--r--libcilkrts/include/cilk/reducer_opadd.h227
-rw-r--r--libcilkrts/include/cilk/reducer_opand.h216
-rw-r--r--libcilkrts/include/cilk/reducer_opmul.h131
-rw-r--r--libcilkrts/include/cilk/reducer_opor.h213
-rw-r--r--libcilkrts/include/cilk/reducer_opxor.h212
-rw-r--r--libcilkrts/include/cilk/reducer_ostream.h650
-rw-r--r--libcilkrts/include/cilk/reducer_string.h198
-rw-r--r--libcilkrts/include/cilk/reducer_vector.h533
-rw-r--r--libcilkrts/include/cilktools/cilkscreen.h19
-rw-r--r--libcilkrts/include/cilktools/cilkview.h19
-rw-r--r--libcilkrts/include/cilktools/fake_mutex.h19
-rw-r--r--libcilkrts/include/cilktools/lock_guard.h19
-rw-r--r--libcilkrts/include/internal/abi.h33
-rw-r--r--libcilkrts/include/internal/cilk_fake.h19
-rw-r--r--libcilkrts/include/internal/cilk_version.h31
-rw-r--r--libcilkrts/include/internal/metacall.h19
-rw-r--r--libcilkrts/include/internal/rev.mk21
-rw-r--r--libcilkrts/mk/cilk-version.mk19
-rw-r--r--libcilkrts/runtime/acknowledgements.dox19
-rw-r--r--libcilkrts/runtime/bug.cpp21
-rw-r--r--libcilkrts/runtime/bug.h19
-rw-r--r--libcilkrts/runtime/c_reducers.c26
-rw-r--r--libcilkrts/runtime/cilk-abi-cilk-for.cpp22
-rw-r--r--libcilkrts/runtime/cilk-abi-vla-internal.c19
-rw-r--r--libcilkrts/runtime/cilk-abi-vla-internal.h19
-rw-r--r--libcilkrts/runtime/cilk-abi.c73
-rw-r--r--libcilkrts/runtime/cilk-ittnotify.h19
-rw-r--r--libcilkrts/runtime/cilk-tbb-interop.h19
-rw-r--r--libcilkrts/runtime/cilk_api.c19
-rw-r--r--libcilkrts/runtime/cilk_fiber-unix.cpp58
-rw-r--r--libcilkrts/runtime/cilk_fiber-unix.h30
-rw-r--r--libcilkrts/runtime/cilk_fiber.cpp19
-rw-r--r--libcilkrts/runtime/cilk_fiber.h19
-rw-r--r--libcilkrts/runtime/cilk_malloc.c21
-rw-r--r--libcilkrts/runtime/cilk_malloc.h19
-rw-r--r--libcilkrts/runtime/cilk_str_mem.h94
-rw-r--r--libcilkrts/runtime/component.h19
-rw-r--r--libcilkrts/runtime/config/arm/cilk-abi-vla.c115
-rw-r--r--libcilkrts/runtime/config/arm/os-fence.h64
-rw-r--r--libcilkrts/runtime/config/arm/os-unix-sysdep.c105
-rw-r--r--libcilkrts/runtime/config/generic/cilk-abi-vla.c21
-rw-r--r--libcilkrts/runtime/config/generic/os-fence.h19
-rw-r--r--libcilkrts/runtime/config/generic/os-unix-sysdep.c19
-rw-r--r--libcilkrts/runtime/config/x86/cilk-abi-vla.c78
-rw-r--r--libcilkrts/runtime/config/x86/os-fence.h19
-rw-r--r--libcilkrts/runtime/config/x86/os-unix-sysdep.c21
-rw-r--r--libcilkrts/runtime/declare-alloca.h (renamed from libcilkrts/runtime/symbol_test.c)64
-rw-r--r--libcilkrts/runtime/doxygen-layout.xml19
-rw-r--r--libcilkrts/runtime/doxygen.cfg19
-rw-r--r--libcilkrts/runtime/except-gcc.cpp27
-rw-r--r--libcilkrts/runtime/except-gcc.h19
-rw-r--r--libcilkrts/runtime/except.h19
-rw-r--r--libcilkrts/runtime/frame_malloc.c19
-rw-r--r--libcilkrts/runtime/frame_malloc.h19
-rw-r--r--libcilkrts/runtime/full_frame.c19
-rw-r--r--libcilkrts/runtime/full_frame.h19
-rw-r--r--libcilkrts/runtime/global_state.cpp43
-rw-r--r--libcilkrts/runtime/global_state.h33
-rw-r--r--libcilkrts/runtime/jmpbuf.c19
-rw-r--r--libcilkrts/runtime/jmpbuf.h19
-rw-r--r--libcilkrts/runtime/linux-symbols.ver23
-rw-r--r--libcilkrts/runtime/local_state.c19
-rw-r--r--libcilkrts/runtime/local_state.h19
-rw-r--r--libcilkrts/runtime/mac-symbols.txt6
-rw-r--r--libcilkrts/runtime/metacall_impl.c19
-rw-r--r--libcilkrts/runtime/metacall_impl.h19
-rw-r--r--libcilkrts/runtime/os-unix.c210
-rw-r--r--libcilkrts/runtime/os.h21
-rw-r--r--libcilkrts/runtime/os_mutex-unix.c19
-rw-r--r--libcilkrts/runtime/os_mutex.h19
-rw-r--r--libcilkrts/runtime/pedigrees.c19
-rw-r--r--libcilkrts/runtime/pedigrees.h19
-rw-r--r--libcilkrts/runtime/record-replay.cpp42
-rw-r--r--libcilkrts/runtime/record-replay.h19
-rw-r--r--libcilkrts/runtime/reducer_impl.cpp19
-rw-r--r--libcilkrts/runtime/reducer_impl.h19
-rw-r--r--libcilkrts/runtime/rts-common.h33
-rw-r--r--libcilkrts/runtime/scheduler.c114
-rw-r--r--libcilkrts/runtime/scheduler.h19
-rw-r--r--libcilkrts/runtime/signal_node.c19
-rw-r--r--libcilkrts/runtime/signal_node.h19
-rw-r--r--libcilkrts/runtime/spin_mutex.c19
-rw-r--r--libcilkrts/runtime/spin_mutex.h19
-rw-r--r--libcilkrts/runtime/sslib/ignore_handler_s.c72
-rw-r--r--libcilkrts/runtime/sslib/safe_lib.h61
-rw-r--r--libcilkrts/runtime/sslib/safe_lib_errno.h100
-rw-r--r--libcilkrts/runtime/sslib/safe_str_constraint.c146
-rw-r--r--libcilkrts/runtime/sslib/safe_str_constraint.h78
-rw-r--r--libcilkrts/runtime/sslib/safe_str_lib.h70
-rw-r--r--libcilkrts/runtime/sslib/safe_types.h61
-rw-r--r--libcilkrts/runtime/sslib/safeclib_private.h93
-rw-r--r--libcilkrts/runtime/sslib/snprintf_s.h49
-rw-r--r--libcilkrts/runtime/sslib/snprintf_support.c353
-rw-r--r--libcilkrts/runtime/sslib/strcpy_s.c198
-rw-r--r--libcilkrts/runtime/sslib/strncpy_s.c238
-rw-r--r--libcilkrts/runtime/sslib/strnlen_s.c112
-rw-r--r--libcilkrts/runtime/stats.c69
-rw-r--r--libcilkrts/runtime/stats.h56
-rw-r--r--libcilkrts/runtime/sysdep-unix.c147
-rw-r--r--libcilkrts/runtime/sysdep.h19
-rw-r--r--libcilkrts/runtime/worker_mutex.c19
-rw-r--r--libcilkrts/runtime/worker_mutex.h19
124 files changed, 9316 insertions, 4083 deletions
diff --git a/libcilkrts/ChangeLog b/libcilkrts/ChangeLog
index 8fada8a82a6..df34aa52b54 100644
--- a/libcilkrts/ChangeLog
+++ b/libcilkrts/ChangeLog
@@ -1,3 +1,131 @@
+2016-05-04 Ilya Verbin <ilya.verbin@intel.com>
+
+ * Makefile.am: Merge from upstream, version 2.0.4420.0
+ <https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git>.
+ * README: Likewise.
+ * configure.ac: Likewise.
+ * configure.tgt: Likewise.
+ * include/cilk/cilk.h: Likewise.
+ * include/cilk/cilk_api.h: Likewise.
+ * include/cilk/cilk_api_linux.h: Likewise.
+ * include/cilk/cilk_stub.h: Likewise.
+ * include/cilk/cilk_undocumented.h: Likewise.
+ * include/cilk/common.h: Likewise.
+ * include/cilk/holder.h: Likewise.
+ * include/cilk/hyperobject_base.h: Likewise.
+ * include/cilk/metaprogramming.h: Likewise.
+ * include/cilk/reducer.h: Likewise.
+ * include/cilk/reducer_file.h: Likewise.
+ * include/cilk/reducer_list.h: Likewise.
+ * include/cilk/reducer_max.h: Likewise.
+ * include/cilk/reducer_min.h: Likewise.
+ * include/cilk/reducer_min_max.h: Likewise.
+ * include/cilk/reducer_opadd.h: Likewise.
+ * include/cilk/reducer_opand.h: Likewise.
+ * include/cilk/reducer_opmul.h: Likewise.
+ * include/cilk/reducer_opor.h: Likewise.
+ * include/cilk/reducer_opxor.h: Likewise.
+ * include/cilk/reducer_ostream.h: Likewise.
+ * include/cilk/reducer_string.h: Likewise.
+ * include/cilktools/cilkscreen.h: Likewise.
+ * include/cilktools/cilkview.h: Likewise.
+ * include/cilktools/fake_mutex.h: Likewise.
+ * include/cilktools/lock_guard.h: Likewise.
+ * include/internal/abi.h: Likewise.
+ * include/internal/cilk_fake.h: Likewise.
+ * include/internal/cilk_version.h: Likewise.
+ * include/internal/metacall.h: Likewise.
+ * include/internal/rev.mk: Likewise.
+ * mk/cilk-version.mk: Likewise.
+ * runtime/acknowledgements.dox: Likewise.
+ * runtime/bug.cpp: Likewise.
+ * runtime/bug.h: Likewise.
+ * runtime/c_reducers.c: Likewise.
+ * runtime/cilk-abi-cilk-for.cpp: Likewise.
+ * runtime/cilk-abi-vla-internal.c: Likewise.
+ * runtime/cilk-abi-vla-internal.h: Likewise.
+ * runtime/cilk-abi.c: Likewise.
+ * runtime/cilk-ittnotify.h: Likewise.
+ * runtime/cilk-tbb-interop.h: Likewise.
+ * runtime/cilk_api.c: Likewise.
+ * runtime/cilk_fiber-unix.cpp: Likewise.
+ * runtime/cilk_fiber-unix.h: Likewise.
+ * runtime/cilk_fiber.cpp: Likewise.
+ * runtime/cilk_fiber.h: Likewise.
+ * runtime/cilk_malloc.c: Likewise.
+ * runtime/cilk_malloc.h: Likewise.
+ * runtime/component.h: Likewise.
+ * runtime/config/generic/cilk-abi-vla.c: Likewise.
+ * runtime/config/generic/os-fence.h: Likewise.
+ * runtime/config/generic/os-unix-sysdep.c: Likewise.
+ * runtime/config/x86/cilk-abi-vla.c: Likewise.
+ * runtime/config/x86/os-fence.h: Likewise.
+ * runtime/config/x86/os-unix-sysdep.c: Likewise.
+ * runtime/doxygen-layout.xml: Likewise.
+ * runtime/doxygen.cfg: Likewise.
+ * runtime/except-gcc.cpp: Likewise.
+ * runtime/except-gcc.h: Likewise.
+ * runtime/except.h: Likewise.
+ * runtime/frame_malloc.c: Likewise.
+ * runtime/frame_malloc.h: Likewise.
+ * runtime/full_frame.c: Likewise.
+ * runtime/full_frame.h: Likewise.
+ * runtime/global_state.cpp: Likewise.
+ * runtime/global_state.h: Likewise.
+ * runtime/jmpbuf.c: Likewise.
+ * runtime/jmpbuf.h: Likewise.
+ * runtime/linux-symbols.ver: Likewise.
+ * runtime/local_state.c: Likewise.
+ * runtime/local_state.h: Likewise.
+ * runtime/mac-symbols.txt: Likewise.
+ * runtime/metacall_impl.c: Likewise.
+ * runtime/metacall_impl.h: Likewise.
+ * runtime/os-unix.c: Likewise.
+ * runtime/os.h: Likewise.
+ * runtime/os_mutex-unix.c: Likewise.
+ * runtime/os_mutex.h: Likewise.
+ * runtime/pedigrees.c: Likewise.
+ * runtime/pedigrees.h: Likewise.
+ * runtime/record-replay.cpp: Likewise.
+ * runtime/record-replay.h: Likewise.
+ * runtime/reducer_impl.cpp: Likewise.
+ * runtime/reducer_impl.h: Likewise.
+ * runtime/rts-common.h: Likewise.
+ * runtime/scheduler.c: Likewise.
+ * runtime/scheduler.h: Likewise.
+ * runtime/signal_node.c: Likewise.
+ * runtime/signal_node.h: Likewise.
+ * runtime/spin_mutex.c: Likewise.
+ * runtime/spin_mutex.h: Likewise.
+ * runtime/stats.c: Likewise.
+ * runtime/stats.h: Likewise.
+ * runtime/sysdep-unix.c: Likewise.
+ * runtime/sysdep.h: Likewise.
+ * runtime/worker_mutex.c: Likewise.
+ * runtime/worker_mutex.h: Likewise.
+ * include/cilk/reducer_vector.h: New.
+ * runtime/cilk_str_mem.h: New.
+ * runtime/config/arm/cilk-abi-vla.c: New.
+ * runtime/config/arm/os-fence.h: New.
+ * runtime/config/arm/os-unix-sysdep.c: New.
+ * runtime/declare-alloca.h: New.
+ * runtime/sslib/ignore_handler_s.c: New.
+ * runtime/sslib/safe_lib.h: New.
+ * runtime/sslib/safe_lib_errno.h: New.
+ * runtime/sslib/safe_str_constraint.c: New.
+ * runtime/sslib/safe_str_constraint.h: New.
+ * runtime/sslib/safe_str_lib.h: New.
+ * runtime/sslib/safe_types.h: New.
+ * runtime/sslib/safeclib_private.h: New.
+ * runtime/sslib/snprintf_s.h: New.
+ * runtime/sslib/snprintf_support.c: New.
+ * runtime/sslib/strcpy_s.c: New.
+ * runtime/sslib/strncpy_s.c: New.
+ * runtime/sslib/strnlen_s.c: New.
+ * runtime/symbol_test.c: Remove.
+ * Makefile.in: Regenerate.
+ * configure: Regenerate.
+
2016-04-26 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
PR target/60290
diff --git a/libcilkrts/Makefile.am b/libcilkrts/Makefile.am
index 4f944dd1a62..3736a636fb1 100644
--- a/libcilkrts/Makefile.am
+++ b/libcilkrts/Makefile.am
@@ -1,8 +1,6 @@
-# @copyright
-# Copyright (C) 2011, 2013, Intel Corporation
+# Copyright (C) 2011-2016, Intel Corporation
# All rights reserved.
#
-# @copyright
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
@@ -17,7 +15,6 @@
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
-# @copyright
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -30,6 +27,20 @@
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
# WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
+#
+# *********************************************************************
+#
+# PLEASE NOTE: This file is a downstream copy of a file mainitained in
+# a repository at cilkplus.org. Changes made to this file that are not
+# submitted through the contribution process detailed at
+# http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+# time that a new version is released. Changes only submitted to the
+# GNU compiler collection or posted to the git repository at
+# https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+# not tracked.
+#
+# We welcome your contributions to this open source project. Thank you
+# for your assistance in helping us improve Cilk Plus.
AUTOMAKE_OPTIONS = foreign
@@ -37,7 +48,7 @@ AUTOMAKE_OPTIONS = foreign
ACLOCAL_AMFLAGS = -I .. -I ../config
# Compiler and linker flags.
-GENERAL_FLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/runtime -I$(top_srcdir)/runtime/config/$(config_dir) -DIN_CILK_RUNTIME=1
+GENERAL_FLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/runtime -I$(top_srcdir)/runtime/config/$(config_dir) -I$(top_srcdir)/runtime/sslib -DIN_CILK_RUNTIME=1
# GENERAL_FLAGS += -D_Cilk_spawn="" -D_Cilk_sync="" -D_Cilk_for=for
# Enable Intel Cilk Plus extension
@@ -60,6 +71,19 @@ toolexeclib_LTLIBRARIES = libcilkrts.la
libcilkrts_la_SOURCES = \
runtime/config/$(config_dir)/cilk-abi-vla.c \
runtime/config/$(config_dir)/os-unix-sysdep.c \
+ runtime/sslib/ignore_handler_s.c \
+ runtime/sslib/safe_lib.h \
+ runtime/sslib/safe_lib_errno.h \
+ runtime/sslib/safe_str_constraint.c \
+ runtime/sslib/safe_str_constraint.h \
+ runtime/sslib/safe_str_lib.h \
+ runtime/sslib/safe_types.h \
+ runtime/sslib/safeclib_private.h \
+ runtime/sslib/snprintf_s.h \
+ runtime/sslib/snprintf_support.c \
+ runtime/sslib/strcpy_s.c \
+ runtime/sslib/strncpy_s.c \
+ runtime/sslib/strnlen_s.c \
runtime/bug.cpp \
runtime/cilk-abi.c \
runtime/cilk-abi-cilk-for.cpp \
@@ -85,7 +109,6 @@ libcilkrts_la_SOURCES = \
runtime/signal_node.c \
runtime/spin_mutex.c \
runtime/stats.c \
- runtime/symbol_test.c \
runtime/sysdep-unix.c \
runtime/worker_mutex.c
diff --git a/libcilkrts/Makefile.in b/libcilkrts/Makefile.in
index a25d1c6f50e..ff88e9dab89 100644
--- a/libcilkrts/Makefile.in
+++ b/libcilkrts/Makefile.in
@@ -15,11 +15,9 @@
@SET_MAKE@
-# @copyright
-# Copyright (C) 2011, 2013, Intel Corporation
+# Copyright (C) 2011-2016, Intel Corporation
# All rights reserved.
#
-# @copyright
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
@@ -34,7 +32,6 @@
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
-# @copyright
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -47,14 +44,26 @@
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
# WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
+#
+# *********************************************************************
+#
+# PLEASE NOTE: This file is a downstream copy of a file mainitained in
+# a repository at cilkplus.org. Changes made to this file that are not
+# submitted through the contribution process detailed at
+# http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+# time that a new version is released. Changes only submitted to the
+# GNU compiler collection or posted to the git repository at
+# https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+# not tracked.
+#
+# We welcome your contributions to this open source project. Thank you
+# for your assistance in helping us improve Cilk Plus.
#########################################################################
#
-# @copyright
-# Copyright (C) 2011-2013, Intel Corporation
+# Copyright (C) 2011-2016, Intel Corporation
# All rights reserved.
#
-# @copyright
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
@@ -69,7 +78,6 @@
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
-# @copyright
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -82,6 +90,20 @@
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
# WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
+#
+# *********************************************************************
+#
+# PLEASE NOTE: This file is a downstream copy of a file mainitained in
+# a repository at cilkplus.org. Changes made to this file that are not
+# submitted through the contribution process detailed at
+# http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+# time that a new version is released. Changes only submitted to the
+# GNU compiler collection or posted to the git repository at
+# https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+# not tracked.
+#
+# We welcome your contributions to this open source project. Thank you
+# for your assistance in helping us improve Cilk Plus.
###########################################################################
# DO NOT EDIT THIS FILE!
@@ -184,14 +206,16 @@ am__installdirs = "$(DESTDIR)$(toolexeclibdir)" \
"$(DESTDIR)$(cilkincludedir)" "$(DESTDIR)$(toolexeclibdir)"
LTLIBRARIES = $(toolexeclib_LTLIBRARIES)
libcilkrts_la_LIBADD =
-am_libcilkrts_la_OBJECTS = cilk-abi-vla.lo os-unix-sysdep.lo bug.lo \
- cilk-abi.lo cilk-abi-cilk-for.lo cilk-abi-vla-internal.lo \
- cilk_api.lo cilk_fiber.lo cilk_fiber-unix.lo cilk_malloc.lo \
- c_reducers.lo except-gcc.lo frame_malloc.lo full_frame.lo \
- global_state.lo jmpbuf.lo local_state.lo metacall_impl.lo \
- os_mutex-unix.lo os-unix.lo pedigrees.lo record-replay.lo \
- reducer_impl.lo scheduler.lo signal_node.lo spin_mutex.lo \
- stats.lo symbol_test.lo sysdep-unix.lo worker_mutex.lo
+am_libcilkrts_la_OBJECTS = cilk-abi-vla.lo os-unix-sysdep.lo \
+ ignore_handler_s.lo safe_str_constraint.lo snprintf_support.lo \
+ strcpy_s.lo strncpy_s.lo strnlen_s.lo bug.lo cilk-abi.lo \
+ cilk-abi-cilk-for.lo cilk-abi-vla-internal.lo cilk_api.lo \
+ cilk_fiber.lo cilk_fiber-unix.lo cilk_malloc.lo c_reducers.lo \
+ except-gcc.lo frame_malloc.lo full_frame.lo global_state.lo \
+ jmpbuf.lo local_state.lo metacall_impl.lo os_mutex-unix.lo \
+ os-unix.lo pedigrees.lo record-replay.lo reducer_impl.lo \
+ scheduler.lo signal_node.lo spin_mutex.lo stats.lo \
+ sysdep-unix.lo worker_mutex.lo
libcilkrts_la_OBJECTS = $(am_libcilkrts_la_OBJECTS)
libcilkrts_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
@@ -375,7 +399,8 @@ ACLOCAL_AMFLAGS = -I .. -I ../config
# Always generate unwind tables
GENERAL_FLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/runtime \
-I$(top_srcdir)/runtime/config/$(config_dir) \
- -DIN_CILK_RUNTIME=1 -fcilkplus -funwind-tables
+ -I$(top_srcdir)/runtime/sslib -DIN_CILK_RUNTIME=1 -fcilkplus \
+ -funwind-tables
AM_CFLAGS = $(XCFLAGS) $(GENERAL_FLAGS) -std=c99
AM_CPPFLAGS = $(GENERAL_FLAGS)
AM_LDFLAGS = $(XLDFLAGS)
@@ -389,6 +414,19 @@ toolexeclib_LTLIBRARIES = libcilkrts.la
libcilkrts_la_SOURCES = \
runtime/config/$(config_dir)/cilk-abi-vla.c \
runtime/config/$(config_dir)/os-unix-sysdep.c \
+ runtime/sslib/ignore_handler_s.c \
+ runtime/sslib/safe_lib.h \
+ runtime/sslib/safe_lib_errno.h \
+ runtime/sslib/safe_str_constraint.c \
+ runtime/sslib/safe_str_constraint.h \
+ runtime/sslib/safe_str_lib.h \
+ runtime/sslib/safe_types.h \
+ runtime/sslib/safeclib_private.h \
+ runtime/sslib/snprintf_s.h \
+ runtime/sslib/snprintf_support.c \
+ runtime/sslib/strcpy_s.c \
+ runtime/sslib/strncpy_s.c \
+ runtime/sslib/strnlen_s.c \
runtime/bug.cpp \
runtime/cilk-abi.c \
runtime/cilk-abi-cilk-for.cpp \
@@ -414,11 +452,10 @@ libcilkrts_la_SOURCES = \
runtime/signal_node.c \
runtime/spin_mutex.c \
runtime/stats.c \
- runtime/symbol_test.c \
runtime/sysdep-unix.c \
runtime/worker_mutex.c
-CILK_REVISION = 3902
+CILK_REVISION = 4420
# Load the $(REVISION) value.
@@ -591,6 +628,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/frame_malloc.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/full_frame.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/global_state.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ignore_handler_s.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jmpbuf.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/local_state.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/metacall_impl.Plo@am__quote@
@@ -600,11 +638,15 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pedigrees.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/record-replay.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reducer_impl.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/safe_str_constraint.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scheduler.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/signal_node.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/snprintf_support.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/spin_mutex.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stats.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/symbol_test.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strcpy_s.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strncpy_s.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strnlen_s.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sysdep-unix.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/worker_mutex.Plo@am__quote@
@@ -643,6 +685,48 @@ os-unix-sysdep.lo: runtime/config/$(config_dir)/os-unix-sysdep.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o os-unix-sysdep.lo `test -f 'runtime/config/$(config_dir)/os-unix-sysdep.c' || echo '$(srcdir)/'`runtime/config/$(config_dir)/os-unix-sysdep.c
+ignore_handler_s.lo: runtime/sslib/ignore_handler_s.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ignore_handler_s.lo -MD -MP -MF $(DEPDIR)/ignore_handler_s.Tpo -c -o ignore_handler_s.lo `test -f 'runtime/sslib/ignore_handler_s.c' || echo '$(srcdir)/'`runtime/sslib/ignore_handler_s.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/ignore_handler_s.Tpo $(DEPDIR)/ignore_handler_s.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/sslib/ignore_handler_s.c' object='ignore_handler_s.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ignore_handler_s.lo `test -f 'runtime/sslib/ignore_handler_s.c' || echo '$(srcdir)/'`runtime/sslib/ignore_handler_s.c
+
+safe_str_constraint.lo: runtime/sslib/safe_str_constraint.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT safe_str_constraint.lo -MD -MP -MF $(DEPDIR)/safe_str_constraint.Tpo -c -o safe_str_constraint.lo `test -f 'runtime/sslib/safe_str_constraint.c' || echo '$(srcdir)/'`runtime/sslib/safe_str_constraint.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/safe_str_constraint.Tpo $(DEPDIR)/safe_str_constraint.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/sslib/safe_str_constraint.c' object='safe_str_constraint.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o safe_str_constraint.lo `test -f 'runtime/sslib/safe_str_constraint.c' || echo '$(srcdir)/'`runtime/sslib/safe_str_constraint.c
+
+snprintf_support.lo: runtime/sslib/snprintf_support.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT snprintf_support.lo -MD -MP -MF $(DEPDIR)/snprintf_support.Tpo -c -o snprintf_support.lo `test -f 'runtime/sslib/snprintf_support.c' || echo '$(srcdir)/'`runtime/sslib/snprintf_support.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/snprintf_support.Tpo $(DEPDIR)/snprintf_support.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/sslib/snprintf_support.c' object='snprintf_support.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o snprintf_support.lo `test -f 'runtime/sslib/snprintf_support.c' || echo '$(srcdir)/'`runtime/sslib/snprintf_support.c
+
+strcpy_s.lo: runtime/sslib/strcpy_s.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT strcpy_s.lo -MD -MP -MF $(DEPDIR)/strcpy_s.Tpo -c -o strcpy_s.lo `test -f 'runtime/sslib/strcpy_s.c' || echo '$(srcdir)/'`runtime/sslib/strcpy_s.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/strcpy_s.Tpo $(DEPDIR)/strcpy_s.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/sslib/strcpy_s.c' object='strcpy_s.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strcpy_s.lo `test -f 'runtime/sslib/strcpy_s.c' || echo '$(srcdir)/'`runtime/sslib/strcpy_s.c
+
+strncpy_s.lo: runtime/sslib/strncpy_s.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT strncpy_s.lo -MD -MP -MF $(DEPDIR)/strncpy_s.Tpo -c -o strncpy_s.lo `test -f 'runtime/sslib/strncpy_s.c' || echo '$(srcdir)/'`runtime/sslib/strncpy_s.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/strncpy_s.Tpo $(DEPDIR)/strncpy_s.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/sslib/strncpy_s.c' object='strncpy_s.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strncpy_s.lo `test -f 'runtime/sslib/strncpy_s.c' || echo '$(srcdir)/'`runtime/sslib/strncpy_s.c
+
+strnlen_s.lo: runtime/sslib/strnlen_s.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT strnlen_s.lo -MD -MP -MF $(DEPDIR)/strnlen_s.Tpo -c -o strnlen_s.lo `test -f 'runtime/sslib/strnlen_s.c' || echo '$(srcdir)/'`runtime/sslib/strnlen_s.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/strnlen_s.Tpo $(DEPDIR)/strnlen_s.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/sslib/strnlen_s.c' object='strnlen_s.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strnlen_s.lo `test -f 'runtime/sslib/strnlen_s.c' || echo '$(srcdir)/'`runtime/sslib/strnlen_s.c
+
cilk-abi.lo: runtime/cilk-abi.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cilk-abi.lo -MD -MP -MF $(DEPDIR)/cilk-abi.Tpo -c -o cilk-abi.lo `test -f 'runtime/cilk-abi.c' || echo '$(srcdir)/'`runtime/cilk-abi.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/cilk-abi.Tpo $(DEPDIR)/cilk-abi.Plo
@@ -762,13 +846,6 @@ stats.lo: runtime/stats.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stats.lo `test -f 'runtime/stats.c' || echo '$(srcdir)/'`runtime/stats.c
-symbol_test.lo: runtime/symbol_test.c
-@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT symbol_test.lo -MD -MP -MF $(DEPDIR)/symbol_test.Tpo -c -o symbol_test.lo `test -f 'runtime/symbol_test.c' || echo '$(srcdir)/'`runtime/symbol_test.c
-@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/symbol_test.Tpo $(DEPDIR)/symbol_test.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/symbol_test.c' object='symbol_test.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o symbol_test.lo `test -f 'runtime/symbol_test.c' || echo '$(srcdir)/'`runtime/symbol_test.c
-
sysdep-unix.lo: runtime/sysdep-unix.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sysdep-unix.lo -MD -MP -MF $(DEPDIR)/sysdep-unix.Tpo -c -o sysdep-unix.lo `test -f 'runtime/sysdep-unix.c' || echo '$(srcdir)/'`runtime/sysdep-unix.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/sysdep-unix.Tpo $(DEPDIR)/sysdep-unix.Plo
diff --git a/libcilkrts/README b/libcilkrts/README
index 7c101150ece..d3503f44e34 100644
--- a/libcilkrts/README
+++ b/libcilkrts/README
@@ -40,6 +40,9 @@ configure script:
% ./configure --prefix=/your/path/to/lib
+It is also possible to use CMake if the above method does not apply
+well in your environment. Instruction is available in CMakeLists.txt.
+
#
# 2. USING:
#
@@ -79,6 +82,9 @@ http://cilkplus.org/
Changes to the Intel Cilk Plus runtime are welcome and should be
contributed to the upstream version via http://cilkplus.org/.
+Thanks to Tobias Burnus for showing us the magic to make gcc and g++
+automatically include the Cilk Plus runtime.
+
------------------------
Intel and Cilk are trademarks of Intel Corporation in the U.S. and/or
other countries.
diff --git a/libcilkrts/configure b/libcilkrts/configure
index 4e1d459f812..802b325eba6 100644
--- a/libcilkrts/configure
+++ b/libcilkrts/configure
@@ -632,9 +632,6 @@ MAC_LINKER_SCRIPT_TRUE
LINUX_LINKER_SCRIPT_FALSE
LINUX_LINKER_SCRIPT_TRUE
config_dir
-EGREP
-GREP
-CPP
ALLOCA
am__fastdepCXX_FALSE
am__fastdepCXX_TRUE
@@ -642,6 +639,10 @@ CXXDEPMODE
ac_ct_CXX
CXXFLAGS
CXX
+multi_basedir
+MAINT
+MAINTAINER_MODE_FALSE
+MAINTAINER_MODE_TRUE
am__fastdepCC_FALSE
am__fastdepCC_TRUE
CCDEPMODE
@@ -652,17 +653,6 @@ AMDEP_TRUE
am__quote
am__include
DEPDIR
-OBJEXT
-EXEEXT
-ac_ct_CC
-CPPFLAGS
-LDFLAGS
-CFLAGS
-CC
-multi_basedir
-MAINT
-MAINTAINER_MODE_FALSE
-MAINTAINER_MODE_TRUE
am__untar
am__tar
AMTAR
@@ -686,6 +676,16 @@ am__isrc
INSTALL_DATA
INSTALL_SCRIPT
INSTALL_PROGRAM
+EGREP
+GREP
+CPP
+OBJEXT
+EXEEXT
+ac_ct_CC
+CPPFLAGS
+LDFLAGS
+CFLAGS
+CC
target_os
target_vendor
target_cpu
@@ -739,9 +739,9 @@ SHELL'
ac_subst_files=''
ac_user_opts='
enable_option_checking
+enable_dependency_tracking
enable_maintainer_mode
enable_multilib
-enable_dependency_tracking
enable_version_specific_runtime_libs
enable_shared
enable_static
@@ -758,10 +758,10 @@ CFLAGS
LDFLAGS
LIBS
CPPFLAGS
+CPP
CXX
CXXFLAGS
CCC
-CPP
CXXCPP'
@@ -1384,11 +1384,11 @@ Optional Features:
--disable-option-checking ignore unrecognized --enable/--with options
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --disable-dependency-tracking speeds up one-time build
+ --enable-dependency-tracking do not reject slow dependency extractors
--enable-maintainer-mode enable make rules and dependencies not useful
(and sometimes confusing) to the casual installer
--enable-multilib build many library versions (default)
- --disable-dependency-tracking speeds up one-time build
- --enable-dependency-tracking do not reject slow dependency extractors
--enable-version-specific-runtime-libs
Specify that runtime libraries should be installed
in a compi ler-specific directory
@@ -1413,9 +1413,9 @@ Some influential environment variables:
LIBS libraries to pass to the linker, e.g. -l<library>
CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
you have headers in a nonstandard directory <include dir>
+ CPP C preprocessor
CXX C++ compiler command
CXXFLAGS C++ compiler flags
- CPP C preprocessor
CXXCPP C++ preprocessor
Use these variables to override the choices made by `configure' or to help
@@ -1536,6 +1536,209 @@ fi
} # ac_fn_c_try_compile
+# ac_fn_c_try_cpp LINENO
+# ----------------------
+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_cpp ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if { { ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ return $ac_retval
+
+} # ac_fn_c_try_cpp
+
+# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists, giving a warning if it cannot be compiled using
+# the include files in INCLUDES and setting the cache variable VAR
+# accordingly.
+ac_fn_c_check_header_mongrel ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+ $as_echo_n "(cached) " >&6
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
+$as_echo_n "checking $2 usability... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_header_compiler=yes
+else
+ ac_header_compiler=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
+$as_echo_n "checking $2 presence... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <$2>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ ac_header_preproc=yes
+else
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
+ yes:no: )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+ ;;
+ no:yes:* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+( cat <<\_ASBOX
+## ----------------------------- ##
+## Report this to cilk@intel.com ##
+## ----------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+ $as_echo_n "(cached) " >&6
+else
+ eval "$3=\$ac_header_compiler"
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+fi
+ eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_c_check_header_mongrel
+
+# ac_fn_c_try_run LINENO
+# ----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
+# that executables *can* be run.
+ac_fn_c_try_run ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
+ { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: program exited with status $ac_status" >&5
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=$ac_status
+fi
+ rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+ eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ return $ac_retval
+
+} # ac_fn_c_try_run
+
+# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists and can be compiled using the include files in
+# INCLUDES, setting the cache variable VAR accordingly.
+ac_fn_c_check_header_compile ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ eval "$3=yes"
+else
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_c_check_header_compile
+
# ac_fn_cxx_try_compile LINENO
# ----------------------------
# Try to compile conftest.$ac_ext, and return whether this succeeded.
@@ -1620,43 +1823,6 @@ fi
} # ac_fn_c_try_link
-# ac_fn_c_try_cpp LINENO
-# ----------------------
-# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
-ac_fn_c_try_cpp ()
-{
- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- if { { ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
- ac_status=$?
- if test -s conftest.err; then
- grep -v '^ *+' conftest.err >conftest.er1
- cat conftest.er1 >&5
- mv -f conftest.er1 conftest.err
- fi
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then :
- ac_retval=0
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_retval=1
-fi
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
- return $ac_retval
-
-} # ac_fn_c_try_cpp
-
# ac_fn_c_check_func LINENO FUNC VAR
# ----------------------------------
# Tests whether FUNC exists, setting the cache variable VAR accordingly
@@ -1724,79 +1890,6 @@ $as_echo "$ac_res" >&6; }
} # ac_fn_c_check_func
-# ac_fn_c_try_run LINENO
-# ----------------------
-# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
-# that executables *can* be run.
-ac_fn_c_try_run ()
-{
- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- if { { ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
- (eval "$ac_link") 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
- { { case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }; then :
- ac_retval=0
-else
- $as_echo "$as_me: program exited with status $ac_status" >&5
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_retval=$ac_status
-fi
- rm -rf conftest.dSYM conftest_ipa8_conftest.oo
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
- return $ac_retval
-
-} # ac_fn_c_try_run
-
-# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
-# -------------------------------------------------------
-# Tests whether HEADER exists and can be compiled using the include files in
-# INCLUDES, setting the cache variable VAR accordingly.
-ac_fn_c_check_header_compile ()
-{
- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
-$as_echo_n "checking for $2... " >&6; }
-if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$4
-#include <$2>
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- eval "$3=yes"
-else
- eval "$3=no"
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-eval ac_res=\$$3
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
-
-} # ac_fn_c_check_header_compile
-
# ac_fn_cxx_try_cpp LINENO
# ------------------------
# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
@@ -2373,6 +2466,1234 @@ test -n "$target_alias" &&
target_alias=${target_alias-$host_alias}
+
+# Test for GNU extensions. Will define _GNU_SOURCE if they're available
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CC="${ac_tool_prefix}gcc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_CC="gcc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CC="${ac_tool_prefix}cc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ fi
+fi
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# != 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+ fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in cl.exe
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$CC" && break
+ done
+fi
+if test -z "$CC"; then
+ ac_ct_CC=$CC
+ for ac_prog in cl.exe
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_CC="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ac_ct_CC" && break
+done
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+fi
+
+fi
+
+
+test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error "no acceptable C compiler found in \$PATH
+See \`config.log' for more details." "$LINENO" 5; }
+
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+ { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ sed '10a\
+... rest of stderr output deleted ...
+ 10q' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ rm -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+done
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out conftest.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
+$as_echo_n "checking for C compiler default output file name... " >&6; }
+ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+
+# The possible output files:
+ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
+
+ac_rmfiles=
+for ac_file in $ac_files
+do
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+ * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+ esac
+done
+rm -f $ac_rmfiles
+
+if { { ac_try="$ac_link_default"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link_default") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+# in a Makefile. We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files ''
+do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
+ ;;
+ [ab].out )
+ # We found the default executable, but exeext='' is most
+ # certainly right.
+ break;;
+ *.* )
+ if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+ then :; else
+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ fi
+ # We set ac_cv_exeext here because the later test for it is not
+ # safe: cross compilers may not add the suffix if given an `-o'
+ # argument, so we may need to know it at that point already.
+ # Even if this section looks crufty: it has the advantage of
+ # actually working.
+ break;;
+ * )
+ break;;
+ esac
+done
+test "$ac_cv_exeext" = no && ac_cv_exeext=
+
+else
+ ac_file=''
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
+$as_echo "$ac_file" >&6; }
+if test -z "$ac_file"; then :
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ as_fn_set_status 77
+as_fn_error "C compiler cannot create executables
+See \`config.log' for more details." "$LINENO" 5; }; }
+fi
+ac_exeext=$ac_cv_exeext
+
+# Check that the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
+$as_echo_n "checking whether the C compiler works... " >&6; }
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+ if { ac_try='./$ac_file'
+ { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error "cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." "$LINENO" 5; }
+ fi
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out conftest.out
+ac_clean_files=$ac_clean_files_save
+# Check that the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
+$as_echo_n "checking whether we are cross compiling... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
+$as_echo "$cross_compiling" >&6; }
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
+$as_echo_n "checking for suffix of executables... " >&6; }
+if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ break;;
+ * ) break;;
+ esac
+done
+else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error "cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." "$LINENO" 5; }
+fi
+rm -f conftest$ac_cv_exeext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
+$as_echo "$ac_cv_exeext" >&6; }
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
+$as_echo_n "checking for suffix of object files... " >&6; }
+if test "${ac_cv_objext+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { { ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compile") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ for ac_file in conftest.o conftest.obj conftest.*; do
+ test -f "$ac_file" || continue;
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+ break;;
+ esac
+done
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error "cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." "$LINENO" 5; }
+fi
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
+$as_echo "$ac_cv_objext" >&6; }
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
+$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
+if test "${ac_cv_c_compiler_gnu+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_compiler_gnu=yes
+else
+ ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
+$as_echo "$ac_cv_c_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+ GCC=yes
+else
+ GCC=
+fi
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
+$as_echo_n "checking whether $CC accepts -g... " >&6; }
+if test "${ac_cv_prog_cc_g+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_save_c_werror_flag=$ac_c_werror_flag
+ ac_c_werror_flag=yes
+ ac_cv_prog_cc_g=no
+ CFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_g=yes
+else
+ CFLAGS=""
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+ ac_c_werror_flag=$ac_save_c_werror_flag
+ CFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
+$as_echo "$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
+$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
+if test "${ac_cv_prog_cc_c89+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
+ function prototypes and stuff, but not '\xHH' hex character constants.
+ These don't provoke an error unfortunately, instead are silently treated
+ as 'x'. The following induces an error, until -std is added to get
+ proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
+ array size at least. It's necessary to write '\x00'==0 to get something
+ that's true only with -std. */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+ inside strings and character constants. */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+ ;
+ return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_c89=$ac_arg
+fi
+rm -f core conftest.err conftest.$ac_objext
+ test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+ x)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
+ xno)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
+ *)
+ CC="$CC $ac_cv_prog_cc_c89"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
+$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+if test "x$ac_cv_prog_cc_c89" != xno; then :
+
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
+$as_echo_n "checking how to run the C preprocessor... " >&6; }
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+ if test "${ac_cv_prog_CPP+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ # Double quotes because CPP needs to be expanded
+ for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+ do
+ ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ # Broken: success on invalid input.
+continue
+else
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+ break
+fi
+
+ done
+ ac_cv_prog_CPP=$CPP
+
+fi
+ CPP=$ac_cv_prog_CPP
+else
+ ac_cv_prog_CPP=$CPP
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
+$as_echo "$CPP" >&6; }
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ # Broken: success on invalid input.
+continue
+else
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+
+else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error "C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." "$LINENO" 5; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
+$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
+if test "${ac_cv_path_GREP+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$GREP"; then
+ ac_path_GREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in grep ggrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+ { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+# Check for GNU ac_path_GREP and select it if it is found.
+ # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'GREP' >> "conftest.nl"
+ "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_GREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_GREP="$ac_path_GREP"
+ ac_path_GREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_GREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_GREP"; then
+ as_fn_error "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
+else
+ ac_cv_path_GREP=$GREP
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
+$as_echo "$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
+$as_echo_n "checking for egrep... " >&6; }
+if test "${ac_cv_path_EGREP+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+ then ac_cv_path_EGREP="$GREP -E"
+ else
+ if test -z "$EGREP"; then
+ ac_path_EGREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in egrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+ { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+# Check for GNU ac_path_EGREP and select it if it is found.
+ # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'EGREP' >> "conftest.nl"
+ "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_EGREP="$ac_path_EGREP"
+ ac_path_EGREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_EGREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_EGREP"; then
+ as_fn_error "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
+else
+ ac_cv_path_EGREP=$EGREP
+fi
+
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
+$as_echo "$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if test "${ac_cv_header_stdc+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_header_stdc=yes
+else
+ ac_cv_header_stdc=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "memchr" >/dev/null 2>&1; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "free" >/dev/null 2>&1; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then :
+ :
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i))
+ || toupper (i) != TOUPPER (i))
+ return 2;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+ inttypes.h stdint.h unistd.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
+"
+eval as_val=\$$as_ac_Header
+ if test "x$as_val" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+ ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default"
+if test "x$ac_cv_header_minix_config_h" = x""yes; then :
+ MINIX=yes
+else
+ MINIX=
+fi
+
+
+ if test "$MINIX" = yes; then
+
+$as_echo "#define _POSIX_SOURCE 1" >>confdefs.h
+
+
+$as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h
+
+
+$as_echo "#define _MINIX 1" >>confdefs.h
+
+ fi
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5
+$as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; }
+if test "${ac_cv_safe_to_define___extensions__+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+# define __EXTENSIONS__ 1
+ $ac_includes_default
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_safe_to_define___extensions__=yes
+else
+ ac_cv_safe_to_define___extensions__=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5
+$as_echo "$ac_cv_safe_to_define___extensions__" >&6; }
+ test $ac_cv_safe_to_define___extensions__ = yes &&
+ $as_echo "#define __EXTENSIONS__ 1" >>confdefs.h
+
+ $as_echo "#define _ALL_SOURCE 1" >>confdefs.h
+
+ $as_echo "#define _GNU_SOURCE 1" >>confdefs.h
+
+ $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h
+
+ $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h
+
+
+
am__api_version='1.11'
# Find a good install program. We prefer a C program (faster),
@@ -2789,6 +4110,69 @@ else
fi
rmdir .tst 2>/dev/null
+DEPDIR="${am__leading_dot}deps"
+
+ac_config_commands="$ac_config_commands depfiles"
+
+
+am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+ @echo this is the am__doit target
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5
+$as_echo_n "checking for style of include used by $am_make... " >&6; }
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# Ignore all kinds of additional output from `make'.
+case `$am_make -s -f confmf 2> /dev/null` in #(
+*the\ am__doit\ target*)
+ am__include=include
+ am__quote=
+ _am_result=GNU
+ ;;
+esac
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ case `$am_make -s -f confmf 2> /dev/null` in #(
+ *the\ am__doit\ target*)
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ ;;
+ esac
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5
+$as_echo "$_am_result" >&6; }
+rm -f confinc confmf
+
+# Check whether --enable-dependency-tracking was given.
+if test "${enable_dependency_tracking+set}" = set; then :
+ enableval=$enable_dependency_tracking;
+fi
+
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+ am__nodep='_no'
+fi
+ if test "x$enable_dependency_tracking" != xno; then
+ AMDEP_TRUE=
+ AMDEP_FALSE='#'
+else
+ AMDEP_TRUE='#'
+ AMDEP_FALSE=
+fi
+
+
if test "`cd $srcdir && pwd`" != "`pwd`"; then
# Use -I$(srcdir) only when $(srcdir) != ., so that make's output
# is not polluted with repeated "-I."
@@ -2850,6 +4234,134 @@ am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'
+depcc="$CC" am_compiler_list=
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
+$as_echo_n "checking dependency style of $depcc... " >&6; }
+if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named `D' -- because `-MD' means `put the output
+ # in D'.
+ rm -rf conftest.dir
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_CC_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+ fi
+ am__universal=false
+ case " $depcc " in #(
+ *\ -arch\ *\ -arch\ *) am__universal=true ;;
+ esac
+
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+ # Solaris 8's {/usr,}/bin/sh.
+ touch sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ # We check with `-c' and `-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle `-M -o', and we need to detect this. Also, some Intel
+ # versions had trouble with output in subdirs
+ am__obj=sub/conftest.${OBJEXT-o}
+ am__minus_obj="-o $am__obj"
+ case $depmode in
+ gcc)
+ # This depmode causes a compiler race in universal mode.
+ test "$am__universal" = false || continue
+ ;;
+ nosideeffect)
+ # after this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ msvc7 | msvc7msys | msvisualcpp | msvcmsys)
+ # This compiler won't grok `-c -o', but also, the minuso test has
+ # not run yet. These depmodes are late enough in the game, and
+ # so weak that their functioning should not be impacted.
+ am__obj=conftest.${OBJEXT-o}
+ am__minus_obj=
+ ;;
+ none) break ;;
+ esac
+ if depmode=$depmode \
+ source=sub/conftest.c object=$am__obj \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_CC_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5
+$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; }
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+ if
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+ am__fastdepCC_TRUE=
+ am__fastdepCC_FALSE='#'
+else
+ am__fastdepCC_TRUE='#'
+ am__fastdepCC_FALSE=
+fi
+
+
@@ -3244,231 +4756,6 @@ $as_echo "$ac_try_echo"; } >&5
test $ac_status = 0; }
done
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out conftest.out"
-# Try to create an executable without -o first, disregard a.out.
-# It will help us diagnose broken compilers, and finding out an intuition
-# of exeext.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
-$as_echo_n "checking for C compiler default output file name... " >&6; }
-ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
-
-# The possible output files:
-ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
-
-ac_rmfiles=
-for ac_file in $ac_files
-do
- case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
- * ) ac_rmfiles="$ac_rmfiles $ac_file";;
- esac
-done
-rm -f $ac_rmfiles
-
-if { { ac_try="$ac_link_default"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
- (eval "$ac_link_default") 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then :
- # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
-# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
-# in a Makefile. We should not override ac_cv_exeext if it was cached,
-# so that the user can short-circuit this test for compilers unknown to
-# Autoconf.
-for ac_file in $ac_files ''
-do
- test -f "$ac_file" || continue
- case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
- ;;
- [ab].out )
- # We found the default executable, but exeext='' is most
- # certainly right.
- break;;
- *.* )
- if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
- then :; else
- ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
- fi
- # We set ac_cv_exeext here because the later test for it is not
- # safe: cross compilers may not add the suffix if given an `-o'
- # argument, so we may need to know it at that point already.
- # Even if this section looks crufty: it has the advantage of
- # actually working.
- break;;
- * )
- break;;
- esac
-done
-test "$ac_cv_exeext" = no && ac_cv_exeext=
-
-else
- ac_file=''
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
-$as_echo "$ac_file" >&6; }
-if test -z "$ac_file"; then :
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ as_fn_set_status 77
-as_fn_error "C compiler cannot create executables
-See \`config.log' for more details." "$LINENO" 5; }; }
-fi
-ac_exeext=$ac_cv_exeext
-
-# Check that the compiler produces executables we can run. If not, either
-# the compiler is broken, or we cross compile.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
-$as_echo_n "checking whether the C compiler works... " >&6; }
-# If not cross compiling, check that we can run a simple program.
-if test "$cross_compiling" != yes; then
- if { ac_try='./$ac_file'
- { { case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }; then
- cross_compiling=no
- else
- if test "$cross_compiling" = maybe; then
- cross_compiling=yes
- else
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." "$LINENO" 5; }
- fi
- fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-
-rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out conftest.out
-ac_clean_files=$ac_clean_files_save
-# Check that the compiler produces executables we can run. If not, either
-# the compiler is broken, or we cross compile.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
-$as_echo_n "checking whether we are cross compiling... " >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
-$as_echo "$cross_compiling" >&6; }
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
-$as_echo_n "checking for suffix of executables... " >&6; }
-if { { ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
- (eval "$ac_link") 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then :
- # If both `conftest.exe' and `conftest' are `present' (well, observable)
-# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
-# work properly (i.e., refer to `conftest.exe'), while it won't with
-# `rm'.
-for ac_file in conftest.exe conftest conftest.*; do
- test -f "$ac_file" || continue
- case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
- *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
- break;;
- * ) break;;
- esac
-done
-else
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." "$LINENO" 5; }
-fi
-rm -f conftest$ac_cv_exeext
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
-$as_echo "$ac_cv_exeext" >&6; }
-
-rm -f conftest.$ac_ext
-EXEEXT=$ac_cv_exeext
-ac_exeext=$EXEEXT
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
-$as_echo_n "checking for suffix of object files... " >&6; }
-if test "${ac_cv_objext+set}" = set; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.o conftest.obj
-if { { ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
- (eval "$ac_compile") 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then :
- for ac_file in conftest.o conftest.obj conftest.*; do
- test -f "$ac_file" || continue;
- case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
- *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
- break;;
- esac
-done
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." "$LINENO" 5; }
-fi
-rm -f conftest.$ac_cv_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
-$as_echo "$ac_cv_objext" >&6; }
-OBJEXT=$ac_cv_objext
-ac_objext=$OBJEXT
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
if test "${ac_cv_c_compiler_gnu+set}" = set; then :
@@ -3680,197 +4967,6 @@ ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
-DEPDIR="${am__leading_dot}deps"
-
-ac_config_commands="$ac_config_commands depfiles"
-
-
-am_make=${MAKE-make}
-cat > confinc << 'END'
-am__doit:
- @echo this is the am__doit target
-.PHONY: am__doit
-END
-# If we don't find an include directive, just comment out the code.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5
-$as_echo_n "checking for style of include used by $am_make... " >&6; }
-am__include="#"
-am__quote=
-_am_result=none
-# First try GNU make style include.
-echo "include confinc" > confmf
-# Ignore all kinds of additional output from `make'.
-case `$am_make -s -f confmf 2> /dev/null` in #(
-*the\ am__doit\ target*)
- am__include=include
- am__quote=
- _am_result=GNU
- ;;
-esac
-# Now try BSD make style include.
-if test "$am__include" = "#"; then
- echo '.include "confinc"' > confmf
- case `$am_make -s -f confmf 2> /dev/null` in #(
- *the\ am__doit\ target*)
- am__include=.include
- am__quote="\""
- _am_result=BSD
- ;;
- esac
-fi
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5
-$as_echo "$_am_result" >&6; }
-rm -f confinc confmf
-
-# Check whether --enable-dependency-tracking was given.
-if test "${enable_dependency_tracking+set}" = set; then :
- enableval=$enable_dependency_tracking;
-fi
-
-if test "x$enable_dependency_tracking" != xno; then
- am_depcomp="$ac_aux_dir/depcomp"
- AMDEPBACKSLASH='\'
- am__nodep='_no'
-fi
- if test "x$enable_dependency_tracking" != xno; then
- AMDEP_TRUE=
- AMDEP_FALSE='#'
-else
- AMDEP_TRUE='#'
- AMDEP_FALSE=
-fi
-
-
-
-depcc="$CC" am_compiler_list=
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
-$as_echo_n "checking dependency style of $depcc... " >&6; }
-if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then :
- $as_echo_n "(cached) " >&6
-else
- if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
- # We make a subdir and do the tests there. Otherwise we can end up
- # making bogus files that we don't know about and never remove. For
- # instance it was reported that on HP-UX the gcc test will end up
- # making a dummy file named `D' -- because `-MD' means `put the output
- # in D'.
- rm -rf conftest.dir
- mkdir conftest.dir
- # Copy depcomp to subdir because otherwise we won't find it if we're
- # using a relative directory.
- cp "$am_depcomp" conftest.dir
- cd conftest.dir
- # We will build objects and dependencies in a subdirectory because
- # it helps to detect inapplicable dependency modes. For instance
- # both Tru64's cc and ICC support -MD to output dependencies as a
- # side effect of compilation, but ICC will put the dependencies in
- # the current directory while Tru64 will put them in the object
- # directory.
- mkdir sub
-
- am_cv_CC_dependencies_compiler_type=none
- if test "$am_compiler_list" = ""; then
- am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
- fi
- am__universal=false
- case " $depcc " in #(
- *\ -arch\ *\ -arch\ *) am__universal=true ;;
- esac
-
- for depmode in $am_compiler_list; do
- # Setup a source with many dependencies, because some compilers
- # like to wrap large dependency lists on column 80 (with \), and
- # we should not choose a depcomp mode which is confused by this.
- #
- # We need to recreate these files for each test, as the compiler may
- # overwrite some of them when testing with obscure command lines.
- # This happens at least with the AIX C compiler.
- : > sub/conftest.c
- for i in 1 2 3 4 5 6; do
- echo '#include "conftst'$i'.h"' >> sub/conftest.c
- # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
- # Solaris 8's {/usr,}/bin/sh.
- touch sub/conftst$i.h
- done
- echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
-
- # We check with `-c' and `-o' for the sake of the "dashmstdout"
- # mode. It turns out that the SunPro C++ compiler does not properly
- # handle `-M -o', and we need to detect this. Also, some Intel
- # versions had trouble with output in subdirs
- am__obj=sub/conftest.${OBJEXT-o}
- am__minus_obj="-o $am__obj"
- case $depmode in
- gcc)
- # This depmode causes a compiler race in universal mode.
- test "$am__universal" = false || continue
- ;;
- nosideeffect)
- # after this tag, mechanisms are not by side-effect, so they'll
- # only be used when explicitly requested
- if test "x$enable_dependency_tracking" = xyes; then
- continue
- else
- break
- fi
- ;;
- msvc7 | msvc7msys | msvisualcpp | msvcmsys)
- # This compiler won't grok `-c -o', but also, the minuso test has
- # not run yet. These depmodes are late enough in the game, and
- # so weak that their functioning should not be impacted.
- am__obj=conftest.${OBJEXT-o}
- am__minus_obj=
- ;;
- none) break ;;
- esac
- if depmode=$depmode \
- source=sub/conftest.c object=$am__obj \
- depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
- $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
- >/dev/null 2>conftest.err &&
- grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
- grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
- grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
- ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
- # icc doesn't choke on unknown options, it will just issue warnings
- # or remarks (even with -Werror). So we grep stderr for any message
- # that says an option was ignored or not supported.
- # When given -MP, icc 7.0 and 7.1 complain thusly:
- # icc: Command line warning: ignoring option '-M'; no argument required
- # The diagnosis changed in icc 8.0:
- # icc: Command line remark: option '-MP' not supported
- if (grep 'ignoring option' conftest.err ||
- grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
- am_cv_CC_dependencies_compiler_type=$depmode
- break
- fi
- fi
- done
-
- cd ..
- rm -rf conftest.dir
-else
- am_cv_CC_dependencies_compiler_type=none
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5
-$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; }
-CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
-
- if
- test "x$enable_dependency_tracking" != xno \
- && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
- am__fastdepCC_TRUE=
- am__fastdepCC_FALSE='#'
-else
- am__fastdepCC_TRUE='#'
- am__fastdepCC_FALSE=
-fi
-
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
@@ -4261,405 +5357,6 @@ fi
# AC_CONFIG_MACRO_DIR([..])
ac_config_files="$ac_config_files Makefile libcilkrts.spec"
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
-$as_echo_n "checking how to run the C preprocessor... " >&6; }
-# On Suns, sometimes $CPP names a directory.
-if test -n "$CPP" && test -d "$CPP"; then
- CPP=
-fi
-if test -z "$CPP"; then
- if test "${ac_cv_prog_CPP+set}" = set; then :
- $as_echo_n "(cached) " >&6
-else
- # Double quotes because CPP needs to be expanded
- for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
- do
- ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
-do
- # Use a header file that comes with gcc, so configuring glibc
- # with a fresh cross-compiler works.
- # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- # <limits.h> exists even on freestanding compilers.
- # On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp. "Syntax error" is here to catch this case.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
- Syntax error
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
-
-else
- # Broken: fails on valid input.
-continue
-fi
-rm -f conftest.err conftest.$ac_ext
-
- # OK, works on sane cases. Now check whether nonexistent headers
- # can be detected and how.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <ac_nonexistent.h>
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
- # Broken: success on invalid input.
-continue
-else
- # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-rm -f conftest.err conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then :
- break
-fi
-
- done
- ac_cv_prog_CPP=$CPP
-
-fi
- CPP=$ac_cv_prog_CPP
-else
- ac_cv_prog_CPP=$CPP
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
-$as_echo "$CPP" >&6; }
-ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
-do
- # Use a header file that comes with gcc, so configuring glibc
- # with a fresh cross-compiler works.
- # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- # <limits.h> exists even on freestanding compilers.
- # On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp. "Syntax error" is here to catch this case.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
- Syntax error
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
-
-else
- # Broken: fails on valid input.
-continue
-fi
-rm -f conftest.err conftest.$ac_ext
-
- # OK, works on sane cases. Now check whether nonexistent headers
- # can be detected and how.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <ac_nonexistent.h>
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
- # Broken: success on invalid input.
-continue
-else
- # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-rm -f conftest.err conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then :
-
-else
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." "$LINENO" 5; }
-fi
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
-$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
-if test "${ac_cv_path_GREP+set}" = set; then :
- $as_echo_n "(cached) " >&6
-else
- if test -z "$GREP"; then
- ac_path_GREP_found=false
- # Loop through the user's path and test for each of PROGNAME-LIST
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_prog in grep ggrep; do
- for ac_exec_ext in '' $ac_executable_extensions; do
- ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
- { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
-# Check for GNU ac_path_GREP and select it if it is found.
- # Check for GNU $ac_path_GREP
-case `"$ac_path_GREP" --version 2>&1` in
-*GNU*)
- ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
-*)
- ac_count=0
- $as_echo_n 0123456789 >"conftest.in"
- while :
- do
- cat "conftest.in" "conftest.in" >"conftest.tmp"
- mv "conftest.tmp" "conftest.in"
- cp "conftest.in" "conftest.nl"
- $as_echo 'GREP' >> "conftest.nl"
- "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
- diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
- as_fn_arith $ac_count + 1 && ac_count=$as_val
- if test $ac_count -gt ${ac_path_GREP_max-0}; then
- # Best one so far, save it but keep looking for a better one
- ac_cv_path_GREP="$ac_path_GREP"
- ac_path_GREP_max=$ac_count
- fi
- # 10*(2^10) chars as input seems more than enough
- test $ac_count -gt 10 && break
- done
- rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
-
- $ac_path_GREP_found && break 3
- done
- done
- done
-IFS=$as_save_IFS
- if test -z "$ac_cv_path_GREP"; then
- as_fn_error "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
- fi
-else
- ac_cv_path_GREP=$GREP
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
-$as_echo "$ac_cv_path_GREP" >&6; }
- GREP="$ac_cv_path_GREP"
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
-$as_echo_n "checking for egrep... " >&6; }
-if test "${ac_cv_path_EGREP+set}" = set; then :
- $as_echo_n "(cached) " >&6
-else
- if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
- then ac_cv_path_EGREP="$GREP -E"
- else
- if test -z "$EGREP"; then
- ac_path_EGREP_found=false
- # Loop through the user's path and test for each of PROGNAME-LIST
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_prog in egrep; do
- for ac_exec_ext in '' $ac_executable_extensions; do
- ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
- { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
-# Check for GNU ac_path_EGREP and select it if it is found.
- # Check for GNU $ac_path_EGREP
-case `"$ac_path_EGREP" --version 2>&1` in
-*GNU*)
- ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
-*)
- ac_count=0
- $as_echo_n 0123456789 >"conftest.in"
- while :
- do
- cat "conftest.in" "conftest.in" >"conftest.tmp"
- mv "conftest.tmp" "conftest.in"
- cp "conftest.in" "conftest.nl"
- $as_echo 'EGREP' >> "conftest.nl"
- "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
- diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
- as_fn_arith $ac_count + 1 && ac_count=$as_val
- if test $ac_count -gt ${ac_path_EGREP_max-0}; then
- # Best one so far, save it but keep looking for a better one
- ac_cv_path_EGREP="$ac_path_EGREP"
- ac_path_EGREP_max=$ac_count
- fi
- # 10*(2^10) chars as input seems more than enough
- test $ac_count -gt 10 && break
- done
- rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
-
- $ac_path_EGREP_found && break 3
- done
- done
- done
-IFS=$as_save_IFS
- if test -z "$ac_cv_path_EGREP"; then
- as_fn_error "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
- fi
-else
- ac_cv_path_EGREP=$EGREP
-fi
-
- fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
-$as_echo "$ac_cv_path_EGREP" >&6; }
- EGREP="$ac_cv_path_EGREP"
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
-$as_echo_n "checking for ANSI C header files... " >&6; }
-if test "${ac_cv_header_stdc+set}" = set; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- ac_cv_header_stdc=yes
-else
- ac_cv_header_stdc=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-if test $ac_cv_header_stdc = yes; then
- # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <string.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "memchr" >/dev/null 2>&1; then :
-
-else
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
- # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <stdlib.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "free" >/dev/null 2>&1; then :
-
-else
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
- # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
- if test "$cross_compiling" = yes; then :
- :
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <ctype.h>
-#include <stdlib.h>
-#if ((' ' & 0x0FF) == 0x020)
-# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#else
-# define ISLOWER(c) \
- (('a' <= (c) && (c) <= 'i') \
- || ('j' <= (c) && (c) <= 'r') \
- || ('s' <= (c) && (c) <= 'z'))
-# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
-#endif
-
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
-int
-main ()
-{
- int i;
- for (i = 0; i < 256; i++)
- if (XOR (islower (i), ISLOWER (i))
- || toupper (i) != TOUPPER (i))
- return 2;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-
-else
- ac_cv_header_stdc=no
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
- conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
-fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
-$as_echo "$ac_cv_header_stdc" >&6; }
-if test $ac_cv_header_stdc = yes; then
-
-$as_echo "#define STDC_HEADERS 1" >>confdefs.h
-
-fi
-
-# On IRIX 5.3, sys/types and inttypes.h are conflicting.
-for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
- inttypes.h stdint.h unistd.h
-do :
- as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
-"
-eval as_val=\$$as_ac_Header
- if test "x$as_val" = x""yes; then :
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
# for constant arguments. Useless!
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5
@@ -4949,6 +5646,10 @@ case "${target}" in
config_dir="x86"
;;
+ arm-*-*)
+ config_dir="arm"
+ ;;
+
*)
config_dir="generic"
;;
@@ -9036,7 +9737,7 @@ _LT_EOF
if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
else
- export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "L")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
fi
aix_use_runtimelinking=no
@@ -11064,7 +11765,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11067 "configure"
+#line 11768 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11170,7 +11871,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11173 "configure"
+#line 11874 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13522,7 +14223,7 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
else
- export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "L")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
fi
;;
pw32*)
@@ -14476,8 +15177,7 @@ rm -f core conftest.err conftest.$ac_objext \
# Check for pthread_{,attr_}[sg]etaffinity_np.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-#define _GNU_SOURCE
- #include <pthread.h>
+#include <pthread.h>
int
main ()
{
@@ -14665,6 +15365,14 @@ LIBOBJS=$ac_libobjs
LTLIBOBJS=$ac_ltlibobjs
+if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
+ as_fn_error "conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+ as_fn_error "conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -n "$EXEEXT"; then
am__EXEEXT_TRUE=
am__EXEEXT_FALSE='#'
@@ -14677,14 +15385,6 @@ if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
-if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
- as_fn_error "conditional \"AMDEP\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
-if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
- as_fn_error "conditional \"am__fastdepCC\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then
as_fn_error "conditional \"am__fastdepCXX\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -15260,6 +15960,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
#
# INIT-COMMANDS
#
+AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
srcdir="$srcdir"
host="$host"
@@ -15274,7 +15975,6 @@ CC="$CC"
CXX="$CXX"
GFORTRAN="$GFORTRAN"
GCJ="$GCJ"
-AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
# The HP-UX ksh and POSIX shell print the target directory to stdout
@@ -15644,8 +16344,8 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
for ac_config_target in $ac_config_targets
do
case $ac_config_target in
- "default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
"depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+ "default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
"libcilkrts.spec") CONFIG_FILES="$CONFIG_FILES libcilkrts.spec" ;;
"libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
@@ -16067,14 +16767,6 @@ $as_echo "$as_me: executing $ac_file commands" >&6;}
case $ac_file$ac_mode in
- "default-1":C)
-# Only add multilib support code if we just rebuilt the top-level
-# Makefile.
-case " $CONFIG_FILES " in
- *" Makefile "*)
- ac_file=Makefile . ${multi_basedir}/config-ml.in
- ;;
-esac ;;
"depfiles":C) test x"$AMDEP_TRUE" != x"" || {
# Autoconf 2.62 quotes --file arguments for eval, but not when files
# are listed without --file. Let's play safe and only enable the eval
@@ -16170,6 +16862,14 @@ $as_echo X"$file" |
done
}
;;
+ "default-1":C)
+# Only add multilib support code if we just rebuilt the top-level
+# Makefile.
+case " $CONFIG_FILES " in
+ *" Makefile "*)
+ ac_file=Makefile . ${multi_basedir}/config-ml.in
+ ;;
+esac ;;
"libtool":C)
# See if we are running on zsh, and set the options which allow our
diff --git a/libcilkrts/configure.ac b/libcilkrts/configure.ac
index 8ad647ea8e7..6edb9f7c917 100644
--- a/libcilkrts/configure.ac
+++ b/libcilkrts/configure.ac
@@ -1,8 +1,6 @@
-# @copyright
-# Copyright (C) 2011-2013, Intel Corporation
+# Copyright (C) 2011-2016, Intel Corporation
# All rights reserved.
#
-# @copyright
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
@@ -17,7 +15,6 @@
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
-# @copyright
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -30,6 +27,20 @@
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
# WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
+#
+# *********************************************************************
+#
+# PLEASE NOTE: This file is a downstream copy of a file mainitained in
+# a repository at cilkplus.org. Changes made to this file that are not
+# submitted through the contribution process detailed at
+# http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+# time that a new version is released. Changes only submitted to the
+# GNU compiler collection or posted to the git repository at
+# https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+# not tracked.
+#
+# We welcome your contributions to this open source project. Thank you
+# for your assistance in helping us improve Cilk Plus.
AC_INIT([Cilk Runtime Library], [2.0], [cilk@intel.com])
AC_PREREQ([2.64])
@@ -39,6 +50,10 @@ AC_PREREQ([2.64])
AC_CANONICAL_SYSTEM
target_alias=${target_alias-$host_alias}
AC_SUBST(target_alias)
+
+# Test for GNU extensions. Will define _GNU_SOURCE if they're available
+AC_USE_SYSTEM_EXTENSIONS
+
AM_INIT_AUTOMAKE(foreign no-dist)
AM_MAINTAINER_MODE
@@ -134,6 +149,10 @@ case "${target}" in
config_dir="x86"
;;
+ arm-*-*)
+ config_dir="arm"
+ ;;
+
*)
config_dir="generic"
;;
@@ -189,8 +208,7 @@ AC_LINK_IFELSE(
# Check for pthread_{,attr_}[sg]etaffinity_np.
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
- [#define _GNU_SOURCE
- #include <pthread.h>],
+ [#include <pthread.h>],
[cpu_set_t cpuset;
pthread_attr_t attr;
pthread_getaffinity_np (pthread_self (), sizeof (cpu_set_t), &cpuset);
diff --git a/libcilkrts/configure.tgt b/libcilkrts/configure.tgt
index fcda70fb68f..7f0befc870c 100644
--- a/libcilkrts/configure.tgt
+++ b/libcilkrts/configure.tgt
@@ -1,8 +1,6 @@
-# @copyright
-# Copyright (C) 2011-2013, Intel Corporation
+# Copyright (C) 2013-2016, Intel Corporation
# All rights reserved.
#
-# @copyright
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
@@ -17,7 +15,6 @@
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
-# @copyright
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -30,13 +27,29 @@
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
# WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
+#
+# *********************************************************************
+#
+# PLEASE NOTE: This file is a downstream copy of a file mainitained in
+# a repository at cilkplus.org. Changes made to this file that are not
+# submitted through the contribution process detailed at
+# http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+# time that a new version is released. Changes only submitted to the
+# GNU compiler collection or posted to the git repository at
+# https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+# not tracked.
+#
+# We welcome your contributions to this open source project. Thank you
+# for your assistance in helping us improve Cilk Plus.
-# Disable Cilk Runtime library for non x86 architecture...for now.
+# Disable Cilk Runtime library for unsupported architectures.
case "${target}" in
x86_64-*-*)
;;
i?86-*-*)
;;
+ arm-*-*)
+ ;;
*-*-*)
UNSUPPORTED=1
;;
diff --git a/libcilkrts/include/cilk/cilk.h b/libcilkrts/include/cilk/cilk.h
index 2d0de0d293e..86038ac1adc 100644
--- a/libcilkrts/include/cilk/cilk.h
+++ b/libcilkrts/include/cilk/cilk.h
@@ -1,10 +1,8 @@
/* cilk.h -*-C++-*-
*
- * @copyright
- * Copyright (C) 2010-2013, Intel Corporation
+ * Copyright (C) 2010-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -19,7 +17,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -32,40 +29,54 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
*/
/** @file cilk.h
*
- * @brief Provides convenient aliases for the Cilk language keywords.
+ * @brief Provides convenient aliases for Intel(R) Cilk(TM) language keywords.
*
* @details
- * Since Cilk is a nonstandard extension to both C and C++, the Cilk
- * language keywords all begin with “`_Cilk_`”, which guarantees that they
+ * Since Intel Cilk Plus is a nonstandard extension to both C and C++, the Intel
+ * Cilk language keywords all begin with "`_Cilk_`", which guarantees that they
* will not conflict with user-defined identifiers in properly written
- * programs, so that “standard” C and C++ programs can safely be
- * compiled a Cilk-enabled C or C++ compiler.
+ * programs. This way, a Cilk-enabled C or C++ compiler can safely compile
+ * "standard" C and C++ programs.
*
* However, this means that the keywords _look_ like something grafted on to
* the base language. Therefore, you can include this header:
*
* #include "cilk/cilk.h"
*
- * and then write the Cilk keywords with a “`cilk_`” prefix instead of
- * “`_Cilk_`”.
+ * and then write the Intel Cilk keywords with a "`cilk_`" prefix instead of
+ * "`_Cilk_`".
*
* @ingroup language
*/
/** @defgroup language Language Keywords
- * Definitions having to do with the Cilk language.
+ * Definitions for the Intel Cilk language.
* @{
*/
#ifndef cilk_spawn
# define cilk_spawn _Cilk_spawn ///< Spawn a task that can execute in parallel.
# define cilk_sync _Cilk_sync ///< Wait for spawned tasks to complete.
-# define cilk_for _Cilk_for ///< Execute iterations of a for loop in parallel.
+# define cilk_for _Cilk_for ///< Execute iterations of a `for` loop in parallel.
#endif
/// @}
diff --git a/libcilkrts/include/cilk/cilk_api.h b/libcilkrts/include/cilk/cilk_api.h
index a21687b7b32..6cc62c994b7 100644
--- a/libcilkrts/include/cilk/cilk_api.h
+++ b/libcilkrts/include/cilk/cilk_api.h
@@ -1,10 +1,8 @@
/* cilk_api.h
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -19,7 +17,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -32,23 +29,37 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
*/
-
+
/** @file cilk_api.h
*
- * @brief Defines the documented API exposed by the Cilk Plus for use
- * by applications.
+ * @brief Defines the Intel(R) Cilk(TM) Plus API for use by applications.
*
* @ingroup api
*/
-
+
#ifndef INCLUDED_CILK_API_H
#define INCLUDED_CILK_API_H
+
/** @defgroup api Runtime API
- * API to allow user programs to interact with the Cilk runtime.
- * @{
- */
+* API to interact with the Intel Cilk Plus runtime.
+* @{
+*/
#ifndef CILK_STUB /* Real (non-stub) definitions */
@@ -81,7 +92,7 @@
__CILKRTS_BEGIN_EXTERN_C
-/** Return values from __cilkrts_set_param() and __cilkrts_set_param_w()
+/** Return values from `__cilkrts_set_param()` and `__cilkrts_set_param_w()`
*/
enum __cilkrts_set_param_status {
__CILKRTS_SET_PARAM_SUCCESS = 0, /**< Success - parameter set */
@@ -91,79 +102,79 @@ enum __cilkrts_set_param_status {
__CILKRTS_SET_PARAM_LATE = 4 /**< Too late to change parameter value */
};
-/** Set user controllable runtime parameters
+/** Sets user controllable runtime parameters
*
- * Call this function to set runtime parameters that control the behavior
- * of the Cilk scheduler.
+ * Call this function to set runtime parameters that control the behavior
+ * of the Intel Cilk Plus scheduler.
*
* @param param A string specifying the parameter to be set. One of:
* - `"nworkers"`
* - `"force reduce"`
* @param value A string specifying the parameter value.
- * @returns A value from the @ref __cilkrts_set_param_status
+ * @returns A value from the @ref __cilkrts_set_param_status
* enumeration indicating the result of the operation.
*
* @par The "nworkers" parameter
*
* This parameter specifies the number of worker threads to be created by the
- * Cilk runtime. @a Value must be a string of digits to be parsed by
- * `strtol()`.
+ * Intel Cilk Plus runtime. @a Value must be a string of digits to be parsed by
+ * `strtol()` as a decimal number.
*
* The number of worker threads is:
- * 1. the value set with `__cilkrts_set_param("nworkers")`, if it is
+ * 1. the value set with `__cilkrts_set_param("nworkers")`, if it is
* positive; otherwise,
- * 2. the value of the CILK_NWORKERS environment variable, if it is
+ * 2. the value of the CILK_NWORKERS environment variable, if it is
* defined; otherwise
* 3. the number of cores available, as reported by the operating system.
*
* @note
- * Technically, Cilk distinguishes between the _user thread_ (the thread that
- * the user code was executing on when the Cilk runtime started), and
- * _worker threads_ (new threads created by the Cilk runtime to support
- * Cilk parallelism). `nworkers` actually includes both the user thread and
- * the worker threads; that is, it is one greater than the number of true
- * “worker threads”.
+ * Technically, Intel Cilk Plus distinguishes between the _user thread_ (the thread
+ * that the user code was executing on when the Intel Cilk Plus runtime started),
+ * and _worker threads_ (new threads created by the Intel Cilk Plus runtime to
+ * support Intel Cilk Plus parallelism). `nworkers` actually includes both the user
+ * thread and the worker threads; that is, it is one greater than the number of
+ * true "worker threads".
*
* @note
- * Setting `nworkers = 1` produces serial behavior. Cilk spawns and syncs will
- * be executed, but with only one worker, continuations will never be stolen,
- * so all code will execute in serial.
+ * Setting `nworkers = 1` produces serial behavior. Intel Cilk Plus spawns and syncs
+ * will be executed, but with only one worker, continuations will never be
+ * stolen, so all code will execute in serial.
*
* @warning
- * The number of worker threads can only be set *before* the runtime has
- * started. Attempting to set it when the runtime is running will have no
- * effect, and will return an error code. You can call __cilkrts_end_cilk()
+ * The number of worker threads can only be set *before* the runtime has
+ * started. Attempting to set it when the runtime is running will have no
+ * effect, and will return an error code. You can call __cilkrts_end_cilk()
* to shut down the runtime to change the number of workers.
*
* @warning
- * The default Cilk scheduler behavior is usually pretty good. The ability
- * to override `nworkers` can be useful for experimentation, but it won’t
- * usually be necessary for getting good performance.
+ * The default Intel Cilk scheduler behavior is usually pretty good. The
+ * ability to override `nworkers` can be useful for experimentation, but it
+ * won't usually be necessary for getting good performance.
*
* @par The "force reduce" parameter
*
* This parameter controls whether the runtime should allocate a new view
- * for a reducer for every parallel strand that it is accessed on. (See
- * @ref pagereducers.) @a Value must be `"1"` or `"true"` to enable the
- * “force reduce” behavior, or `"0"` or `"false"` to disable it.
+ * for a reducer for every parallel strand that it is accessed on. (See
+ * @ref pagereducers.) @a Value must be `"1"` or `"true"` to enable the
+ * "force reduce" behavior, or `"0"` or `"false"` to disable it.
*
- * “Force reduce” behavior will also be enabled if
+ * "Force reduce" behavior will also be enabled if
* `__cilkrts_set_param("force reduce")` is not called, but the
* `CILK_FORCE_REDUCE` environment variable is defined.
*
* @warning
- * When this option is enabled, `nworkers` should be set to `1`. Using “force
- * reduce” with more than one worker may result in runtime errors.
- *
+ * When this option is enabled, `nworkers` should be set to `1`. Using "force
+ * reduce" with more than one worker may result in runtime errors.
+ *
* @warning
- * Enabling this option can significantly reduce performance. It should
- * _only_ be used as a debugging tool.
+ * Enabling this option can significantly reduce performance. Use it
+ * _only_ as a debugging tool.
*/
CILK_API(int) __cilkrts_set_param(const char *param, const char *value);
#ifdef _WIN32
/**
- * Set user controllable parameters using wide strings
+ * Sets user controllable parameters using wide strings
*
* @note This variant of __cilkrts_set_param() is only available
* on Windows.
@@ -173,36 +184,36 @@ CILK_API(int) __cilkrts_set_param(const char *param, const char *value);
CILK_API(int) __cilkrts_set_param_w(const wchar_t *param, const wchar_t *value);
#endif
-/** Shut down and deallocate all Cilk state. The runtime will abort the
- * application if Cilk is still in use by this thread. Otherwise the runtime
- * will wait for all other threads using Cilk to exit.
+/** Shuts down and deallocates all Intel Cilk Plus states. If Intel Cilk Plus is still in
+ * use by the calling thread, the runtime aborts the application. Otherwise, the
+ * runtime waits for all other threads using Intel Cilk Plus to exit.
*/
CILK_API(void) __cilkrts_end_cilk(void);
-/** Initialize the Cilk data structures and start the runtime.
+/** Initializes Intel Cilk Plus data structures and start the runtime.
*/
CILK_API(void) __cilkrts_init(void);
-/** Return the runtime `nworkers` parameter. (See the discussion of `nworkers`
+/** Returns the runtime `nworkers` parameter. (See the discussion of `nworkers`
* in the documentation for __cilkrts_set_param().)
*/
CILK_API(int) __cilkrts_get_nworkers(void);
-/** Return the number of thread data structures.
+/** Returns the number of thread data structures.
*
- * This function returns the number of data structures that has been allocated
- * allocated by the runtime to hold information about user and worker threads.
+ * This function returns the number of data structures that have been allocated
+ * by the runtime to hold information about user and worker threads.
*
- * If you don’t already know what this is good for, then you probably don’t
- * need it.
+ * If you don't already know what this is good for, then you probably don't
+ * need it. :)
*/
CILK_API(int) __cilkrts_get_total_workers(void);
-/** What thread is the function running on?
+/** Returns a small integer identifying the current thread.
*
- * Return a small integer identifying the current thread. Each worker thread
- * started by the Cilk runtime library has a unique worker number in the range
- * `1 .. nworkers - 1`.
+ * What thread is the function running on? Each worker thread
+ * started by the Intel Cilk Plus runtime library has a unique worker number in the
+ * range `1 .. nworkers - 1`.
*
* All _user_ threads (threads started by the user, or by other libraries) are
* identified as worker number 0. Therefore, the worker number is not unique
@@ -210,13 +221,13 @@ CILK_API(int) __cilkrts_get_total_workers(void);
*/
CILK_API(int) __cilkrts_get_worker_number(void);
-/** Test whether “force reduce” behavior is enabled.
- *
+/** Tests whether "force reduce" behavior is enabled.
+ *
* @return Non-zero if force-reduce mode is on, zero if it is off.
*/
CILK_API(int) __cilkrts_get_force_reduce(void);
-/** Interact with tools
+/** Interacts with tools
*/
CILK_API(void)
__cilkrts_metacall(unsigned int tool, unsigned int code, void *data);
@@ -229,12 +240,13 @@ typedef struct _EXCEPTION_RECORD _EXCEPTION_RECORD;
*/
typedef void (*__cilkrts_pfn_seh_callback)(const _EXCEPTION_RECORD *exception);
-/** Specify a function to call when a non-C++ exception is caught.
+/** Specifies a function to call when a non-C++ exception is caught.
*
- * Cilk Plus parallelism plays nicely with C++ exception handling, but the
- * Cilk Plus runtime has no way to unwind the stack across a strand boundary
- * for Microsoft SEH (“Structured Exception Handling”) exceptions. Therefore,
- * when the runtime catches such an exception, it must abort the application.
+ * Intel Cilk Plus parallelism plays nicely with C++ exception handling, but
+ * the Intel Cilk Plus runtime has no way to unwind the stack across a strand
+ * boundary for Microsoft SEH ("Structured Exception Handling") exceptions.
+ * Therefore, when the runtime catches such an exception, it must abort the
+ * application.
*
* If an SEH callback has been set, the runtime will call it before aborting.
*
@@ -267,33 +279,33 @@ __cilkrts_bump_worker_rank_internal(__cilkrts_worker* w);
/// @endcond
-/** Get the current pedigree, in a linked list representation.
+/** Gets the current pedigree in a linked list representation.
*
* This routine returns a copy of the last node in the pedigree list.
* For example, if the current pedigree (in order) is <1, 2, 3, 4>,
* then this method returns a node with rank == 4, and whose parent
* field points to the node with rank of 3. In summary, following the
* nodes in the chain visits the terms of the pedigree in reverse.
- *
+ *
* The returned node is guaranteed to be valid only until the caller
* of this routine has returned.
*/
__CILKRTS_INLINE
-__cilkrts_pedigree __cilkrts_get_pedigree(void)
+__cilkrts_pedigree __cilkrts_get_pedigree(void)
{
- return __cilkrts_get_pedigree_internal(__cilkrts_get_tls_worker());
+ return __cilkrts_get_pedigree_internal(__cilkrts_get_tls_worker());
}
/** Context used by __cilkrts_get_pedigree_info.
*
* @deprecated
- * This data structure is only used by the deprecated
+ * This data structure is only used by the deprecated
* __cilkrts_get_pedigree_info function.
*
* Callers should initialize the `data` array to NULL and set the `size`
* field to `sizeof(__cilkrts_pedigree_context_t)` before the first call
- * to __cilkrts_get_pedigree_info(), and should not examine or modify it
- * thereafter.
+ * to `__cilkrts_get_pedigree_info()`. Also, callers should not examine or
+ * modify `data` thereafter.
*/
typedef struct
{
@@ -301,16 +313,16 @@ typedef struct
void *data[3]; /**< Opaque context data */
} __cilkrts_pedigree_context_t;
-/** Get pedigree information.
+/** Gets pedigree information.
*
* @deprecated
* Use __cilkrts_get_pedigree() instead.
*
- * This routine allows code to walk up the stack of Cilk frames to gather
+ * This routine allows code to walk up the stack of Intel Cilk Plus frames to gather
* the pedigree.
*
* Initialize the pedigree walk by filling the pedigree context with NULLs
- * and setting the size field to sizeof(__cilkrts_pedigree_context).
+ * and setting the size field to `sizeof(__cilkrts_pedigree_context)`.
* Other than initialization to NULL to start the walk, user coder should
* consider the pedigree context data opaque and should not examine or
* modify it.
@@ -326,7 +338,7 @@ CILK_API(int)
__cilkrts_get_pedigree_info(/* In/Out */ __cilkrts_pedigree_context_t *context,
/* Out */ uint64_t *sf_birthrank);
-/** Get the rank of the currently executing worker.
+/** Gets the rank of the currently executing worker.
*
* @deprecated
* Use `__cilkrts_get_pedigree().rank` instead.
@@ -335,16 +347,16 @@ __cilkrts_get_pedigree_info(/* In/Out */ __cilkrts_pedigree_context_t *context,
* @returns <0 - Failure - *rank is not changed
*/
CILK_EXPORT_AND_INLINE
-int __cilkrts_get_worker_rank(uint64_t *rank)
+int __cilkrts_get_worker_rank(uint64_t *rank)
{
*rank = __cilkrts_get_pedigree().rank;
return 0;
}
-/** Increment the pedigree rank of the currently executing worker.
+/** Increments the pedigree rank of the currently executing worker.
*
* @returns 0 - Success - rank was incremented
- * @returns-1 - Failure
+ * @returns -1 - Failure
*/
CILK_EXPORT_AND_INLINE
int __cilkrts_bump_worker_rank(void)
@@ -352,7 +364,7 @@ int __cilkrts_bump_worker_rank(void)
return __cilkrts_bump_worker_rank_internal(__cilkrts_get_tls_worker());
}
-/** Increment the pedigree rank for a cilk_for loop.
+/** Increments the pedigree rank for a `cilk_for` loop.
* Obsolete.
*
* @deprecated
@@ -362,7 +374,7 @@ int __cilkrts_bump_worker_rank(void)
* be called, but will have no effect.
*/
CILK_EXPORT_AND_INLINE
-int __cilkrts_bump_loop_rank(void)
+int __cilkrts_bump_loop_rank(void)
{
return 0;
}
@@ -375,7 +387,7 @@ __CILKRTS_END_EXTERN_C
#else /* CILK_STUB */
-// Programs compiled with CILK_STUB are not linked with the Cilk runtime
+// Programs compiled with CILK_STUB are not linked with the Intel Cilk Plus runtime
// library, so they should not have external references to runtime functions.
// Therefore, the functions are replaced with stubs.
@@ -401,8 +413,8 @@ __CILKRTS_END_EXTERN_C
/*
* A stub method for __cilkrts_get_pedigree.
- * Returns an empty __cilkrts_pedigree.
- */
+ * Returns an empty __cilkrts_pedigree.
+ */
__CILKRTS_INLINE
__cilkrts_pedigree __cilkrts_get_pedigree_stub(void)
{
diff --git a/libcilkrts/include/cilk/cilk_api_linux.h b/libcilkrts/include/cilk/cilk_api_linux.h
index ed9e70635f6..0ebd57cba21 100644
--- a/libcilkrts/include/cilk/cilk_api_linux.h
+++ b/libcilkrts/include/cilk/cilk_api_linux.h
@@ -1,9 +1,7 @@
/*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -18,7 +16,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -31,6 +28,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
*
*/
diff --git a/libcilkrts/include/cilk/cilk_stub.h b/libcilkrts/include/cilk/cilk_stub.h
index 116e3ff5541..b4a54f37c9b 100644
--- a/libcilkrts/include/cilk/cilk_stub.h
+++ b/libcilkrts/include/cilk/cilk_stub.h
@@ -1,10 +1,8 @@
/* cilk_stub.h -*-C++-*-
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -19,7 +17,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -32,13 +29,27 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
*
*/
#ifndef INCLUDED_CILK_STUB_DOT_H
#define INCLUDED_CILK_STUB_DOT_H
-/* Definitions for creating a serialization from a Cilk program.
+/* Definitions for creating a serialization from an Intel(R) Cilk(TM) Plus program.
* These definitions are suitable for use by a compiler that is not
* Cilk-enabled.
*/
@@ -47,9 +58,14 @@
#undef __cilk
#define CILK_STUB
-/* Replace Cilk keywords with serial equivalents */
+/* Replace Intel Cilk keywords with serial equivalents */
#define _Cilk_spawn
#define _Cilk_sync
#define _Cilk_for for
+/* Replace simd-loop keywords with serial equivalents */
+#define _Simd
+#define _Safelen(...)
+#define _Reduction(...)
+
#endif /* ! defined(INCLUDED_CILK_STUB_DOT_H) */
diff --git a/libcilkrts/include/cilk/cilk_undocumented.h b/libcilkrts/include/cilk/cilk_undocumented.h
index 81cdd64bb89..5f4a8c5dff1 100644
--- a/libcilkrts/include/cilk/cilk_undocumented.h
+++ b/libcilkrts/include/cilk/cilk_undocumented.h
@@ -1,9 +1,7 @@
/*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -18,7 +16,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -31,6 +28,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
*
******************************************************************************
*
@@ -83,7 +94,7 @@ CILK_EXPORT __CILKRTS_NOTHROW
void *__cilkrts_get_sf(void);
/**
- * Returns the size of stacks created by Cilk.
+ * Returns the size of stacks created by Intel(R) Cilk(TM) Plus.
*/
CILK_EXPORT __CILKRTS_NOTHROW
size_t __cilkrts_get_stack_size(void);
diff --git a/libcilkrts/include/cilk/common.h b/libcilkrts/include/cilk/common.h
index 97dd66e0639..91b2928e7e6 100644
--- a/libcilkrts/include/cilk/common.h
+++ b/libcilkrts/include/cilk/common.h
@@ -1,10 +1,8 @@
/** common.h
*
- * @copyright
- * Copyright (C) 2010-2013, Intel Corporation
+ * Copyright (C) 2010-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -19,7 +17,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -32,18 +29,31 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
*/
/** @file common.h
*
- * @brief Defines common macros and structures used by the Intel Cilk Plus
- * runtime.
+ * @brief Defines common macros and structures used by the Intel(R) Cilk(TM) Plus runtime.
*
* @ingroup common
*/
/** @defgroup common Common Definitions
- * Macro, structure, and class definitions used elsewhere in the runtime.
+ * Definitions for runtime macros, structures, and classes.
* @{
*/
@@ -51,18 +61,17 @@
#define INCLUDED_CILK_COMMON
#ifdef __cplusplus
-/** Namespace for all Cilk definitions that can be included in user code.
+/** Namespace for all Intel Cilk Plus definitions that can be included in user code.
*/
namespace cilk {
- /** Namespace for definitions that are primarily intended for use
- * in other Cilk definitions.
+ /** Namespace for definitions re-used in other Intel Cilk Plus definitions.
*/
namespace internal {}
}
#endif
-/** Cilk library version = 1.01
+/** Intel Cilk Plus library version = 1.02
*/
#define CILK_LIBRARY_VERSION 102
@@ -73,7 +82,7 @@ namespace cilk {
#endif
/**
- * Prefix standard library function and type names with __STDNS in order to
+ * Prefix standard library function and type names with __STDNS to
* get correct lookup in both C and C++.
*/
#ifdef __cplusplus
@@ -159,7 +168,7 @@ namespace cilk {
/**
* Macro to specify alignment of a data member in a structure.
- * Because of the way that gcc’s alignment attribute is defined, @a n must
+ * Because of the way that gcc's alignment attribute is defined, @a n must
* be a numeric literal, not just a compile-time constant expression.
*/
#ifdef _WIN32
@@ -231,7 +240,7 @@ namespace cilk {
/**
* OS-independent macro to specify a function that should be inlined
*/
-#ifdef __cpluspus
+#ifdef __cplusplus
// C++
# define __CILKRTS_INLINE inline
#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
@@ -247,7 +256,7 @@ namespace cilk {
/**
* Functions marked as CILK_EXPORT_AND_INLINE have both
- * inline versions defined in the Cilk API, as well as
+ * inline versions defined in the Intel Cilk Plus API, as well as
* non-inlined versions that are exported (for
* compatibility with previous versions that did not
* inline the functions).
@@ -306,13 +315,14 @@ namespace cilk {
#endif /* ! defined(_MSC_VER) || (_MSC_VER >= 1600) */
/**
- * @brief Application Binary Interface version of the Cilk runtime library.
+ * @brief Application Binary Interface (ABI) version of the Intel Cilk Plus runtime
+ * library.
*
- * The ABI version is determined by the compiler used. An object file
- * compiled with a higher ABI version is not compatible with a library that is
- * compiled with a lower ABI version. An object file compiled with a lower
- * ABI version, however, can be used with a library compiled with a higher ABI
- * version unless otherwise stated.
+ * The compiler determines the ABI version used for compilation. Object files
+ * compiled with higher ABI versions are not compatible with libraries compiled
+ * with lower ABI versions. However, an object file compiled with a lower ABI
+ * version can be used with a library compiled with a higher ABI version
+ * (unless otherwise stated.)
*/
#ifndef __CILKRTS_ABI_VERSION
# ifdef IN_CILK_RUNTIME
diff --git a/libcilkrts/include/cilk/holder.h b/libcilkrts/include/cilk/holder.h
index 8620c052f53..66899a25bc9 100644
--- a/libcilkrts/include/cilk/holder.h
+++ b/libcilkrts/include/cilk/holder.h
@@ -1,9 +1,7 @@
/*
- * @copyright
- * Copyright (C) 2011-2013, Intel Corporation
+ * Copyright (C) 2011-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -18,7 +16,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -31,6 +28,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
*
*/
@@ -60,8 +71,8 @@
* common variable where it is not necessary to preserve changes from
* different parallel strands. In effect, a holder acts a bit like
* thread-local storage, but has qualities that work better with the
- * fork-join structure of Cilk. In particular, a holder has the following
- * qualities:
+ * fork-join structure of Intel(R) Cilk(TM) Plus. In particular, a holder has the
+ * following qualities:
*
* - The view of a holder before the first spawn within a function is the same
* as the view after each sync (as in the case of a reducer).
@@ -220,7 +231,7 @@
* same as the view on entry to 'h'. More importantly, the view of the holder
* within the recursive call to 'compute' is the same as the view on entry to
* 'h', even if a different worker is executing the recursive call. Thus, the
- * holder view within a Cilk program has useful qualities not found in
+ * holder view within a Intel Cilk Plus program has useful qualities not found in
* thread-local storage.
*/
diff --git a/libcilkrts/include/cilk/hyperobject_base.h b/libcilkrts/include/cilk/hyperobject_base.h
index 484bf5f01ea..dd7ccfd9020 100644
--- a/libcilkrts/include/cilk/hyperobject_base.h
+++ b/libcilkrts/include/cilk/hyperobject_base.h
@@ -1,9 +1,7 @@
/*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -18,7 +16,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -31,6 +28,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
*
*/
@@ -49,7 +60,7 @@
#if defined _WIN32 || defined _WIN64
# if !defined CILK_STUB && !defined IN_CILK_RUNTIME
- /* bring in the Cilk library, which has definitions for some of these
+ /* bring in the Intel(R) Cilk(TM) Plus library, which has definitions for some of these
* functions. */
# pragma comment(lib, "cilkrts")
# endif
@@ -126,7 +137,7 @@ CILK_EXPORT
#else // CILK_STUB
-// Programs compiled with CILK_STUB are not linked with the Cilk runtime
+// Programs compiled with CILK_STUB are not linked with the Intel Cilk Plus runtime
// library, so they should not have external references to cilkrts functions.
// Furthermore, they don't need the hyperobject functionality, so the
// functions can be stubbed.
diff --git a/libcilkrts/include/cilk/metaprogramming.h b/libcilkrts/include/cilk/metaprogramming.h
index 29b0839e788..2df7cf6467c 100644
--- a/libcilkrts/include/cilk/metaprogramming.h
+++ b/libcilkrts/include/cilk/metaprogramming.h
@@ -1,10 +1,8 @@
/* metaprogramming.h -*- C++ -*-
*
- * @copyright
- * Copyright (C) 2012-2013, Intel Corporation
+ * Copyright (C) 2012-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -19,7 +17,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -32,11 +29,25 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
*/
/** @file metaprogramming.h
*
- * @brief Defines metaprogramming utility classes used in the Cilk library.
+ * @brief Defines metaprogramming utility classes used in the Intel(R) Cilk(TM) Plus library.
*
* @ingroup common
*/
@@ -61,7 +72,7 @@ namespace internal {
/** Test if a class is empty.
*
* If @a Class is an empty (and therefore necessarily stateless) class, then
- * the “empty base-class optimization” guarantees that
+ * the "empty base-class optimization" guarantees that
* `sizeof(check_for_empty_class<Class>) == sizeof(char)`. Conversely, if
* `sizeof(check_for_empty_class<Class>) > sizeof(char)`, then @a Class is not
* empty, and we must discriminate distinct instances of @a Class.
@@ -84,7 +95,7 @@ namespace internal {
* @ingroup common
*/
template <class Class>
-class class_is_empty {
+class class_is_empty {
class check_for_empty_class : public Class
{
char m_data;
@@ -147,11 +158,11 @@ public:
* @tparam Size The required minimum size of the resulting class.
* @tparam Alignment The required alignment of the resulting class.
*
- * @pre @a Alignment shall be a power of 2 no greater then 64.
+ * @pre @a Alignment shall be a power of 2 no greater than 64.
*
* @note This is implemented using the `CILK_ALIGNAS` macro, which uses
* the non-standard, implementation-specific features
- * `__declspec(align(N))` on Windows, and
+ * `__declspec(align(N))` on Windows, and
* `__attribute__((__aligned__(N)))` on Unix. The `gcc` implementation
* of `__attribute__((__aligned__(N)))` requires a numeric literal `N`
* (_not_ an arbitrary compile-time constant expression). Therefore,
@@ -165,21 +176,22 @@ public:
template <std::size_t Size, std::size_t Alignment>
struct aligned_storage;
-template<std::size_t Size> class aligned_storage<Size, 1>
+/// @cond
+template<std::size_t Size> class aligned_storage<Size, 1>
{ CILK_ALIGNAS( 1) char m_bytes[Size]; };
-template<std::size_t Size> class aligned_storage<Size, 2>
+template<std::size_t Size> class aligned_storage<Size, 2>
{ CILK_ALIGNAS( 2) char m_bytes[Size]; };
-template<std::size_t Size> class aligned_storage<Size, 4>
+template<std::size_t Size> class aligned_storage<Size, 4>
{ CILK_ALIGNAS( 4) char m_bytes[Size]; };
-template<std::size_t Size> class aligned_storage<Size, 8>
+template<std::size_t Size> class aligned_storage<Size, 8>
{ CILK_ALIGNAS( 8) char m_bytes[Size]; };
-template<std::size_t Size> class aligned_storage<Size, 16>
+template<std::size_t Size> class aligned_storage<Size, 16>
{ CILK_ALIGNAS(16) char m_bytes[Size]; };
-template<std::size_t Size> class aligned_storage<Size, 32>
+template<std::size_t Size> class aligned_storage<Size, 32>
{ CILK_ALIGNAS(32) char m_bytes[Size]; };
-template<std::size_t Size> class aligned_storage<Size, 64>
+template<std::size_t Size> class aligned_storage<Size, 64>
{ CILK_ALIGNAS(64) char m_bytes[Size]; };
-
+/// @endcond
/** A buffer of uninitialized bytes with the same size and alignment as a
* specified type.
@@ -188,14 +200,14 @@ template<std::size_t Size> class aligned_storage<Size, 64>
* properties as `Type`, but it will contain only raw (uninitialized) bytes.
* This allows the definition of a data member which can contain a `Type`
* object which is initialized explicitly under program control, rather
- * than implicitly as part of the initialization of the containing class.
+ * than implicitly as part of the initialization of the containing class.
* For example:
*
* class C {
* storage_for_object<MemberClass> _member;
* public:
* C() ... // Does NOT initialize _member
- * void initialize(args)
+ * void initialize(args)
* { new (_member.pointer()) MemberClass(args); }
* const MemberClass& member() const { return _member.object(); }
* MemberClass& member() { return _member.object(); }
@@ -204,21 +216,22 @@ template<std::size_t Size> class aligned_storage<Size, 64>
* by this class.
*/
template <typename Type>
-class storage_for_object :
+class storage_for_object :
aligned_storage< sizeof(Type), align_of<Type>::value >
{
public:
/// Return a typed reference to the buffer.
const Type& object() const { return *reinterpret_cast<Type*>(this); }
+ /// Return a typed reference to the buffer.
Type& object() { return *reinterpret_cast<Type*>(this); }
};
/** Get the functor class corresponding to a binary function type.
*
- * The `binary_functor` template class class can be instantiated with a binary
+ * The `binary_functor` template class can be instantiated with a binary
* functor class or with a real binary function, and will yield an equivalent
- * binary functor class class in either case.
+ * binary functor class in either case.
*
* @tparam F A binary functor class, a binary function type, or a pointer to
* binary function type.
@@ -260,7 +273,7 @@ struct binary_functor<R(*)(A,B)> {
* `typed_indirect_binary_function<F>` is an `Adaptable Binary Function` class
* based on an existing binary functor class or binary function type @a F. If
* @a F is a stateless class, then this class will be empty, and its
- * `operator()` will invoke @a F’s `operator()`. Otherwise, an object of this
+ * `operator()` will invoke @a F's `operator()`. Otherwise, an object of this
* class will hold a pointer to an object of type @a F, and will refer its
* `operator()` calls to the pointed-to @a F object.
*
@@ -276,14 +289,15 @@ struct binary_functor<R(*)(A,B)> {
*
* @note Just to repeat: if `F` is an empty class, then
* `typed_indirect_binary_function\<F\>' is also an empty class.
- * This is critical for its use in the @ref min_max::view_base
+ * This is critical for its use in the
+ * @ref cilk::cilk_lib_1_1::min_max_internal::view_base
* "min/max reducer view classes", where it allows the view to
* call a comparison functor in the monoid without actually
- * having to allocate a pointer in the view class when the
+ * having to allocate a pointer in the view class when the
* comparison class is empty.
*
* @note If you have an `Adaptable Binary Function` class or a binary
- * function type, then you can use the
+ * function type, then you can use the
* @ref indirect_binary_function class, which derives the
* argument and result types parameter type instead of requiring
* you to specify them as template arguments.
@@ -312,7 +326,7 @@ class typed_indirect_binary_function : std::binary_function<A1, A2, R>
public:
/// Constructor captures a pointer to the wrapped function.
typed_indirect_binary_function(const F* f) : f(f) {}
-
+
/// Return the comparator pointer, or `NULL` if the comparator is stateless.
const F* pointer() const { return f; }
@@ -323,10 +337,10 @@ public:
/// @copydoc typed_indirect_binary_function
/// Specialization for an empty functor class. (This is only possible if @a F
-/// itself is an empty class. If @a F is a function or pointer-to-function
+/// itself is an empty class. If @a F is a function or pointer-to-function
/// type, then the functor will contain a pointer.)
template <typename F, typename A1, typename A2, typename R, typename Functor>
-class typed_indirect_binary_function<F, A1, A2, R, Functor, true> :
+class typed_indirect_binary_function<F, A1, A2, R, Functor, true> :
std::binary_function<A1, A2, R>
{
public:
@@ -335,7 +349,7 @@ public:
/// Constructor discards the pointer to a stateless functor class.
typed_indirect_binary_function(const F* f) {}
-
+
/// Create an instance of the stateless functor class and apply it to the arguments.
R operator()(const A1& a1, const A2& a2) const { return F()(a1, a2); }
};
@@ -343,28 +357,29 @@ public:
/** Indirect binary function class with inferred types.
*
- * This is identical to @ref typed_indirect_binary_function, except that it
- * derives the binary function argument and result types from the parameter
- * type @a F instead of taking them as additional template parameters. If @a F
- * is a class type, then it must be an `Adaptable Binary Function`.
+ * This is identical to @ref cilk::internal::typed_indirect_binary_function,
+ * except that it derives the binary function argument and result types from
+ * the parameter type @a F instead of taking them as additional template
+ * parameters. If @a F is a class type, then it must be an `Adaptable Binary
+ * Function`.
*
* @see typed_indirect_binary_function
*
* @ingroup common
*/
template <typename F, typename Functor = typename binary_functor<F>::type>
-class indirect_binary_function :
+class indirect_binary_function :
typed_indirect_binary_function< F
, typename Functor::first_argument_type
, typename Functor::second_argument_type
, typename Functor::result_type
- >
+ >
{
typedef typed_indirect_binary_function< F
, typename Functor::first_argument_type
, typename Functor::second_argument_type
, typename Functor::result_type
- >
+ >
base;
public:
indirect_binary_function(const F* f) : base(f) {} ///< Constructor
@@ -373,7 +388,7 @@ public:
/** Choose a type based on a boolean constant.
*
- * This metafunction is identical to C++11’s condition metafunction.
+ * This metafunction is identical to C++11's condition metafunction.
* It needs to be here until we can reasonably assume that users will be
* compiling with C++11.
*
@@ -407,12 +422,12 @@ struct condition<false, IfTrue, IfFalse>
* Causes a compilation error if a compile-time constant expression is false.
*
* @par Usage example.
- * This assertion is used in reducer_min_max.h to avoid defining
+ * This assertion is used in reducer_min_max.h to avoid defining
* legacy reducer classes that would not be binary-compatible with the
* same classes compiled with earlier versions of the reducer library.
*
* __CILKRTS_STATIC_ASSERT(
- * internal::class_is_empty< internal::binary_functor<Compare> >::value,
+ * internal::class_is_empty< internal::binary_functor<Compare> >::value,
* "cilk::reducer_max<Value, Compare> only works with an empty Compare class");
*
* @note In a C++11 compiler, this is just the language predefined
@@ -468,13 +483,13 @@ inline void* allocate_aligned(std::size_t size, std::size_t alignment)
#ifdef _WIN32
return _aligned_malloc(size, alignment);
#else
-#if defined(__ANDROID__)
+#if defined(__ANDROID__) || defined(__VXWORKS__)
return memalign(std::max(alignment, sizeof(void*)), size);
#else
void* ptr;
return (posix_memalign(&ptr, std::max(alignment, sizeof(void*)), size) == 0) ? ptr : 0;
#endif
-#endif
+#endif
}
/** Implementation-specific aligned memory deallocation function.
@@ -487,13 +502,13 @@ inline void deallocate_aligned(void* ptr)
_aligned_free(ptr);
#else
std::free(ptr);
-#endif
+#endif
}
/** Class to allocate and guard an aligned pointer.
*
* A new_aligned_pointer object allocates aligned heap-allocated memory when
- * it is created, and automatically deallocates it when it is destroyed
+ * it is created, and automatically deallocates it when it is destroyed
* unless its `ok()` function is called.
*
* @tparam T The type of the object to allocate on the heap. The allocated
@@ -504,14 +519,14 @@ class new_aligned_pointer {
void* m_ptr;
public:
/// Constructor allocates the pointer.
- new_aligned_pointer() :
+ new_aligned_pointer() :
m_ptr(allocate_aligned(sizeof(T), internal::align_of<T>::value)) {}
/// Destructor deallocates the pointer.
~new_aligned_pointer() { if (m_ptr) deallocate_aligned(m_ptr); }
/// Get the pointer.
operator void*() { return m_ptr; }
/// Return the pointer and release the guard.
- T* ok() {
+ T* ok() {
T* ptr = static_cast<T*>(m_ptr);
m_ptr = 0;
return ptr;
diff --git a/libcilkrts/include/cilk/reducer.h b/libcilkrts/include/cilk/reducer.h
index a22651e1e6f..09c2e196903 100644
--- a/libcilkrts/include/cilk/reducer.h
+++ b/libcilkrts/include/cilk/reducer.h
@@ -1,10 +1,8 @@
/* reducer.h -*- C++ -*-
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -19,7 +17,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -32,11 +29,25 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
*/
-
+
/** @file reducer.h
*
- * @brief Defines foundation classes for creating Cilk reducers.
+ * @brief Defines foundation classes for creating Intel(R) Cilk(TM) Plus reducers.
*
* @ingroup Reducers
*
@@ -44,7 +55,7 @@
*
* @defgroup Reducers Reducers
*/
-
+
#ifndef REDUCER_H_INCLUDED
#define REDUCER_H_INCLUDED
@@ -59,12 +70,96 @@
namespace cilk {
+/** Class for provisionally constructed objects.
+ *
+ * The monoid_base<T,V>::construct() functions manually construct both a
+ * monoid and a view. If one of these is constructed successfully, and the
+ * construction of the other (or some other initialization) fails, then the
+ * first one must be destroyed to avoid a memory leak. Because the
+ * construction is explicit, the destruction must be explicit, too.
+ *
+ * A provisional_guard object wraps a pointer to a newly constructed
+ * object. A call to its confirm() function confirms that the object is
+ * really going to be used. If the guard is destroyed without being
+ * confirmed, then the pointed-to object is destroyed (but not
+ * deallocated).
+ *
+ * Expected usage:
+ *
+ * provisional_guard<T1> x1_provisional( new (x1) T1 );
+ * … more initialization …
+ * x1_provisional.confirm();
+ *
+ * or
+ *
+ * provisional_guard<T1> x1_provisional( new (x1) T1 );
+ * x1_provisional.confirm_if( new (x2) T2 );
+ *
+ * If an exception is thrown in the "more initialization" code in the
+ * first example, or in the `T2` constructor in the second example, then
+ * `x1_provisional` will not be confirmed, so when its destructor is
+ * called during exception unwinding, the `T1` object that was constructed
+ * in `x1` will be destroyed.
+ *
+ * **NOTE**: Do *not* be tempted to chain a `provisional_guard`
+ * constructor with `confirm_if` as in this example:
+ *
+ * // BAD IDEA
+ * provisional_guard<T1>( new (x1) T1 ).confirm_if( new (x2) T2 );
+ *
+ * The code above is problematic because the evaluation of the T2
+ * constructor is unsequenced with respect to the call to the
+ * `provisional_guard` constructor (and with respect the T1 constructor).
+ * Thus, the compiler may choose to evaluate `new (x2) T2` before
+ * constructing the guard and leak the T1 object if the `T2` constructor
+ * throws.
+ *
+ * @tparam Type The type of the provisionally constructed object.
+ */
+template <typename Type>
+class provisional_guard {
+ Type* m_ptr;
+
+public:
+
+ /** Constructor. Creates a guard for a provisionally constructed object.
+ *
+ * @param ptr A pointer to the provisionally constructed object.
+ */
+ provisional_guard(Type* ptr) : m_ptr(ptr) {}
+
+ /** Destructor. Destroy the object pointed to by the contained pointer
+ * if it has not been confirmed.
+ */
+ ~provisional_guard() { if (m_ptr) m_ptr->~Type(); }
+
+ /** Confirm the provisional construction. Do *not* delete the contained
+ * pointer when the guard is destroyed.
+ */
+ void confirm() { m_ptr = 0; }
+
+ /** Confirm provisional construction if argument is non-null. Note that
+ * if an exception is thrown during evaluation of the argument
+ * expression, then this function will not be called, and the
+ * provisional object will not be confirmed. This allows the usage:
+ *
+ * x1_provisional.confirm_if( new (x2) T2() );
+ *
+ * @param cond An arbitrary pointer. The provisional object will be
+ * confirmed if @a cond is not null.
+ *
+ * @returns The value of the @a cond argument.
+ */
+ template <typename Cond>
+ Cond* confirm_if(Cond* cond) { if (cond) m_ptr = 0; return cond; }
+};
+
/** Base class for defining monoids.
*
* The monoid_base class template is useful for creating classes that model
* the monoid concept. It provides the core type and memory management
* functionality. A subclass of monoid_base need only declare and implement
- * the `identity` and `reduce` functions.
+ * the `identity` and `reduce` functions.
*
* The monoid_base class also manages the integration between the monoid, the
* reducer class that is based on it, and an optional view class which wraps
@@ -79,149 +174,51 @@ namespace cilk {
template <typename Value, typename View = Value>
class monoid_base
{
-protected:
-
- /** Class for provisionally constructed objects.
- *
- * The monoid_base::construct() functions manually construct both a monoid
- * and a view. If one of these is constructed successfully, and the
- * construction of the other (or some other initialization) fails, then
- * the first one must be destroyed to avoid a memory leak. Because the
- * construction is explicit, the destruction must be explicit, too.
- *
- * A provisional_guard object wraps a pointer to a newly constructed
- * object. A call to its confirm() function confirms that the object is
- * really going to be used. If the guard is destroyed without being
- * confirmed, then the pointed-to object is destroyed (but not
- * deallocated).
- *
- * Expected usage:
- *
- * provisional_guard<T1> x1_provisional( new (x1) T1() );
- * … more initialization …
- * x1_provisional.confirm();
- *
- * or
- *
- * provisional_guard<T1> x1_provisional( new (x1) T1() );
- * x1_provisional.confirm_if( new (x2) T2() );
- *
- * If an exception is thrown in the “more initialization” code in the
- * first example, or in the `T2` constructor in the second example, then
- * `x1_provisional` will not be confirmed, so when its destructor is
- * called during exception unwinding, the `T1` object that was constructed
- * in `x1` will be destroyed.
- *
- * @see provisional()
- *
- * @tparam Type The type of the provisionally constructed object.
- */
- template <typename Type>
- class provisional_guard {
- Type* m_ptr;
-
- public:
-
- /** Constructor. Creates a guard for a provisionally constructed object.
- *
- * @param ptr A pointer to the provisionally constructed object.
- */
- provisional_guard(Type* ptr) : m_ptr(ptr) {}
-
- /** Destructor. Destroy the object pointed to by the contained pointer
- * if it has not been confirmed.
- */
- ~provisional_guard() { if (m_ptr) m_ptr->~Type(); }
-
- /** Confirm the provisional construction. Do *not* delete the contained
- * pointer when the guard is destroyed.
- */
- void confirm() { m_ptr = 0; }
-
- /** Confirm provisional construction if argument is non-null. Note that
- * if an exception is thrown during evaluation of the argument
- * expression, then this function will not be called, and the
- * provisional object will not be confirmed. This allows the usage:
- *
- * x1_provisional.confirm_if( new (x2) T2() );
- *
- * @param cond An arbitrary pointer. The provisional object will be
- * confirmed if @a cond is not null.
- *
- * @returns The value of the @a cond argument.
- */
- template <typename Cond>
- Cond* confirm_if(Cond* cond) { if (cond) m_ptr = 0; return cond; }
- };
-
-
- /** Create a provisional_guard object. This function allows simpler code
- * when the only use of a provisional_guard is in a
- * provisional_guard::confirm_if() call immediately following its
- * creation. Instead of
- *
- * provisional_guard<T>guard( new (ptr_to_T) T() );
- * guard.confirm_if( new (ptr_to_U) U() );
- *
- * you can just write
- *
- * provisional( new (ptr_to_T) T() ).confirm_if( new (ptr_to_U) U() );
- *
- * @tparam Type The type of the provisionally constructed object.
- *
- * @param ptr A pointer to a provisionally constructed object.
- *
- * @returns A @ref provisional_guard object that guards the
- * provisionally constructed object pointed to by @a ptr.
- */
- template <typename Type>
- static provisional_guard<Type> provisional(Type* ptr)
- { return provisional_guard<Type>(ptr); }
public:
/** Value type of the monoid.
*/
typedef Value value_type;
-
+
/** View type of the monoid. Defaults to be the same as the value type.
* @see monoid_with_view
*/
typedef View view_type;
-
- enum {
+
+ enum {
/** Should reducers created with this monoid be aligned?
*
* @details
- * “Aligned” means that the view is allocated at a cache-line aligned
+ * "Aligned" means that the view is allocated at a cache-line aligned
* offset in the reducer, and the reducer must be cache-line aligned.
- * “Unaligned” means that the reducer as a whole is just naturally
- * aligned, but it contains a large enough block of uninitialized
+ * "Unaligned" means that the reducer as a whole is just naturally
+ * aligned, but it contains a large enough block of uninitialized
* storage for a cache-line aligned view to be allocated in it at
* reducer construction time.
*
- * Since the standard heap allocator (new reducer) does not allocate
+ * Since the standard heap allocator (new reducer) does not allocate
* cache-line aligned storage, only unaligned reducers can be safely
* allocated on the heap.
- *
+ *
* Default is false (unaligned) unless overridden in a subclass.
*
* @since 1.02
- * (In Cilk library versions 1.0 and 1.01, the default was true.
- * In Cilk library versions prior to 1.0, reducers were always aligned,
- * and this data member did not exist.)
+ * (In Intel Cilk Plus library versions 1.0 and 1.01, the default was true.
+ * In Intel Cilk Plus library versions prior to 1.0, reducers were always
+ * aligned, and this data member did not exist.)
*/
- align_reducer = false
+ align_reducer = false
};
-
- /** Destroy a view. Destroys (without deallocating) the @a View object
+
+ /** Destroys a view. Destroys (without deallocating) the @a View object
* pointed to by @a p.
*
* @param p The address of the @a View object to be destroyed.
*/
void destroy(view_type* p) const { p->~view_type(); }
- /** Allocate raw memory. Allocate @a s bytes of memory with no
+ /** Allocates raw memory. Allocate @a s bytes of memory with no
* initialization.
*
* @param s The number of bytes of memory to allocate.
@@ -229,7 +226,7 @@ public:
*/
void* allocate(size_t s) const { return operator new(s); }
- /** Deallocate raw memory. Deallocates the memory pointed to by @a p
+ /** Deallocates raw memory pointed to by @a p
* without doing any destruction.
*
* @param p Pointer to the memory to be deallocated.
@@ -239,10 +236,10 @@ public:
*/
void deallocate(void* p) const { operator delete(p); }
- /** Create the identity value. Constructs (without allocating) a @a View
+ /** Creates the identity value. Constructs (without allocating) a @a View
* object representing the default value of the @a Value type.
*
- * @param p A pointer to a block of raw memory large enough to hold a
+ * @param p A pointer to a block of raw memory large enough to hold a
* @a View object.
*
* @post The memory pointed to by @a p contains a @a View object that
@@ -255,128 +252,165 @@ public:
* this default definition.
*/
void identity(View* p) const { new ((void*) p) View(); }
-
-
- /** @name Construct the monoid and the view with arbitrary arguments.
+
+
+ /** @name Constructs the monoid and the view with arbitrary arguments.
*
* A @ref reducer object contains monoid and view data members, which are
* declared as raw storage (byte arrays), so that they are not implicitly
* constructed when the reducer is constructed. Instead, a reducer
- * constructor calls one of the monoid class’s static construct()
+ * constructor calls one of the monoid class's static construct()
* functions with the addresses of the monoid and the view, and the
* construct() function uses placement `new` to construct them.
- *
* This allows the monoid to determine the order in which the monoid and
* view are constructed, and to make one of them dependent on the other.
*
- * Any arguments to the reducer constructor are just passed on as
+ * Any arguments to the reducer constructor are just passed on as
* additional arguments to the construct() function (after the monoid
- * and view addresses).
+ * and view addresses are set).
*
- * Any monoid whose needs are satisfied by the suite of construct()
+ * A monoid whose needs are satisfied by the suite of construct()
* functions below, such as @ref monoid_with_view, can just inherit them
* from monoid_base. Other monoids will need to provide their own versions
* to override the monoid_base functions.
*/
//@{
-
- /** Default-construct the monoid, and pass zero to five const reference
- * arguments to the view constructor.
+
+ /** Default-constructs the monoid, identity-constructs the view.
+ *
+ * @param monoid Address of uninitialized monoid object.
+ * @param view Address of uninitialized initial view object.
*/
//@{
-
template <typename Monoid>
static void construct(Monoid* monoid, View* view)
- { provisional( new ((void*)monoid) Monoid() ).confirm_if(
- (monoid->identity(view), view) ); }
+ {
+ provisional_guard<Monoid> guard( new((void*) monoid) Monoid() );
+ monoid->identity(view);
+ guard.confirm();
+ }
+ //@}
+
+ /** Default-constructs the monoid, and passes one to five const reference
+ * arguments to the view constructor.
+ */
+ //@{
template <typename Monoid, typename T1>
static void construct(Monoid* monoid, View* view, const T1& x1)
- { provisional( new ((void*)monoid) Monoid() ).confirm_if(
- new ((void*)view) View(x1) ); }
+ {
+ provisional_guard<Monoid> guard( new((void*) monoid) Monoid() );
+ guard.confirm_if( new((void*) view) View(x1) );
+ }
template <typename Monoid, typename T1, typename T2>
- static void construct(Monoid* monoid, View* view,
+ static void construct(Monoid* monoid, View* view,
const T1& x1, const T2& x2)
- { provisional( new ((void*)monoid) Monoid() ).confirm_if(
- new ((void*)view) View(x1, x2) ); }
+ {
+ provisional_guard<Monoid> guard( new((void*) monoid) Monoid() );
+ guard.confirm_if( new((void*) view) View(x1, x2) );
+ }
template <typename Monoid, typename T1, typename T2, typename T3>
- static void construct(Monoid* monoid, View* view,
+ static void construct(Monoid* monoid, View* view,
const T1& x1, const T2& x2, const T3& x3)
- { provisional( new ((void*)monoid) Monoid() ).confirm_if(
- new ((void*)view) View(x1, x2, x3) ); }
+ {
+ provisional_guard<Monoid> guard( new((void*) monoid) Monoid() );
+ guard.confirm_if( new((void*) view) View(x1, x2, x3) );
+ }
- template <typename Monoid, typename T1, typename T2, typename T3,
+ template <typename Monoid, typename T1, typename T2, typename T3,
typename T4>
- static void construct(Monoid* monoid, View* view,
- const T1& x1, const T2& x2, const T3& x3,
+ static void construct(Monoid* monoid, View* view,
+ const T1& x1, const T2& x2, const T3& x3,
const T4& x4)
- { provisional( new ((void*)monoid) Monoid() ).confirm_if(
- new ((void*)view) View(x1, x2, x3, x4) ); }
+ {
+ provisional_guard<Monoid> guard( new((void*) monoid) Monoid() );
+ guard.confirm_if( new((void*) view) View(x1, x2, x3, x4) );
+ }
- template <typename Monoid, typename T1, typename T2, typename T3,
+ template <typename Monoid, typename T1, typename T2, typename T3,
typename T4, typename T5>
- static void construct(Monoid* monoid, View* view,
- const T1& x1, const T2& x2, const T3& x3,
+ static void construct(Monoid* monoid, View* view,
+ const T1& x1, const T2& x2, const T3& x3,
const T4& x4, const T5& x5)
- { provisional( new ((void*)monoid) Monoid() ).confirm_if(
- new ((void*)view) View(x1, x2, x3, x4, x5) ); }
-
+ {
+ provisional_guard<Monoid> guard( new((void*) monoid) Monoid() );
+ guard.confirm_if( new((void*) view) View(x1, x2, x3, x4, x5) );
+ }
+
//@}
-
- /** Default-construct the monoid, and pass one non-const reference argument
- * to the view constructor.
+
+ /** Default-constructs the monoid, and passes one non-const reference
+ * argument to the view constructor.
*/
//@{
template <typename Monoid, typename T1>
static void construct(Monoid* monoid, View* view, T1& x1)
- { provisional( new ((void*)monoid) Monoid() ).confirm_if(
- new ((void*)view) View(x1) ); }
+ {
+ provisional_guard<Monoid> guard( new((void*) monoid) Monoid() );
+ guard.confirm_if( new((void*) view) View(x1) );
+ }
//@}
- /** Copy-construct the monoid, and pass zero to four const reference
- * arguments to the view constructor.
+ /** Copy-constructs the monoid, and identity-constructs the view
+ * constructor.
+ *
+ * @param monoid Address of uninitialized monoid object.
+ * @param view Address of uninitialized initial view object.
+ * @param m Object to be copied into `*monoid`
*/
//@{
-
template <typename Monoid>
static void construct(Monoid* monoid, View* view, const Monoid& m)
- { provisional( new ((void*)monoid) Monoid(m) ).confirm_if(
- new ((void*)view) View() ); }
+ {
+ provisional_guard<Monoid> guard( new((void*) monoid) Monoid(m) );
+ monoid->identity(view);
+ guard.confirm();
+ }
+ //@}
+
+ /** Copy-constructs the monoid, and passes one to four const reference
+ * arguments to the view constructor.
+ */
+ //@{
template <typename Monoid, typename T1>
- static void construct(Monoid* monoid, View* view, const Monoid& m,
+ static void construct(Monoid* monoid, View* view, const Monoid& m,
const T1& x1)
- { provisional( new ((void*)monoid) Monoid(m) ).confirm_if(
- new ((void*)view) View(x1) ); }
-
+ {
+ provisional_guard<Monoid> guard( new((void*) monoid) Monoid(m) );
+ guard.confirm_if( new((void*) view) View(x1) );
+ }
+
template <typename Monoid, typename T1, typename T2>
- static void construct(Monoid* monoid, View* view, const Monoid& m,
+ static void construct(Monoid* monoid, View* view, const Monoid& m,
const T1& x1, const T2& x2)
- { provisional( new ((void*)monoid) Monoid(m) ).confirm_if(
- new ((void*)view) View(x1, x2) ); }
-
+ {
+ provisional_guard<Monoid> guard( new((void*) monoid) Monoid(m) );
+ guard.confirm_if( new((void*) view) View(x1, x2) );
+ }
+
template <typename Monoid, typename T1, typename T2, typename T3>
- static void construct(Monoid* monoid, View* view, const Monoid& m,
+ static void construct(Monoid* monoid, View* view, const Monoid& m,
const T1& x1, const T2& x2, const T3& x3)
{
- provisional( new ((void*)monoid) Monoid(m) ).confirm_if(
- new ((void*)view) View(x1, x2, x3) );
+ provisional_guard<Monoid> guard( new((void*) monoid) Monoid(m) );
+ guard.confirm_if( new((void*) view) View(x1, x2, x3) );
}
-
- template <typename Monoid, typename T1, typename T2, typename T3,
+
+ template <typename Monoid, typename T1, typename T2, typename T3,
typename T4>
- static void construct(Monoid* monoid, View* view, const Monoid& m,
- const T1& x1, const T2& x2, const T3& x3,
+ static void construct(Monoid* monoid, View* view, const Monoid& m,
+ const T1& x1, const T2& x2, const T3& x3,
const T4& x4)
{
- provisional( new ((void*)monoid) Monoid(m) ).confirm_if(
- new ((void*)view) View(x1, x2, x3, x4) );
+ provisional_guard<Monoid> guard( new((void*) monoid) Monoid(m) );
+ guard.confirm_if( new((void*) view) View(x1, x2, x3, x4) );
}
-
+
//@}
-
+
//@}
};
@@ -385,8 +419,8 @@ public:
* from its view.
*
* A simple implementation of the monoid-view-reducer architecture would
- * distribute knowledge about the type and operations for the reduction
- * between the monoid and the view — the identity and reduction operations are
+ * distribute knowledge about the type and operations for the reduction
+ * between the monoid and the view - the identity and reduction operations are
* specified in the monoid, the reduction operations are implemented in the
* view, and the value type is specified in both the monoid and the view.
* This is inelegant.
@@ -396,10 +430,11 @@ public:
* customization of the monoid_with_view class itself is needed beyond
* instantiating it with an appropriate view class. (Customized subclasses of
* monoid_with_view may be needed for other reasons, such as to keep some
- * state for the reducer.) All of the Cilk predefined reducers use
+ * state for the reducer.) All of the Intel Cilk Plus predefined reducers use
* monoid_with_view or one of its subclasses.
- *
- * The view class `View` of a monoid_with_view must provide the following public definitions:
+ *
+ * The view class `View` of a monoid_with_view must provide the following
+ * public definitions:
*
* Definition | Meaning
* ---------------------------------|--------
@@ -420,20 +455,20 @@ public:
/** Should reducers created with this monoid be aligned?
*/
enum { align_reducer = Align };
-
+
/** Create the identity value.
*
- * Implements the monoid `identity` operation by using the @a View class’s
+ * Implements the monoid `identity` operation by using the @a View class's
* default constructor.
*
- * @param p A pointer to a block of raw memory large enough to hold a
+ * @param p A pointer to a block of raw memory large enough to hold a
* @p View object.
*/
- void identity(View* p) const { new ((void*)p) View(); }
-
+ void identity(View* p) const { new((void*) p) View(); }
+
/** Reduce the values of two views.
*
- * Implements the monoid `reduce` operation by calling the left view’s
+ * Implements the monoid `reduce` operation by calling the left view's
* `%reduce()` function with the right view as an operand.
*
* @param left The left operand of the reduce operation.
@@ -452,7 +487,7 @@ public:
* required by a @ref monoid_with_view (but not the identity constructor and
* reduce operation, which are inherently specific to a particular kind of
* reduction). It also defines the value access functions which will be called
- * by the corresponding @ref reducer functions. (It uses copy semantics for
+ * by the corresponding @ref reducer functions. (It uses copy semantics for
* the view_move_in() and view_move_out() functions, which is appropriate
* for simple scalar types, but not necessarily for more complex types like
* STL containers.
@@ -469,15 +504,15 @@ public:
/** Value type definition required by @ref monoid_with_view.
*/
typedef Type value_type;
-
+
/** Default constructor.
*/
- scalar_view() : m_value() {}
-
+ scalar_view() : m_value() {}
+
/** Value constructor.
*/
scalar_view(const Type& v) : m_value(v) {}
-
+
/** @name Value functions required by the reducer class.
*
* Note that the move in/out functions use simple assignment semantics.
@@ -499,12 +534,16 @@ public:
/** Get the value of the view.
*/
Type const& view_get_value() const { return m_value; }
-
+
+ /** Type returned by view_get_value.
+ */
+ typedef Type const& return_type_for_get_value;
+
/** Get a reference to the value contained in the view. For legacy
* reducer support only.
*/
Type & view_get_reference() { return m_value; }
-
+
/** Get a reference to the value contained in the view. For legacy
* reducer support only.
*/
@@ -517,18 +556,18 @@ public:
*
* Some types allow their values to be _moved_ as an alternative to copying.
* Moving a value may be much faster than copying it, but may leave the value
- * of the move’s source undefined. Consider the `swap` operation provided by
+ * of the move's source undefined. Consider the `swap` operation provided by
* many STL container classes:
*
* list<T> x, y;
* x = y; // Copy
* x.swap(y); // Move
*
- * The assignment _copies_ the value of `y` into `x` in time linear in the
+ * The assignment _copies_ the value of `y` into `x` in time linear in the
* size of `y`, leaving `y` unchanged. The `swap` _moves_ the value of `y`
* into `x` in constant time, but it also moves the value of `x` into `y`,
* potentially leaving `y` undefined.
- *
+ *
* A move_in_wrapper simply wraps a pointer to an object. It is created by a
* call to cilk::move_in(). Passing a move_in_wrapper to a view constructor
* (actually, passing it to a reducer constructor, which passes it to the
@@ -538,18 +577,18 @@ public:
*
* A view class exercises this option by defining a _move-in constructor_,
* i.e., a constructor with a move_in_wrapper parameter. The constructor calls
- * the wrapper’s `value()` function to get a reference to its pointed-to
+ * the wrapper's `value()` function to get a reference to its pointed-to
* value, and can then use that reference in a move operation.
*
* A move_in_wrapper also has an implicit conversion to its pointed-to value,
- * so if a view class does not define a move-in constructor, its ordinary
+ * so if a view class does not define a move-in constructor, its ordinary
* value constructor will be called with the wrapped value. For example, an
* @ref ReducersAdd "op_add" view does not have a move-in constructor, so
*
* int x;
* reducer< op_add<int> > xr(move_in(x));
*
- * will simply call the `op_add_view(const int &)` constructor. But an
+ * will simply call the `op_add_view(const int &)` constructor. But an
* @ref ReducersList "op_list_append" view does have a move-in constructor,
* so
*
@@ -573,19 +612,19 @@ class move_in_wrapper
{
Type *m_pointer;
public:
-
+
/** Constructor that captures the address of its argument. This is almost
* always called from the @ref move_in function.
*/
explicit move_in_wrapper(Type& ref) : m_pointer(&ref) { }
-
+
/** Implicit conversion to the wrapped value. This allows a move_in_wrapper
* to be used where a value of the wrapped type is expected, in which case
* the wrapper is completely transparent.
*/
operator Type&() const { return *m_pointer; }
-
- /** Get a reference to the pointed-to value. This has the same effect as
+
+ /** Get a reference to the pointed-to value. This has the same effect as
* the implicit conversion, but makes the intent clearer in a move-in
* constructor.
*/
@@ -594,7 +633,7 @@ public:
/** Function to create a move_in_wrapper for a value.
*
- * @tparam Type The type of the argument, which will be the `type` of the
+ * @tparam Type The type of the argument, which will be the `type` of the
* created wrapper.
*
* @see move_in_wrapper
@@ -608,9 +647,9 @@ move_in_wrapper<Type> move_in(Type& ref)
/** @copydoc move_in(Type&)
*
* @note Applying a function that is explicitly specified as modifying its
- * argument to a const argument is obviously an irrational thing to
+ * argument to a const argument is obviously an irrational thing to
* do. This move_in() variant is just provided to allow calling a
- * move-in constructor with a function return value, which the
+ * move-in constructor with a function return value, which the
* language treats as a const. Using it for any other purpose will
* probably end in tears.
*/
@@ -622,37 +661,37 @@ move_in_wrapper<Type> move_in(const Type& ref)
/** Wrapper class to allow implicit downcasts to reducer subclasses.
*
- * The Cilk library contains a collection of reducer wrapper classes which
- * were created before the `cilk::reducer<Monoid>` style was developed. For
+ * The Intel Cilk Plus library contains a collection of reducer wrapper classes which
+ * were created before the `cilk::reducer<Monoid>` style was developed. For
* example, `cilk::reducer_opadd<Type>` provided essentially the same
- * functionality that is now provided by
- * `cilk::reducer< cilk::op_add<Type> >`. These legacy reducer classes are
- * deprecated, but still supported, and they have been reimplemented as
+ * functionality that is now provided by
+ * `cilk::reducer< cilk::op_add<Type> >`. These legacy reducer classes are
+ * deprecated, but still supported, and they have been reimplemented as
* subclasses of the corresponding `cilk::reducer` classes. For example:
*
* template <class T>
* reducer_opadd<T> : public reducer< op_add<T> > { ... };
*
- * This reimplementation allows transparent conversion between legacy and
- * new reducers. That is, a `reducer<op_add>*` or `reducer<op_add>&` can be
- * used anywhere that a `reducer_opadd*` or `reducer_opadd&` is expected,
- * and vice versa.
+ * This reimplementation allows transparent conversion between legacy and
+ * new reducers. That is, a `reducer<op_add>*` or `reducer<op_add>&` can be
+ * used anywhere that a `reducer_opadd*` or `reducer_opadd&` is expected,
+ * and vice versa.
*
- * The conversion from the legacy reducer to the new reducer is just an
- * up-cast, which is provided for free by C++. The conversion from the new
- * reducer to the legacy reducer is a down-cast, though, which requires an
+ * The conversion from the legacy reducer to the new reducer is just an
+ * up-cast, which is provided for free by C++. The conversion from the new
+ * reducer to the legacy reducer is a down-cast, though, which requires an
* explicit conversion member function in the `reducer` class. The challenge
* is to define a function in the reducer template class which will convert
- * each cilk::reducer specialization to the corresponding legacy reducer,
+ * each cilk::reducer specialization to the corresponding legacy reducer,
* if there is one.
*
* The trick is in the legacy_reducer_downcast template class, which provides
* a mapping from `cilk::reducer` specializations to legacy reducer classes.
- * `reducer<Monoid>` has a conversion function to convert itself to
+ * `reducer<Monoid>` has a conversion function to convert itself to
* `legacy_reducer_downcast< reducer<Monoid> >::%type`. By default,
* `legacy_reducer_downcast<Reducer>::%type` is just a trivial subclass of
* `Reducer`, which is uninteresting, but a reducer with a legacy counterpart
- * will have a specialization of `legacy_reducer_downcast` whose `type` is
+ * will have a specialization of `legacy_reducer_downcast` whose `type` is
* the corresponding legacy reducer. For example:
*
* template <typename Type>
@@ -662,16 +701,17 @@ move_in_wrapper<Type> move_in(const Type& ref)
* };
*
*
- * @tparam Reducer The new-style reducer class whose corresponding legacy reducer class
- * is `type`, if there is such a legacy reducer class.
+ * @tparam Reducer The new-style reducer class whose corresponding legacy
+ * reducer class is `type`, if there is such a legacy reducer
+ * class.
*/
template <typename Reducer>
struct legacy_reducer_downcast
{
/** The related legacy reducer class.
*
- * By default, this is just a trivial subclass of Reducer, but it can be
- * overridden in the specialization of legacy_reducer_downcast for
+ * By default, this is just a trivial subclass of Reducer, but it can be
+ * overridden in the specialization of legacy_reducer_downcast for
* a reducer that has a corresponding legacy reducers.
*/
struct type : Reducer { };
@@ -684,21 +724,51 @@ namespace internal {
template <typename Value, typename View>
struct reducer_set_get
{
- static View theView; // Declared but not defined
-
- // sizeof(notchar) is guaranteed larger than 1
+ // sizeof(notchar) != sizeof(char)
struct notchar { char x[2]; };
- // check_for_ref returns char if 'get_value' returns by value and notchar
- // if 'get_value' returns by reference.
- static char check_for_ref(Value, ...);
- static notchar check_for_ref(Value&, int);
+ // `does_view_define_return_type_for_get_value(View*)` returns `char` if
+ // `View` defines `return_type_for_get_value`, and `notchar` if it doesn't.
+
+ template <typename T>
+ struct using_type {};
+
+ template <typename T>
+ static char does_view_define_return_type_for_get_value(
+ using_type<typename T::return_type_for_get_value>*);
- enum { GET_VALUE_BY_VALUE =
- (1 == sizeof(check_for_ref(theView.view_get_value(), 0))) } ;
+ template <typename T>
+ static notchar does_view_define_return_type_for_get_value(...);
- typedef typename condition<GET_VALUE_BY_VALUE,
- Value, const Value&>::type get_value_type;
+ // `VIEW_DOES_DEFINE_RETURN_TYPE_FOR_GET_VALUE` is true if `View` defines
+ // `return_type_for_get_value`.
+
+ enum { VIEW_DOES_DEFINE_RETURN_TYPE_FOR_GET_VALUE =
+ sizeof( does_view_define_return_type_for_get_value<View>(0) )
+ == sizeof(char) } ;
+
+ // `return_type_for_get_value` is `View::return_type_for_get_value`
+ // if it is defined, and just `Value` otherwise.
+
+ template <typename InnerView, bool ViewDoesDefineReturnTypeForGetValue>
+ struct return_type_for_view_get_value {
+ typedef Value type;
+ };
+
+ template <typename InnerView>
+ struct return_type_for_view_get_value<InnerView, true> {
+ typedef typename InnerView::return_type_for_get_value type;
+ };
+
+public:
+
+ typedef
+ typename
+ return_type_for_view_get_value<
+ View,
+ VIEW_DOES_DEFINE_RETURN_TYPE_FOR_GET_VALUE
+ >::type
+ return_type_for_get_value;
static void move_in(View& view, Value& v) { view.view_move_in(v); }
static void move_out(View& view, Value& v) { view.view_move_out(v); }
@@ -706,21 +776,23 @@ struct reducer_set_get
static void set_value(View& view, const Value& v)
{ view.view_set_value(v); }
- static get_value_type get_value(const View& view)
+ static return_type_for_get_value get_value(const View& view)
{ return view.view_get_value(); }
};
template <typename Value>
struct reducer_set_get<Value, Value>
{
- typedef const Value& get_value_type;
+ typedef const Value& return_type_for_get_value;
static void move_in(Value& view, Value& v) { view = v; }
static void move_out(Value& view, Value& v) { v = view; }
- static void set_value(Value& view, const Value& v) { view = v; }
+ static void set_value(Value& view, const Value& v)
+ { view = v; }
- static get_value_type get_value(const Value& view) { return view; }
+ static return_type_for_get_value get_value(const Value& view)
+ { return view; }
};
/// @endcond
@@ -728,7 +800,7 @@ struct reducer_set_get<Value, Value>
/** Base class defining the data layout that is common to all reducers.
*/
-template <typename Monoid>
+template <typename Monoid>
class reducer_base {
typedef typename Monoid::view_type view_type;
@@ -746,20 +818,20 @@ class reducer_base {
// Used for sanity checking at destruction.
//
void* m_initialThis;
-
+
// The leftmost view comes next. It is defined in the derived
// reducer_content class.
-
+
/** @name C-callable wrappers for the C++-coded monoid dispatch functions.
*/
//@{
-
+
static void reduce_wrapper(void* r, void* lhs, void* rhs);
static void identity_wrapper(void* r, void* view);
static void destroy_wrapper(void* r, void* view);
static void* allocate_wrapper(void* r, __STDNS size_t bytes);
static void deallocate_wrapper(void* r, void* view);
-
+
//@}
protected:
@@ -768,7 +840,7 @@ protected:
*
* @param leftmost The address of the leftmost view in the reducer.
*/
- reducer_base(char* leftmost)
+ reducer_base(char* leftmost)
{
static const cilk_c_monoid c_monoid_initializer = {
(cilk_c_reducer_reduce_fn_t) &reduce_wrapper,
@@ -783,10 +855,10 @@ protected:
m_base.__view_offset = (char*)leftmost - (char*)this;
m_base.__view_size = sizeof(view_type);
m_initialThis = this;
-
+
__cilkrts_hyper_create(&m_base);
}
-
+
/** Destructor.
*/
__CILKRTS_STRAND_STALE(~reducer_base())
@@ -794,7 +866,7 @@ protected:
// Make sure we haven't been memcopy'd or corrupted
__CILKRTS_ASSERT(
this == m_initialThis ||
- // Allow for a layout bug that may put the initialThis field one
+ // Allow for a layout bug that may put the initialThis field one
// word later in 1.0 reducers than in 0.9 and 1.1 reducers.
this == *(&m_initialThis + 1)
);
@@ -803,63 +875,63 @@ protected:
/** Monoid data member.
*
- * @return A pointer to the reducer’s monoid data member.
+ * @return A pointer to the reducer's monoid data member.
*/
Monoid* monoid_ptr() { return &m_monoid.object(); }
/** Leftmost view data member.
*
- * @return A pointer to the reducer’s leftmost view data member.
+ * @return A pointer to the reducer's leftmost view data member.
*
- * @note This function returns the address of the *leftmost* view,
- * which is unique for the lifetime of the reducer. It is
- * intended to be used in constructors and destructors.
- * Use the reducer::view() function to access the per-strand
+ * @note This function returns the address of the *leftmost* view,
+ * which is unique for the lifetime of the reducer. It is
+ * intended to be used in constructors and destructors.
+ * Use the reducer::view() function to access the per-strand
* view instance.
*/
- view_type* leftmost_ptr()
+ view_type* leftmost_ptr()
{
char* view_addr = (char*)this + m_base.__view_offset;
return reinterpret_cast<view_type*>(view_addr);
}
-
+
public:
/** @name Access the current view.
*
- * These functions return a reference to the instance of the reducer’s
+ * These functions return a reference to the instance of the reducer's
* view that was created for the current strand of a parallel computation
- * (and create it if it doesn’t already exist). Note the difference from
+ * (and create it if it doesn't already exist). Note the difference from
* the (private) leftmost_ptr() function, which returns a pointer to the
* _leftmost_ view, which is the same in all strands.
*/
//@{
-
+
/** Per-strand view instance.
*
* @return A reference to the per-strand view instance.
*/
- view_type& view()
+ view_type& view()
{
- return *static_cast<view_type *>(__cilkrts_hyper_lookup(&m_base));
+ return *static_cast<view_type *>(__cilkrts_hyper_lookup(&m_base));
}
-
+
/** @copydoc view()
*/
- const view_type& view() const
- {
- return const_cast<reducer_base*>(this)->view();
+ const view_type& view() const
+ {
+ return const_cast<reducer_base*>(this)->view();
}
-
+
//@}
-
+
/** Initial view pointer field.
*
* @internal
*
* @return a reference to the m_initialThis field.
*
- * @note This function is provided for “white-box” testing of the
+ * @note This function is provided for "white-box" testing of the
* reducer layout code. There is never any reason for user code
* to call it.
*/
@@ -905,7 +977,7 @@ void reducer_base<Monoid>::deallocate_wrapper(void* r, void* view)
/** Base class defining the data members of a reducer.
*
- * @tparam Aligned The `m_view` data member, and therefore the entire
+ * @tparam Aligned The `m_view` data member, and therefore the entire
* structure, are cache-line aligned if this parameter
* is `true'.
*/
@@ -918,12 +990,12 @@ template <typename Monoid>
class reducer_content<Monoid, true> : public reducer_base<Monoid>
{
typedef typename Monoid::view_type view_type;
-
+
// The leftmost view is defined as raw bytes. It will be constructed
- // by the monoid `construct` function. It is cache-aligned, which
+ // by the monoid `construct` function. It is cache-aligned, which
// will push it into a new cache line. Furthermore, its alignment causes
- // the reducer as a whole to be cache-aligned, which makes the reducer
- // size a multiple of a cache line. Since there is nothing in the reducer
+ // the reducer as a whole to be cache-aligned, which makes the reducer
+ // size a multiple of a cache line. Since there is nothing in the reducer
// after the view, all this means that the leftmost view gets one or more
// cache lines all to itself, which prevents false sharing.
//
@@ -936,7 +1008,7 @@ class reducer_content<Monoid, true> : public reducer_base<Monoid>
*/
bool reducer_is_cache_aligned() const
{ return 0 == ((std::size_t) this & (__CILKRTS_CACHE_LINE__ - 1)); }
-
+
protected:
/** Constructor.
@@ -945,14 +1017,15 @@ protected:
{
#ifndef CILK_IGNORE_REDUCER_ALIGNMENT
assert(reducer_is_cache_aligned() &&
- "Reducer should be cache aligned. Please see comments following this assertion for explanation and fixes.");
+ "Reducer should be cache aligned. Please see comments following "
+ "this assertion for explanation and fixes.");
#endif
/* "REDUCER SHOULD BE CACHE ALIGNED" ASSERTION.
*
- * This Reducer class instantiation specifies cache-line alignment of the
+ * This Reducer class instantiation specifies cache-line alignment of the
* leftmost view field (and, implicitly, of the reducer itself). You got
* this assertion because a reducer with this class was allocated at a
- * non-cache-aligned address, probably because it was allocated on the
+ * non-cache-aligned address, probably because it was allocated on the
* heap with `new`. This can be a problem for two reasons:
*
* 1. If the leftmost view is not on a cache line by itself, there might
@@ -974,14 +1047,14 @@ protected:
*
* There are three ways that you can fix this assertion failure.
*
- * A. Rewrite your code to use the new-style `reducer< op_XXX<Type> >`
+ * A. Rewrite your code to use the new-style `reducer< op_XXX<Type> >`
* instead of the legacy `reducer_XXX<type>`. The new-style reducers
* are not declared to be cache-aligned, and will work properly if
* they are not cache-aligned.
*
* B. If you must allocate an old-style reducer or a structure containing
* a reducer on the heap, figure out how to align it correctly. The
- * suggested fix is to use `cilk::aligned_new()` and
+ * suggested fix is to use `cilk::aligned_new()` and
* `cilk::aligned_delete()` instead of `new` and `delete`, as follows:
*
* Type* ptr = cilk::aligned_new<Type>(constructor-arguments);
@@ -1003,7 +1076,7 @@ class reducer_content<Monoid, false> : public reducer_base<Monoid>
// Reserve space for the leftmost view. The view will be allocated at an
// aligned offset in this space at runtime, to guarantee that the view
- // will get one or more cache lines all to itself, to prevent false
+ // will get one or more cache lines all to itself, to prevent false
// sharing.
//
// The number of bytes to reserve is determined as follows:
@@ -1026,10 +1099,10 @@ class reducer_content<Monoid, false> : public reducer_base<Monoid>
protected:
/** Constructor. Find the first cache-aligned position in the reserved
- * area, and pass it to the base constructor as the leftmost view
+ * area, and pass it to the base constructor as the leftmost view
* address.
*/
- reducer_content() :
+ reducer_content() :
reducer_base<Monoid>(
(char*)( ((std::size_t)&m_leftmost + __CILKRTS_CACHE_LINE__ - 1)
& ~ (__CILKRTS_CACHE_LINE__ - 1) ) )
@@ -1056,8 +1129,9 @@ namespace stub {
* A reducer is instantiated on a Monoid. The Monoid provides the value
* type, associative reduce function, and identity for the reducer.
*
- * @tparam Monoid The monoid class that the reducer is instantiated on. It must model
- * the @ref reducers_monoid_concept "monoid concept".
+ * @tparam Monoid The monoid class that the reducer is instantiated on. It
+ * must model the @ref reducers_monoid_concept "monoid
+ * concept".
*
* @see @ref pagereducers
*/
@@ -1068,33 +1142,33 @@ class reducer : public internal::reducer_content<Monoid>
using base::monoid_ptr;
using base::leftmost_ptr;
public:
- typedef Monoid monoid_type; ///< The monoid type.
- typedef typename Monoid::value_type value_type; ///< The value type.
- typedef typename Monoid::view_type view_type; ///< The view type.
+ typedef Monoid monoid_type; ///< The monoid type.
+ typedef typename Monoid::value_type value_type; ///< The value type.
+ typedef typename Monoid::view_type view_type; ///< The view type.
private:
typedef internal::reducer_set_get<value_type, view_type> set_get;
-
+
reducer(const reducer&); ///< Disallow copying.
reducer& operator=(const reducer&); ///< Disallow assignment.
public:
-
+
/** @name Constructors
*
- * All reducer constructors call the static `construct()` function of the monoid class to
- * construct the reducer's monoid and leftmost view.
+ * All reducer constructors call the static `construct()` function of the
+ * monoid class to construct the reducer's monoid and leftmost view.
*
- * The reducer constructor arguments are simply passed through to the construct() function.
- * Thus, the constructor parameters accepted by a particular reducer class are determined
- * by its monoid class.
+ * The reducer constructor arguments are simply passed through to the
+ * construct() function. Thus, the constructor parameters accepted by a
+ * particular reducer class are determined by its monoid class.
*/
//@{
/** 0 – 6 const reference parameters.
*/
//@{
-
+
reducer()
{
monoid_type::construct(monoid_ptr(), leftmost_ptr());
@@ -1125,19 +1199,24 @@ class reducer : public internal::reducer_content<Monoid>
}
template <typename T1, typename T2, typename T3, typename T4, typename T5>
- reducer(const T1& x1, const T2& x2, const T3& x3, const T4& x4, const T5& x5)
+ reducer(const T1& x1, const T2& x2, const T3& x3, const T4& x4,
+ const T5& x5)
{
- monoid_type::construct(monoid_ptr(), leftmost_ptr(), x1, x2, x3, x4, x5);
+ monoid_type::construct(monoid_ptr(), leftmost_ptr(),
+ x1, x2, x3, x4, x5);
}
- template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
- reducer(const T1& x1, const T2& x2, const T3& x3, const T4& x4, const T5& x5, const T6& x6)
+ template <typename T1, typename T2, typename T3, typename T4,
+ typename T5, typename T6>
+ reducer(const T1& x1, const T2& x2, const T3& x3, const T4& x4,
+ const T5& x5, const T6& x6)
{
- monoid_type::construct(monoid_ptr(), leftmost_ptr(), x1, x2, x3, x4, x5, x6);
+ monoid_type::construct(monoid_ptr(), leftmost_ptr(),
+ x1, x2, x3, x4, x5, x6);
}
-
+
//@}
-
+
/** 1 non-const reference parameter.
*/
//@{
@@ -1147,7 +1226,7 @@ class reducer : public internal::reducer_content<Monoid>
{
monoid_type::construct(monoid_ptr(), leftmost_ptr(), x1);
}
-
+
//@}
/** Destructor.
@@ -1164,29 +1243,29 @@ class reducer : public internal::reducer_content<Monoid>
* @return A reference to the monoid object belonging to this reducer.
*/
Monoid& monoid() { return *monoid_ptr(); }
-
- const Monoid& monoid() const
+
+ const Monoid& monoid() const
{ return const_cast<reducer*>(this)->monoid(); }
//@}
//@{
/** Access the current view.
*
- * Return a reference to the instance of the reducer’s view that was
+ * Return a reference to the instance of the reducer's view that was
* created for the current strand of a parallel computation (and create
- * it if it doesn’t already exist).
+ * it if it doesn't already exist).
*/
view_type& view() { return base::view(); }
const view_type& view() const { return base::view(); }
//@}
-
+
/** @name Dereference the reducer to get the view.
*
- * “Dereferencing” a reducer yields the view for the current strand. The
+ * "Dereferencing" a reducer yields the view for the current strand. The
* view, in turn, acts as a proxy for its contained value, exposing only
- * those operations which are consistent with the reducer’s monoid. Thus,
- * all modifications of the reducer’s accumulator variable are written as
+ * those operations which are consistent with the reducer's monoid. Thus,
+ * all modifications of the reducer's accumulator variable are written as
*
* *reducer OP ...
*
@@ -1194,7 +1273,7 @@ class reducer : public internal::reducer_content<Monoid>
*
* reducer->func(...)
*
- * (The permitted operations on a reducer’s accumulator are listed in the
+ * (The permitted operations on a reducer's accumulator are listed in the
* documentation for that particular kind of reducer.)
*
* @note `*r` is a synonym for `r.view()`. Recommended style is to use
@@ -1204,7 +1283,7 @@ class reducer : public internal::reducer_content<Monoid>
* call attention to the view itself.
*/
//@{
-
+
//@{
/** Dereference operator.
*
@@ -1222,12 +1301,12 @@ class reducer : public internal::reducer_content<Monoid>
view_type* operator->() { return &view(); }
view_type const* operator->() const { return &view(); }
//@}
-
+
//@{
/** Deprecated view access.
*
- * `r()` is a synonym for `*r` which was used with early versions of Cilk
- * reducers. `*r` is now the preferred usage.
+ * `r()` is a synonym for `*r` which was used with early versions of
+ * Intel Cilk Plus reducers. `*r` is now the preferred usage.
*
* @deprecated Use operator*() instead of operator()().
*
@@ -1236,9 +1315,9 @@ class reducer : public internal::reducer_content<Monoid>
view_type& operator()() { return view(); }
view_type const& operator()() const { return view(); }
//@}
-
+
//@}
-
+
/** @name Set and get the value.
*
* These functions are used to set an initial value for the reducer before
@@ -1247,25 +1326,25 @@ class reducer : public internal::reducer_content<Monoid>
*
* @note These functions are completely different from the view
* operations that are made available via operator*() and
- * operator->(), which are used to _modify_ the reducer’s value
+ * operator->(), which are used to _modify_ the reducer's value
* _during_ the reduction.
*
- * @warning These functions _can_ be called at any time, and in
+ * @warning These functions _can_ be called at any time, and in
* general, they will refer to the value contained in the view
* for the current strand. However, using them other than to
- * set the reduction’s initial value or get its final value
+ * set the reduction's initial value or get its final value
* will almost always result in undefined behavior.
*/
//@{
/** Move a value into the reducer.
*
- * This function is used to set the initial value of the reducer’s
+ * This function is used to set the initial value of the reducer's
* accumulator variable by either copying or _moving_ the value of @a obj
* into it. Moving a value can often be performed in constant time, even
* for large container objects, but has the side effect of leaving the
- * value of @a obj undefined. (See the description of the
- * @ref move_in_wrapper class for a discussion of moving values.)
+ * value of @a obj undefined. (See the description of the
+ * @ref move_in_wrapper class for a discussion of moving values.)
*
* @par Usage
* A move_in() call to initialize a reducer is often paired with a
@@ -1278,14 +1357,14 @@ class reducer : public internal::reducer_content<Monoid>
*
* @par Assumptions
* - You cannot assume either that this will function will copy its
- * value or that it will move it.
- * - You must assume that the value of @a obj will be undefined
- * after the call to move_in().
+ * value or that it will move it.
+ * - You must assume that the value of @a obj will be undefined
+ * after the call to move_in().
* - You can assume that move_in() will be at least as efficient as
* set_value(), and you should therefore prefer move_in() unless
* you need the value of @a obj to be unchanged after the call.
* (But you should usually prefer the move-in constructor over a
- * move_in() call — see the note below.)
+ * move_in() call - see the note below.)
*
* @note The behavior of a default constructor followed by move-in
* initialization:
@@ -1296,14 +1375,14 @@ class reducer : public internal::reducer_content<Monoid>
* @note is not necessarily the same as a move-in constructor:
*
* reducer<Type> xr(move_in(x));
- *
- * @note In particular, when @a Type is a container type with a
+ *
+ * @note In particular, when @a Type is a container type with a
* non-empty allocator, the move-in constructor will create the
* accumulator variable with the same allocator as the input
* argument @a x, while the default constructor will create the
* accumulator variable with a default allocator. The mismatch of
- * allocators in the latter case means that the input argument
- * @a x may have to be copied in linear time instead of being
+ * allocators in the latter case means that the input argument
+ * @a x may have to be copied in linear time instead of being
* moved in constant time.
*
* @note Best practice is to prefer the move-in constructor over the
@@ -1326,13 +1405,13 @@ class reducer : public internal::reducer_content<Monoid>
/** Move the value out of the reducer.
*
- * This function is used to retrieve the final value of the reducer’s
+ * This function is used to retrieve the final value of the reducer's
* accumulator variable by either copying or _moving_ the value of @a obj
* into it. Moving a value can often be performed in constant time, even
* for large container objects, but has the side effect of leaving the
- * value of the reducer’s accumulator variable undefined. (See the
- * description of the @ref move_in_wrapper class for a discussion of
- * moving values.)
+ * value of the reducer's accumulator variable undefined. (See the
+ * description of the @ref move_in_wrapper class for a discussion of
+ * moving values.)
*
* @par Usage
* A move_in() call to initialize a reducer is often paired with a
@@ -1345,15 +1424,15 @@ class reducer : public internal::reducer_content<Monoid>
*
* @par Assumptions
* - You cannot assume either that this will function will copy its
- * value or that it will move it.
- * - You must assume that the value of the reducer’s accumulator
+ * value or that it will move it.
+ * - You must assume that the value of the reducer's accumulator
* variable will be undefined after the call to move_out().
* - You can assume that move_out() will be at least as efficient as
* get_value(), and you should therefore prefer move_out() unless
* you need the accumulator variable to be preserved after the
* call.
*
- * @warning Calling this function other than to retrieve the final
+ * @warning Calling this function other than to retrieve the final
* value of a reduction will almost always result in undefined
* behavior.
*
@@ -1368,7 +1447,7 @@ class reducer : public internal::reducer_content<Monoid>
/** Set the value of the reducer.
*
- * This function sets the initial value of the reducer’s accumulator
+ * This function sets the initial value of the reducer's accumulator
* variable to the value of @a obj.
*
* @note The behavior of a default constructor followed by
@@ -1380,8 +1459,8 @@ class reducer : public internal::reducer_content<Monoid>
* @note is not necessarily the same as a value constructor:
*
* reducer<Type> xr(x);
- *
- * @note In particular, when @a Type is a container type with a
+ *
+ * @note In particular, when @a Type is a container type with a
* non-empty allocator, the value constructor will create the
* accumulator variable with the same allocator as the input
* argument @a x, while the default constructor will create the
@@ -1391,7 +1470,7 @@ class reducer : public internal::reducer_content<Monoid>
* for a reduction will almost always result in undefined
* behavior.
*
- * @param obj The object containing the value that will be copied into
+ * @param obj The object containing the value that will be copied into
* the reducer.
*
* @post The reducer contains a copy of the value in @a obj.
@@ -1402,10 +1481,10 @@ class reducer : public internal::reducer_content<Monoid>
/** Get the value of the reducer.
*
- * This function gets the final value of the reducer’s accumulator
+ * This function gets the final value of the reducer's accumulator
* variable.
*
- * @warning Calling this function other than to retrieve the final
+ * @warning Calling this function other than to retrieve the final
* value of a reduction will almost always result in undefined
* behavior.
*
@@ -1413,9 +1492,9 @@ class reducer : public internal::reducer_content<Monoid>
*
* @see move_out()
*/
- typename set_get::get_value_type get_value() const
+ typename set_get::return_type_for_get_value get_value() const
{ return set_get::get_value(view()); }
-
+
//@}
/** Implicit downcast to legacy reducer wrapper, if any.
@@ -1452,137 +1531,148 @@ using stub::reducer;
/** @page page_reducers_in_c Creating and Using Reducers in C
*
* @tableofcontents
- *
- * The Cilk runtime supports reducers written in C as well as in C++. The basic logic is the
- * same, but the implementation details are very different. The C++ reducer implementation uses
- * templates heavily to create very generic components. The C reducer implementation uses
- * macros, which are a much blunter instrument. The most immediate consequence is that the
- * monoid/view/reducer architecture is mostly implicit rather than explicit in C reducers.
- *
+ *
+ * The Intel Cilk Plus runtime supports reducers written in C as well as in C++. The
+ * basic logic is the same, but the implementation details are very
+ * different. The C++ reducer implementation uses templates heavily to create
+ * very generic components. The C reducer implementation uses macros, which
+ * are a much blunter instrument. The most immediate consequence is that the
+ * monoid/view/reducer architecture is mostly implicit rather than explicit
+ * in C reducers.
+ *
* @section reducers_c_overview Overview of Using Reducers in C
- *
+ *
* The basic usage pattern for C reducers is:
- *
+ *
* 1. Create and initialize a reducer object.
- * 2. Tell the Cilk runtime about the reducer.
+ * 2. Tell the Intel Cilk Plus runtime about the reducer.
* 3. Update the value contained in the reducer in a parallel computation.
- * 4. Tell the Cilk runtime that you are done with the reducer.
+ * 4. Tell the Intel Cilk Plus runtime that you are done with the reducer.
* 5. Retrieve the value from the reducer.
- *
+ *
* @subsection reducers_c_creation Creating and Initializing a C Reducer
- *
+ *
* The basic pattern for creating and initializing a reducer object in C is
- *
+ *
* CILK_C_DECLARE_REDUCER(value-type) reducer-name =
* CILK_C_INIT_REDUCER(value-type,
* reduce-function,
* identity-function,
* destroy-function,
* initial-value);
- *
- * This is simply an initialized definition of a variable named _reducer-name_. The
- * @ref CILK_C_DECLARE_REDUCER macro expands to an anonymous `struct` declaration for a reducer
- * object containing a view of type _value-type_, and the @ref CILK_C_INIT_REDUCER macro
- * expands to a struct initializer.
- *
+ *
+ * This is simply an initialized definition of a variable named
+ * _reducer-name_. The @ref CILK_C_DECLARE_REDUCER macro expands to an
+ * anonymous `struct` declaration for a reducer object containing a view of
+ * type _value-type_, and the @ref CILK_C_INIT_REDUCER macro expands to a
+ * struct initializer.
+ *
* @subsection reducers_c_reduce_func Reduce Functions
- *
- * The reduce function for a reducer is called when a parallel execution strand terminates, to
- * combine the values computed by the terminating strand and the strand to its left. It takes
- * three arguments:
- *
- * - `void* reducer` — the address of the reducer.
- * - `void* left` — the address of the value for the left strand.
- * - `void* right` — the address of the value for the right (terminating) strand.
- *
- * It must apply the reducer’s reduction operation to the `left` and `right` values, leaving
- * the result in the `left` value. The `right` value is undefined after the reduce function
- * call.
- *
+ *
+ * The reduce function for a reducer is called when a parallel execution
+ * strand terminates, to combine the values computed by the terminating
+ * strand and the strand to its left. It takes three arguments:
+ *
+ * - `void* reducer` - the address of the reducer.
+ * - `void* left` - the address of the value for the left strand.
+ * - `void* right` - the address of the value for the right (terminating)
+ * strand.
+ *
+ * It must apply the reducer's reduction operation to the `left` and `right`
+ * values, leaving the result in the `left` value. The `right` value is
+ * undefined after the reduce function call.
+ *
* @subsection reducers_c_identity_func Identity Functions
- *
- * The identity function for a reducer is called when a parallel execution strand begins, to
- * initialize its value to the reducer’s identity value. It takes two arguments:
- *
- * - `void* reducer` — the address of the reducer.
- * - `void* v` — the address of a freshly allocated block of memory of size
+ *
+ * The identity function for a reducer is called when a parallel execution
+ * strand begins, to initialize its value to the reducer's identity value. It
+ * takes two arguments:
+ *
+ * - `void* reducer` - the address of the reducer.
+ * - `void* v` - the address of a freshly allocated block of memory of size
* `sizeof(value-type)`.
- *
- * It must initialize the memory pointed to by `v` so that it contains the reducer’s identity
- * value.
- *
+ *
+ * It must initialize the memory pointed to by `v` so that it contains the
+ * reducer's identity value.
+ *
* @subsection reducers_c_destroy_func Destroy Functions
- *
- * The destroy function for a reducer is called when a parallel execution strand terminates, to
- * do any necessary cleanup before its value is deallocated. It takes two arguments:
- *
- * - `void* reducer` — the address of the reducer.
- * - `void* p` — the address of the value for the terminating strand.
- *
- * It must release any resources belonging to the value pointed to by `p`, to avoid a resource
- * leak when the memory containing the value is deallocated.
- *
- * The runtime function `__cilkrts_hyperobject_noop_destroy` can be used for the destructor
- * function if the reducer’s values do not need any cleanup.
- *
- * @subsection reducers_c_register Tell the Cilk Runtime About the Reducer
- *
- * Call the @ref CILK_C_REGISTER_REDUCER macro to register the reducer with the Cilk runtime:
- *
+ *
+ * The destroy function for a reducer is called when a parallel execution
+ * strand terminates, to do any necessary cleanup before its value is
+ * deallocated. It takes two arguments:
+ *
+ * - `void* reducer` - the address of the reducer.
+ * - `void* p` - the address of the value for the terminating strand.
+ *
+ * It must release any resources belonging to the value pointed to by `p`, to
+ * avoid a resource leak when the memory containing the value is deallocated.
+ *
+ * The runtime function `__cilkrts_hyperobject_noop_destroy` can be used for
+ * the destructor function if the reducer's values do not need any cleanup.
+ *
+ * @subsection reducers_c_register Tell the Intel Cilk Plus Runtime About the
+ * Reducer
+ *
+ * Call the @ref CILK_C_REGISTER_REDUCER macro to register the reducer with
+ * the Intel Cilk Plus runtime:
+ *
* CILK_C_REGISTER_REDUCER(reducer-name);
- *
- * The runtime will manage reducer values for all registered reducers when parallel execution
- * strands begin and end.
- *
+ *
+ * The runtime will manage reducer values for all registered reducers when
+ * parallel execution strands begin and end.
+ *
* @subsection reducers_c_update Update the Value Contained in the Reducer
- *
- * The @ref REDUCER_VIEW macro returns a reference to the reducer’s value for the current
- * parallel strand:
- *
+ *
+ * The @ref REDUCER_VIEW macro returns a reference to the reducer's value for
+ * the current parallel strand:
+ *
* REDUCER_VIEW(reducer-name) = REDUCER_VIEW(reducer-name) OP x;
- *
- * C++ reducer views restrict access to the wrapped value so that it can only be modified in
- * ways consistent with the reducer’s operation. No such protection is provided for C reducers.
- * It is
- * entirely the responsibility of the user to avoid modifying the value in any
- * inappropriate way.
- *
- * @subsection c_reducers_unregister Tell the Cilk Runtime That You Are Done with the Reducer
- *
- * When the parallel computation is complete, call the @ref CILK_C_UNREGISTER_REDUCER macro to
- * unregister the reducer with the Cilk runtime:
- *
+ *
+ * C++ reducer views restrict access to the wrapped value so that it can only
+ * be modified in ways consistent with the reducer's operation. No such
+ * protection is provided for C reducers. It is entirely the responsibility
+ * of the user to avoid modifying the value in any inappropriate way.
+ *
+ * @subsection c_reducers_unregister Tell the Intel Cilk Plus Runtime That You Are
+ * Done with the Reducer
+ *
+ * When the parallel computation is complete, call the @ref
+ * CILK_C_UNREGISTER_REDUCER macro to unregister the reducer with the
+ * Intel Cilk Plus runtime:
+ *
* CILK_C_UNREGISTER_REDUCER(reducer-name);
- *
+ *
* The runtime will stop managing reducer values for the reducer.
- *
+ *
* @subsection c_reducers_retrieve Retrieve the Value from the Reducer
- *
- * When the parallel computation is complete, use the @ref REDUCER_VIEW macro to retrieve the
- * final value computed by the reducer.
- *
- * @subsection reducers_c_example_custom Example — Creating and Using a Custom C Reducer
- *
+ *
+ * When the parallel computation is complete, use the @ref REDUCER_VIEW macro
+ * to retrieve the final value computed by the reducer.
+ *
+ * @subsection reducers_c_example_custom Example - Creating and Using a
+ * Custom C Reducer
+ *
* The `IntList` type represents a simple list of integers.
- *
+ *
* struct _intListNode {
* int value;
* _intListNode* next;
* } IntListNode;
* typedef struct { IntListNode* head; IntListNode* tail; } IntList;
- *
+ *
* // Initialize a list to be empty
* void IntList_init(IntList* list) { list->head = list->tail = 0; }
- *
+ *
* // Append an integer to the list
- * void IntList_append(IntList* list, int x)
- * {
+ * void IntList_append(IntList* list, int x)
+ * {
* IntListNode* node = (IntListNode*) malloc(sizeof(IntListNode));
* if (list->tail) list->tail->next = node; else list->head = node;
* list->tail = node;
* }
- *
- * // Append the right list to the left list, and leave the right list empty
+ *
+ * // Append the right list to the left list, and leave the right list
+ * // empty
* void IntList_concat(IntList* left, IntList* right)
* {
* if (left->head) {
@@ -1594,19 +1684,20 @@ using stub::reducer;
* }
* IntList_init(*right);
* }
- *
- * This code creates a reducer that supports creating an `IntList` by appending values to it.
- *
+ *
+ * This code creates a reducer that supports creating an `IntList` by
+ * appending values to it.
+ *
* void identity_IntList(void* reducer, void* list)
* {
* IntList_init((IntList*)list);
* }
- *
+ *
* void reduce_IntList(void* reducer, void* left, void* right)
* {
* IntList_concat((IntList*)left, (IntList*)right);
* }
- *
+ *
* CILK_C_DECLARE_REDUCER(IntList) my_list_int_reducer =
* CILK_C_INIT_REDUCER(IntList,
* reduce_int_list,
@@ -1620,28 +1711,29 @@ using stub::reducer;
* IntList_append(&REDUCER_VIEW(my_int_list_reducer), a[i]);
* }
* CILK_C_UNREGISTER_REDUCER(my_int_list_reducer);
- *
+ *
* IntList result = REDUCER_VIEW(my_int_list_reducer);
*
* @section reducers_c_predefined Predefined C Reducers
*
- * Some of the predefined reducer classes in the Cilk library come with a set of predefined
- * macros to provide the same capabilities in C. In general, two macros are provided for each
- * predefined reducer family:
+ * Some of the predefined reducer classes in the Intel Cilk Plus library come with
+ * a set of predefined macros to provide the same capabilities in C.
+ * In general, two macros are provided for each predefined reducer family:
*
- * - `CILK_C_REDUCER_operation(reducer-name, type-name, initial-value)` — Declares a
- * reducer object named _reducer-name_ with initial value _initial-value_ to perform
- * a reduction using the _operation_ on values of the type specified by _type-name_.
- * This is the equivalent of the general code described in @ref reducers_c_creation :
+ * - `CILK_C_REDUCER_operation(reducer-name, type-name, initial-value)` -
+ * Declares a reducer object named _reducer-name_ with initial value
+ * _initial-value_ to perform a reduction using the _operation_ on values
+ * of the type specified by _type-name_. This is the equivalent of the
+ * general code described in @ref reducers_c_creation :
*
* CILK_C_DECLARE_REDUCER(type) reducer-name =
* CILK_C_INIT_REDUCER(type, ..., initial-value);
*
- * where _type_ is the C type corresponding to _type_name_. See @ref reducers_c_type_names
- * below for the _type-names_ that you can use.
+ * where _type_ is the C type corresponding to _type_name_. See @ref
+ * reducers_c_type_names below for the _type-names_ that you can use.
*
- * - `CILK_C_REDUCER_operation_TYPE(type-name)` — Expands to the `typedef` name for the type
- * of the reducer object declared by
+ * - `CILK_C_REDUCER_operation_TYPE(type-name)` - Expands to the `typedef`
+ * name for the type of the reducer object declared by
* `CILK_C_REDUCER_operation(reducer-name, type-name, initial-value)`.
*
* See @ref reducers_c_example_predefined.
@@ -1651,22 +1743,23 @@ using stub::reducer;
* | Operation | Name | Documentation |
* |-------------------|---------------|-------------------------------|
* | addition | `OPADD` | @ref ReducersAdd |
- * | bitwise and | `OPAND` | @ref ReducersAnd |
- * | bitwise or | `OPOR` | @ref ReducersOr |
- * | bitwise xor | `OPXOR` | @ref ReducersXor |
+ * | bitwise AND | `OPAND` | @ref ReducersAnd |
+ * | bitwise OR | `OPOR` | @ref ReducersOr |
+ * | bitwise XOR | `OPXOR` | @ref ReducersXor |
* | multiplication | `OPMUL` | @ref ReducersMul |
* | minimum | `MIN` | @ref ReducersMinMax |
* | minimum & index | `MIN_INDEX` | @ref ReducersMinMax |
- * | maximum | `MIN` | @ref ReducersMinMax |
- * | maximum & index | `MIN_INDEX` | @ref ReducersMinMax |
- *
+ * | maximum | `MAX` | @ref ReducersMinMax |
+ * | maximum & index | `MAX_INDEX` | @ref ReducersMinMax |
+ *
* @subsection reducers_c_type_names Numeric Type Names
- *
- * The type and function names created by the C reducer definition macros incorporate both the
- * reducer kind (`opadd`, `opxor`, etc.) and the value type of the reducer (`int`, `double`,
- * etc.). The value type is represented by a _numeric type name_ string. The types supported
- * in C reducers, and their corresponding numeric type names, are given in the following table:
- *
+ *
+ * The type and function names created by the C reducer definition macros
+ * incorporate both the reducer kind (`opadd`, `opxor`, etc.) and the value
+ * type of the reducer (`int`, `double`, etc.). The value type is represented
+ * by a _numeric type name_ string. The types supported in C reducers, and
+ * their corresponding numeric type names, are given in the following table:
+ *
* | Type | Numeric Type Name |
* |-----------------------|-------------------------------|
* | `char` | `char` |
@@ -1685,8 +1778,9 @@ using stub::reducer;
* | `float` | `float` |
* | `double` | `double` |
* | `long double` | `longdouble` |
- *
- * @subsection reducers_c_example_predefined Example — Using a Predefined C Reducer
+ *
+ * @subsection reducers_c_example_predefined Example - Using a Predefined C
+ * Reducer
*
* To compute the sum of all the values in an array of `unsigned int`:
*
@@ -1699,7 +1793,7 @@ using stub::reducer;
* printf("The sum is %u\n", REDUCER_VIEW(sum));
*/
-
+
/** @name C language reducer macros
*
* These macros are used to declare and work with reducers in C code.
@@ -1712,7 +1806,8 @@ using stub::reducer;
/** @name Compound identifier macros.
*
- * These macros are used to construct an identifier by concatenating two or three identifiers.
+ * These macros are used to construct an identifier by concatenating two or
+ * three identifiers.
*/
//@{
@@ -1730,7 +1825,7 @@ using stub::reducer;
//@}
-/** Compiler-specific keyword for the “type of” operator.
+/** Compiler-specific keyword for the "type of" operator.
*/
#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
# define _Typeof __typeof__
@@ -1738,15 +1833,16 @@ using stub::reducer;
/** @name Predefined reducer function declaration macros.
*
- * These macros are used to create the function headers for the identity, reduction,
- * and destructor functions for a builtin reducer family. The macro can be followed by
- * a semicolon to create a declaration, or by a brace-enclosed body to create a definition.
+ * These macros are used to create the function headers for the identity,
+ * reduction, and destructor functions for a builtin reducer family. The
+ * macro can be followed by a semicolon to create a declaration, or by a
+ * brace-enclosed body to create a definition.
*/
//@{
/** Create an identity function header.
*
- * @note The name of the function’s value pointer parameter will always be `v`.
+ * @note The name of the function's value pointer parameter will always be `v`.
*
* @param name The reducer family name.
* @param tn The type name.
@@ -1758,8 +1854,9 @@ using stub::reducer;
*
* @param name The reducer family name.
* @param tn The type name.
- * @param l The name to use for the function’s left value pointer parameter.
- * @param r The name to use for the function’s right value pointer parameter.
+ * @param l The name to use for the function's left value pointer parameter.
+ * @param r The name to use for the function's right value pointer
+ * parameter.
*/
#define __CILKRTS_DECLARE_REDUCER_REDUCE(name,tn,l,r) CILK_EXPORT \
void __CILKRTS_MKIDENT3(name,_reduce_,tn)(void* key, void* l, void* r)
@@ -1768,7 +1865,7 @@ using stub::reducer;
*
* @param name The reducer family name.
* @param tn The type name.
- * @param p The name to use for the function’s value pointer parameter.
+ * @param p The name to use for the function's value pointer parameter.
*/
#define __CILKRTS_DECLARE_REDUCER_DESTROY(name,tn,p) CILK_EXPORT \
void __CILKRTS_MKIDENT3(name,_destroy_,tn)(void* key, void* p)
@@ -1784,8 +1881,8 @@ using stub::reducer;
/** Declaration of a C reducer structure type.
*
- * This macro expands into an anonymous structure declaration for a C reducer structure
- * which contains a @a Type value. For example:
+ * This macro expands into an anonymous structure declaration for a C reducer
+ * structure which contains a @a Type value. For example:
*
* CILK_C_DECLARE_REDUCER(int) my_add_int_reducer =
* CILK_C_INIT_REDUCER(int, …);
@@ -1801,27 +1898,30 @@ using stub::reducer;
/** Initializer for a C reducer structure.
*
- * This macro expands into a brace-enclosed structure initializer for a C reducer structure
- * that was declared with `CILK_C_DECLARE_REDUCER(Type)`. For example:
+ * This macro expands into a brace-enclosed structure initializer for a C
+ * reducer structure that was declared with
+ * `CILK_C_DECLARE_REDUCER(Type)`. For example:
*
* CILK_C_DECLARE_REDUCER(int) my_add_int_reducer =
- * CILK_C_INIT_REDUCER(int,
- * add_int_reduce,
- * add_int_identity,
+ * CILK_C_INIT_REDUCER(int,
+ * add_int_reduce,
+ * add_int_identity,
* __cilkrts_hyperobject_noop_destroy,
* 0);
*
- * @param Type The type of the value contained in the reducer object. Must be the same as
- * the @a Type argument of the CILK_C_DECLARE_REDUCER macro call that created
- * the reducer.
- * @param Reduce The address of the @ref reducers_c_reduce_func "reduce function" for the
+ * @param Type The type of the value contained in the reducer object. Must
+ * be the same as the @a Type argument of the
+ * CILK_C_DECLARE_REDUCER macro call that created the
* reducer.
- * @param Identity The address of the @ref reducers_c_identity_func "identity function" for
- * the reducer.
- * @param Destroy The address of the @ref reducers_c_destroy_func "destroy function" for the
- * reducer.
- * @param ... The initial value for the reducer. (A single expression if @a Type is a
- * scalar type; a list of values if @a Type is a struct or array type.)
+ * @param Reduce The address of the @ref reducers_c_reduce_func
+ * "reduce function" for the reducer.
+ * @param Identity The address of the @ref reducers_c_identity_func
+ * "identity function" for the reducer.
+ * @param Destroy The address of the @ref reducers_c_destroy_func
+ * "destroy function" for the reducer.
+ * @param ... The initial value for the reducer. (A single expression if
+ * @a Type is a scalar type; a list of values if @a Type is a
+ * struct or array type.)
*
* @see @ref reducers_c_creation
*/
@@ -1840,10 +1940,10 @@ using stub::reducer;
, __VA_ARGS__ \
}
-/** Register a reducer with the Cilk runtime.
+/** Register a reducer with the Intel Cilk Plus runtime.
*
- * The runtime will manage reducer values for all registered reducers when parallel execution
- * strands begin and end. For example:
+ * The runtime will manage reducer values for all registered reducers when
+ * parallel execution strands begin and end. For example:
*
* CILK_C_REGISTER_REDUCER(my_add_int_reducer);
* cilk_for (int i = 0; i != n; ++i) {
@@ -1857,10 +1957,10 @@ using stub::reducer;
#define CILK_C_REGISTER_REDUCER(Expr) \
__cilkrts_hyper_create(&(Expr).__cilkrts_hyperbase)
-/** Unregister a reducer with the Cilk runtime.
+/** Unregister a reducer with the Intel Cilk Plus runtime.
*
- * The runtime will stop managing reducer values for a reducer after it is unregistered. For
- * example:
+ * The runtime will stop managing reducer values for a reducer after it is
+ * unregistered. For example:
*
* cilk_for (int i = 0; i != n; ++i) {
* …
@@ -1876,17 +1976,19 @@ using stub::reducer;
/** Get the current view for a reducer.
*
- * The `REDUCER_VIEW(reducer-name)` returns a reference to the reducer’s value for the
- * current parallel strand. This can be used to initialize thevalue of the reducer before it
- * is used, to modify the value of the reducer on the current parallel strand, or to retrieve
- * the final value of the reducer at the end of the parallel computation.
+ * The `REDUCER_VIEW(reducer-name)` returns a reference to the reducer's
+ * value for the current parallel strand. This can be used to initialize the
+ * value of the reducer before it is used, to modify the value of the reducer
+ * on the current parallel strand, or to retrieve the final value of the
+ * reducer at the end of the parallel computation.
*
* REDUCER_VIEW(my_add_int_reducer) = REDUCER_VIEW(my_add_int_reducer) + x;
*
- * @note C++ reducer views restrict access to the wrapped value so that it can only be
- * modified in ways consistent with the reducer’s operation. No such protection is provided
- * for C reducers. It is entirely the responsibility of the user to refrain from modifying the
- * value in any inappropriate way.
+ * @note C++ reducer views restrict access to the wrapped value so that it
+ * can only be modified in ways consistent with the reducer's operation. No
+ * such protection is provided for C reducers. It is entirely the
+ * responsibility of the user to refrain from modifying the value in any
+ * inappropriate way.
*
* @param Expr The reducer whose value is to be returned.
*
diff --git a/libcilkrts/include/cilk/reducer_file.h b/libcilkrts/include/cilk/reducer_file.h
index 75af994e9d4..a372cee7cda 100644
--- a/libcilkrts/include/cilk/reducer_file.h
+++ b/libcilkrts/include/cilk/reducer_file.h
@@ -1,9 +1,7 @@
/*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -18,7 +16,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -31,6 +28,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
*
*/
diff --git a/libcilkrts/include/cilk/reducer_list.h b/libcilkrts/include/cilk/reducer_list.h
index fc0be1e03d3..80204af1d9e 100644
--- a/libcilkrts/include/cilk/reducer_list.h
+++ b/libcilkrts/include/cilk/reducer_list.h
@@ -1,10 +1,8 @@
/* reducer_list.h -*- C++ -*-
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -19,7 +17,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -32,12 +29,26 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
*/
/** @file reducer_list.h
*
- * @brief Defines classes for doing parallel list creation by appending or
- * prepending.
+ * @brief Defines classes for parallel list creation by appending or
+ * prepending reducers.
*
* @ingroup ReducersList
*
@@ -52,19 +63,19 @@
/** @defgroup ReducersList List Reducers
*
- * List append and prepend reducers allow the creation of a standard list by
+ * List-append and list-prepend reducers create standard lists by
* concatenating a set of lists or values in parallel.
*
* @ingroup Reducers
*
- * You should be familiar with @ref pagereducers "Cilk reducers", described in
- * file `reducers.md`, and particularly with @ref reducers_using, before trying
- * to use the information in this file.
+ * You should be familiar with @ref pagereducers "Intel(R) Cilk(TM) Plus reducers"
+ * (from file `reducers.md`) and particularly with @ref reducers_using, before
+ * trying to use the information in this file.
*
* @section redlist_usage Usage Example
*
* // Create a list containing the labels of the nodes of a tree in
- * // “inorder” (left subtree, root, right subtree).
+ * // "inorder" (left subtree, root, right subtree).
*
* struct Tree { Tree* left; Tree* right; string label; ... };
*
@@ -72,8 +83,8 @@
* cilk::reducer< cilk::op_list_append<string> > xr(cilk::move_in(x));
* collect_labels(tree, xr);
* xr.move_out(x);
- *
- * void collect_labels(Tree* node,
+ *
+ * void collect_labels(Tree* node,
* cilk::reducer< cilk::op_list_append<string> >& xr)
* {
* if (node) {
@@ -88,39 +99,39 @@
*
* @subsection redlist_monoid_values Value Set
*
- * The value set of a list reducer is the set of values of the class
- * `std::list<Type, Allocator>`, which we refer to as “the reducer’s list
- * type”.
+ * The __value set__ of a list reducer is the set of values of the class
+ * `std::list<Type, Allocator>`, which we refer to as the reducer's _list
+ * type_.
*
* @subsection redlist_monoid_operator Operator
*
- * The operator of a list append reducer is defined as
+ * The operator of a list-append reducer is defined as
*
* x CAT y == (every element of x, followed by every element of y)
*
- * The operator of a list prepend reducer is defined as
+ * The operator of a list-prepend reducer is defined as
*
* x RCAT y == (every element of y, followed by every element of x)
*
* @subsection redlist_monoid_identity Identity
*
- * The identity value of a list reducer is the empty list, which is the value
+ * The identity value of a list reducer is the empty list, which is the value
* of the expression `std::list<Type, Allocator>([allocator])`.
*
* @section redlist_operations Operations
*
- * In the operation descriptions below, the type name `List` refers to the
- * reducer’s string type, `std::list<Type, Allocator>`.
+ * In the operation descriptions below, the type name `List` refers to the
+ * reducer's string type, `std::list<Type, Allocator>`.
*
* @subsection redlist_constructors Constructors
*
- * Any argument list which is valid for a `std::list` constructor is valid for
+ * Any argument list which is valid for a `std::list` constructor is valid for
* a list reducer constructor. The usual move-in constructor is also provided:
*
* reducer(move_in(List& variable))
*
- * A list reducer with no constructor arguments, or with only an allocator
- * argument, will initially contain the identity value, an empty list.
+ * A list reducer with no constructor arguments, or with only an allocator
+ * argument, will initially contain the identity value, an empty list.
*
* @subsection redlist_get_set Set and Get
*
@@ -131,19 +142,19 @@
*
* @subsection redlist_view_ops View Operations
*
- * The view of a list append reducer provides the following member functions:
+ * The view of a list-append reducer provides the following member functions:
*
- * void push_back(const Type& element)
- * void insert_back(List::size_type n, const Type& element)
+ * void push_back(const Type& element)
+ * void insert_back(List::size_type n, const Type& element)
* template <typename Iter> void insert_back(Iter first, Iter last)
* void splice_back(List& x)
* void splice_back(List& x, List::iterator i)
* void splice_back(List& x, List::iterator first, List::iterator last)
- *
- * The view of a list prepend reducer provides the following member functions:
*
- * void push_front(const Type& element)
- * void insert_front(List::size_type n, const Type& element)
+ * The view of a list-prepend reducer provides the following member functions:
+ *
+ * void push_front(const Type& element)
+ * void insert_front(List::size_type n, const Type& element)
* template <typename Iter> void insert_front(Iter first, Iter last)
* void splice_front(List& x)
* void splice_front(List& x, List::iterator i)
@@ -151,26 +162,26 @@
*
* The `push_back` and `push_front` functions are the same as the
* corresponding `std::list` functions. The `insert_back`, `splice_back`,
- * `insert_front`, and `splice_front` functions are the same as the
+ * `insert_front`, and `splice_front` functions are the same as the
* `std::list` `insert` and `splice` functions, with the first parameter
* fixed to the end or beginning of the list, respectively.
*
* @section redlist_performance Performance Considerations
*
- * An efficient reducer requires that combining the values of two views (using
+ * An efficient reducer requires that combining the values of two views (using
* the view `reduce()` function) be a constant-time operations. Two lists can
* be merged in constant time using the `splice()` function if they have the
* same allocator. Therefore, the lists for new views are created (by the view
* identity constructor) using the same allocator as the list that was created
* when the reducer was constructed.
*
- * The performance of adding elements to a list reducer depends on the view
+ * The performance of adding elements to a list reducer depends on the view
* operations that are used:
*
* * The `push` functions add a single element to the list, and therefore
* take constant time.
* * An `insert` function that inserts _N_ elements adds each of them
- * individually, and therefore takes _O(N)_ time.
+ * individually, and therefore takes _O(N)_ time.
* * A `splice` function that inserts _N_ elements just adjusts a couple of
* pointers, and therefore takes constant time, _if the splice is from a
* list with the same allocator as the reducer_. Otherwise, it is
@@ -183,7 +194,7 @@
* The reducer `move_in` and `move_out` functions do a constant-time `swap` if
* the variable has the same allocator as the reducer, and a linear-time copy
* otherwise.
- *
+ *
* Note that the allocator of a list reducer is determined when the reducer is
* constructed. The following two examples may have very different behavior:
*
@@ -199,16 +210,16 @@
* reducer2.move_out(a_list);
*
* * `reducer1` will be constructed with the same allocator as `a_list`,
- * because the list was was specified in the constructor. The `move_in`
- * and`move_out` can therefore be done with a `swap` in constant time.
+ * because the list was specified in the constructor. The `move_in`
+ * and `move_out` can therefore be done with a `swap` in constant time.
* * `reducer2` will be constructed with a _default_ allocator,
- * “`Allocator()`”, which may or may not be the same as the allocator of
+ * "`Allocator()`", which may or may not be the same as the allocator of
* `a_list`. Therefore, the `move_in` and `move_out` may have to be done
* with a copy in _O(N)_ time.
- *
+ *
* (All instances of an allocator type with no internal state (like
- * `std::allocator`) are “the same”. You only need to worry about the “same
- * allocator” issue when you create list reducers with custom allocator types.)
+ * `std::allocator`) are "the same". You only need to worry about the "same
+ * allocator" issue when you create list reducers with custom allocator types.)
*
* @section redlist_types Type and Operator Requirements
*
@@ -223,11 +234,11 @@ namespace internal {
/** @ingroup ReducersList */
//@{
-/** Base class for list append and prepend view classes.
+/** Base class for list-append and prepend view classes.
*
* @note This class provides the definitions that are required for a class
* that will be used as the parameter of a @ref list_monoid_base
- * specialization.
+ * specialization.
*
* @tparam Type The list element type (not the list type).
* @tparam Allocator The list's allocator class.
@@ -250,31 +261,31 @@ public:
/** @name Monoid support.
*/
//@{
-
+
/// Required by @ref monoid_with_view
typedef list_type value_type;
/// Required by @ref list_monoid_base
Allocator get_allocator() const
- {
- return m_value.get_allocator();
+ {
+ return m_value.get_allocator();
}
-
+
//@}
-
-
+
+
/** @name Constructors.
*/
//@{
-
+
/// Standard list constructor.
explicit list_view_base(const Allocator& a = Allocator()) : m_value(a) {}
explicit list_view_base(
- typename list_type::size_type n,
- const Type& value = Type(),
+ typename list_type::size_type n,
+ const Type& value = Type(),
const Allocator& a = Allocator() ) : m_value(n, value, a) {}
- template <typename Iter>
- list_view_base(Iter first, Iter last, const Allocator& a = Allocator()) :
+ template <typename Iter>
+ list_view_base(Iter first, Iter last, const Allocator& a = Allocator()) :
m_value(first, last, a) {}
list_view_base(const list_type& list) : m_value(list) {}
@@ -284,13 +295,13 @@ public:
{
m_value.swap(w.value());
}
-
+
//@}
-
+
/** @name Reducer support.
*/
//@{
-
+
/// Required by reducer::move_in()
void view_move_in(value_type& v)
{
@@ -302,7 +313,7 @@ public:
m_value = v;
v.clear();
}
-
+
/// Required by reducer::move_out()
void view_move_out(value_type& v)
{
@@ -314,43 +325,46 @@ public:
v = m_value;
m_value.clear();
}
-
+
/// Required by reducer::set_value()
void view_set_value(const value_type& v) { m_value = v; }
/// Required by reducer::get_value()
value_type const& view_get_value() const { return m_value; }
-
+
+ /// Type returned by view_get_value.
+ typedef value_type const& return_type_for_get_value;
+
// Required by legacy wrapper get_reference()
value_type & view_get_reference() { return m_value; }
value_type const& view_get_reference() const { return m_value; }
-
+
//@}
};
-/** Base class for list append and prepend monoid classes.
+/** Base class for list-append and prepend monoid classes.
*
* The key to efficient reducers is that the `identity` operation, which
* creates a new per-strand view, and the `reduce` operation, which combines
* two per-strand views, must be constant-time operations. Two lists can be
* concatenated in constant time only if they have the same allocator.
* Therefore, all the per-strand list accumulator variables must be created
- * with the same allocator as the leftmost view list.
+ * with the same allocator as the leftmost view list.
*
* This means that a list reduction monoid must have a copy of the allocator
- * of the leftmost view’s list, so that it can use it in the `identity`
+ * of the leftmost view's list, so that it can use it in the `identity`
* operation. This, in turn, requires that list reduction monoids have a
* specialized `construct()` function, which constructs the leftmost view
- * before the monoid, and then passes the leftmost view’s allocator to the
+ * before the monoid, and then passes the leftmost view's allocator to the
* monoid constructor.
*
- * @tparam View The list append or prepend view class.
+ * @tparam View The list-append or prepend view class.
* @tparam Align If `false` (the default), reducers instantiated on this
- * monoid will be naturally aligned (the Cilk library 1.0
+ * monoid will be naturally aligned (the Intel Cilk Plus library 1.0
* behavior). If `true`, reducers instantiated on this monoid
- * will be cache-aligned for binary compatibility with
- * reducers in Cilk library version 0.9.
+ * will be cache-aligned for binary compatibility with
+ * reducers in Intel Cilk Plus library version 0.9.
*
* @see ReducersList
* @see list_view_base
@@ -360,15 +374,15 @@ class list_monoid_base : public monoid_with_view<View, Align>
{
typedef typename View::value_type list_type;
typedef typename list_type::allocator_type allocator_type;
+ typedef provisional_guard<View> view_guard;
+
allocator_type m_allocator;
-
- using monoid_base<list_type, View>::provisional;
-
+
public:
/** Constructor.
*
- * There is no default constructor for list monoids, because the allocator
+ * There is no default constructor for list monoids, because the allocator
* must always be specified.
*
* @param allocator The list allocator to be used when
@@ -377,7 +391,7 @@ public:
list_monoid_base(const allocator_type& allocator = allocator_type()) :
m_allocator(allocator) {}
- /** Create an identity view.
+ /** Creates an identity view.
*
* List view identity constructors take the list allocator as an argument.
*
@@ -385,12 +399,12 @@ public:
* will be constructed.
*/
void identity(View *v) const { ::new((void*) v) View(m_allocator); }
-
+
/** @name construct functions
*
- * All `construct()` functions first construct the leftmost view, using
+ * All `construct()` functions first construct the leftmost view, using
* the optional @a x1, @a x2, and @a x3 arguments that were passed in from
- * the reducer constructor. They then call the view’s `get_allocator()`
+ * the reducer constructor. They then call the view's `get_allocator()`
* function to get the list allocator from its contained list, and pass it
* to the monoid constructor.
*/
@@ -398,24 +412,33 @@ public:
template <typename Monoid>
static void construct(Monoid* monoid, View* view)
- { provisional( new ((void*)view) View() ).confirm_if(
- new ((void*)monoid) Monoid(view->get_allocator()) ); }
+ {
+ view_guard vg( new((void*) view) View() );
+ vg.confirm_if( new((void*) monoid) Monoid(view->get_allocator()) );
+ }
template <typename Monoid, typename T1>
static void construct(Monoid* monoid, View* view, const T1& x1)
- { provisional( new ((void*)view) View(x1) ).confirm_if(
- new ((void*)monoid) Monoid(view->get_allocator()) ); }
+ {
+ view_guard vg( new((void*) view) View(x1) );
+ vg.confirm_if( new((void*) monoid) Monoid(view->get_allocator()) );
+ }
template <typename Monoid, typename T1, typename T2>
- static void construct(Monoid* monoid, View* view, const T1& x1, const T2& x2)
- { provisional( new ((void*)view) View(x1, x2) ).confirm_if(
- new ((void*)monoid) Monoid(view->get_allocator()) ); }
+ static void construct(Monoid* monoid, View* view,
+ const T1& x1, const T2& x2)
+ {
+ view_guard vg( new((void*) view) View(x1, x2) );
+ vg.confirm_if( new((void*) monoid) Monoid(view->get_allocator()) );
+ }
template <typename Monoid, typename T1, typename T2, typename T3>
- static void construct(Monoid* monoid, View* view, const T1& x1, const T2& x2,
- const T3& x3)
- { provisional( new ((void*)view) View(x1, x2, x3) ).confirm_if(
- new ((void*)monoid) Monoid(view->get_allocator()) ); }
+ static void construct(Monoid* monoid, View* view,
+ const T1& x1, const T2& x2, const T3& x3)
+ {
+ view_guard vg( new((void*) view) View(x1, x2, x3) );
+ vg.confirm_if( new((void*) monoid) Monoid(view->get_allocator()) );
+ }
//@}
};
@@ -428,17 +451,17 @@ public:
/** @ingroup ReducersList */
//@{
-/** The list append reducer view class.
+/** The list-append reducer view class.
*
- * This is the view class for reducers created with
+ * This is the view class for reducers created with
* `cilk::reducer< cilk::op_list_append<Type, Allocator> >`. It holds the
* accumulator variable for the reduction, and allows only append operations
* to be performed on it.
*
- * @note The reducer “dereference” operation (`reducer::operator *()`)
- * yields a reference to the view. Thus, for example, the view class’s
+ * @note The reducer "dereference" operation (`reducer::operator *()`)
+ * yields a reference to the view. Thus, for example, the view class's
* `push_back` operation would be used in an expression like
- * `r->push_back(a)`, where `r` is a list append reducer variable.
+ * `r->push_back(a)`, where `r` is a list-append reducer variable.
*
* @tparam Type The list element type (not the list type).
* @tparam Allocator The list allocator type.
@@ -446,14 +469,14 @@ public:
* @see ReducersList
* @see op_list_append
*/
-template <class Type,
+template <class Type,
class Allocator = typename std::list<Type>::allocator_type>
class op_list_append_view : public internal::list_view_base<Type, Allocator>
{
typedef internal::list_view_base<Type, Allocator> base;
typedef std::list<Type, Allocator> list_type;
typedef typename list_type::iterator iterator;
-
+
iterator end() { return this->m_value.end(); }
public:
@@ -467,40 +490,40 @@ public:
* forms, as well as the reducer move_in constructor form.
*/
//@{
-
+
op_list_append_view() : base() {}
-
+
template <typename T1>
op_list_append_view(const T1& x1) : base(x1) {}
-
+
template <typename T1, typename T2>
op_list_append_view(const T1& x1, const T2& x2) : base(x1, x2) {}
-
+
template <typename T1, typename T2, typename T3>
- op_list_append_view(const T1& x1, const T2& x2, const T3& x3) :
+ op_list_append_view(const T1& x1, const T2& x2, const T3& x3) :
base(x1, x2, x3) {}
- //@}
+ //@}
/** @name View modifier operations.
*/
//@{
-
- /** Add an element at the end of the list.
+
+ /** Adds an element at the end of the list.
*
* This is equivalent to `list.push_back(element)`
*/
- void push_back(const Type& element)
+ void push_back(const Type& element)
{ this->m_value.push_back(element); }
- /** Insert elements at the end of the list.
+ /** Inserts elements at the end of the list.
*
* This is equivalent to `list.insert(list.end(), n, element)`
*/
- void insert_back(typename list_type::size_type n, const Type& element)
+ void insert_back(typename list_type::size_type n, const Type& element)
{ this->m_value.insert(end(), n, element); }
- /** Insert elements at the end of the list.
+ /** Inserts elements at the end of the list.
*
* This is equivalent to `list.insert(list.end(), first, last)`
*/
@@ -508,7 +531,7 @@ public:
void insert_back(Iter first, Iter last)
{ this->m_value.insert(end(), first, last); }
- /** Splice elements at the end of the list.
+ /** Splices elements at the end of the list.
*
* This is equivalent to `list.splice(list.end(), x)`
*/
@@ -521,7 +544,7 @@ public:
}
}
- /** Splice elements at the end of the list.
+ /** Splices elements at the end of the list.
*
* This is equivalent to `list.splice(list.end(), x, i)`
*/
@@ -534,7 +557,7 @@ public:
}
}
- /** Splice elements at the end of the list.
+ /** Splices elements at the end of the list.
*
* This is equivalent to `list.splice(list.end(), x, first, last)`
*/
@@ -546,14 +569,14 @@ public:
x.erase(first, last);
}
}
-
+
//@}
- /** Reduction operation.
+ /** Reduces the views of two strands.
*
* This function is invoked by the @ref op_list_append monoid to combine
- * the views of two strands when the right strand merges with the left
- * one. It appends the value contained in the right-strand view to the
+ * the views of two strands when the right strand merges with the left
+ * one. It appends the value contained in the right-strand view to the
* value contained in the left-strand view, and leaves the value in the
* right-strand view undefined.
*
@@ -572,17 +595,17 @@ public:
};
-/** The list prepend reducer view class.
+/** The list-prepend reducer view class.
*
- * This is the view class for reducers created with
+ * This is the view class for reducers created with
* `cilk::reducer< cilk::op_list_prepend<Type, Allocator> >`. It holds the
* accumulator variable for the reduction, and allows only prepend operations
* to be performed on it.
*
- * @note The reducer “dereference” operation (`reducer::operator *()`)
- * yields a reference to the view. Thus, for example, the view class’s
+ * @note The reducer "dereference" operation (`reducer::operator *()`)
+ * yields a reference to the view. Thus, for example, the view class's
* `push_front` operation would be used in an expression like
- * `r->push_front(a)`, where `r` is a list prepend reducer variable.
+ * `r->push_front(a)`, where `r` is a list-prepend reducer variable.
*
* @tparam Type The list element type (not the list type).
* @tparam Allocator The list allocator type.
@@ -590,14 +613,14 @@ public:
* @see ReducersList
* @see op_list_prepend
*/
-template <class Type,
+template <class Type,
class Allocator = typename std::list<Type>::allocator_type>
class op_list_prepend_view : public internal::list_view_base<Type, Allocator>
{
typedef internal::list_view_base<Type, Allocator> base;
typedef std::list<Type, Allocator> list_type;
typedef typename list_type::iterator iterator;
-
+
iterator begin() { return this->m_value.begin(); }
public:
@@ -612,40 +635,40 @@ public:
*
*/
//@{
-
+
op_list_prepend_view() : base() {}
-
+
template <typename T1>
op_list_prepend_view(const T1& x1) : base(x1) {}
-
+
template <typename T1, typename T2>
op_list_prepend_view(const T1& x1, const T2& x2) : base(x1, x2) {}
-
+
template <typename T1, typename T2, typename T3>
- op_list_prepend_view(const T1& x1, const T2& x2, const T3& x3) :
+ op_list_prepend_view(const T1& x1, const T2& x2, const T3& x3) :
base(x1, x2, x3) {}
- //@}
+ //@}
/** @name View modifier operations.
*/
//@{
-
- /** Add an element at the beginning of the list.
+
+ /** Adds an element at the beginning of the list.
*
* This is equivalent to `list.push_front(element)`
*/
- void push_front(const Type& element)
+ void push_front(const Type& element)
{ this->m_value.push_front(element); }
- /** Insert elements at the beginning of the list.
+ /** Inserts elements at the beginning of the list.
*
* This is equivalent to `list.insert(list.begin(), n, element)`
*/
- void insert_front(typename list_type::size_type n, const Type& element)
+ void insert_front(typename list_type::size_type n, const Type& element)
{ this->m_value.insert(begin(), n, element); }
- /** Insert elements at the beginning of the list.
+ /** Inserts elements at the beginning of the list.
*
* This is equivalent to `list.insert(list.begin(), first, last)`
*/
@@ -653,7 +676,7 @@ public:
void insert_front(Iter first, Iter last)
{ this->m_value.insert(begin(), first, last); }
- /** Splice elements at the beginning of the list.
+ /** Splices elements at the beginning of the list.
*
* This is equivalent to `list.splice(list.begin(), x)`
*/
@@ -666,7 +689,7 @@ public:
}
}
- /** Splice elements at the beginning of the list.
+ /** Splices elements at the beginning of the list.
*
* This is equivalent to `list.splice(list.begin(), x, i)`
*/
@@ -679,7 +702,7 @@ public:
}
}
- /** Splice elements at the beginning of the list.
+ /** Splices elements at the beginning of the list.
*
* This is equivalent to `list.splice(list.begin(), x, first, last)`
*/
@@ -691,14 +714,14 @@ public:
x.erase(first, last);
}
}
-
+
//@}
- /** Reduction operation.
+ /** Reduces the views of two strands.
*
* This function is invoked by the @ref op_list_prepend monoid to combine
- * the views of two strands when the right strand merges with the left
- * one. It prepends the value contained in the right-strand view to the
+ * the views of two strands when the right strand merges with the left
+ * one. It prepends the value contained in the right-strand view to the
* value contained in the left-strand view, and leaves the value in the
* right-strand view undefined.
*
@@ -722,8 +745,8 @@ public:
-/** Monoid class for list append reductions. Instantiate the cilk::reducer
- * template class with a op_list_append monoid to create a list append reducer
+/** Monoid class for list-append reductions. Instantiate the cilk::reducer
+ * template class with a op_list_append monoid to create a list-append reducer
* class. For example, to create a list of strings:
*
* cilk::reducer< cilk::op_list_append<std::string> > r;
@@ -731,29 +754,29 @@ public:
* @tparam Type The list element type (not the list type).
* @tparam Alloc The list allocator type.
* @tparam Align If `false` (the default), reducers instantiated on this
- * monoid will be naturally aligned (the Cilk library 1.0
+ * monoid will be naturally aligned (the Intel Cilk Plus library 1.0
* behavior). If `true`, reducers instantiated on this monoid
- * will be cache-aligned for binary compatibility with
- * reducers in Cilk library version 0.9.
+ * will be cache-aligned for binary compatibility with
+ * reducers in Intel Cilk Plus library version 0.9.
*
* @see ReducersList
* @see op_list_append_view
*/
-template <typename Type,
+template <typename Type,
typename Allocator = typename std::list<Type>::allocator_type,
bool Align = false>
-struct op_list_append :
- public internal::list_monoid_base<op_list_append_view<Type, Allocator>, Align>
+struct op_list_append :
+ public internal::list_monoid_base<op_list_append_view<Type, Allocator>, Align>
{
/// Construct with default allocator.
op_list_append() {}
/// Construct with specified allocator.
- op_list_append(const Allocator& alloc) :
+ op_list_append(const Allocator& alloc) :
internal::list_monoid_base<op_list_append_view<Type, Allocator>, Align>(alloc) {}
};
-/** Monoid class for list prepend reductions. Instantiate the cilk::reducer
- * template class with a op_list_prepend monoid to create a list prepend
+/** Monoid class for list-prepend reductions. Instantiate the cilk::reducer
+ * template class with a op_list_prepend monoid to create a list-prepend
* reducer class. For example, to create a list of strings:
*
* cilk::reducer< cilk::op_list_prepend<std::string> > r;
@@ -761,45 +784,45 @@ struct op_list_append :
* @tparam Type The list element type (not the list type).
* @tparam Alloc The list allocator type.
* @tparam Align If `false` (the default), reducers instantiated on this
- * monoid will be naturally aligned (the Cilk library 1.0
+ * monoid will be naturally aligned (the Intel Cilk Plus library 1.0
* behavior). If `true`, reducers instantiated on this monoid
- * will be cache-aligned for binary compatibility with
- * reducers in Cilk library version 0.9.
+ * will be cache-aligned for binary compatibility with
+ * reducers in Intel Cilk Plus library version 0.9.
*
* @see ReducersList
* @see op_list_prepend_view
*/
-template <typename Type,
+template <typename Type,
typename Allocator = typename std::list<Type>::allocator_type,
bool Align = false>
-struct op_list_prepend :
- public internal::list_monoid_base<op_list_prepend_view<Type, Allocator>, Align>
+struct op_list_prepend :
+ public internal::list_monoid_base<op_list_prepend_view<Type, Allocator>, Align>
{
/// Construct with default allocator.
op_list_prepend() {}
/// Construct with specified allocator.
- op_list_prepend(const Allocator& alloc) :
+ op_list_prepend(const Allocator& alloc) :
internal::list_monoid_base<op_list_prepend_view<Type, Allocator>, Align>(alloc) {}
};
-/** Deprecated list append reducer wrapper class.
+/** Deprecated list-append reducer wrapper class.
*
- * reducer_list_append is the same as
+ * reducer_list_append is the same as
* @ref reducer<@ref op_list_append>, except that reducer_list_append is a
- * proxy for the contained view, so that accumulator variable update
+ * proxy for the contained view, so that accumulator variable update
* operations can be applied directly to the reducer. For example, an element
* is appended to a `reducer<%op_list_append>` with `r->push_back(a)`, but an
* element can be appended to a `%reducer_list_append` with `r.push_back(a)`.
*
* @deprecated Users are strongly encouraged to use `reducer<monoid>`
- * reducers rather than the old wrappers like reducer_list_append.
+ * reducers rather than the old wrappers like reducer_list_append.
* The `reducer<monoid>` reducers show the reducer/monoid/view
* architecture more clearly, are more consistent in their
* implementation, and present a simpler model for new
* user-implemented reducers.
*
- * @note Implicit conversions are provided between `%reducer_list_append`
+ * @note Implicit conversions are provided between `%reducer_list_append`
* and `reducer<%op_list_append>`. This allows incremental code
* conversion: old code that used `%reducer_list_append` can pass a
* `%reducer_list_append` to a converted function that now expects a
@@ -814,20 +837,20 @@ struct op_list_prepend :
* @see ReducersList
*/
template <class Type, class Allocator = std::allocator<Type> >
-class reducer_list_append :
+class reducer_list_append :
public reducer<op_list_append<Type, Allocator, true> >
{
typedef reducer<op_list_append<Type, Allocator, true> > base;
using base::view;
public:
- /// The reducer’s list type.
+ /// The reducer's list type.
typedef typename base::value_type list_type;
- /// The list’s element type.
+ /// The list's element type.
typedef Type list_value_type;
- /// The reducer’s primitive component type.
+ /// The reducer's primitive component type.
typedef Type basic_value_type;
/// The monoid type.
@@ -836,18 +859,18 @@ public:
/** @name Constructors
*/
//@{
-
- /** Construct a reducer with an empty list.
+
+ /** Constructs a reducer with an empty list.
*/
reducer_list_append() {}
- /** Construct a reducer with a specified initial list value.
+ /** Constructs a reducer with a specified initial list value.
*/
- reducer_list_append(const std::list<Type, Allocator> &initial_value) :
+ reducer_list_append(const std::list<Type, Allocator> &initial_value) :
base(initial_value) {}
-
+
//@}
-
+
/** @name Forwarded functions
* @details Functions that update the contained accumulator variable are
@@ -856,25 +879,25 @@ public:
/// @copydoc op_list_append_view::push_back(const Type&)
void push_back(const Type& element) { view().push_back(element); }
-
+
//@}
- /** Allow mutable access to the list within the current view.
- *
+ /** Allows mutable access to the list within the current view.
+ *
* @warning If this method is called before the parallel calculation is
* complete, the list returned by this method will be a partial
* result.
- *
+ *
* @returns A mutable reference to the list within the current view.
*/
list_type &get_reference() { return view().view_get_reference(); }
- /** Allow read-only access to the list within the current view.
- *
+ /** Allows read-only access to the list within the current view.
+ *
* @warning If this method is called before the parallel calculation is
* complete, the list returned by this method will be a partial
* result.
- *
+ *
* @returns A const reference to the list within the current view.
*/
list_type const &get_reference() const { return view().view_get_reference(); }
@@ -903,12 +926,12 @@ public:
reducer_list_append* operator->() { return this; }
reducer_list_append const* operator->() const { return this; }
//@}
-
+
/** @name Upcast
- * @details In Cilk library 0.9, reducers were always cache-aligned. In
- * library 1.0, reducer cache alignment is optional. By default, reducers
- * are unaligned (i.e., just naturally aligned), but legacy wrappers
- * inherit from cache-aligned reducers for binary compatibility.
+ * @details In Intel Cilk Plus library 0.9, reducers were always cache-aligned.
+ * In library 1.0, reducer cache alignment is optional. By default,
+ * reducers are unaligned (i.e., just naturally aligned), but legacy
+ * wrappers inherit from cache-aligned reducers for binary compatibility.
*
* This means that a wrapper will automatically be upcast to its aligned
* reducer base class. The following conversion operators provide
@@ -923,18 +946,18 @@ public:
}
operator const reducer< op_list_append<Type, Allocator, false> >& () const
{
- return *reinterpret_cast<
- const reducer< op_list_append<Type, Allocator, false> >*
+ return *reinterpret_cast<
+ const reducer< op_list_append<Type, Allocator, false> >*
>(this);
}
//@}
-
+
};
-/** Deprecated list prepend reducer wrapper class.
+/** Deprecated list-prepend reducer wrapper class.
*
- * reducer_list_prepend is the same as
+ * reducer_list_prepend is the same as
* @ref reducer<@ref op_list_prepend>, except that reducer_list_prepend is a
* proxy for the contained view, so that accumulator variable update operations
* can be applied directly to the reducer. For example, an element is prepended
@@ -942,13 +965,13 @@ public:
* prepended to a `reducer_list_prepend` with `r.push_back(a)`.
*
* @deprecated Users are strongly encouraged to use `reducer<monoid>`
- * reducers rather than the old wrappers like reducer_list_prepend.
+ * reducers rather than the old wrappers like reducer_list_prepend.
* The `reducer<monoid>` reducers show the reducer/monoid/view
* architecture more clearly, are more consistent in their
* implementation, and present a simpler model for new
* user-implemented reducers.
*
- * @note Implicit conversions are provided between `%reducer_list_prepend`
+ * @note Implicit conversions are provided between `%reducer_list_prepend`
* and `reducer<%op_list_prepend>`. This allows incremental code
* conversion: old code that used `%reducer_list_prepend` can pass a
* `%reducer_list_prepend` to a converted function that now expects a
@@ -963,22 +986,22 @@ public:
* @see ReducersList
*/
template <class Type, class Allocator = std::allocator<Type> >
-class reducer_list_prepend :
+class reducer_list_prepend :
public reducer<op_list_prepend<Type, Allocator, true> >
{
typedef reducer<op_list_prepend<Type, Allocator, true> > base;
using base::view;
public:
- /** The reducer’s list type.
+ /** The reducer's list type.
*/
typedef typename base::value_type list_type;
- /** The list’s element type.
+ /** The list's element type.
*/
typedef Type list_value_type;
- /** The reducer’s primitive component type.
+ /** The reducer's primitive component type.
*/
typedef Type basic_value_type;
@@ -989,45 +1012,45 @@ public:
/** @name Constructors
*/
//@{
-
- /** Construct a reducer with an empty list.
+
+ /** Constructs a reducer with an empty list.
*/
reducer_list_prepend() {}
- /** Construct a reducer with a specified initial list value.
+ /** Constructs a reducer with a specified initial list value.
*/
- reducer_list_prepend(const std::list<Type, Allocator> &initial_value) :
+ reducer_list_prepend(const std::list<Type, Allocator> &initial_value) :
base(initial_value) {}
-
+
//@}
/** @name Forwarded functions
* @details Functions that update the contained accumulator variable are
- * simply forwarded to the contained @ref op_and_view.
+ * simply forwarded to the contained @ref op_and_view.
*/
//@{
/// @copydoc op_list_prepend_view::push_front(const Type&)
void push_front(const Type& element) { view().push_front(element); }
-
+
//@}
- /** Allow mutable access to the list within the current view.
- *
+ /** Allows mutable access to the list within the current view.
+ *
* @warning If this method is called before the parallel calculation is
* complete, the list returned by this method will be a partial
* result.
- *
+ *
* @returns A mutable reference to the list within the current view.
*/
list_type &get_reference() { return view().view_get_reference(); }
- /** Allow read-only access to the list within the current view.
- *
+ /** Allows read-only access to the list within the current view.
+ *
* @warning If this method is called before the parallel calculation is
* complete, the list returned by this method will be a partial
* result.
- *
+ *
* @returns A const reference to the list within the current view.
*/
list_type const &get_reference() const { return view().view_get_reference(); }
@@ -1055,12 +1078,12 @@ public:
reducer_list_prepend* operator->() { return this; }
reducer_list_prepend const* operator->() const { return this; }
//@}
-
+
/** @name Upcast
- * @details In Cilk library 0.9, reducers were always cache-aligned. In
- * library 1.0, reducer cache alignment is optional. By default, reducers
- * are unaligned (i.e., just naturally aligned), but legacy wrappers
- * inherit from cache-aligned reducers for binary compatibility.
+ * @details In Intel Cilk Plus library 0.9, reducers were always cache-aligned.
+ * In library 1.0, reducer cache alignment is optional. By default,
+ * reducers are unaligned (i.e., just naturally aligned), but legacy
+ * wrappers inherit from cache-aligned reducers for binary compatibility.
*
* This means that a wrapper will automatically be upcast to its aligned
* reducer base class. The following conversion operators provide
@@ -1070,17 +1093,17 @@ public:
operator reducer< op_list_prepend<Type, Allocator, false> >& ()
{
return *reinterpret_cast<
- reducer< op_list_prepend<Type, Allocator, false> >*
+ reducer< op_list_prepend<Type, Allocator, false> >*
>(this);
}
operator const reducer< op_list_prepend<Type, Allocator, false> >& () const
{
return *reinterpret_cast<
- const reducer< op_list_prepend<Type, Allocator, false> >*
+ const reducer< op_list_prepend<Type, Allocator, false> >*
>(this);
}
//@}
-
+
};
/// @cond internal
@@ -1105,7 +1128,7 @@ struct legacy_reducer_downcast<reducer<op_list_append<Type, Allocator, Align> >
*
* This specialization of the @ref legacy_reducer_downcast template class
* defined in reducer.h causes the
- * `reducer< op_list_prepend<Type, Allocator> >` class to have an
+ * `reducer< op_list_prepend<Type, Allocator> >` class to have an
* `operator reducer_list_prepend<Type, Allocator>& ()` conversion operator
* that statically downcasts the `reducer<op_list_prepend>` to the
* corresponding `reducer_list_prepend` type. (The reverse conversion, from
diff --git a/libcilkrts/include/cilk/reducer_max.h b/libcilkrts/include/cilk/reducer_max.h
index 3ba3a0bc8ac..3982cb11c2a 100644
--- a/libcilkrts/include/cilk/reducer_max.h
+++ b/libcilkrts/include/cilk/reducer_max.h
@@ -1,10 +1,8 @@
/* reducer_max.h -*- C++ -*-
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -19,7 +17,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -32,6 +29,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
*/
/** @file reducer_max.h
diff --git a/libcilkrts/include/cilk/reducer_min.h b/libcilkrts/include/cilk/reducer_min.h
index f5a3910850e..912979d7229 100644
--- a/libcilkrts/include/cilk/reducer_min.h
+++ b/libcilkrts/include/cilk/reducer_min.h
@@ -1,10 +1,8 @@
/* reducer_min.h -*- C++ -*-
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -19,7 +17,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -32,6 +29,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
*/
/** @file reducer_min.h
diff --git a/libcilkrts/include/cilk/reducer_min_max.h b/libcilkrts/include/cilk/reducer_min_max.h
index 7fe09e8d605..641aa823901 100644
--- a/libcilkrts/include/cilk/reducer_min_max.h
+++ b/libcilkrts/include/cilk/reducer_min_max.h
@@ -1,10 +1,8 @@
/* reducer_min_max.h -*- C++ -*-
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -19,7 +17,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -32,6 +29,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
*/
/** @file reducer_min_max.h
@@ -60,9 +71,9 @@
*
* @ingroup Reducers
*
- * You should be familiar with @ref pagereducers "Cilk reducers", described in
- * file `reducers.md`, and particularly with @ref reducers_using, before trying
- * to use the information in this file.
+ * You should be familiar with @ref pagereducers "Intel(R) Cilk(TM) Plus reducers",
+ * described in file `reducers.md`, and particularly with @ref reducers_using,
+ * before trying to use the information in this file.
*
* @section redminmax_usage Usage Examples
*
@@ -88,12 +99,13 @@
* @subsection redminmax_monoid_values Value Set
*
* The value set of a minimum or maximum reducer is the set of values of
- * `Type`, possibly augmented with a special identity value which is greater
- * than (less than) any value of `Type`.
+ * `Type`, augmented with a "special identity value" which is not a value of
+ * `Type`, but which is defined to be greater than (less than) any value of
+ * `Type`.
*
* @subsection redminmax_monoid_operator Operator
*
- * In the most common case, the operator of a minimum reducer is defined as
+ * By default, the operator of a minimum reducer is defined as
*
* x MIN y == (x < y) ? x : y
*
@@ -112,7 +124,7 @@
* Min/max reducers are not limited to finding the minimum or maximum value
* determined by the `<` or `>` operator. In fact, all min/max reducers use a
* _comparator_, which is either a function or an object of a function class
- * that defines a [strict weak ordering]
+ * that defines a [strict weak ordering]
* (http://en.wikipedia.org/wiki/Strict_weak_ordering#Strict_weak_orderings)
* on a set of values. (This is exactly the same as the requirement for the
* comparison predicate for STL associative containers and sorting
@@ -121,8 +133,8 @@
* Just as with STL algorithms and containers, the comparator type parameter
* for min/max reducers is optional. If it is omitted, it defaults to
* `std::less`, which gives the behavior described in the previous section.
- * Using non-default comparators (anything other than `std::less`) with
- * min/max reducers is just like using them with STL containers and
+ * Using non-default comparators (anything other than `std::less`) with
+ * min/max reducers is just like using them with STL containers and
* algorithms.
*
* Taking comparator objects into account, the reduction operation `MIN` for a
@@ -130,45 +142,44 @@
*
* x MIN y == compare(x, y) ? x : y
*
- * where `compare()` is the reducer’s comparator. Similarly, the reduction
+ * where `compare()` is the reducer's comparator. Similarly, the reduction
* operation MAX for a maximum reducer is defined as
*
* x MAX y == compare(y, x) ? x : y
*
- * (If `compare(x, y) == x < y`, then `compare(y, x) == x > y`.)
+ * (If `compare(x, y) == x < y`, then `compare(y, x) == x > y`.)
*
* @subsection redminmax_monoid_identity Identity
*
- * The identity value of the reducer is the value which is greater than (less
- * than) any other value in the value set of the reducer. This is the
- * [“special identity value”](#redminmax_monoid_values) if the reducer has
- * one, or the largest (smallest) value in the value set otherwise.
+ * The identity value of a min/max reducer is its monoid's
+ * ["special identity value"](#redminmax_monoid_values), which is not a value
+ * of the reducer's data type. (See @ref redminmax_initial.)
*
* @section redminmax_index Value and Index Reducers
*
- * Min/max reducers come in two families. The _value_ reducers, using `op_min`
- * and `op_max` monoids, simply find the smallest or largest value from a set
- * of values. The _index_ reducers, using `op_min_index` and `op_max_index`
- * monoids, also record an index value associated with the first occurrence of
- * the smallest or largest value.
+ * Min/max reducers come in two families. The _value_ reducers, with the
+ * `op_min` and `op_max` monoids, simply find the smallest or largest value
+ * from a set of values. The _index_ reducers, with the `op_min_index` and
+ * `op_max_index` monoids, also record an index value associated with the
+ * first occurrence of the smallest or largest value.
*
* In the `%op_min_index` usage example [above](#redminmax_usage), the values
* are taken from an array, and the index of a value is the index of the array
* element it comes from. More generally, though, an index can be any sort of
* key which identifies a particular value in a collection of values. For
- * example, if the values were taken from the nodes of a tree, then the
- * “index” of a value might be a pointer to the node containing that value.
+ * example, if the values were taken from the nodes of a tree, then the
+ * "index" of a value might be a pointer to the node containing that value.
*
* A min/max index reducer is essentially the same as a min/max value reducer
- * whose value type is an (index, value) pair, and whose comparator ignores
+ * whose value type is an (index, value) pair, and whose comparator ignores
* the index part of the pair. (index, value) pairs are represented by
- * `std::pair<Index, Type>` objects. This has the consequence that wherever
- * the interface of a min/max value reducer has a `Type`, the interface of the
- * corresponding min/max index reducer has a `std::pair<Index, Type>`. (There
- * are convenience variants of the `reducer(Type)` constructor and the
+ * `std::pair<Index, Type>` objects. This has the consequence that wherever
+ * the interface of a min/max value reducer has a `Type`, the interface of a
+ * min/max index reducer has a `std::pair<Index, Type>`. (There are
+ * convenience variants of the `reducer(Type)` constructor and the
* `calc_min()`, `calc_max()`, `%min_of()`, and `%max_of()` functions that
- * take an index argument and a value argument instead of an index/value
- * pair.)
+ * take an index argument and a value argument instead of a single index/value
+ * pair argument.)
*
* @section redminmax_operations Operations
*
@@ -194,6 +205,12 @@
* reducer(const Index& index, const Type& value, const Compare& compare)
* reducer(move_in(std::pair<Index, Type>& variable), const Compare& compare)
*
+ * See the explanation of the following two constructors in
+ * @ref redminmax_index_vector.
+ *
+ * reducer(const Index& index)
+ * reducer(const Index& index, const Compare& compare)
+ *
* @subsection redminmax_get_set Set and Get
*
* r.set_value(const Type& value)
@@ -207,51 +224,101 @@
*
* @subsection redminmax_initial Initial Values and is_set()
*
- * A minimum or maximum reducer without a specified initial value, before any
- * MIN or MAX operation has been performed on it, represents the [identity
- * value](#redminmax_monoid_identity) of its monoid. For value reducers with a
- * numeric type and default comparator (`std::less`), this will be a well
- * defined value. For example,
- *
- * reducer< op_max<unsigned> > r1;
- * // r1.get_value() == 0
- *
- * reducer< op_min<float> > r2;
- * // r2.get_value() == std::numeric_limits<float>::infinity
- *
- * In other cases, though (index reducers, non-numeric types, or non-default
- * comparators), the actual identity value for the monoid may be unknown, or
- * it may not even be a value of the reducer’s type. For example, there is no
- * “largest string” to serve as the initial value for a
- * `reducer< op_min<std::string> >`. In these cases, the result of calling
- * `get_value()` is undefined.
- *
- * To avoid calling `get_value()` when its result is undefined, you can call
- * the view’s `is_set()` function, which will return true if the reducer
- * has a well-defined value — either because a MIN or MAX operation has been
- * performed, or because it had a well-defined initial value:
- *
- * reducer< op_max<unsigned> > r1;
- * // r1->is_set() == true
- * // r1.get_value() == 0
- *
- * reducer< op_min<std::string> > r2;
- * // r2->is_set() == false
- * // r2.get_value() is undefined
- * r2->calc_min("xyzzy");
- * // r2->is_set() == true
- * // r2.get_value() == "xyzzy"
- *
- * > Note: For an index reducer without a specified initial value, the
- * > initial value of the index is the default value of the `Index` type.
+ * The initial value of the leftmost view of a default-initialized min/max
+ * reducer, or of a non-leftmost view (created for a stolen parallel strand)
+ * is the special identity value, which is not a value of the reducer's value
+ * type.
+ *
+ * A view will have a real (non-identity) value if:
+ *
+ * - it is the leftmost view of a reducer that was constructed with an
+ * initial value, or
+ * - it was assigned a value with a call to `reducer.set_value()` or
+ * `reducer.move_in()`, or
+ * - it has been updated with a call to `reducer->calc_min()` or
+ * `reducer->calc_max()`, or
+ * - it has been updated with an assignment `*reducer = min_of(*reducer, x)`
+ * or `*reducer = max_of(*reducer, x)`.
+ *
+ * Calling `get_value()` or `move_out()` on a reducer whose view has the
+ * special identity value will yield an undefined result. The `is_set()`
+ * function can be used to test whether a view has the special identity value
+ * or a real value. If a reducer's current view has the special identity
+ * value, then `reducer()->is_set()` will return `false` (and
+ * `reducer.get_value()` will return an undefined value); if the view has a
+ * real value, them `reducer->is_set()` will return `true` and
+ * `reducer.get_value()` will return the value.
+ *
+ * @subsubsection redminmax_index_vector Special Issues with Min/Max Index Reducers
+ *
+ * The index portion of the computed index/value pair will be wrong in the
+ * following special case:
+ *
+ * - The reducer's value type is a simple numeric type.
+ * - The reducer uses the default comparator (`std::less<Type>`).
+ * - The reducer is updated at least once with a call to `calc_min()` or
+ * `calc_max()` or an assignment with `min_of()` or `max_of()`.
+ * - The value in _every_ update to the reducer is the maximum value of the
+ * value type (for a min_index reducer) or the minimum value of the value
+ * type (for a max_index reducer).
+ *
+ * In this case, `reducer.get_value().first` should be the index argument from
+ * the first reducer update, but it will actually be the default value of the
+ * `Index` type. Now, in the common case where the index type is an integer
+ * type and the reducer is finding the smallest or largest element in an
+ * array, the default value of the index type will be zero, which is the
+ * index of the first element in the array, so everything will work out:
+ *
+ * unsigned a[3] = {0, 0, 0};
+ * reducer< op_max_index<int, unsigned> > r;
+ * for (int i = 0; i < 3; ++i) r->calc_max(i, a[i]);
+ * // r.get_value() = (0, 0)
+ *
+ * However, it doesn't always work out so well:
+ *
+ * typedef std::map<std::string, unsigned> my_map;
+ * my_map a;
+ * a["first"] = 0;
+ * a["second"] = 0;
+ * a["third"] = 0;
+ * reducer< op_max_index<std::string, unsigned> > r;
+ * for (typename my_map::iterator i = a.begin(); i != a.end(); ++i)
+ * r.calc_max(i->first, i->second);
+ * // r.get_value() = ("", 0), should be ("first", 0)
+ *
+ * If you know that no data value is associated with the default index value,
+ * then you can treat the default index value as a flag meaning "use the index
+ * of the first data value." But suppose that you don't know whether there is
+ * an element in the map with index `""`. Then you won't know what to do when
+ * `r.get_value().first == ""`.
+ *
+ * As a workaround for this conundrum, you can specify an alternative
+ * "default" index value. Either provide an index argument, _but not a
+ * value argument_, to the reducer constructor:
+ *
+ * reducer< op_max_index<std::string, unsigned> >
+ * r(a.empty() ? std::string() : a.begin()->first);
+ *
+ * or specify the default index with the view `set_default_index()` function:
+ *
+ * reducer< op_max_index<std::string, unsigned> > r;
+ * if (!a.empty()) r->set_default_index(a.begin()->first);
+ *
+ * Note that setting a default index, unlike setting an initial value, does
+ * not mark the view as having a non-identity value:
+ *
+ * reducer< op_min_index<int, int> > r;
+ * r->set_default_index(-1);
+ * // r->is_set() = false
+ * // r.get_value() is undefined
*
* @subsection redminmax_view_ops View Operations
*
- * The basic reduction operation is `x = x MIN a` for a minimum reducer, or
+ * The basic reduction operation is `x = x MIN a` for a minimum reducer, or
* `x = x MAX a` for a maximum reducer. The basic syntax for these operations
* uses the `calc_min()` and `calc_max()` member functions of the view class.
- * An assignment syntax is also provided, using the %cilk::min_of() and
- * %cilk::max_of() global functions:
+ * An assignment syntax is also provided, using the `%cilk::min_of()` and
+ * `%cilk::max_of()` global functions:
*
* Class | Modifier | Assignment
* ---------------|---------------------|-----------
@@ -260,7 +327,7 @@
* `op_min_index` | `r->calc_min(i, x)` | `*r = min_of(*r, i, x)` or `*r = min_of(i, x, *r)`
* `op_max_index` | `r->calc_max(i, x)` | `*r = max_of(*r, i, x)` or `*r = max_of(i, x, *r)`
*
- * Wherever an “`i`, `x`” argument pair is shown in the table above, a single
+ * Wherever an "`i`, `x`" argument pair is shown in the table above, a single
* pair argument may be passed instead. For example:
*
* Index index;
@@ -272,7 +339,7 @@
* *r = min_of(*r, index, value);
* *r = min_of(*r, ind_val);
*
- * The `calc_min()` and `calc_max()` member functions return a reference to
+ * The `calc_min()` and `calc_max()` member functions return a reference to
* the view, so they can be chained:
*
* r->calc_max(x).calc_max(y).calc_max(z);
@@ -290,58 +357,48 @@
* *r = max_of(max_of(max_of(*r, x), y), z);
* *r = min_of(i, a[i], min_of(j, a[j], min_of(k, a[k], *r)));
*
- * @section redminmax_compatibility Compatibility Issues
- *
- * Most Cilk library reducers provide
- * * Binary compatibility between `reducer_KIND` reducers compiled with Cilk
- * library version 0.9 (distributed with Intel® C++ Composer XE version
- * 13.0 and earlier) and the same reducers compiled with Cilk library
- * version 1.0 and later.
- * * Transparent casting between references to `reducer<op_KIND>` and
- * `reducer_KIND`.
- *
- * This compatibility is not available in all cases for min/max reducers.
- * There are two areas of incompatibility.
+ * @section redminmax_compatibility Binary Compatibility Issues
+ *
+ * Most Intel Cilk Plus library reducers provide binary compatibility between
+ * `reducer_KIND` reducers compiled with Intel Cilk Plus library version 0.9
+ * (distributed with Intel® C++ Composer XE version 13.0 and earlier) and the
+ * ame reducers compiled with Intel Cilk Plus library version 1.0 and later.
+ *
+ * Because of implementation changes that were needed to allow vectorization
+ * of loops containing min/max reducers, this binary compatibility is _not_
+ * generally available for min/max reducers, either between Intel Cilk Plus library
+ * versions 0.9 and 1.0, or between versions 1.0 and 1.1. (Code compiled with
+ * different versions can be linked together safely, but min/max reducers in
+ * different library versions are in different namespaces, so reducer objects
+ * cannot be shared between them.)
+ *
+ * If this is an inconvenience, the simplest solution is just to recompile any
+ * existing code you may have that uses min/max reducers. If that is
+ * impossible, you can define the `CILK_LIBRARY_0_9_REDUCER_MINMAX` macro (on
+ * the compiler command line, or in your source code before including
+ * `reducer_min_max.h`) when compiling with the new library. This will cause
+ * it to generate numeric reducers that will be link-time and run-time
+ * compatible with the 0.9 library.
*
* @subsection redminmax_compatibility_stateful Non-empty Comparators
*
- * There is no way to provide binary compatibility between the 0.9 and 1.0
- * definitions of min/max reducers that use a non-empty comparator class or a
- * comparator function. (Empty comparator classes like `std::less` are not a
- * problem.)
- *
- * To avoid run-time surprises, the legacy `reducer_{min|max}[_index]` classes
- * have been coded in the 1.0 library so that they will not even compile when
- * instantiated with a non-empty comparator class.
- *
- * @subsection redminmax_compatibility_optimized Numeric Optimization
- *
- * Min/max reducers with a numeric value type and the default comparator can
- * be implemented slightly more efficiently than other min/max reducers.
- * However, the optimization is incompatible with the 0.9 library
- * implementation of min/max reducers.
- *
- * The default min/max reducers implementation in the 1.0 library uses this
- * numeric optimization. Code using legacy reducers compiled with the 1.0
- * library can be safely used in the same program as code compiled with the
- * 0.9 library, but classes compiled with the different Cilk libraries will be
- * defined in different namespaces.
- *
- * The simplest solution is just to recompile the code that was compiled with
- * the older version of Cilk. However, if this is impossible, you can define
- * the `CILK_LIBRARY_0_9_REDUCER_MINMAX` macro (on the compiler command line,
- * or in your source code before including `reducer_min_max.h`) when compiling
- * with the new library. This will cause it to generate numeric reducers that
- * will be less efficient, but will be fully compatible with previously
- * compiled code. (Note that this macro has no effect on [the non-empty
- * comparator incompatibility] (redminmax_compatibility_stateful).)
+ * The representation of min/max reducers with non-empty comparator objects or
+ * with comparator functions is so different in between the 0.9 and 1.1
+ * libraries that there is no way to make them binary compatible, even when
+ * compiling with `CILK_LIBRARY_0_9_REDUCER_MINMAX`. Therefore, the
+ * `reducer_{min|max}[_index]` wrapper classes have been coded in the 1.0 and
+ * later library so that they will not even compile when instantiated with a
+ * non-empty comparator class.
+ *
+ * This is not a problem when using an empty comparator class, such as the
+ * default `std::less`.
*
* @section redminmax_types Type Requirements
*
* `Type` and `Index` must be `Copy Constructible`, `Default Constructible`,
* and `Assignable`.
*
- * `Compare` must be `Copy Constructible` if the reducer is constructed with a
+ * `Compare` must be `Copy Constructible` if the reducer is constructed with a
* `compare` argument, and `Default Constructible` otherwise.
*
* The `Compare` function must induce a strict weak ordering on the elements
@@ -353,8 +410,8 @@
*
* Declaration | Type | Operation
* -----------------------------|-----------------------------------|----------
- * @ref CILK_C_REDUCER_MIN |@ref CILK_C_REDUCER_MIN_TYPE |@ref CILK_C_REDUCER_MIN_CALC
- * @ref CILK_C_REDUCER_MAX |@ref CILK_C_REDUCER_MAX_TYPE |@ref CILK_C_REDUCER_MAX_CALC
+ * @ref CILK_C_REDUCER_MIN |@ref CILK_C_REDUCER_MIN_TYPE |@ref CILK_C_REDUCER_MIN_CALC
+ * @ref CILK_C_REDUCER_MAX |@ref CILK_C_REDUCER_MAX_TYPE |@ref CILK_C_REDUCER_MAX_CALC
* @ref CILK_C_REDUCER_MIN_INDEX |@ref CILK_C_REDUCER_MIN_INDEX_TYPE |@ref CILK_C_REDUCER_MIN_INDEX_CALC
* @ref CILK_C_REDUCER_MAX_INDEX |@ref CILK_C_REDUCER_MAX_INDEX_TYPE |@ref CILK_C_REDUCER_MAX_INDEX_CALC
*
@@ -375,7 +432,7 @@
* CILK_C_REDUCER_MAX_INDEX_CALC(r, i, a[i]);
* }
* CILK_C_UNREGISTER_REDUCER(r);
- * printf("The largest value in a is %u at %d\n",
+ * printf("The largest value in a is %u at %d\n",
* REDUCER_VIEW (r).value, REDUCER_VIEW(r).index);
*
* See @ref reducers_c_predefined.
@@ -385,39 +442,39 @@ namespace cilk {
/** @defgroup ReducersMinMaxBinComp Binary compatibility
*
- * If the macro CILK_LIBRARY_0_9_REDUCER_MINMAX is defined, then we generate
+ * If the macro `CILK_LIBRARY_0_9_REDUCER_MINMAX` is defined, then we generate
* reducer code and data structures which are binary-compatible with code that
* was compiled with the old min/max wrapper definitions, so we want the
* mangled names of the legacy min/max reducer wrapper classes to be the
* same as the names produced by the old definitions.
*
- * Conversely, if the macro is not defined, then we generate binary-
- * incompatible code, so we want different mangled names, to make sure that
+ * Conversely, if the macro is not defined, then we generate binary-
+ * incompatible code, so we want different mangled names, to make sure that
* the linker does not allow new and old compiled legacy wrappers to be passed
* to one another. (Global variables are a different, and probably insoluble,
* problem.)
*
- * Similarly, min/max classes compiled with and without
- * CILK_LIBRARY_0_9_REDUCER_MINMAX are binary-incompatible, and must get
+ * Similarly, min/max classes compiled with and without
+ * CILK_LIBRARY_0_9_REDUCER_MINMAX are binary-incompatible, and must get
* different mangled names.
*
* The trick is, when compiling in normal (non-compatibility) mode, wrap
* everything in an extra namespace, and then `use` it into the top-level cilk
- * namespace. Then
+ * namespace. Then
*
* * Classes and functions compiled in normal mode will be in
* different namespaces from the same classes and functions compiled in
* compatibility mode.
- * * The legacy wrapper classes and functions will be in the same namespace
- * as the same classes and functions compiled with the0.9 library if and
- * only if the are compiled in compatibility mode.
+ * * The legacy wrapper classes and functions will be in the same namespace
+ * as the same classes and functions compiled with the 0.9 library if and
+ * only if they are compiled in compatibility mode.
*
* @ingroup ReducersMinMax
*/
-
+
#ifndef CILK_LIBRARY_0_9_REDUCER_MINMAX
-/** Namespace to wrap min/max reducer definitions when not compiling in “binary
- * compatibility” mode.
+/** Namespace to wrap min/max reducer definitions when not compiling in "binary
+ * compatibility" mode.
*
* By default, all of the min/max reducer definitions are defined in this
* namespace and then imported into namespace ::cilk, so that they do not
@@ -430,7 +487,7 @@ namespace cilk {
* @ingroup ReducersMinMaxBinComp
* @ingroup ReducersMinMax
*/
-namespace cilk_lib_1_0 {
+namespace cilk_lib_1_1 {
#endif
/** Namespace containing internal implementation classes and functions for
@@ -444,12 +501,12 @@ using ::cilk::internal::binary_functor;
using ::cilk::internal::typed_indirect_binary_function;
using ::cilk::internal::class_is_empty;
-/** @defgroup ReducersMinMaxIsSet The “is_set optimization”
+/** @defgroup ReducersMinMaxIsSet The "is_set optimization"
*
* The obvious definition of the identity value for a max or min reducer is as
- * the smallest (or largest) value of the value type. However, for an
+ * the smallest (or largest) value of the value type. However, for an
* arbitrary comparator and/or an arbitrary value type, the largest / smallest
- * value may not be known. It may not even be defined — what is the largest
+ * value may not be known. It may not even be defined - what is the largest
* string?
*
* Therefore, min/max reducers represent their value internally as a pair
@@ -463,41 +520,41 @@ using ::cilk::internal::class_is_empty;
* smallest and largest values. Testing `is_set` for every comparison is then
* unnecessary and wasteful.
*
- * The “is_set optimization” just means generating code that doesn’t use
- * `is_set` when it isn’t needed. It is implemented using two metaprogramming
+ * The "is_set optimization" just means generating code that doesn't use
+ * `is_set` when it isn't needed. It is implemented using two metaprogramming
* classes:
*
* - do_is_set_optimization tests whether the optimization is applicable.
* - identity_value gets the appropriate identity value for a type.
*
* The is_set optimization is the reason that min/max reducers compiled with
- * Cilk library 1.0 are binary-incompatible with the same reducers compiled
- * with library 0.9, and therefore the optimization is suppressed when
- * compiling in
- * ReducersMinMaxBinComp "binary compatibility mode".
- *
+ * Intel Cilk Plus library 1.0 are binary-incompatible with the same reducers
+ * compiled with library 0.9, and therefore the optimization is suppressed when
+ * compiling in
+ * ReducersMinMaxBinComp "binary compatibility mode".
+ *
* @ingroup ReducersMinMax
*/
-/** Test whether the ReducersMinMaxIsSet "is_set optimization" is
+/** Tests whether the ReducersMinMaxIsSet "is_set optimization" is
* applicable.
*
* The @ref do_is_set_optimization class is used to test whether the is_set
* optimization should be applied for a particular reducer. It is instantiated
- * with a value type and a comparator, and defines a boolean constant,
+ * with a value type and a comparator, and defines a boolean constant,
* `value`. Then `%do_is_set_optimization<Type, Comp>::%value` can be used as
* a boolean template parameter to control the specialization of another
* class.
*
- * In ReducersMinMaxBinComp "binary compatibility mode", when the
- * `CILK_LIBRARY_0_9_REDUCER_MINMAX` macro is defined, `value` will always
+ * In ReducersMinMaxBinComp "binary compatibility mode" (i.e., when the
+ * `CILK_LIBRARY_0_9_REDUCER_MINMAX` macro is defined), `value` will always
* be false.
*
* @tparam Type The value type for the reducer.
* @tparam Compare The comparator type for the reducer.
*
- * @result The `value` data member will be `true` if @a Type is a numeric
- * type, @a Compare is `std::less<Type>`, and
+ * @result The `value` data member will be `true` if @a Type is a numeric
+ * type, @a Compare is `std::less<Type>`, and
* `CILK_LIBRARY_0_9_REDUCER_MINMAX` is not defined.
*
* @see ReducersMinMaxIsSet
@@ -505,10 +562,10 @@ using ::cilk::internal::class_is_empty;
*
* @ingroup ReducersMinMaxIsSet
*/
-template < typename Type,
+template < typename Type,
typename Compare >
-struct do_is_set_optimization
-{
+struct do_is_set_optimization
+{
/// `True` if the is_set optimization should be applied to min/max reducers
/// with this value type and comparator; `false` otherwise.
static const bool value = false;
@@ -517,8 +574,8 @@ struct do_is_set_optimization
#ifndef CILK_LIBRARY_0_9_REDUCER_MINMAX
/// @cond
template <typename Type>
-struct do_is_set_optimization<Type, std::less<Type> >
-{
+struct do_is_set_optimization<Type, std::less<Type> >
+{
/// True in the special case where optimization is possible.
static const bool value = std::numeric_limits<Type>::is_specialized;
};
@@ -526,7 +583,7 @@ struct do_is_set_optimization<Type, std::less<Type> >
#endif
-/** Get the identity value when using the ReducersMinMaxIsSet
+/** Gets the identity value when using the ReducersMinMaxIsSet
* "is_set optimization".
*
* This class defines a function which assigns the appropriate identity value
@@ -534,7 +591,7 @@ struct do_is_set_optimization<Type, std::less<Type> >
*
* @tparam Type The value type for the reducer.
* @tparam Compare The comparator type for the reducer.
- * @tparam ForMax `true` to get the identity value for a max reducer (i.e.,
+ * @tparam ForMax `true` to get the identity value for a max reducer (i.e.,
* the smallest value of @a Type), `false` to get the identity
* value for a min reducer (i.e., the largest value of
* @a Type).
@@ -549,8 +606,8 @@ struct do_is_set_optimization<Type, std::less<Type> >
* @ingroup ReducersMinMaxIsSet
* @see @ref view_content
*/
-template < typename Type,
- typename Compare,
+template < typename Type,
+ typename Compare,
bool ForMax,
bool = std::numeric_limits<Type>::is_specialized,
bool = std::numeric_limits<Type>::has_infinity >
@@ -563,7 +620,7 @@ struct identity_value {
template <typename Type>
struct identity_value<Type, std::less<Type>, true, true, true> {
/// Floating max identity is negative infinity.
- static void set_identity(Type& id)
+ static void set_identity(Type& id)
{ id = -std::numeric_limits<Type>::infinity(); }
};
@@ -599,25 +656,25 @@ struct identity_value<Type, std::less<Type>, false, true, false> {
* max(x, y) == (x < y) ? y : x
* min(x, y) == (y < x) ? y : x == (x > y) ? y : x
*
- * More generally, if `c` is a predicate defining a `Strict Weak Ordering`,
+ * More generally, if `c` is a predicate defining a `Strict Weak Ordering`,
* and `c*(x, y) == c(y, x)`, then
*
* max(x, y, c) == c(x, y) ? y : x
* min(x, y, c) == c(y, x) ? y : x == c*(x, y) ? y : x == max(x, y, c*)
*
- * For any predicate `C` with argument type `T`, the template class
+ * For any predicate `C` with argument type `T`, the template class
* `%reverse_predicate<C, T>` defines a predicate which is identical to `C`,
* except that its arguments are reversed. Thus, for example, we could
* implement `%op_min_view<Type, Compare>` as
- * `%op_max_view<Type, %reverse_predicate<Compare, Type> >`.
- * (Actually, op_min_view and op_max_view are both implemented as subclasses
+ * `%op_max_view<Type, %reverse_predicate<Compare, Type> >`.
+ * (Actually, op_min_view and op_max_view are both implemented as subclasses
* of a common base class, view_base.)
*
* @note If `C` is an empty functor class, then `reverse_predicate(C)` will
* also be an empty functor class.
*
* @tparam Predicate The predicate whose arguments are to be reversed.
- * @tparam Argument @a Predicate’s argument type.
+ * @tparam Argument @a Predicate's argument type.
*
* @ingroup ReducersMinMax
*/
@@ -629,7 +686,7 @@ public:
/// Default constructor
reverse_predicate() : base() {}
/// Constructor with predicate object
- reverse_predicate(const Predicate& p) : base(p) {}
+ reverse_predicate(const Predicate& p) : base(p) {}
/// The reversed predicate operation
bool operator()(const Argument& x, const Argument& y) const
{ return base::operator()(y, x); }
@@ -638,7 +695,7 @@ public:
/** Class to represent the comparator for a min/max view class.
*
- * This class is intended to accomplish two objectives in the implementation
+ * This class is intended to accomplish two objectives in the implementation
* of min/max views.
*
* 1. To minimize data bloat, when we have a reducer with a non-stateless
@@ -646,24 +703,24 @@ public:
* in the monoid, and just call it from the views.
* 2. In ReducersMinMaxBinComp "binary compatibility mode", views for
* reducers with a stateless comparator must have the same content as in
- * Cilk library 0.9 — that is, they must contain only `value` and
+ * Intel Cilk Plus library 0.9 - that is, they must contain only `value` and
* `is_set` data members.
*
- * To achieve the first objective, we use the
+ * To achieve the first objective, we use the
* @ref internal::typed_indirect_binary_function class defined in
* metaprogramming.h to wrap a pointer to the actual comparator. If no
- * pointer is needed because the actual comparator is stateless, the
+ * pointer is needed because the actual comparator is stateless, the
* `typed_indirect_binary_function` class will be empty, too.
*
* To achieve the second objective, we make the
* `typed_indirect_binary_function` class a base class of the view rather than
- * a data member, so the “empty base class” rule will ensure no that no
+ * a data member, so the "empty base class" rule will ensure no that no
* additional space is allocated in the view unless it is needed.
*
* We could simply use typed_indirect_binary_function as the base class of the
* view, but this would mean writing comparisons as `(*this)(x, y)`, which is
* just weird. So, instead, we comparator_base as a subclass of
- * typed_indirect_binary_function which provides function `compare()`
+ * typed_indirect_binary_function which provides function `compare()`
* as a synonym for `operator()`.
*
* @tparam Type The value type of the comparator class.
@@ -679,13 +736,13 @@ class comparator_base : private typed_indirect_binary_function<Compare, Type, Ty
typedef typed_indirect_binary_function<Compare, Type, Type, bool> base;
protected:
comparator_base(const Compare* f) : base(f) {} ///< Constructor.
-
+
/// Comparison function.
bool compare(const Type& a, const Type& b) const
{
- return base::operator()(a, b);
+ return base::operator()(a, b);
}
-
+
/// Get the comparator pointer.
const Compare* compare_pointer() const { return base::pointer(); }
};
@@ -695,7 +752,7 @@ protected:
*
* @ingroup ReducersMinMax
*
- * Minimum and maximum reducer view classes inherit from a “view content”
+ * Minimum and maximum reducer view classes inherit from a "view content"
* class. The content class defines the actual data members for the view,
* and provides typedefs and member functions for accessing the data members
* as needed to support the view functionality.
@@ -708,31 +765,32 @@ protected:
*
* @note An obvious, and arguably simpler, encapsulation strategy would be
* to just let the `Type` of a min/max view be an (index, value) pair
- * structure for min_index and max_index reducers. Then all views
+ * structure for min_index and max_index reducers. Then all views
* would just have a `Type` data member and an `is_set` data member,
* and the comparator for min_index and max_index views could be
* customized to consider only the value component of the (index,
* value) `Type` pair. Unfortunately, this would break binary
* compatibility with reducer_max_index and reducer_min_index in
- * Cilk library 0.9, because the memory layout of an (index, value)
- * pair followed by a `bool` is different from the memory layout of an
- * index data member followed by a value data member followed by a
- * `bool` data member. The content class is designed to exactly
- * replicate the layout of the views in library 0.9 reducers.
+ * Intel Cilk Plus library 0.9, because the memory layout of an
+ * (index, value) pair followed by a `bool` is different from the
+ * memory layout of an index data member followed by a value data
+ * member followed by a `bool` data member. The content class is
+ * designed to exactly replicate the layout of the views in library 0.9
+ * reducers.
*
* A content class `C`, and its objects `c`, must define the following:
*
* Definition | Meaning
* ------------------------------------|--------
* `C::value_type` | A typedef for `Type` of the view. (A `std::pair<Index, Type>` for min_index and max_index views).
- * `C::comp_value_type` | A typedef for the type of value compared by the view’s `compare()` function.
+ * `C::comp_value_type` | A typedef for the type of value compared by the view's `compare()` function.
* `C()` | Constructs the content with the identity value.
* `C(const value_type&)` | Constructs the content with a specified value.
* `c.is_set()` | Returns true if the content has a known value.
- * `c.value()` | Returns the content’s value.
- * `c.set_value(const value_type&)` | Sets the content’s value. (The value becomes known.)
- * `c.comp_value()` | Returns a const reference to the value or component of the value that is to be compared by the view’s comparator.
- * `C::comp_value(const value_type&)` | Returns a const reference to a value or component of a value that is to be compared by the view’s comparator.
+ * `c.value()` | Returns the content's value.
+ * `c.set_value(const value_type&)` | Sets the content's value. (The value becomes known.)
+ * `c.comp_value()` | Returns a const reference to the value or component of the value that is to be compared by the view's comparator.
+ * `C::comp_value(const value_type&)` | Returns a const reference to a value or component of a value that is to be compared by the view's comparator.
*
* @see view_base
*/
@@ -740,20 +798,20 @@ protected:
/** Content class for op_min_view and op_max_view.
*
* @tparam Type The value type of the op_min_view or op_max_view.
- * @tparam Compare The comparator class specified for the op_min_view or
+ * @tparam Compare The comparator class specified for the op_min_view or
* op_max_view. (_Not_ the derived comparator class actually
* used by the view_base. For example, the view_content of an
- * `op_min_view<int>` will have `Compare = std::less<int>`,
- * but its comparator_base will have
+ * `op_min_view<int>` will have `Compare = std::less<int>`,
+ * but its comparator_base will have
* `Compare = reverse_predicate< std::less<int> >`.)
* @tparam ForMax `true` if this is the content class for an op_max_view,
* `false` if it is for an op_min_view.
*
* @note The general implementation of view_content uses an `is_set` data
- * member. There is also a specialization which implements the
+ * member. There is also a specialization which implements the
* ReducersMinMaxIsSet "is_set optimization". View classes that
* inherit from view_content do not need to know anything about the
- * difference, though; the details are abstracted away in the
+ * difference, though; the details are abstracted away in the
* view_content interface.
*
* @see ReducersMinMaxViewContent
@@ -767,96 +825,94 @@ template < typename Type
, bool = do_is_set_optimization<Type, Compare>::value
>
class view_content {
+protected:
+/// @cond
Type m_value;
bool m_is_set;
+/// @endcond
public:
/// The value type of the view.
typedef Type value_type;
-
- /// The type compared by the view’s `compare()` function (which is the same
+
+ /// The type compared by the view's `compare()` function (which is the same
/// as the value type for view_content).
typedef Type comp_value_type;
-
+
/// Construct with the identity value.
view_content() : m_value(), m_is_set(false) {}
-
+
/// Construct with a defined value.
view_content(const value_type& value) : m_value(value), m_is_set(true) {}
-
- /// Get the value.
+
+ /// Gets the value.
value_type value() const { return m_value; }
-
- /// Set the value.
- void set_value(const value_type& value)
- {
+
+ /// Sets the value.
+ void set_value(const value_type& value)
+ {
m_value = value;
+ }
+
+ /// Sets the is_set flag.
+ void set_is_set()
+ {
m_is_set = true;
}
-
- /// Get the comparison value (which is the same as the value for
- /// view_content).
+
+ /// Sets the index part of the value (which is meaningless for non-index
+ ///reducers, but required for view_base).
+ void set_default_index(const value_type&) {}
+
+ /// Gets the comparison value (which, for view_content, is the same as the
+ /// value).
const comp_value_type& comp_value() const { return m_value; }
- /// Given an arbitrary value, get the corresponding comparison value (which
- /// is the same as the value for view_content).
- static const comp_value_type& comp_value(const value_type& value)
+ /// Given an arbitrary value, gets the corresponding comparison value
+ /// (which, for view_content, is the same as the value).
+ static const comp_value_type& comp_value(const value_type& value)
{
- return value;
+ return value;
}
-
- /// Get a const reference to value part of the value (which is the same as
+
+ /// Gets a const reference to value part of the value (which is the same as
/// the value for view_content).
const Type& get_reference() const { return m_value; }
-
- /// Get a const reference to the index part of the value (which is
+
+ /// Gets a const reference to the index part of the value (which is
/// meaningless for non-index reducers, but required for view_base.
const Type& get_index_reference() const { return m_value; }
-
- /// Test if the value is defined.
+
+ /// Tests if the value is defined.
bool is_set() const { return m_is_set; }
+
+ /// Tests if the view has a comparable value.
+ bool has_value() const { return is_set(); }
};
/// @cond
/* This is the specialization of the view_content class for cases where
- * `AssumeIsSet` is true (i.e., where the is_set optimization is applicable).
+ * the is_set optimization is applicable).
*/
template < typename Type
, typename Compare
- , bool ForMax
+ , bool ForMax
>
-class view_content<Type, Compare, ForMax, true> {
+class view_content<Type, Compare, ForMax, true> :
+ public view_content<Type, Compare, ForMax, false>
+{
+ typedef view_content<Type, Compare, ForMax, false> base;
typedef identity_value<Type, Compare, ForMax> Identity;
- Type m_value;
+
public:
- typedef Type value_type;
- typedef Type comp_value_type;
-
- /// Construct with identity value.
- view_content() { Identity::set_identity(m_value); }
-
- view_content(const value_type& value) : m_value(value) {}
-
- value_type value() const { return m_value; }
-
- void set_value(const value_type& value)
- {
- m_value = value;
- }
-
- const comp_value_type& comp_value() const { return m_value; }
+ typedef typename base::value_type value_type;;
+ typedef typename base::comp_value_type comp_value_type;;
- static const comp_value_type& comp_value(const value_type& value)
- {
- return value;
- }
-
- const Type& get_reference() const { return m_value; }
-
- const Type& get_index_reference() const { return m_value; }
-
- /// Test if the value is defined.
- bool is_set() const { return true; }
+ view_content() : base() { Identity::set_identity(this->m_value); }
+
+ view_content(const value_type& value) : base(value) {}
+
+ bool has_value() const { return true; }
};
/// @endcond
@@ -866,10 +922,10 @@ public:
*
* @tparam Index The index type of the op_min_index_view or
op_max_index_view.
- * @tparam Type The value type of the op_min_view or op_max_view. (_Not_
+ * @tparam Type The value type of the op_min_view or op_max_view. (_Not_
* the value type of the view, which will be
* `std::pair<Index, Type>`.)
- * @tparam Compare The comparator class specified for the op_min_index_view or
+ * @tparam Compare The comparator class specified for the op_min_index_view or
* op_max_index_view. (_Not_ the derived comparator class
* actually used by the view_base. For example, the
* index_view_content of an `op_min_index_view<int>` will have
@@ -887,93 +943,147 @@ public:
template < typename Index
, typename Type
, typename Compare
- , bool ForMax
+ , bool ForMax
+ , bool = do_is_set_optimization<Type, Compare>::value
>
class index_view_content {
- typedef identity_value<Type, Compare, ForMax> Identity;
-
+protected:
+/// @cond
Index m_index;
Type m_value;
bool m_is_set;
+/// @endcond
public:
- /// The value type of the view (which is an <index, value> pair for
+ /// The value type of the view (which is an <index, value> pair for
/// index_view_content).
typedef std::pair<Index, Type> value_type;
-
- /// The type compared by the view’s `compare()` function (which is the data
+
+ /// The type compared by the view's `compare()` function (which is the data
/// value type for index_view_content).
typedef Type comp_value_type;
-
+
/// Construct with the identity value.
index_view_content() : m_index(), m_value(), m_is_set(false) {}
-
+
/// Construct with an index/value pair.
- index_view_content(const value_type& value) :
+ index_view_content(const value_type& value) :
m_index(value.first), m_value(value.second), m_is_set(true) {}
-
+
/// Construct with an index and a value.
- index_view_content(const Index& index, const Type& value) :
+ index_view_content(const Index& index, const Type& value) :
m_index(index), m_value(value), m_is_set(true) {}
-
+
/// Construct with just an index.
- index_view_content(const Index& index) :
+ index_view_content(const Index& index) :
m_index(index), m_value(), m_is_set(false) {}
-
- /// Get the value.
+
+ /// Gets the value.
value_type value() const { return value_type(m_index, m_value); }
-
- /// Set value.
- void set_value(const value_type& value)
- {
- m_index = value.first;
+
+ /// Sets the value.
+ void set_value(const value_type& value)
+ {
+ m_index = value.first;
m_value = value.second;
+ }
+
+ /// Sets the is_set flag.
+ void set_is_set()
+ {
m_is_set = true;
}
-
- /// Get the comparison value (which is the value component of the
- /// index/value pair for index_view_content).
+
+ /// Sets the (initial) index, without marking the view as set.
+ void set_default_index(const Index& index)
+ {
+ m_index = index;
+ }
+
+ /// Gets the comparison value (which, for index_view_content, is the value
+ /// component of the index/value pair).
const comp_value_type& comp_value() const { return m_value; }
-
- /// Given an arbitrary value (i.e., index/value pair), get the
- /// corresponding comparison value (which is the value component of the
- /// index/value pair for index_view_content).
- static const comp_value_type& comp_value(const value_type& value)
+
+ /// Given an arbitrary value (i.e., index/value pair), gets the
+ /// corresponding comparison value (which, for index_view_content, is the
+ /// value component of the index/value pair).
+ static const comp_value_type& comp_value(const value_type& value)
{ return value.second; }
-
- /// Get a const reference to value part of the value.
+
+ /// Gets a const reference to the value part of the value.
const Type& get_reference() const { return m_value; }
-
- /// Get a const reference to the index part of the value.
+
+ /// Gets a const reference to the index part of the value.
const Index& get_index_reference() const { return m_index; }
-
- /// Test if the value is defined.
+
+ /// Tests if the value is defined.
bool is_set() const { return m_is_set; }
+
+ /// Tests if the view has a comparable value.
+ bool has_value() const { return is_set(); }
+};
+
+
+/// @cond
+
+/* This is the specialization of the index_view_content class for cases where
+ * the is_set optimization is applicable).
+ */
+template < typename Index
+ , typename Type
+ , typename Compare
+ , bool ForMax
+ >
+class index_view_content<Index, Type, Compare, ForMax, true> :
+ public index_view_content<Index, Type, Compare, ForMax, false>
+{
+ typedef index_view_content<Index, Type, Compare, ForMax, false> base;
+ typedef identity_value<Type, Compare, ForMax> Identity;
+public:
+ typedef typename base::value_type value_type;;
+ typedef typename base::comp_value_type comp_value_type;;
+
+ index_view_content() : base() { Identity::set_identity(this->m_value); }
+
+ index_view_content(const value_type& value) : base(value) {}
+
+ index_view_content(const Index& index, const Type& value) :
+ base(index, value) {}
+
+ index_view_content(const Index& index) : base() {
+ Identity::set_identity(this->m_value);
+ this->m_index = index;
+ }
+
+ /// Test if the view has a comparable value.
+ bool has_value() const { return true; }
};
+/// @endcond
+
template <typename View> class rhs_proxy;
-/** Create an rhs_proxy.
+/** Creates an rhs_proxy.
*/
template <typename View>
-inline rhs_proxy<View>
+inline rhs_proxy<View>
make_proxy(const typename View::value_type& value, const View& view);
template <typename Content, typename Less, typename Compare> class view_base;
-/** Class to represent the right-hand side of
+/** Class to represent the right-hand side of
* `*reducer = {min|max}_of(*reducer, value)`.
*
* The only assignment operator for a min/max view class takes a rhs_proxy as
* its operand. This results in the syntactic restriction that the only
* expressions that can be assigned to a min/max view are ones which generate
- * an rhs_proxy — that is, expressions of the form `max_of(view, value)` and
+ * an rhs_proxy - that is, expressions of the form `max_of(view, value)` and
* `min_of(view, value)`.
*
* @warning
- * The lhs and rhs views in such an assignment must be the same; otherwise,
- * the behavior will be undefined. (I.e., `*r1 = min_of(*r1, x)` is legal;
+ * The lhs and rhs views in such an assignment must be the same; otherwise,
+ * the behavior will be undefined. (I.e., `*r1 = min_of(*r1, x)` is legal;
* `*r1 = min_of(*r2, x)` is illegal.) This condition will be checked with a
* runtime assertion when compiled in debug mode.
*
@@ -991,12 +1101,12 @@ class rhs_proxy {
typedef typename View::value_type value_type;
typedef typename View::content_type content_type;
typedef typename content_type::comp_value_type comp_value_type;
-
+
friend class view_base<content_type, less_type, compare_type>;
friend rhs_proxy make_proxy<View>(
- const typename View::value_type& value,
+ const typename View::value_type& value,
const View& view);
-
+
typed_indirect_binary_function<
compare_type, comp_value_type, comp_value_type, bool>
m_comp;
@@ -1005,38 +1115,38 @@ class rhs_proxy {
rhs_proxy& operator=(const rhs_proxy&); // Disable assignment operator
rhs_proxy(); // Disable default constructor
-
+
// Constructor (called from view_base::make_proxy).
- rhs_proxy(const View* view,
+ rhs_proxy(const View* view,
const value_type& value,
- const compare_type* compare) :
+ const compare_type* compare) :
m_view(view), m_value(value), m_comp(compare) {}
-
- // Check matching view, then return value (called from view_base::assign).
+
+ // Checks matching view, then return value (called from view_base::assign).
value_type value(const typename View::base* view) const
- {
- __CILKRTS_ASSERT(view == m_view);
- return m_value;
+ {
+ __CILKRTS_ASSERT(view == m_view);
+ return m_value;
}
public:
- /** Support max_of(max_of(view, value), value) and the like.
+ /** Supports max_of(max_of(view, value), value) and the like.
*/
rhs_proxy calc(const value_type& x) const
{
return rhs_proxy(
- m_view,
- m_comp( content_type::comp_value(m_value),
+ m_view,
+ m_comp( content_type::comp_value(m_value),
content_type::comp_value(x)
) ? x : m_value,
m_comp.pointer());
}
};
-
-
+
+
template <typename View>
-inline rhs_proxy<View>
+inline rhs_proxy<View>
make_proxy(const typename View::value_type& value, const View& view)
{
return rhs_proxy<View>(&view, value, view.compare_pointer());
@@ -1058,14 +1168,14 @@ make_proxy(const typename View::value_type& value, const View& view)
* which is equivalent to `std::greater`, then the accumulated value is the
* first argument value which is not greater than any other argument value,
* i.e., the minimum.
- *
+ *
* @note This class provides the definitions that are required for a class
- * that will be used as the parameter of a
- * min_max_internal::monoid_base specialization.
+ * that will be used as the parameter of a
+ * min_max_internal::monoid_base specialization.
*
* @tparam Content A content class that provides the value types and data
* members for the view.
- * @tparam Less A “less than” binary predicate that defines the min or
+ * @tparam Less A "less than" binary predicate that defines the min or
* max function.
* @tparam Compare A binary predicate to be used to compare the values.
* (The same as @a Less for max reducers; its reversal for
@@ -1081,73 +1191,76 @@ make_proxy(const typename View::value_type& value, const View& view)
* @ingroup ReducersMinMax
*/
template <typename Content, typename Less, typename Compare>
-class view_base :
+class view_base :
// comparator_base comes first to ensure that it will get empty base class
// treatment
- private comparator_base<typename Content::comp_value_type, Compare>,
+ private comparator_base<typename Content::comp_value_type, Compare>,
private Content
{
typedef comparator_base<typename Content::comp_value_type, Compare> base;
using base::compare;
using Content::value;
using Content::set_value;
+ using Content::has_value;
+ using Content::set_is_set;
using Content::comp_value;
typedef Content content_type;
-
+
template <typename View> friend class rhs_proxy;
template <typename View>
friend rhs_proxy<View> make_proxy(const typename View::value_type& value, const View& view);
-
+
public:
-
+
/** @name Monoid support.
*/
//@{
-
+
/** Value type. Required by @ref monoid_with_view.
*/
typedef typename Content::value_type value_type;
-
- /** The type of the comparator specified by the user, that defines the
+
+ /** The type of the comparator specified by the user, that defines the
* ordering on @a Type. Required by min_max::monoid_base.
*/
typedef Less less_type;
-
- /** The type of the comparator actually used by the view. Required by
- * min_max::monoid_base. (This is the same as the @ref less_type for a
+
+ /** The type of the comparator actually used by the view. Required by
+ * min_max::monoid_base. (This is the same as the @ref less_type for a
* max reducer, or `reverse_predicate<less_type>` for a min reducer.)
*/
typedef Compare compare_type;
- /** Reduce operation. Required by @ref monoid_with_view.
+ /** Reduces two views. Required by @ref monoid_with_view.
*/
void reduce(view_base* other)
{
if ( other->is_set() &&
- ( !this->is_set() ||
+ ( !this->is_set() ||
compare(this->comp_value(), other->comp_value()) ) )
{
this->set_value(other->value());
+ this->set_is_set();
}
}
-
+
//@}
-
+
/** Default constructor. Initializes to identity value.
*/
- explicit view_base(const compare_type* compare) :
+ explicit view_base(const compare_type* compare) :
base(compare), Content() {}
-
+
/** Value constructor.
*/
template <typename T1>
- view_base(const T1& x1, const compare_type* compare) :
+ view_base(const T1& x1, const compare_type* compare) :
base(compare), Content(x1) {}
/** Value constructor.
*/
template <typename T1, typename T2>
- view_base(const T1& x1, const T2& x2, const compare_type* compare) :
+ view_base(const T1& x1, const T2& x2, const compare_type* compare) :
base(compare), Content(x1, x2) {}
@@ -1155,44 +1268,54 @@ public:
*/
explicit view_base(move_in_wrapper<value_type> w, const compare_type* compare) :
base(compare), Content(w.value()) {}
-
+
/** @name Reducer support.
*/
//@{
-
- void view_move_in(value_type& v) { set_value(v); }
- void view_move_out(value_type& v) { v = value(); }
- void view_set_value(const value_type& v) { set_value(v); }
- value_type view_get_value() const { return value(); }
+
+ void view_move_in(value_type& v)
+ { set_value(v); set_is_set();}
+ void view_move_out(value_type& v)
+ { v = value(); }
+ void view_set_value(const value_type& v)
+ { set_value(v); set_is_set(); }
+ value_type view_get_value() const
+ { return value(); }
// view_get_reference() NOT SUPPORTED
-
+
//@}
-
+
+ /** Sets the contained index data member, without marking the view as set.
+ * (Meaningless for non-index reducers.)
+ */
+ using Content::set_default_index;
+
/** Is the value defined?
*/
using Content::is_set;
-
+
/** Reference to contained value data member.
* @deprecated For legacy reducers only.
*/
using Content::get_reference;
-
+
/** Reference to contained index data member.
* (Meaningless for non-index reducers.)
* @deprecated For legacy reducers only.
*/
using Content::get_index_reference;
-
+
protected:
- /** Update the min/max value.
+ /** Updates the min/max value.
*/
void calc(const value_type& x)
{
- if (!is_set() || compare(comp_value(), comp_value(x))) set_value(x);
+ if (!has_value() || compare(comp_value(), comp_value(x))) set_value(x);
+ set_is_set();
}
-
- /** Assign the result of a `{min|max}_of(view, value)` expression to the
+
+ /** Assigns the result of a `{min|max}_of(view, value)` expression to the
* view.
*
* @see rhs_proxy
@@ -1202,21 +1325,21 @@ protected:
{
calc(rhs.value(this));
}
-
+
};
/** Base class for min and max monoid classes.
*
- * The unique characteristic of minimum and maximum reducers is that they
- * incorporate a comparator functor that defines what “minimum” or “maximum”
+ * The unique characteristic of minimum and maximum reducers is that they
+ * incorporate a comparator functor that defines what "minimum" or "maximum"
* means. The monoid for a reducer contains the comparator that will be used
* for the reduction. If the comparator is a function or a class with state,
* then each view will have a pointer to the comparator.
*
* This means that the `construct()` functions first construct the monoid
- * (possibly with an explicit comparator argument), and then construct the
- * view with a pointer to the monoid’s comparator.
+ * (possibly with an explicit comparator argument), and then construct the
+ * view with a pointer to the monoid's comparator.
*
* @tparam View The view class.
* @tparam Align If true, reducers instantiated on this monoid will be
@@ -1230,14 +1353,13 @@ protected:
template <typename View, bool Align = false>
class monoid_base : public monoid_with_view<View, Align>
{
- typedef typename View::compare_type compare_type;
- typedef typename View::less_type less_type;
- const compare_type m_compare;
+ typedef typename View::compare_type compare_type;
+ typedef typename View::less_type less_type;
+
+ const compare_type m_compare;
const compare_type* compare_pointer() const { return &m_compare; }
-
- using cilk::monoid_base<typename View::value_type, View>::provisional;
-
+
public:
/** Default constructor uses default comparator.
@@ -1250,51 +1372,68 @@ public:
*/
monoid_base(const compare_type& compare) : m_compare(compare) {}
- /** Create an identity view.
+ /** Creates an identity view.
*
* List view identity constructors take the list allocator as an argument.
*
- * @param v The address of the uninitialized memory in which the view
+ * @param v The address of the uninitialized memory in which the view
* will be constructed.
*/
void identity(View *v) const { ::new((void*) v) View(compare_pointer()); }
-
+
/** @name construct functions
*
* Min/max monoid `construct()` functions optionally take one or two value
* arguments, a @ref move_in argument, and/or a comparator argument.
*/
//@{
-
+
template <typename Monoid>
static void construct(Monoid* monoid, View* view)
- { provisional( new ((void*)monoid) Monoid() ).confirm_if(
- new ((void*)view) View(monoid->compare_pointer()) ); }
+ {
+ provisional_guard<Monoid> mg( new((void*) monoid) Monoid );
+ mg.confirm_if( new((void*) view) View(monoid->compare_pointer()) );
+ }
template <typename Monoid, typename T1>
static void construct(Monoid* monoid, View* view, const T1& x1)
- { provisional( new ((void*)monoid) Monoid() ).confirm_if(
- new ((void*)view) View(x1, monoid->compare_pointer()) ); }
+ {
+ provisional_guard<Monoid> mg( new((void*) monoid) Monoid );
+ mg.confirm_if( new((void*) view) View(x1, monoid->compare_pointer()) );
+ }
template <typename Monoid, typename T1, typename T2>
- static void construct(Monoid* monoid, View* view, const T1& x1, const T2& x2)
- { provisional( new ((void*)monoid) Monoid() ).confirm_if(
- new ((void*)view) View(x1, x2, monoid->compare_pointer()) ); }
+ static void construct(Monoid* monoid, View* view,
+ const T1& x1, const T2& x2)
+ {
+ provisional_guard<Monoid> mg( new((void*) monoid) Monoid );
+ mg.confirm_if( new((void*) view) View(x1, x2,
+ monoid->compare_pointer()) );
+ }
template <typename Monoid>
static void construct(Monoid* monoid, View* view, const less_type& compare)
- { provisional( new ((void*)monoid) Monoid(compare) ).confirm_if(
- new ((void*)view) View(monoid->compare_pointer()) ); }
+ {
+ provisional_guard<Monoid> mg( new((void*) monoid) Monoid(compare) );
+ mg.confirm_if( new((void*) view) View(monoid->compare_pointer()) );
+ }
template <typename Monoid, typename T1>
- static void construct(Monoid* monoid, View* view, const T1& x1, const less_type& compare)
- { provisional( new ((void*)monoid) Monoid(compare) ).confirm_if(
- new ((void*)view) View(x1, monoid->compare_pointer()) ); }
+ static void construct(Monoid* monoid, View* view, const T1& x1,
+ const less_type& compare)
+ {
+ provisional_guard<Monoid> mg( new((void*) monoid) Monoid(compare) );
+ mg.confirm_if( new((void*) view) View(x1, monoid->compare_pointer()) );
+ }
template <typename Monoid, typename T1, typename T2>
- static void construct(Monoid* monoid, View* view, const T1& x1, const T2& x2, const less_type& compare)
- { provisional( new ((void*)monoid) Monoid(compare) ).confirm_if(
- new ((void*)view) View(x1, x2, monoid->compare_pointer()) ); }
+ static void construct(Monoid* monoid, View* view,
+ const T1& x1, const T2& x2, const less_type& compare)
+ {
+ provisional_guard<Monoid> mg( new((void*) monoid) Monoid(compare) );
+ mg.confirm_if( new((void*) view) View(x1, x2,
+ monoid->compare_pointer()) );
+ }
//@}
};
@@ -1312,7 +1451,7 @@ public:
/** The maximum reducer view class.
*
- * This is the view class for reducers created with
+ * This is the view class for reducers created with
* `cilk::reducer< cilk::op_max<Type, Compare> >`. It accumulates the maximum,
* as determined by a comparator, of a set of values which have occurred as
* arguments to the `calc_max()` function. The accumulated value will be the
@@ -1323,16 +1462,16 @@ public:
* argument value which is not less than any other argument value, i.e., the
* maximum.
*
- * @note The reducer “dereference” operation (`reducer::operator *()`)
- * yields a reference to the view. Thus, for example, the view class’s
+ * @note The reducer "dereference" operation (`reducer::operator *()`)
+ * yields a reference to the view. Thus, for example, the view class's
* `calc_max()` function would be used in an expression like
* `r->calc_max(a)` where `r` is an op_max reducer variable.
*
* @tparam Type The type of the values compared by the reducer. This will
- * be the value type of a monoid_with_view that is
+ * be the value type of a monoid_with_view that is
* instantiated with this view.
* @tparam Compare A `Strict Weak Ordering` whose argument type is @a Type. It
- * defines the “less than” relation used to compute the
+ * defines the "less than" relation used to compute the
* maximum.
*
* @see ReducersMinMax
@@ -1340,56 +1479,54 @@ public:
*/
template <typename Type, typename Compare>
class op_max_view : public min_max_internal::view_base<
- min_max_internal::view_content<Type, Compare, true>,
+ min_max_internal::view_content<Type, Compare, true>,
Compare,
Compare>
{
typedef min_max_internal::view_base<
- min_max_internal::view_content<Type, Compare, true>,
+ min_max_internal::view_content<Type, Compare, true>,
Compare,
Compare> base;
using base::calc;
using base::assign;
friend class min_max_internal::rhs_proxy<op_max_view>;
-
+
public:
/** @name Constructors.
*
- * All op_max_view constructors simply pass their arguments on to the
+ * All op_max_view constructors simply pass their arguments on to the
* @ref view_base base class.
*/
//@{
-
- op_max_view() : base() {}
-
+
template <typename T1>
op_max_view(const T1& x1) : base(x1) {}
-
+
template <typename T1, typename T2>
op_max_view(const T1& x1, const T2& x2) : base(x1, x2) {}
-
- //@}
+
+ //@}
/** @name View modifier operations.
*/
//@{
-
- /** Maximize with a value.
+
+ /** Maximizes with a value.
*
- * If @a x is greater than the current value of the view (as defined by
- * the reducer’s comparator), or if the view was created without an
- * initial value and its value has never been updated (with `calc_max()`
+ * If @a x is greater than the current value of the view (as defined by
+ * the reducer's comparator), or if the view was created without an
+ * initial value and its value has never been updated (with `calc_max()`
* or `= max_of()`), then the value of the view is set to @a x.
*
- * @param x The value to maximize the view’s value with.
+ * @param x The value to maximize the view's value with.
*
* @return A reference to the view. (Allows chaining
* `view.comp_max(a).comp_max(b)…`.)
*/
op_max_view& calc_max(const Type& x) { calc(x); return *this; }
- /** Assign the result of a `max_of(view, value)` expression to the view.
+ /** Assigns the result of a `max_of(view, value)` expression to the view.
*
* @param rhs An rhs_proxy value created by a `max_of(view, value)`
* expression.
@@ -1398,16 +1535,16 @@ public:
*
* @see min_max_internal::view_base::rhs_proxy
*/
- op_max_view& operator=(const min_max_internal::rhs_proxy<op_max_view>& rhs)
+ op_max_view& operator=(const min_max_internal::rhs_proxy<op_max_view>& rhs)
{ assign(rhs); return *this; }
-
+
//@}
};
-/** Compute the maximum of the value in an op_max_view and another value.
+/** Computes the maximum of the value in an op_max_view and another value.
*
- * The result of this computation can only be assigned back to the original
+ * The result of this computation can only be assigned back to the original
* view or used in another max_of() call. For example,
*
* *reducer = max_of(*reducer, x);
@@ -1430,7 +1567,7 @@ max_of(const Type& value, const op_max_view<Type, Compare>& view)
return min_max_internal::make_proxy(value, view);
}
-/** Nested maximum computation.
+/** Computes nested maximum.
*
* Compute the maximum of the result of a max_of() call and another value.
*
@@ -1444,7 +1581,7 @@ max_of(const Type& value, const op_max_view<Type, Compare>& view)
*/
template <typename Type, typename Compare>
inline min_max_internal::rhs_proxy< op_max_view<Type, Compare> >
-max_of(const min_max_internal::rhs_proxy< op_max_view<Type, Compare> >& proxy,
+max_of(const min_max_internal::rhs_proxy< op_max_view<Type, Compare> >& proxy,
const Type& value)
{
return proxy.calc(value);
@@ -1453,7 +1590,7 @@ max_of(const min_max_internal::rhs_proxy< op_max_view<Type, Compare> >& proxy,
/// @copydoc max_of(const min_max_internal::rhs_proxy< op_max_view<Type, Compare> >&, const Type&)
template <typename Type, typename Compare>
inline min_max_internal::rhs_proxy< op_max_view<Type, Compare> >
-max_of(const Type& value,
+max_of(const Type& value,
const min_max_internal::rhs_proxy< op_max_view<Type, Compare> >& proxy)
{
return proxy.calc(value);
@@ -1470,8 +1607,8 @@ max_of(const Type& value,
* @see op_max_view
*/
template <typename Type, typename Compare=std::less<Type>, bool Align = false>
-class op_max :
- public min_max_internal::monoid_base<op_max_view<Type, Compare>, Align>
+class op_max :
+ public min_max_internal::monoid_base<op_max_view<Type, Compare>, Align>
{
typedef min_max_internal::monoid_base<op_max_view<Type, Compare>, Align>
base;
@@ -1495,7 +1632,7 @@ public:
/** The minimum reducer view class.
*
- * This is the view class for reducers created with
+ * This is the view class for reducers created with
* `cilk::reducer< cilk::op_min<Type, Compare> >`. It accumulates the minimum,
* as determined by a comparator, of a set of values which have occurred as
* arguments to the `calc_min()` function. The accumulated value will be the
@@ -1506,16 +1643,16 @@ public:
* argument value which no other argument value is less than, i.e., the
* minimum.
*
- * @note The reducer “dereference” operation (`reducer::operator *()`)
- * yields a reference to the view. Thus, for example, the view class’s
+ * @note The reducer "dereference" operation (`reducer::operator *()`)
+ * yields a reference to the view. Thus, for example, the view class's
* `calc_min()` function would be used in an expression like
* `r->calc_min(a)` where `r` is an op_min reducer variable.
*
- * @tparam Type The type of the values compared by the reducer. This will
- * be the value type of a monoid_with_view that is
+ * @tparam Type The type of the values compared by the reducer. This will
+ * be the value type of a monoid_with_view that is
* instantiated with this view.
- * @tparam Compare A `Strict Weak Ordering` whose argument type is @a Type. It
- * defines the “less than” relation used to compute the
+ * @tparam Compare A `Strict Weak Ordering` whose argument type is @a Type. It
+ * defines the "less than" relation used to compute the
* minimum.
*
* @see ReducersMinMax
@@ -1523,12 +1660,12 @@ public:
*/
template <typename Type, typename Compare>
class op_min_view : public min_max_internal::view_base<
- min_max_internal::view_content<Type, Compare, false>,
+ min_max_internal::view_content<Type, Compare, false>,
Compare,
min_max_internal::reverse_predicate<Compare, Type> >
{
typedef min_max_internal::view_base<
- min_max_internal::view_content<Type, Compare, false>,
+ min_max_internal::view_content<Type, Compare, false>,
Compare,
min_max_internal::reverse_predicate<Compare, Type> > base;
using base::calc;
@@ -1538,40 +1675,38 @@ class op_min_view : public min_max_internal::view_base<
public:
/** @name Constructors.
*
- * All op_min_view constructors simply pass their arguments on to the
+ * All op_min_view constructors simply pass their arguments on to the
* @ref view_base base class.
*/
//@{
-
- op_min_view() : base() {}
-
+
template <typename T1>
op_min_view(const T1& x1) : base(x1) {}
-
+
template <typename T1, typename T2>
op_min_view(const T1& x1, const T2& x2) : base(x1, x2) {}
-
- //@}
+
+ //@}
/** @name View modifier operations.
*/
//@{
-
- /** Minimize with a value.
+
+ /** Minimizes with a value.
*
* If @a x is less than the current value of the view (as defined by the
- * reducer’s comparator), or if the view was created without an initial
+ * reducer's comparator), or if the view was created without an initial
* value and its value has never been updated (with `calc_min()` or
* `= min_of()`), then the value of the view is set to @a x.
*
- * @param x The value to minimize the view’s value with.
+ * @param x The value to minimize the view's value with.
*
* @return A reference to the view. (Allows chaining
* `view.comp_min(a).comp_min(b)…`.)
*/
op_min_view& calc_min(const Type& x) { calc(x); return *this; }
- /** Assign the result of a `min_of(view, value)` expression to the view.
+ /** Assigns the result of a `min_of(view, value)` expression to the view.
*
* @param rhs An rhs_proxy value created by a `min_of(view, value)`
* expression.
@@ -1580,12 +1715,12 @@ public:
*
* @see min_max_internal::view_base::rhs_proxy
*/
- op_min_view& operator=(const min_max_internal::rhs_proxy<op_min_view>& rhs)
+ op_min_view& operator=(const min_max_internal::rhs_proxy<op_min_view>& rhs)
{ assign(rhs); return *this; }
};
-/** Compute the minimum of the value in a view and another value.
+/** Computes the minimum of the value in a view and another value.
*
* The result of this computation can only be assigned back to the original
* view or used in another min_of() call. For example,
@@ -1610,7 +1745,7 @@ min_of(const Type& value, const op_min_view<Type, Compare>& view)
return min_max_internal::make_proxy(value, view);
}
-/** Nested minimum computation.
+/** Computes nested minimum.
*
* Compute the minimum of the result of a min_of() call and another value.
*
@@ -1624,7 +1759,7 @@ min_of(const Type& value, const op_min_view<Type, Compare>& view)
*/
template <typename Type, typename Compare>
inline min_max_internal::rhs_proxy< op_min_view<Type, Compare> >
-min_of(const min_max_internal::rhs_proxy< op_min_view<Type, Compare> >& proxy,
+min_of(const min_max_internal::rhs_proxy< op_min_view<Type, Compare> >& proxy,
const Type& value)
{
return proxy.calc(value);
@@ -1633,7 +1768,7 @@ min_of(const min_max_internal::rhs_proxy< op_min_view<Type, Compare> >& proxy,
/// @copydoc min_of(const min_max_internal::rhs_proxy< op_min_view<Type, Compare> >&, const Type&)
template <typename Type, typename Compare>
inline min_max_internal::rhs_proxy< op_min_view<Type, Compare> >
-min_of(const Type& value,
+min_of(const Type& value,
const min_max_internal::rhs_proxy< op_min_view<Type, Compare> >& proxy)
{
return proxy.calc(value);
@@ -1673,7 +1808,7 @@ public:
/** The maximum index reducer view class.
*
- * This is the view class for reducers created with
+ * This is the view class for reducers created with
* `cilk::reducer< cilk::op_max_index<Index, Type, Compare> >`. It accumulates
* the maximum, as determined by a comparator, of a set of values which have
* occurred as arguments to the `calc_max()` function, and records the index
@@ -1684,33 +1819,33 @@ public:
* argument value which is not less than any other argument value, i.e., the
* maximum.
*
- * @note The reducer “dereference” operation (`reducer::operator *()`)
- * yields a reference to the view. Thus, for example, the view class’s
+ * @note The reducer "dereference" operation (`reducer::operator *()`)
+ * yields a reference to the view. Thus, for example, the view class's
* `calc_max()` function would be used in an expression like
* `r->calc_max(i, a)`where `r` is an op_max_index reducer
* variable.
*
- * @note The word “index” suggests an integer index into an array, but there
+ * @note The word "index" suggests an integer index into an array, but there
* is no restriction on the index type or how it should be used. In
- * general, it may be convenient to use it for any kind of key that
+ * general, it may be convenient to use it for any kind of key that
* can be used to locate the maximum value in the collection that it
- * came from — for example:
+ * came from - for example:
* - An index into an array.
* - A key into an STL map.
* - An iterator into any STL container.
*
- * @note A max_index reducer is essentially a max reducer whose value type
+ * @note A max_index reducer is essentially a max reducer whose value type
* is a `std::pair<Index, Type>`. This fact is camouflaged in the view
* `calc_max` function, the global `max_of` functions, and the reducer
* value constructor, which can all take an index argument and a value
* argument as an alternative to a single `std::pair` argument.
* However, the reducer `set_value()`, `get_value()`, `move_in()`, and
- * `move_out()` functions work only with pairs, not with individual
+ * `move_out()` functions work only with pairs, not with individual
* value and/or index arguments.
*
* @tparam Index The type of the indices associated with the values.
- * @tparam Type The type of the values compared by the reducer. This will
- * be the value type of a monoid_with_view that is
+ * @tparam Type The type of the values compared by the reducer. This will
+ * be the value type of a monoid_with_view that is
* instantiated with this view.
* @tparam Compare Used to compare the values. It must be a binary predicate.
* If it is omitted, then the view computes the conventional
@@ -1737,65 +1872,65 @@ class op_max_index_view : public min_max_internal::view_base<
public:
/** @name Constructors.
*
- * All op_max_index_view constructors simply pass their arguments on to the
+ * All op_max_index_view constructors simply pass their arguments on to the
* @ref view_base base class, except for the `(index, value [, compare])`
* constructors, which create a `std::pair` containing the index and value.
*/
//@{
-
+
op_max_index_view() : base() {}
-
+
template <typename T1>
op_max_index_view(const T1& x1) : base(x1) {}
-
+
template <typename T1, typename T2>
op_max_index_view(const T1& x1, const T2& x2) : base(x1, x2) {}
-
+
template <typename T1, typename T2, typename T3>
op_max_index_view(const T1& x1, const T2& x2, const T3& x3) : base(x1, x2, x3) {}
-
+
op_max_index_view(const Index& i, const Type& v) : base(pair_type(i, v)) {}
-
- op_max_index_view(const Index& i, const Type& v, const typename base::compare_type* c) :
+
+ op_max_index_view(const Index& i, const Type& v, const typename base::compare_type* c) :
base(pair_type(i, v), c) {}
-
- //@}
- /** Maximize with a value and index.
+ //@}
+
+ /** Maximizes with a value and index.
*
- * If @a x is greater than the current value of the view (as defined by
- * the reducer’s comparator), or if the view was created without an
- * initial value and its value has never been updated (with `calc_max()`
+ * If @a x is greater than the current value of the view (as defined by
+ * the reducer's comparator), or if the view was created without an
+ * initial value and its value has never been updated (with `calc_max()`
* or `= max_of()`), then the value of the view is set to @a x, and the
* index is set to @a i..
*
* @param i The index of the value @a x.
- * @param x The value to maximize the view’s value with.
+ * @param x The value to maximize the view's value with.
*
- * @return A reference to the view. (Allows
+ * @return A reference to the view. (Allows
* `view.comp_max(i, a).comp_max(j, b)…`.)
*/
- op_max_index_view& calc_max(const Index& i, const Type& x)
+ op_max_index_view& calc_max(const Index& i, const Type& x)
{ calc(pair_type(i, x)); return *this; }
- /** Maximize with an index/value pair.
+ /** Maximizes with an index/value pair.
*
* If @a pair.second is greater than the current value of the view (as
- * defined by the reducer’s comparator), or if the view was created
+ * defined by the reducer's comparator), or if the view was created
* without an initial value and its value has never been updated (with
* `calc_max()` or `= max_of()`), then the value of the view is set to
* @a pair.second, and the index is set to @a pair.first.
*
- * @param pair A pair containing a value to maximize the view’s value
+ * @param pair A pair containing a value to maximize the view's value
* with and its associated index.
*
* @return A reference to the view. (Allows
* `view.comp_max(p1).comp_max(p2)…`.)
*/
- op_max_index_view& calc_max(const pair_type& pair)
+ op_max_index_view& calc_max(const pair_type& pair)
{ calc(pair); return *this; }
- /** Assign the result of a `max_of(view, index, value)` expression to the
+ /** Assigns the result of a `max_of(view, index, value)` expression to the
* view.
*
* @param rhs An rhs_proxy value created by a `max_of(view, index, value)`
@@ -1805,12 +1940,12 @@ public:
*
* @see min_max_internal::view_base::rhs_proxy
*/
- op_max_index_view& operator=(const min_max_internal::rhs_proxy<op_max_index_view>& rhs)
+ op_max_index_view& operator=(const min_max_internal::rhs_proxy<op_max_index_view>& rhs)
{ assign(rhs); return *this; }
};
-/** Compute the maximum of the value in a view and another value.
+/** Computes the maximum of the value in a view and another value.
*
* The result of this computation can only be assigned back to the original
* view or used in another max_of() call. For example,
@@ -1855,7 +1990,7 @@ max_of(const std::pair<Index, Type>& pair,
return min_max_internal::make_proxy(pair, view);
}
-/** Nested computation of the maximum of the value in a view and other values.
+/** Computes the nested maximum between the value in a view and other values.
*
* Compute the maximum of the result of a max_of() call and another value.
*
@@ -1918,7 +2053,7 @@ template < typename Index
, typename Compare=std::less<Type>
, bool Align = false
>
-class op_max_index : public min_max_internal::monoid_base<op_max_index_view<Index, Type, Compare>, Align>
+class op_max_index : public min_max_internal::monoid_base<op_max_index_view<Index, Type, Compare>, Align>
{
typedef min_max_internal::monoid_base<
op_max_index_view<Index, Type, Compare>, Align> base;
@@ -1944,7 +2079,7 @@ public:
/** The minimum index reducer view class.
*
- * This is the view class for reducers created with
+ * This is the view class for reducers created with
* `cilk::reducer<cilk::op_min_index<Index, Type, Compare> >`. It accumulates
* the minimum, as determined by a comparator, of a set of values which have
* occurred as arguments to the `calc_min()` function, and records the index
@@ -1955,22 +2090,22 @@ public:
* argument value which no other argument value is less than, i.e., the
* minimum.
*
- * @note The reducer “dereference” operation (`reducer::operator *()`)
- * yields a reference to the view. Thus, for example, the view class’s
+ * @note The reducer "dereference" operation (`reducer::operator *()`)
+ * yields a reference to the view. Thus, for example, the view class's
* `calc_min()` function would be
* used in an expression like `r->calc_min(i, a)`where `r` is an
* op_min_index reducer variable.
*
- * @note The word “index” suggests an integer index into an array, but there
+ * @note The word "index" suggests an integer index into an array, but there
* is no restriction on the index type or how it should be used. In
- * general, it may be convenient to use it for any kind of key that
+ * general, it may be convenient to use it for any kind of key that
* can be used to locate the minimum value in the collection that it
- * came from — for example:
+ * came from - for example:
* - An index into an array.
* - A key into an STL map.
* - An iterator into any STL container.
*
- * @note A min_index reducer is essentially a min reducer whose value type
+ * @note A min_index reducer is essentially a min reducer whose value type
* is a `std::pair<Index, Type>`. This fact is camouflaged in the view
* `calc_min` function, the global `min_of` functions, and the reducer
* value constructor, which can all take an index argument and a value
@@ -1980,8 +2115,8 @@ public:
* value and/or index arguments.
*
* @tparam Index The type of the indices associated with the values.
- * @tparam Type The type of the values compared by the reducer. This will
- * be the value type of a monoid_with_view that is
+ * @tparam Type The type of the values compared by the reducer. This will
+ * be the value type of a monoid_with_view that is
* instantiated with this view.
* @tparam Compare Used to compare the values. It must be a binary predicate.
* If it is omitted, then the view computes the conventional
@@ -2008,65 +2143,65 @@ class op_min_index_view : public min_max_internal::view_base<
public:
/** @name Constructors.
*
- * All op_min_index_view constructors simply pass their arguments on to the
+ * All op_min_index_view constructors simply pass their arguments on to the
* @ref view_base base class, except for the `(index, value [, compare])`
* constructors, which create a `std::pair` containing the index and value.
*/
//@{
-
+
op_min_index_view() : base() {}
-
+
template <typename T1>
op_min_index_view(const T1& x1) : base(x1) {}
-
+
template <typename T1, typename T2>
op_min_index_view(const T1& x1, const T2& x2) : base(x1, x2) {}
-
+
template <typename T1, typename T2, typename T3>
op_min_index_view(const T1& x1, const T2& x2, const T3& x3) : base(x1, x2, x3) {}
-
+
op_min_index_view(const Index& i, const Type& v) : base(pair_type(i, v)) {}
-
- op_min_index_view(const Index& i, const Type& v, const typename base::compare_type* c) :
+
+ op_min_index_view(const Index& i, const Type& v, const typename base::compare_type* c) :
base(pair_type(i, v), c) {}
-
- //@}
- /** Minimize with a value and index.
+ //@}
+
+ /** Minimizes with a value and index.
*
- * If @a x is greater than the current value of the view (as defined by
- * the reducer’s comparator), or if the view was created without an
- * initial value and its value has never been updated (with `calc_min()`
+ * If @a x is greater than the current value of the view (as defined by
+ * the reducer's comparator), or if the view was created without an
+ * initial value and its value has never been updated (with `calc_min()`
* or `= min_of()`), then the value of the view is set to @a x, and the
* index is set to @a i..
*
* @param i The index of the value @a x.
- * @param x The value to minimize the view’s value with.
+ * @param x The value to minimize the view's value with.
*
- * @return A reference to the view. (Allows
+ * @return A reference to the view. (Allows
* `view.comp_min(i, a).comp_min(j, b)…`.)
*/
- op_min_index_view& calc_min(const Index& i, const Type& x)
+ op_min_index_view& calc_min(const Index& i, const Type& x)
{ calc(pair_type(i, x)); return *this; }
- /** Maximize with an index/value pair.
+ /** Maximizes with an index/value pair.
*
* If @a pair.second is less than the current value of the view (as
- * defined by the reducer’s comparator), or if the view was created
+ * defined by the reducer's comparator), or if the view was created
* without an initial value and its value has never been updated (with
* `calc_min()` or `= min_of()`), then the value of the view is set to
* @a pair.second, and the index is set to @a pair.first.
*
- * @param pair A pair containing a value to minimize the view’s value
+ * @param pair A pair containing a value to minimize the view's value
* with and its associated index.
*
* @return A reference to the view. (Allows
* `view.comp_min(p1).comp_min(p2)…`.)
*/
- op_min_index_view& calc_min(const pair_type& pair)
+ op_min_index_view& calc_min(const pair_type& pair)
{ calc(pair); return *this; }
- /** Assign the result of a `min_of(view, index, value)` expression to the
+ /** Assigns the result of a `min_of(view, index, value)` expression to the
* view.
*
* @param rhs An rhs_proxy value created by a `min_of(view, index, value)`
@@ -2076,12 +2211,12 @@ public:
*
* @see min_max_internal::view_base::rhs_proxy
*/
- op_min_index_view& operator=(const min_max_internal::rhs_proxy<op_min_index_view>& rhs)
+ op_min_index_view& operator=(const min_max_internal::rhs_proxy<op_min_index_view>& rhs)
{ assign(rhs); return *this; }
};
-/** Compute the minimum of the value in a view and another value.
+/** Computes the minimum of the value in a view and another value.
*
* The result of this computation can only be assigned back to the original
* view or used in another min_of() call. For example,
@@ -2126,7 +2261,7 @@ min_of(const std::pair<Index, Type>& pair,
return min_max_internal::make_proxy(pair, view);
}
-/** Nested computation of the minimum of the value in a view and other values.
+/** Computes nested minimum between the value in a view and other values.
*
* Compute the minimum of the result of a min_of() call and another value.
*
@@ -2176,7 +2311,7 @@ min_of(const std::pair<Index, Type>& pair,
/** Monoid class for minimum reductions with index. Instantiate the
* cilk::reducer template class with an op_min_index monoid to create a
- * min_index reducer class. For example, to compute the minimum of an array of
+ * min_index reducer class. For example, to compute the minimum of an array of
* `double` values and the array index of the min value:
*
* cilk::reducer< cilk::op_min_index<unsigned, double> > r;
@@ -2189,7 +2324,7 @@ template < typename Index
, typename Compare=std::less<Type>
, bool Align = false
>
-class op_min_index : public min_max_internal::monoid_base<op_min_index_view<Index, Type, Compare>, Align>
+class op_min_index : public min_max_internal::monoid_base<op_min_index_view<Index, Type, Compare>, Align>
{
typedef min_max_internal::monoid_base<
op_min_index_view<Index, Type, Compare>, Align> base;
@@ -2209,18 +2344,18 @@ public:
* reducer_max is a proxy for the contained view, so that accumulator
* variable update operations can be applied directly to the reducer. For
* example, a value is maximized with a `reducer<%op_max>` with
- * `r->calc_max(a)`, but a value can be maximized with a `%reducer_max` with
+ * `r->calc_max(a)`, but a value can be maximized with a `%reducer_max` with
* `r.calc_max(a)`.
*
*
* @deprecated Users are strongly encouraged to use `reducer<monoid>`
- * reducers rather than the old wrappers like reducer_max.
+ * reducers rather than the old wrappers like reducer_max.
* The `reducer<monoid>` reducers show the reducer/monoid/view
* architecture more clearly, are more consistent in their
* implementation, and present a simpler model for new
* user-implemented reducers.
*
- * @note Implicit conversions are provided between `%reducer_max`
+ * @note Implicit conversions are provided between `%reducer_max`
* and `reducer<%op_max>`. This allows incremental code
* conversion: old code that used `%reducer_max` can pass a
* `%reducer_max` to a converted function that now expects a
@@ -2228,7 +2363,7 @@ public:
* versa. **But see @ref redminmax_compatibility.**
*
* @tparam Type The value type of the reducer.
- * @tparam Compare The “less than” comparator type for the reducer.
+ * @tparam Compare The "less than" comparator type for the reducer.
*
* @see op_max
* @see op_max_view
@@ -2240,53 +2375,53 @@ template <typename Type, typename Compare=std::less<Type> >
class reducer_max : public reducer< op_max<Type, Compare, true> >
{
__CILKRTS_STATIC_ASSERT(
- ::cilk::internal::class_is_empty<
- typename ::cilk::internal::binary_functor<Compare>::type >::value,
+ ::cilk::internal::class_is_empty<
+ typename ::cilk::internal::binary_functor<Compare>::type >::value,
"cilk::reducer_max<Type, Compare> only works with "
"an empty Compare class");
typedef reducer< op_max<Type, Compare, true> > base;
public:
-
+
/// Type of data in a reducer_max.
typedef Type basic_value_type;
-
+
/// The view type for the reducer.
typedef typename base::view_type view_type;
-
+
/// The view type for the reducer.
typedef typename base::view_type View;
-
+
/// The monoid type for the reducer.
typedef typename base::monoid_type monoid_type;
-
+
/// The monoid type for the reducer.
typedef typename base::monoid_type Monoid;
- /// The view’s rhs proxy type.
+ /// The view's rhs proxy type.
typedef min_max_internal::rhs_proxy<View> rhs_proxy;
-
+
using base::view;
/** @name Constructors
*/
//@{
-
- /// Construct the wrapper in its identity state (either `!is_set()`, or
+
+ /// Constructs the wrapper in its identity state (either `!is_set()`, or
/// `value() == identity value`).
reducer_max() : base() {}
- /// Construct the wrapper with a specified initial value.
+ /// Constructs the wrapper with a specified initial value.
explicit reducer_max(const Type& initial_value) : base(initial_value) {}
- /// Construct the wrapper in its identity state with a specified
+ /// Constructs the wrapper in its identity state with a specified
/// comparator.
explicit reducer_max(const Compare& comp) : base(comp) {}
- /// Construct the wrapper with a specified initial value and a specified
+ /// Constructs the wrapper with a specified initial value and a specified
/// comparator.
reducer_max(const Type& initial_value, const Compare& comp)
: base(initial_value, comp) {}
-
+
//@}
/** @name Forwarded functions
@@ -2294,25 +2429,25 @@ public:
* simply forwarded to the contained @ref op_max_view. */
//@{
- /// @copydoc cilk_lib_1_0::min_max_internal::view_content::is_set() const
+ /// @copydoc cilk_lib_1_1::min_max_internal::view_content::is_set() const
bool is_set() const { return view().is_set(); }
/// @copydoc op_max_view::calc_max(const Type&)
- reducer_max& calc_max(const Type& x)
+ reducer_max& calc_max(const Type& x)
{ view().calc_max(x); return *this; }
- /// @copydoc op_max_view::operator=(const min_max_internal::rhs_proxy<op_max_view>&)
+ /// @copydoc op_max_view::operator=(const min_max_internal::rhs_proxy<op_max_view>&)
reducer_max& operator=(const rhs_proxy& rhs)
{ view() = rhs; return *this; }
-
+
//@}
- /** Allow read-only access to the value within the current view.
- *
+ /** Allows read-only access to the value within the current view.
+ *
* @returns A const reference to the value within the current view.
*/
const Type& get_reference() const { return view().get_reference(); }
-
+
/// @name Dereference
/** Dereferencing a wrapper is a no-op. It simply returns the wrapper.
* Combined with the rule that a wrapper forwards view operations to the
@@ -2336,12 +2471,12 @@ public:
reducer_max* operator->() { return this; }
reducer_max const* operator->() const { return this; }
//@}
-
+
/** @name Upcast
- * @details In Cilk library 0.9, reducers were always cache-aligned. In
- * library 1.0, reducer cache alignment is optional. By default, reducers
- * are unaligned (i.e., just naturally aligned), but legacy wrappers
- * inherit from cache-aligned reducers for binary compatibility.
+ * @details In Intel Cilk Plus library 0.9, reducers were always cache-aligned.
+ * In library 1.0, reducer cache alignment is optional. By default,
+ * reducers are unaligned (i.e., just naturally aligned), but legacy
+ * wrappers inherit from cache-aligned reducers for binary compatibility.
*
* This means that a wrapper will automatically be upcast to its aligned
* reducer base class. The following conversion operators provide
@@ -2352,7 +2487,7 @@ public:
{
return *reinterpret_cast< reducer< op_max<Type, Compare, false> >* >(this);
}
-
+
operator const reducer< op_max<Type, Compare, false> >& () const
{
return *reinterpret_cast< const reducer< op_max<Type, Compare, false> >* >(this);
@@ -2363,18 +2498,18 @@ public:
/// @cond internal
// The legacy definition of max_of(reducer_max, value) has different
-// behavior and a different return type than this definition. We add an
+// behavior and a different return type than this definition. We add an
// unused third argument to this version of the function to give it a different
-// signature, so that they won’t end up sharing a single object file entry.
+// signature, so that they won't end up sharing a single object file entry.
struct max_of_1_0_t {};
const max_of_1_0_t max_of_1_0 = {};
/// @endcond
-/** Compute the maximum of the value in a reducer_max and another value.
+/** Computes the maximum of the value in a reducer_max and another value.
*
* @deprecated Because reducer_max is deprecated.
*
- * The result of this computation can only be assigned back to the original
+ * The result of this computation can only be assigned back to the original
* reducer or used in another max_of() call. For example,
*
* reducer = max_of(reducer, x);
@@ -2409,18 +2544,18 @@ max_of(const Type& value, const reducer_max<Type, Compare>& r,
* reducer_min is a proxy for the contained view, so that accumulator
* variable update operations can be applied directly to the reducer. For
* example, a value is minimized with a `reducer<%op_min>` with
- * `r->calc_min(a)`, but a value can be minimized with a `%reducer_min` with
+ * `r->calc_min(a)`, but a value can be minimized with a `%reducer_min` with
* `r.calc_min(a)`.
*
*
* @deprecated Users are strongly encouraged to use `reducer<monoid>`
- * reducers rather than the old wrappers like reducer_min.
+ * reducers rather than the old wrappers like reducer_min.
* The `reducer<monoid>` reducers show the reducer/monoid/view
* architecture more clearly, are more consistent in their
* implementation, and present a simpler model for new
* user-implemented reducers.
*
- * @note Implicit conversions are provided between `%reducer_min`
+ * @note Implicit conversions are provided between `%reducer_min`
* and `reducer<%op_min>`. This allows incremental code
* conversion: old code that used `%reducer_min` can pass a
* `%reducer_min` to a converted function that now expects a
@@ -2428,7 +2563,7 @@ max_of(const Type& value, const reducer_max<Type, Compare>& r,
* versa. **But see @ref redminmax_compatibility.**
*
* @tparam Type The value type of the reducer.
- * @tparam Compare The “less than” comparator type for the reducer.
+ * @tparam Compare The "less than" comparator type for the reducer.
*
* @see op_min
* @see op_min_view
@@ -2441,52 +2576,52 @@ class reducer_min : public reducer< op_min<Type, Compare, true> >
{
__CILKRTS_STATIC_ASSERT(
::cilk::internal::class_is_empty<
- typename ::cilk::internal::binary_functor<Compare>::type >::value,
+ typename ::cilk::internal::binary_functor<Compare>::type >::value,
"cilk::reducer_min<Type, Compare> only works with "
"an empty Compare class");
typedef reducer< op_min<Type, Compare, true> > base;
public:
-
+
/// Type of data in a reducer_min.
typedef Type basic_value_type;
-
+
/// The view type for the reducer.
typedef typename base::view_type view_type;
-
+
/// The view type for the reducer.
typedef typename base::view_type View;
-
+
/// The monoid type for the reducer.
typedef typename base::monoid_type monoid_type;
-
+
/// The monoid type for the reducer.
typedef typename base::monoid_type Monoid;
- /// The view’s rhs proxy type.
+ /// The view's rhs proxy type.
typedef min_max_internal::rhs_proxy<View> rhs_proxy;
-
+
using base::view;
/** @name Constructors
*/
//@{
-
- /// Construct the wrapper in its identity state (either `!is_set()`, or
+
+ /// Constructs the wrapper in its identity state (either `!is_set()`, or
/// `value() == identity value`).
reducer_min() : base() {}
- /// Construct the wrapper with a specified initial value.
+ /// Constructs the wrapper with a specified initial value.
explicit reducer_min(const Type& initial_value) : base(initial_value) {}
- /// Construct the wrapper in its identity state with a specified
+ /// Constructs the wrapper in its identity state with a specified
/// comparator.
explicit reducer_min(const Compare& comp) : base(comp) {}
- /// Construct the wrapper with a specified initial value and a specified
+ /// Constructs the wrapper with a specified initial value and a specified
/// comparator.
reducer_min(const Type& initial_value, const Compare& comp)
: base(initial_value, comp) {}
-
+
//@}
/** @name Forwarded functions
@@ -2494,25 +2629,25 @@ public:
* simply forwarded to the contained @ref op_min_view. */
//@{
- /// @copydoc cilk_lib_1_0::min_max_internal::view_content::is_set() const
+ /// @copydoc cilk_lib_1_1::min_max_internal::view_content::is_set() const
bool is_set() const { return view().is_set(); }
/// @copydoc op_min_view::calc_min(const Type&)
- reducer_min& calc_min(const Type& x)
+ reducer_min& calc_min(const Type& x)
{ view().calc_min(x); return *this; }
- /// @copydoc op_min_view::operator=(const min_max_internal::rhs_proxy<op_min_view>&)
+ /// @copydoc op_min_view::operator=(const min_max_internal::rhs_proxy<op_min_view>&)
reducer_min& operator=(const rhs_proxy& rhs)
{ view() = rhs; return *this; }
-
+
//@}
- /** Allow read-only access to the value within the current view.
- *
+ /** Allows read-only access to the value within the current view.
+ *
* @returns A const reference to the value within the current view.
*/
const Type& get_reference() const { return view().get_reference(); }
-
+
/// @name Dereference
/** Dereferencing a wrapper is a no-op. It simply returns the wrapper.
* Combined with the rule that a wrapper forwards view operations to the
@@ -2536,12 +2671,12 @@ public:
reducer_min* operator->() { return this; }
reducer_min const* operator->() const { return this; }
//@}
-
+
/** @name Upcast
- * @details In Cilk library 0.9, reducers were always cache-aligned. In
- * library 1.0, reducer cache alignment is optional. By default, reducers
- * are unaligned (i.e., just naturally aligned), but legacy wrappers
- * inherit from cache-aligned reducers for binary compatibility.
+ * @details In Intel Cilk Plus library 0.9, reducers were always cache-aligned.
+ * In library 1.0, reducer cache alignment is optional. By default,
+ * reducers are unaligned (i.e., just naturally aligned), but legacy
+ * wrappers inherit from cache-aligned reducers for binary compatibility.
*
* This means that a wrapper will automatically be upcast to its aligned
* reducer base class. The following conversion operators provide
@@ -2552,7 +2687,7 @@ public:
{
return *reinterpret_cast< reducer< op_min<Type, Compare, false> >* >(this);
}
-
+
operator const reducer< op_min<Type, Compare, false> >& () const
{
return *reinterpret_cast< const reducer< op_min<Type, Compare, false> >* >(this);
@@ -2561,15 +2696,15 @@ public:
};
-/** Compute the minimum of a reducer and a value.
+/** Computes the minimum of a reducer and a value.
*
* @deprecated Because reducer_min is deprecated.
*/
//@{
// The legacy definition of min_of(reducer_min, value) has different
-// behavior and a different return type than this definition. We add an
+// behavior and a different return type than this definition. We add an
// unused third argument to this version of the function to give it a different
-// signature, so that they won’t end up sharing a single object file entry.
+// signature, so that they won't end up sharing a single object file entry.
struct min_of_1_0_t {};
const min_of_1_0_t min_of_1_0 = {};
@@ -2597,18 +2732,18 @@ min_of(const Type& value, const reducer_min<Type, Compare>& r,
* that reducer_max_index is a proxy for the contained view, so that
* accumulator variable update operations can be applied directly to the
* reducer. For example, a value is maximized with a `reducer<%op_max_index>`
- * with `r->calc_max(i, a)`, but a value can be maximized with a
+ * with `r->calc_max(i, a)`, but a value can be maximized with a
* `%reducer_max` with `r.calc_max(i, aa)`.
*
*
* @deprecated Users are strongly encouraged to use `reducer<monoid>`
- * reducers rather than the old wrappers like reducer_max.
+ * reducers rather than the old wrappers like reducer_max.
* The `reducer<monoid>` reducers show the reducer/monoid/view
* architecture more clearly, are more consistent in their
* implementation, and present a simpler model for new
* user-implemented reducers.
*
- * @note Implicit conversions are provided between `%reducer_max_index`
+ * @note Implicit conversions are provided between `%reducer_max_index`
* and `reducer<%op_max_index>`. This allows incremental code
* conversion: old code that used `%reducer_max_index` can pass a
* `%reducer_max_index` to a converted function that now expects a
@@ -2617,7 +2752,7 @@ min_of(const Type& value, const reducer_min<Type, Compare>& r,
*
* @tparam Index The index type of the reducer.
* @tparam Type The value type of the reducer.
- * @tparam Compare The “less than” comparator type for the reducer.
+ * @tparam Compare The "less than" comparator type for the reducer.
*
* @see op_max_index
* @see op_max_index_view
@@ -2629,42 +2764,42 @@ template < typename Index
, typename Type
, typename Compare = std::less<Type>
>
-class reducer_max_index :
+class reducer_max_index :
public reducer< op_max_index<Index, Type, Compare, true> >
{
__CILKRTS_STATIC_ASSERT(
- ::cilk::internal::class_is_empty<
- typename ::cilk::internal::binary_functor<Compare>::type >::value,
+ ::cilk::internal::class_is_empty<
+ typename ::cilk::internal::binary_functor<Compare>::type >::value,
"cilk::reducer_max_index<Type, Compare> only works with "
"an empty Compare class");
typedef reducer< op_max_index<Index, Type, Compare, true> > base;
public:
-
+
/// Type of data in a reducer_max_index.
typedef Type basic_value_type;
-
+
/// The view type for the reducer.
typedef typename base::view_type view_type;
-
+
/// The view type for the reducer.
typedef typename base::view_type View;
-
+
/// The monoid type for the reducer.
typedef typename base::monoid_type monoid_type;
-
+
/// The monoid type for the reducer.
typedef typename base::monoid_type Monoid;
- /// The view’s rhs proxy type.
+ /// The view's rhs proxy type.
typedef min_max_internal::rhs_proxy<View> rhs_proxy;
-
+
using base::view;
/** @name Constructors
*/
//@{
-
- /// Construct the wrapper in its identity state (`!is_set()`).
+
+ /// Constructs the wrapper in its identity state (`!is_set()`).
reducer_max_index() : base() {}
/// Construct with a specified initial index and value.
@@ -2672,10 +2807,10 @@ public:
const Type& initial_value)
: base(initial_index, initial_value) {}
- /// Construct the wrapper with a specified comparator.
+ /// Constructs the wrapper with a specified comparator.
explicit reducer_max_index(const Compare& comp) : base(comp) {}
- /// Construct the wrapper with a specified initial index, value,
+ /// Constructs the wrapper with a specified initial index, value,
/// and comparator.
reducer_max_index(const Index& initial_index,
const Type& initial_value,
@@ -2683,49 +2818,49 @@ public:
: base(initial_index, initial_value, comp) {}
//@}
-
+
/** @name Set / Get
*/
//@{
-
- /// Set the index and value of this object.
+
+ /// Sets the index and value of this object.
void set_value(const Index& index, const Type& value)
{ base::set_value(std::make_pair(index, value)); }
- /// Return the maximum value.
- const Type& get_value() const
+ /// Returns the maximum value.
+ const Type& get_value() const
{ return view().get_reference(); }
- /// Return the maximum index.
- const Index& get_index() const
+ /// Returns the maximum index.
+ const Index& get_index() const
{ return view().get_index_reference(); }
- /// Return a const reference to value data member in the view.
+ /// Returns a const reference to value data member in the view.
const Type& get_reference() const
{ return view().get_reference(); }
-
- /// Return a const reference to index data member in the view.
- const Index& get_index_reference() const
+
+ /// Returns a const reference to index data member in the view.
+ const Index& get_index_reference() const
{ return view().get_index_reference(); }
-
+
//@}
-
+
/** @name Forwarded functions
* @details Functions that update the contained accumulator variable are
* simply forwarded to the contained @ref op_max_view. */
//@{
- /// @copydoc cilk_lib_1_0::min_max_internal::view_content::is_set() const
+ /// @copydoc cilk_lib_1_1::min_max_internal::view_content::is_set() const
bool is_set() const { return view().is_set(); }
/// @copydoc op_max_index_view::calc_max(const Index&, const Type&)
- reducer_max_index& calc_max(const Index& i, const Type& x)
+ reducer_max_index& calc_max(const Index& i, const Type& x)
{ view().calc_max(i, x); return *this; }
- /// @copydoc op_max_view::operator=(const min_max_internal::rhs_proxy<op_max_view>&)
+ /// @copydoc op_max_view::operator=(const min_max_internal::rhs_proxy<op_max_view>&)
reducer_max_index& operator=(const rhs_proxy& rhs)
{ view() = rhs; return *this; }
-
+
//@}
/// @name Dereference
@@ -2751,12 +2886,12 @@ public:
reducer_max_index* operator->() { return this; }
reducer_max_index const* operator->() const { return this; }
//@}
-
+
/** @name Upcast
- * @details In Cilk library 0.9, reducers were always cache-aligned. In
- * library 1.0, reducer cache alignment is optional. By default, reducers
- * are unaligned (i.e., just naturally aligned), but legacy wrappers
- * inherit from cache-aligned reducers for binary compatibility.
+ * @details In Intel Cilk Plus library 0.9, reducers were always cache-aligned.
+ * In library 1.0, reducer cache alignment is optional. By default,
+ * reducers are unaligned (i.e., just naturally aligned), but legacy
+ * wrappers inherit from cache-aligned reducers for binary compatibility.
*
* This means that a wrapper will automatically be upcast to its aligned
* reducer base class. The following conversion operators provide
@@ -2767,13 +2902,13 @@ public:
{
return *reinterpret_cast< reducer< op_max_index<Index, Type, Compare, false> >* >(this);
}
-
+
operator const reducer< op_max_index<Index, Type, Compare, false> >& () const
{
return *reinterpret_cast< const reducer< op_max_index<Index, Type, Compare, false> >* >(this);
}
//@}
-
+
};
@@ -2783,18 +2918,18 @@ public:
* that reducer_min_index is a proxy for the contained view, so that
* accumulator variable update operations can be applied directly to the
* reducer. For example, a value is minimized with a `reducer<%op_min_index>`
- * with `r->calc_min(i, a)`, but a value can be minimized with a
+ * with `r->calc_min(i, a)`, but a value can be minimized with a
* `%reducer_min` with `r.calc_min(i, aa)`.
*
*
* @deprecated Users are strongly encouraged to use `reducer<monoid>`
- * reducers rather than the old wrappers like reducer_min.
+ * reducers rather than the old wrappers like reducer_min.
* The `reducer<monoid>` reducers show the reducer/monoid/view
* architecture more clearly, are more consistent in their
* implementation, and present a simpler model for new
* user-implemented reducers.
*
- * @note Implicit conversions are provided between `%reducer_min_index`
+ * @note Implicit conversions are provided between `%reducer_min_index`
* and `reducer<%op_min_index>`. This allows incremental code
* conversion: old code that used `%reducer_min_index` can pass a
* `%reducer_min_index` to a converted function that now expects a
@@ -2803,7 +2938,7 @@ public:
*
* @tparam Index The index type of the reducer.
* @tparam Type The value type of the reducer.
- * @tparam Compare The “less than” comparator type for the reducer.
+ * @tparam Compare The "less than" comparator type for the reducer.
*
* @see op_min_index
* @see op_min_index_view
@@ -2815,42 +2950,42 @@ template < typename Index
, typename Type
, typename Compare = std::less<Type>
>
-class reducer_min_index :
+class reducer_min_index :
public reducer< op_min_index<Index, Type, Compare, true> >
{
__CILKRTS_STATIC_ASSERT(
- ::cilk::internal::class_is_empty<
- typename ::cilk::internal::binary_functor<Compare>::type >::value,
+ ::cilk::internal::class_is_empty<
+ typename ::cilk::internal::binary_functor<Compare>::type >::value,
"cilk::reducer_min_index<Type, Compare> only works with "
"an empty Compare class");
typedef reducer< op_min_index<Index, Type, Compare, true> > base;
public:
-
+
/// Type of data in a reducer_min_index.
typedef Type basic_value_type;
-
+
/// The view type for the reducer.
typedef typename base::view_type view_type;
-
+
/// The view type for the reducer.
typedef typename base::view_type View;
-
+
/// The monoid type for the reducer.
typedef typename base::monoid_type monoid_type;
-
+
/// The monoid type for the reducer.
typedef typename base::monoid_type Monoid;
- /// The view’s rhs proxy type.
+ /// The view's rhs proxy type.
typedef min_max_internal::rhs_proxy<View> rhs_proxy;
-
+
using base::view;
/** @name Constructors
*/
//@{
-
- /// Construct the wrapper in its identity state (`!is_set()`).
+
+ /// Constructs the wrapper in its identity state (`!is_set()`).
reducer_min_index() : base() {}
/// Construct with a specified initial index and value.
@@ -2858,10 +2993,10 @@ public:
const Type& initial_value)
: base(initial_index, initial_value) {}
- /// Construct the wrapper with a specified comparator.
+ /// Constructs the wrapper with a specified comparator.
explicit reducer_min_index(const Compare& comp) : base(comp) {}
- /// Construct the wrapper with a specified initial index, value,
+ /// Constructs the wrapper with a specified initial index, value,
/// and comparator.
reducer_min_index(const Index& initial_index,
const Type& initial_value,
@@ -2869,49 +3004,49 @@ public:
: base(initial_index, initial_value, comp) {}
//@}
-
+
/** @name Set / Get
*/
//@{
-
- /// Set the index and value of this object.
+
+ /// Sets the index and value of this object.
void set_value(const Index& index, const Type& value)
{ base::set_value(std::make_pair(index, value)); }
- /// Return the minimum value.
- const Type& get_value() const
+ /// Returns the minimum value.
+ const Type& get_value() const
{ return view().get_reference(); }
- /// Return the minimum index.
- const Index& get_index() const
+ /// Returns the minimum index.
+ const Index& get_index() const
{ return view().get_index_reference(); }
- /// Return a const reference to value data member in the view.
+ /// Returns a const reference to value data member in the view.
const Type& get_reference() const
{ return view().get_reference(); }
-
- /// Return a const reference to index data member in the view.
- const Index& get_index_reference() const
+
+ /// Returns a const reference to index data member in the view.
+ const Index& get_index_reference() const
{ return view().get_index_reference(); }
-
+
//@}
-
+
/** @name Forwarded functions
* @details Functions that update the contained accumulator variable are
* simply forwarded to the contained @ref op_min_view. */
//@{
- /// @copydoc cilk_lib_1_0::min_max_internal::view_content::is_set() const
+ /// @copydoc cilk_lib_1_1::min_max_internal::view_content::is_set() const
bool is_set() const { return view().is_set(); }
/// @copydoc op_min_index_view::calc_min(const Index&, const Type&)
- reducer_min_index& calc_min(const Index& i, const Type& x)
+ reducer_min_index& calc_min(const Index& i, const Type& x)
{ view().calc_min(i, x); return *this; }
- /// @copydoc op_min_view::operator=(const min_max_internal::rhs_proxy<op_min_view>&)
+ /// @copydoc op_min_view::operator=(const min_max_internal::rhs_proxy<op_min_view>&)
reducer_min_index& operator=(const rhs_proxy& rhs)
{ view() = rhs; return *this; }
-
+
//@}
/// @name Dereference
@@ -2937,12 +3072,12 @@ public:
reducer_min_index* operator->() { return this; }
reducer_min_index const* operator->() const { return this; }
//@}
-
+
/** @name Upcast
- * @details In Cilk library 0.9, reducers were always cache-aligned. In
- * library 1.0, reducer cache alignment is optional. By default, reducers
- * are unaligned (i.e., just naturally aligned), but legacy wrappers
- * inherit from cache-aligned reducers for binary compatibility.
+ * @details In Intel Cilk Plus library 0.9, reducers were always cache-aligned.
+ * In library 1.0, reducer cache alignment is optional. By default,
+ * reducers are unaligned (i.e., just naturally aligned), but legacy
+ * wrappers inherit from cache-aligned reducers for binary compatibility.
*
* This means that a wrapper will automatically be upcast to its aligned
* reducer base class. The following conversion operators provide
@@ -2953,19 +3088,19 @@ public:
{
return *reinterpret_cast< reducer< op_min_index<Index, Type, Compare, false> >* >(this);
}
-
+
operator const reducer< op_min_index<Index, Type, Compare, false> >& () const
{
return *reinterpret_cast< const reducer< op_min_index<Index, Type, Compare, false> >* >(this);
}
//@}
-
+
};
#ifndef CILK_LIBRARY_0_9_REDUCER_MINMAX
-} // namespace cilk_lib_1_0
-using namespace cilk_lib_1_0;
+} // namespace cilk_lib_1_1
+using namespace cilk_lib_1_1;
#endif
@@ -3017,7 +3152,7 @@ struct legacy_reducer_downcast< reducer< op_min_index<Index, Type, Compare, Alig
* @see @ref page_reducers_in_c
*/
//@{
-
+
#ifdef CILK_C_DEFINE_REDUCERS
@@ -3045,7 +3180,7 @@ struct legacy_reducer_downcast< reducer< op_min_index<Index, Type, Compare, Alig
#endif
-/** Max reducer type name.
+/** Declares max reducer type name.
*
* This macro expands into the identifier which is the name of the max reducer
* type for a specified numeric type.
@@ -3058,7 +3193,7 @@ struct legacy_reducer_downcast< reducer< op_min_index<Index, Type, Compare, Alig
#define CILK_C_REDUCER_MAX_TYPE(tn) \
__CILKRTS_MKIDENT(cilk_c_reducer_max_,tn)
-/** Declare a max reducer object.
+/** Declares a max reducer object.
*
* This macro expands into a declaration of a max reducer object for a specified numeric
* type. For example:
@@ -3068,7 +3203,7 @@ struct legacy_reducer_downcast< reducer< op_min_index<Index, Type, Compare, Alig
* @param obj The variable name to be used for the declared reducer object.
* @param tn The @ref reducers_c_type_names "numeric type name" specifying the type of the
* reducer.
- * @param v The initial value for the reducer. (A value which can be assigned to the
+ * @param v The initial value for the reducer. (A value which can be assigned to the
* numeric type represented by @a tn.)
*
* @see @ref reducers_c_predefined
@@ -3080,7 +3215,7 @@ struct legacy_reducer_downcast< reducer< op_min_index<Index, Type, Compare, Alig
__CILKRTS_MKIDENT(cilk_c_reducer_max_identity_,tn), \
__cilkrts_hyperobject_noop_destroy, v)
-/** Maximize with a value.
+/** Maximizes with a value.
*
* `CILK_C_REDUCER_MAX_CALC(reducer, v)` sets the current view of the
* reducer to the max of its previous value and a specified new value.
@@ -3100,27 +3235,27 @@ struct legacy_reducer_downcast< reducer< op_min_index<Index, Type, Compare, Alig
/// @cond internal
-/** Declare the max reducer functions for a numeric type.
+/** Declares the max reducer functions for a numeric type.
*
* This macro expands into external function declarations for functions which implement
* the reducer functionality for the max reducer type for a specified numeric type.
*
* @param t The value type of the reducer.
- * @param tn The value “type name” identifier, used to construct the reducer type name,
+ * @param tn The value "type name" identifier, used to construct the reducer type name,
* function names, etc.
*/
#define CILK_C_REDUCER_MAX_DECLARATION(t,tn,id) \
typedef CILK_C_DECLARE_REDUCER(t) CILK_C_REDUCER_MAX_TYPE(tn); \
__CILKRTS_DECLARE_REDUCER_REDUCE(cilk_c_reducer_max,tn,l,r); \
__CILKRTS_DECLARE_REDUCER_IDENTITY(cilk_c_reducer_max,tn);
-
-/** Define the max reducer functions for a numeric type.
+
+/** Defines the max reducer functions for a numeric type.
*
* This macro expands into function definitions for functions which implement the
* reducer functionality for the max reducer type for a specified numeric type.
*
* @param t The value type of the reducer.
- * @param tn The value “type name” identifier, used to construct the reducer type name,
+ * @param tn The value "type name" identifier, used to construct the reducer type name,
* function names, etc.
*/
#define CILK_C_REDUCER_MAX_DEFINITION(t,tn,id) \
@@ -3129,9 +3264,9 @@ struct legacy_reducer_downcast< reducer< op_min_index<Index, Type, Compare, Alig
{ if (*(t*)l < *(t*)r) *(t*)l = *(t*)r; } \
__CILKRTS_DECLARE_REDUCER_IDENTITY(cilk_c_reducer_max,tn) \
{ *(t*)v = id; }
-
+
//@{
-/** @def CILK_C_REDUCER_MAX_INSTANCE
+/** @def CILK_C_REDUCER_MAX_INSTANCE
* @brief Declare or define implementation functions for a reducer type.
*
* In the runtime source file c_reducers.c, the macro `CILK_C_DEFINE_REDUCERS` will be defined, and
@@ -3147,7 +3282,7 @@ struct legacy_reducer_downcast< reducer< op_min_index<Index, Type, Compare, Alig
#endif
//@}
-/* Declare or define an instance of the reducer type and its functions for each
+/* Declare or define an instance of the reducer type and its functions for each
* numeric type.
*/
__CILKRTS_BEGIN_EXTERN_C
@@ -3184,7 +3319,7 @@ __CILKRTS_END_EXTERN_C
#define CILK_C_REDUCER_MAX_INDEX_TYPE(tn) \
__CILKRTS_MKIDENT(cilk_c_reducer_max_index_,tn)
-/** Declare an op_max_index reducer object.
+/** Declares an op_max_index reducer object.
*
* This macro expands into a declaration of a max_index reducer object for a specified
* numeric type. For example:
@@ -3194,7 +3329,7 @@ __CILKRTS_END_EXTERN_C
* @param obj The variable name to be used for the declared reducer object.
* @param tn The @ref reducers_c_type_names "numeric type name" specifying the type of the
* reducer.
- * @param v The initial value for the reducer. (A value which can be assigned to the
+ * @param v The initial value for the reducer. (A value which can be assigned to the
* numeric type represented by @a tn.)
*
* @see @ref reducers_c_predefined
@@ -3206,7 +3341,7 @@ __CILKRTS_END_EXTERN_C
__CILKRTS_MKIDENT(cilk_c_reducer_max_index_identity_,tn), \
__cilkrts_hyperobject_noop_destroy, {0, v})
-/** Maximize with a value.
+/** Maximizes with a value.
*
* `CILK_C_REDUCER_MAX_INDEX_CALC(reducer, i, v)` sets the current view of the
* reducer to the max of its previous value and a specified new value.
@@ -3215,7 +3350,7 @@ __CILKRTS_END_EXTERN_C
* REDUCER_VIEW(reducer) = max_index(REDUCER_VIEW(reducer), v)
*
* If the value of the reducer is changed to @a v, then the index of the reducer is
- * changed to @a i.
+ * changed to @a i.
*
* @param reducer The reducer whose contained value and index are to be updated.
* @param i The index associated with the new value.
@@ -3231,7 +3366,7 @@ __CILKRTS_END_EXTERN_C
/// @cond internal
-/** Declare the max_index view type.
+/** Declares the max_index view type.
*
* The view of a max_index reducer is a structure containing both the
* maximum value for the reducer and the index that was associated with
@@ -3243,13 +3378,13 @@ __CILKRTS_END_EXTERN_C
t value; \
} __CILKRTS_MKIDENT(cilk_c_reducer_max_index_view_,tn)
-/** Declare the max_index reducer functions for a numeric type.
+/** Declares the max_index reducer functions for a numeric type.
*
* This macro expands into external function declarations for functions which implement
* the reducer functionality for the max_index reducer type for a specified numeric type.
*
* @param t The value type of the reducer.
- * @param tn The value “type name” identifier, used to construct the reducer type name,
+ * @param tn The value "type name" identifier, used to construct the reducer type name,
* function names, etc.
*/
#define CILK_C_REDUCER_MAX_INDEX_DECLARATION(t,tn,id) \
@@ -3259,14 +3394,14 @@ __CILKRTS_END_EXTERN_C
CILK_C_REDUCER_MAX_INDEX_TYPE(tn); \
__CILKRTS_DECLARE_REDUCER_REDUCE(cilk_c_reducer_max_index,tn,l,r); \
__CILKRTS_DECLARE_REDUCER_IDENTITY(cilk_c_reducer_max_index,tn);
-
-/** Define the max_index reducer functions for a numeric type.
+
+/** Defines the max_index reducer functions for a numeric type.
*
* This macro expands into function definitions for functions which implement the
* reducer functionality for the max_index reducer type for a specified numeric type.
*
* @param t The value type of the reducer.
- * @param tn The value “type name” identifier, used to construct the reducer type name,
+ * @param tn The value "type name" identifier, used to construct the reducer type name,
* function names, etc.
*/
#define CILK_C_REDUCER_MAX_INDEX_DEFINITION(t,tn,id) \
@@ -3281,9 +3416,9 @@ __CILKRTS_END_EXTERN_C
__CILKRTS_DECLARE_REDUCER_IDENTITY(cilk_c_reducer_max_index,tn) \
{ typedef __CILKRTS_MKIDENT(cilk_c_reducer_max_index_view_,tn) view_t; \
((view_t*)v)->index = 0; ((view_t*)v)->value = id; }
-
+
//@{
-/** @def CILK_C_REDUCER_MAX_INDEX_INSTANCE
+/** @def CILK_C_REDUCER_MAX_INDEX_INSTANCE
* @brief Declare or define implementation functions for a reducer type.
*
* In the runtime source file c_reducers.c, the macro `CILK_C_DEFINE_REDUCERS` will be defined, and
@@ -3299,7 +3434,7 @@ __CILKRTS_END_EXTERN_C
#endif
//@}
-/* Declare or define an instance of the reducer type and its functions for each
+/* Declares or defines an instance of the reducer type and its functions for each
* numeric type.
*/
__CILKRTS_BEGIN_EXTERN_C
@@ -3323,7 +3458,7 @@ __CILKRTS_END_EXTERN_C
/// @endcond
-/** Min reducer type name.
+/** Declares min reducer type name.
*
* This macro expands into the identifier which is the name of the min reducer
* type for a specified numeric type.
@@ -3336,7 +3471,7 @@ __CILKRTS_END_EXTERN_C
#define CILK_C_REDUCER_MIN_TYPE(tn) \
__CILKRTS_MKIDENT(cilk_c_reducer_min_,tn)
-/** Declare a min reducer object.
+/** Declares a min reducer object.
*
* This macro expands into a declaration of a min reducer object for a specified numeric
* type. For example:
@@ -3346,7 +3481,7 @@ __CILKRTS_END_EXTERN_C
* @param obj The variable name to be used for the declared reducer object.
* @param tn The @ref reducers_c_type_names "numeric type name" specifying the type of the
* reducer.
- * @param v The initial value for the reducer. (A value which can be assigned to the
+ * @param v The initial value for the reducer. (A value which can be assigned to the
* numeric type represented by @a tn.)
*
* @see @ref reducers_c_predefined
@@ -3358,7 +3493,7 @@ __CILKRTS_END_EXTERN_C
__CILKRTS_MKIDENT(cilk_c_reducer_min_identity_,tn), \
__cilkrts_hyperobject_noop_destroy, v)
-/** Minimize with a value.
+/** Minimizes with a value.
*
* `CILK_C_REDUCER_MIN_CALC(reducer, v)` sets the current view of the
* reducer to the min of its previous value and a specified new value.
@@ -3378,27 +3513,27 @@ __CILKRTS_END_EXTERN_C
/// @cond internal
-/** Declare the min reducer functions for a numeric type.
+/** Declares the min reducer functions for a numeric type.
*
* This macro expands into external function declarations for functions which implement
* the reducer functionality for the min reducer type for a specified numeric type.
*
* @param t The value type of the reducer.
- * @param tn The value “type name” identifier, used to construct the reducer type name,
+ * @param tn The value "type name" identifier, used to construct the reducer type name,
* function names, etc.
*/
#define CILK_C_REDUCER_MIN_DECLARATION(t,tn,id) \
typedef CILK_C_DECLARE_REDUCER(t) CILK_C_REDUCER_MIN_TYPE(tn); \
__CILKRTS_DECLARE_REDUCER_REDUCE(cilk_c_reducer_min,tn,l,r); \
__CILKRTS_DECLARE_REDUCER_IDENTITY(cilk_c_reducer_min,tn);
-
-/** Define the min reducer functions for a numeric type.
+
+/** Defines the min reducer functions for a numeric type.
*
* This macro expands into function definitions for functions which implement the
* reducer functionality for the min reducer type for a specified numeric type.
*
* @param t The value type of the reducer.
- * @param tn The value “type name” identifier, used to construct the reducer type name,
+ * @param tn The value "type name" identifier, used to construct the reducer type name,
* function names, etc.
*/
#define CILK_C_REDUCER_MIN_DEFINITION(t,tn,id) \
@@ -3407,9 +3542,9 @@ __CILKRTS_END_EXTERN_C
{ if (*(t*)l > *(t*)r) *(t*)l = *(t*)r; } \
__CILKRTS_DECLARE_REDUCER_IDENTITY(cilk_c_reducer_min,tn) \
{ *(t*)v = id; }
-
+
//@{
-/** @def CILK_C_REDUCER_MIN_INSTANCE
+/** @def CILK_C_REDUCER_MIN_INSTANCE
* @brief Declare or define implementation functions for a reducer type.
*
* In the runtime source file c_reducers.c, the macro `CILK_C_DEFINE_REDUCERS` will be defined, and
@@ -3425,7 +3560,7 @@ __CILKRTS_END_EXTERN_C
#endif
//@}
-/* Declare or define an instance of the reducer type and its functions for each
+/* Declares or defines an instance of the reducer type and its functions for each
* numeric type.
*/
__CILKRTS_BEGIN_EXTERN_C
@@ -3449,7 +3584,7 @@ __CILKRTS_END_EXTERN_C
/// @endcond
-/** Min_index reducer type name.
+/** Declares `min_index` reducer type name.
*
* This macro expands into the identifier which is the name of the min_index reducer
* type for a specified numeric type.
@@ -3462,7 +3597,7 @@ __CILKRTS_END_EXTERN_C
#define CILK_C_REDUCER_MIN_INDEX_TYPE(tn) \
__CILKRTS_MKIDENT(cilk_c_reducer_min_index_,tn)
-/** Declare an op_min_index reducer object.
+/** Declares an op_min_index reducer object.
*
* This macro expands into a declaration of a min_index reducer object for a specified
* numeric type. For example:
@@ -3472,7 +3607,7 @@ __CILKRTS_END_EXTERN_C
* @param obj The variable name to be used for the declared reducer object.
* @param tn The @ref reducers_c_type_names "numeric type name" specifying the type of the
* reducer.
- * @param v The initial value for the reducer. (A value which can be assigned to the
+ * @param v The initial value for the reducer. (A value which can be assigned to the
* numeric type represented by @a tn.)
*
* @see @ref reducers_c_predefined
@@ -3484,7 +3619,7 @@ __CILKRTS_END_EXTERN_C
__CILKRTS_MKIDENT(cilk_c_reducer_min_index_identity_,tn), \
__cilkrts_hyperobject_noop_destroy, {0, v})
-/** Minimize with a value.
+/** Minimizes with a value.
*
* `CILK_C_REDUCER_MIN_INDEX_CALC(reducer, i, v)` sets the current view of the
* reducer to the min of its previous value and a specified new value.
@@ -3493,7 +3628,7 @@ __CILKRTS_END_EXTERN_C
* REDUCER_VIEW(reducer) = min_index(REDUCER_VIEW(reducer), v)
*
* If the value of the reducer is changed to @a v, then the index of the reducer is
- * changed to @a i.
+ * changed to @a i.
*
* @param reducer The reducer whose contained value and index are to be updated.
* @param i The index associated with the new value.
@@ -3509,7 +3644,7 @@ __CILKRTS_END_EXTERN_C
/// @cond internal
-/** Declare the min_index view type.
+/** Declares the min_index view type.
*
* The view of a min_index reducer is a structure containing both the
* minimum value for the reducer and the index that was associated with
@@ -3521,13 +3656,13 @@ __CILKRTS_END_EXTERN_C
t value; \
} __CILKRTS_MKIDENT(cilk_c_reducer_min_index_view_,tn)
-/** Declare the min_index reducer functions for a numeric type.
+/** Declares the min_index reducer functions for a numeric type.
*
* This macro expands into external function declarations for functions which implement
* the reducer functionality for the min_index reducer type for a specified numeric type.
*
* @param t The value type of the reducer.
- * @param tn The value “type name” identifier, used to construct the reducer type name,
+ * @param tn The value "type name" identifier, used to construct the reducer type name,
* function names, etc.
*/
#define CILK_C_REDUCER_MIN_INDEX_DECLARATION(t,tn,id) \
@@ -3537,14 +3672,14 @@ __CILKRTS_END_EXTERN_C
CILK_C_REDUCER_MIN_INDEX_TYPE(tn); \
__CILKRTS_DECLARE_REDUCER_REDUCE(cilk_c_reducer_min_index,tn,l,r); \
__CILKRTS_DECLARE_REDUCER_IDENTITY(cilk_c_reducer_min_index,tn);
-
-/** Define the min_index reducer functions for a numeric type.
+
+/** Defines the min_index reducer functions for a numeric type.
*
* This macro expands into function definitions for functions which implement the
* reducer functionality for the min_index reducer type for a specified numeric type.
*
* @param t The value type of the reducer.
- * @param tn The value “type name” identifier, used to construct the reducer type name,
+ * @param tn The value "type name" identifier, used to construct the reducer type name,
* function names, etc.
*/
#define CILK_C_REDUCER_MIN_INDEX_DEFINITION(t,tn,id) \
@@ -3559,10 +3694,10 @@ __CILKRTS_END_EXTERN_C
__CILKRTS_DECLARE_REDUCER_IDENTITY(cilk_c_reducer_min_index,tn) \
{ typedef __CILKRTS_MKIDENT(cilk_c_reducer_min_index_view_,tn) view_t; \
((view_t*)v)->index = 0; ((view_t*)v)->value = id; }
-
+
//@{
-/** @def CILK_C_REDUCER_MIN_INDEX_INSTANCE
- * @brief Declare or define implementation functions for a reducer type.
+/** @def CILK_C_REDUCER_MIN_INDEX_INSTANCE
+ * @brief Declares or defines implementation functions for a reducer type.
*
* In the runtime source file c_reducers.c, the macro `CILK_C_DEFINE_REDUCERS` will be defined, and
* this macro will generate reducer implementation functions. Everywhere else, `CILK_C_DEFINE_REDUCERS`
@@ -3577,7 +3712,7 @@ __CILKRTS_END_EXTERN_C
#endif
//@}
-/* Declare or define an instance of the reducer type and its functions for each
+/* Declares or defines an instance of the reducer type and its functions for each
* numeric type.
*/
__CILKRTS_BEGIN_EXTERN_C
@@ -3603,4 +3738,4 @@ __CILKRTS_END_EXTERN_C
//@}
-#endif // defined REDUCER_MAX_H_INCLUDED
+#endif // defined REDUCER_MIN_MAX_H_INCLUDED
diff --git a/libcilkrts/include/cilk/reducer_opadd.h b/libcilkrts/include/cilk/reducer_opadd.h
index 4b7a83f845d..46d4b6e9b57 100644
--- a/libcilkrts/include/cilk/reducer_opadd.h
+++ b/libcilkrts/include/cilk/reducer_opadd.h
@@ -1,10 +1,8 @@
/* reducer_opadd.h -*- C++ -*-
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -19,7 +17,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -32,6 +29,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
*/
/** @file reducer_opadd.h
@@ -55,9 +66,9 @@
*
* @ingroup Reducers
*
- * You should be familiar with @ref pagereducers "Cilk reducers", described in
- * file `reducers.md`, and particularly with @ref reducers_using, before trying
- * to use the information in this file.
+ * You should be familiar with @ref pagereducers "Intel(R) Cilk(TM) Plus reducers",
+ * described in file `reducers.md`, and particularly with @ref reducers_using,
+ * before trying to use the information in this file.
*
* @section redopadd_usage Usage Example
*
@@ -78,11 +89,11 @@
* @subsection redopadd_monoid_operator Operator
*
* The operator of an addition reducer is the addition operator, defined by
- * the “`+`” binary operator on `Type`.
+ * the "`+`" binary operator on `Type`.
*
* @subsection redopadd_monoid_identity Identity
*
- * The identity value of the reducer is the numeric value “`0`”. This is
+ * The identity value of the reducer is the numeric value "`0`". This is
* expected to be the value of the default constructor `Type()`.
*
* @section redopadd_operations Operations
@@ -130,22 +141,22 @@
* @section redopadd_floating_point Issues with Floating-Point Types
*
* Because of precision and round-off issues, floating-point addition is not
- * really associative. For example, `(1e30 + -1e30) + 1 == 1`, but
+ * really associative. For example, `(1e30 + -1e30) + 1 == 1`, but
* `1e30 + (-1e30 + 1) == 0`.
*
- * In many cases, this won’t matter, but computations which have been
+ * In many cases, this won't matter, but computations which have been
* carefully ordered to control round-off errors may not deal well with
* being reassociated. In general, you should be sure to understand the
- * floating-point behavior of your program before doing any transformation
- * that will reassociate its computations.
+ * floating-point behavior of your program before doing any transformation
+ * that will reassociate its computations.
*
* @section redopadd_types Type and Operator Requirements
*
* `Type` must be `Copy Constructible`, `Default Constructible`, and
* `Assignable`.
*
- * The operator “`+=`” must be defined on `Type`, with `x += a` having the
- * same meaning as `x = x + a`. In addition, if the code uses the “`-=`”,
+ * The operator "`+=`" must be defined on `Type`, with `x += a` having the
+ * same meaning as `x = x + a`. In addition, if the code uses the "`-=`",
* pre-increment, post-increment, pre-decrement, or post-decrement operators,
* then the corresponding operators must be defined on `Type`.
*
@@ -174,18 +185,18 @@ namespace cilk {
/** The addition reducer view class.
*
- * This is the view class for reducers created with
- * `cilk::reducer< cilk::op_add<Type> >`. It holds the accumulator variable
- * for the reduction, and allows only addition and subtraction operations to
+ * This is the view class for reducers created with
+ * `cilk::reducer< cilk::op_add<Type> >`. It holds the accumulator variable
+ * for the reduction, and allows only addition and subtraction operations to
* be performed on it.
*
- * @note The reducer “dereference” operation (`reducer::operator *()`)
- * yields a reference to the view. Thus, for example, the view class’s
+ * @note The reducer "dereference" operation (`reducer::operator *()`)
+ * yields a reference to the view. Thus, for example, the view class's
* `+=` operation would be used in an expression like `*r += a`, where
* `r` is an op_add reducer variable.
*
- * @tparam Type The type of the contained accumulator variable. This will
- * be the value type of a monoid_with_view that is
+ * @tparam Type The type of the contained accumulator variable. This will
+ * be the value type of a monoid_with_view that is
* instantiated with this view.
*
* @see ReducersAdd
@@ -197,19 +208,19 @@ template <typename Type>
class op_add_view : public scalar_view<Type>
{
typedef scalar_view<Type> base;
-
+
public:
- /** Class to represent the right-hand side of
+ /** Class to represent the right-hand side of
* `*reducer = *reducer ± value`.
*
* The only assignment operator for the op_add_view class takes an
* rhs_proxy as its operand. This results in the syntactic restriction
* that the only expressions that can be assigned to an op_add_view are
- * ones which generate an rhs_proxy — that is, expressions of the form
+ * ones which generate an rhs_proxy - that is, expressions of the form
* `op_add_view ± value ... ± value`.
*
* @warning
- * The lhs and rhs views in such an assignment must be the same;
+ * The lhs and rhs views in such an assignment must be the same;
* otherwise, the behavior will be undefined. (I.e., `v1 = v1 + x` is
* legal; `v1 = v2 + x` is illegal.) This condition will be checked with a
* runtime assertion when compiled in debug mode.
@@ -222,7 +233,7 @@ public:
const op_add_view* m_view;
Type m_value;
- // Constructor is invoked only from op_add_view::operator+() and
+ // Constructor is invoked only from op_add_view::operator+() and
// op_add_view::operator-().
//
rhs_proxy(const op_add_view* view, const Type& value) :
@@ -232,13 +243,13 @@ public:
rhs_proxy(); // Disable default constructor
public:
- //@{
- /** Add or subtract an additional rhs value. If `v` is an op_add_view
- * and `a1` is a value, then the expression `v + a1` invokes the view’s
- * `operator+()` to create an rhs_proxy for `(v, a1)`; then
- * `v + a1 + a2` invokes the rhs_proxy’s `operator+()` to create a new
+ ///@{
+ /** Adds or subtracts an additional rhs value. If `v` is an op_add_view
+ * and `a1` is a value, then the expression `v + a1` invokes the view's
+ * `operator+()` to create an rhs_proxy for `(v, a1)`; then
+ * `v + a1 + a2` invokes the rhs_proxy's `operator+()` to create a new
* rhs_proxy for `(v, a1+a2)`. This allows the right-hand side of an
- * assignment to be not just `view ± value`, but
+ * assignment to be not just `view ± value`, but
* `view ± value ± value ... ± value`. The effect is that
*
* v = v ± a1 ± a2 ... ± an;
@@ -249,11 +260,11 @@ public:
*/
rhs_proxy& operator+(const Type& x) { m_value += x; return *this; }
rhs_proxy& operator-(const Type& x) { m_value -= x; return *this; }
- //@}
+ ///@}
};
-
- /** Default/identity constructor. This constructor initializes the
+
+ /** Default/identity constructor. This constructor initializes the
* contained value to `Type()`, which is expected to be the identity value
* for addition on `Type`.
*/
@@ -262,8 +273,8 @@ public:
/** Construct with a specified initial value.
*/
explicit op_add_view(const Type& v) : base(v) {}
-
- /** Reduction operation.
+
+ /** Reduces the views of two strands.
*
* This function is invoked by the @ref op_add monoid to combine the views
* of two strands when the right strand merges with the left one. It adds
@@ -284,13 +295,13 @@ public:
* These functions support the various syntaxes for incrementing or
* decrementing the accumulator variable contained in the view.
*/
- //@{
+ ///@{
- /** Increment the accumulator variable by @a x.
+ /** Increments the accumulator variable by @a x.
*/
op_add_view& operator+=(const Type& x) { this->m_value += x; return *this; }
- /** Decrement the accumulator variable by @a x.
+ /** Decrements the accumulator variable by @a x.
*/
op_add_view& operator-=(const Type& x) { this->m_value -= x; return *this; }
@@ -298,7 +309,7 @@ public:
*/
op_add_view& operator++() { ++this->m_value; return *this; }
- /** Post-increment.
+ /** Post-increments.
*
* @note Conventionally, post-increment operators return the old value
* of the incremented variable. However, reducer views do not
@@ -307,11 +318,11 @@ public:
*/
void operator++(int) { this->m_value++; }
- /** Pre-decrement.
+ /** Pre-decrements.
*/
op_add_view& operator--() { --this->m_value; return *this; }
- /** Post-decrement.
+ /** Post-decrements.
*
* @note Conventionally, post-decrement operators return the old value
* of the decremented variable. However, reducer views do not
@@ -320,19 +331,19 @@ public:
*/
void operator--(int) { this->m_value--; }
- /** Create an object representing `*this + x`.
+ /** Creates an object representing `*this + x`.
*
* @see rhs_proxy
*/
rhs_proxy operator+(const Type& x) const { return rhs_proxy(this, x); }
- /** Create an object representing `*this - x`.
+ /** Creates an object representing `*this - x`.
*
* @see rhs_proxy
*/
rhs_proxy operator-(const Type& x) const { return rhs_proxy(this, -x); }
- /** Assign the result of a `view ± value` expression to the view. Note that
+ /** Assigns the result of a `view ± value` expression to the view. Note that
* this is the only assignment operator for this class.
*
* @see rhs_proxy
@@ -342,12 +353,12 @@ public:
this->m_value += rhs.m_value;
return *this;
}
-
- //@}
+
+ ///@}
};
-/** Monoid class for addition reductions. Instantiate the cilk::reducer
+/** Monoid class for addition reductions. Instantiate the cilk::reducer
* template class with an op_add monoid to create an addition reducer class.
* For example, to compute
* the sum of a set of `int` values:
@@ -356,10 +367,10 @@ public:
*
* @tparam Type The reducer value type.
* @tparam Align If `false` (the default), reducers instantiated on this
- * monoid will be naturally aligned (the Cilk library 1.0
+ * monoid will be naturally aligned (the Intel Cilk Plus library 1.0
* behavior). If `true`, reducers instantiated on this monoid
- * will be cache-aligned for binary compatibility with
- * reducers in Cilk library version 0.9.
+ * will be cache-aligned for binary compatibility with
+ * reducers in Intel Cilk Plus library version 0.9.
*
* @see ReducersAdd
* @see op_add_view
@@ -378,13 +389,13 @@ struct op_add : public monoid_with_view<op_add_view<Type>, Align> {};
* value can be added to a `%reducer_opadd` with `r += a`.
*
* @deprecated Users are strongly encouraged to use `reducer<monoid>`
- * reducers rather than the old wrappers like reducer_opadd.
+ * reducers rather than the old wrappers like reducer_opadd.
* The `reducer<monoid>` reducers show the reducer/monoid/view
* architecture more clearly, are more consistent in their
* implementation, and present a simpler model for new
* user-implemented reducers.
*
- * @note Implicit conversions are provided between `%reducer_opadd`
+ * @note Implicit conversions are provided between `%reducer_opadd`
* and `reducer<%op_add>`. This allows incremental code
* conversion: old code that used `%reducer_opadd` can pass a
* `%reducer_opadd` to a converted function that now expects a
@@ -408,8 +419,8 @@ class reducer_opadd : public reducer< op_add<Type, true> >
public:
/// The view type for the reducer.
typedef typename base::view_type view_type;
-
- /// The view’s rhs proxy type.
+
+ /// The view's rhs proxy type.
typedef typename view_type::rhs_proxy rhs_proxy;
/// The view type for the reducer.
@@ -420,8 +431,8 @@ class reducer_opadd : public reducer< op_add<Type, true> >
/** @name Constructors
*/
- //@{
-
+ ///@{
+
/** Default (identity) constructor.
*
* Constructs the wrapper with the default initial value of `Type()`.
@@ -433,29 +444,29 @@ class reducer_opadd : public reducer< op_add<Type, true> >
* Constructs the wrapper with a specified initial value.
*/
explicit reducer_opadd(const Type& initial_value) : base(initial_value) {}
-
- //@}
+
+ ///@}
/** @name Forwarded functions
* @details Functions that update the contained accumulator variable are
* simply forwarded to the contained @ref op_add_view. */
- //@{
-
+ ///@{
+
/// @copydoc op_add_view::operator+=(const Type&)
reducer_opadd& operator+=(const Type& x) { view() += x; return *this; }
-
+
/// @copydoc op_add_view::operator-=(const Type&)
reducer_opadd& operator-=(const Type& x) { view() -= x; return *this; }
-
+
/// @copydoc op_add_view::operator++()
reducer_opadd& operator++() { ++view(); return *this; }
-
+
/// @copydoc op_add_view::operator++(int)
void operator++(int) { view()++; }
-
+
/// @copydoc op_add_view::operator-\-()
reducer_opadd& operator--() { --view(); return *this; }
-
+
/// @copydoc op_add_view::operator-\-(int)
void operator--(int) { view()--; }
@@ -463,26 +474,26 @@ class reducer_opadd : public reducer< op_add<Type, true> >
// reducer_opadd::operator-() have different behavior and a different
// return type than this definition. The legacy version is defined as a
// member function, so this new version is defined as a free function to
- // give it a different signature, so that they won’t end up sharing a
+ // give it a different signature, so that they won't end up sharing a
// single object file entry.
/// @copydoc op_add_view::operator+(const Type&) const
friend rhs_proxy operator+(const reducer_opadd& r, const Type& x)
- {
- return r.view() + x;
+ {
+ return r.view() + x;
}
/// @copydoc op_add_view::operator-(const Type&) const
friend rhs_proxy operator-(const reducer_opadd& r, const Type& x)
- {
- return r.view() - x;
+ {
+ return r.view() - x;
}
/// @copydoc op_add_view::operator=(const rhs_proxy&)
- reducer_opadd& operator=(const rhs_proxy& temp)
+ reducer_opadd& operator=(const rhs_proxy& temp)
{
view() = temp;
- return *this;
+ return *this;
}
- //@}
+ ///@}
/** @name Dereference
* @details Dereferencing a wrapper is a no-op. It simply returns the
@@ -501,25 +512,25 @@ class reducer_opadd : public reducer< op_add<Type, true> >
* // operator += is a wrapper member function that
* // calls the corresponding view function
*/
- //@{
+ ///@{
reducer_opadd& operator*() { return *this; }
reducer_opadd const& operator*() const { return *this; }
reducer_opadd* operator->() { return this; }
reducer_opadd const* operator->() const { return this; }
- //@}
-
+ ///@}
+
/** @name Upcast
- * @details In Cilk library 0.9, reducers were always cache-aligned. In
- * library 1.0, reducer cache alignment is optional. By default, reducers
- * are unaligned (i.e., just naturally aligned), but legacy wrappers
- * inherit from cache-aligned reducers for binary compatibility.
+ * @details In Intel Cilk Plus library 0.9, reducers were always cache-aligned.
+ * In library 1.0, reducer cache alignment is optional. By default,
+ * reducers are unaligned (i.e., just naturally aligned), but legacy
+ * wrappers inherit from cache-aligned reducers for binary compatibility.
*
* This means that a wrapper will automatically be upcast to its aligned
* reducer base class. The following conversion operators provide
* pseudo-upcasts to the corresponding unaligned reducer class.
*/
- //@{
+ ///@{
operator reducer< op_add<Type, false> >& ()
{
return *reinterpret_cast< reducer< op_add<Type, false> >* >(this);
@@ -528,15 +539,15 @@ class reducer_opadd : public reducer< op_add<Type, true> >
{
return *reinterpret_cast< const reducer< op_add<Type, false> >* >(this);
}
- //@}
+ ///@}
};
/// @cond internal
/** Metafunction specialization for reducer conversion.
*
- * This specialization of the @ref legacy_reducer_downcast template class
- * defined in reducer.h causes the `reducer< op_add<Type> >` class to have an
- * `operator reducer_opadd<Type>& ()` conversion operator that statically
+ * This specialization of the @ref legacy_reducer_downcast template class
+ * defined in reducer.h causes the `reducer< op_add<Type> >` class to have an
+ * `operator reducer_opadd<Type>& ()` conversion operator that statically
* downcasts the `reducer<op_add>` to the corresponding `reducer_opadd` type.
* (The reverse conversion, from `reducer_opadd` to `reducer<op_add>`, is just
* an upcast, which is provided for free by the language.)
@@ -557,20 +568,20 @@ struct legacy_reducer_downcast<reducer<op_add<Type, Align> > >
/** @ingroup ReducersAdd
*/
-//@{
+///@{
/** @name C Language Reducer Macros
*
- * These macros are used to declare and work with numeric op_add reducers in
+ * These macros are used to declare and work with numeric op_add reducers in
* C code.
*
* @see @ref page_reducers_in_c
*/
- //@{
-
+ ///@{
+
__CILKRTS_BEGIN_EXTERN_C
-/** Opadd reducer type name.
+/** Declares opadd reducer type name.
*
* This macro expands into the identifier which is the name of the op_add
* reducer type for a specified numeric type.
@@ -584,7 +595,7 @@ __CILKRTS_BEGIN_EXTERN_C
#define CILK_C_REDUCER_OPADD_TYPE(tn) \
__CILKRTS_MKIDENT(cilk_c_reducer_opadd_,tn)
-/** Declare an op_add reducer object.
+/** Declares an op_add reducer object.
*
* This macro expands into a declaration of an op_add reducer object for a
* specified numeric type. For example:
@@ -609,29 +620,29 @@ __CILKRTS_BEGIN_EXTERN_C
/// @cond internal
-/** Declare the op_add reducer functions for a numeric type.
+/** Declares the op_add reducer functions for a numeric type.
*
* This macro expands into external function declarations for functions which
* implement the reducer functionality for the op_add reducer type for a
* specified numeric type.
*
* @param t The value type of the reducer.
- * @param tn The value “type name” identifier, used to construct the reducer
+ * @param tn The value "type name" identifier, used to construct the reducer
* type name, function names, etc.
*/
#define CILK_C_REDUCER_OPADD_DECLARATION(t,tn) \
typedef CILK_C_DECLARE_REDUCER(t) CILK_C_REDUCER_OPADD_TYPE(tn); \
__CILKRTS_DECLARE_REDUCER_REDUCE(cilk_c_reducer_opadd,tn,l,r); \
__CILKRTS_DECLARE_REDUCER_IDENTITY(cilk_c_reducer_opadd,tn);
-
-/** Define the op_add reducer functions for a numeric type.
+
+/** Defines the op_add reducer functions for a numeric type.
*
* This macro expands into function definitions for functions which implement
* the reducer functionality for the op_add reducer type for a specified
* numeric type.
*
* @param t The value type of the reducer.
- * @param tn The value “type name” identifier, used to construct the reducer
+ * @param tn The value "type name" identifier, used to construct the reducer
* type name, function names, etc.
*/
#define CILK_C_REDUCER_OPADD_DEFINITION(t,tn) \
@@ -640,13 +651,13 @@ __CILKRTS_BEGIN_EXTERN_C
{ *(t*)l += *(t*)r; } \
__CILKRTS_DECLARE_REDUCER_IDENTITY(cilk_c_reducer_opadd,tn) \
{ *(t*)v = 0; }
-
-//@{
-/** @def CILK_C_REDUCER_OPADD_INSTANCE
- * @brief Declare or define implementation functions for a reducer type.
+
+///@{
+/** @def CILK_C_REDUCER_OPADD_INSTANCE
+ * @brief Declares or defines implementation functions for a reducer type.
*
* In the runtime source file c_reducers.c, the macro `CILK_C_DEFINE_REDUCERS`
- * will be defined, and this macro will generate reducer implementation
+ * will be defined, and this macro will generate reducer implementation
* functions. Everywhere else, `CILK_C_DEFINE_REDUCERS` will be undefined,
* and this macro will expand into external declarations for the functions.
*/
@@ -657,9 +668,9 @@ __CILKRTS_BEGIN_EXTERN_C
# define CILK_C_REDUCER_OPADD_INSTANCE(t,tn) \
CILK_C_REDUCER_OPADD_DECLARATION(t,tn)
#endif
-//@}
+///@}
-/* Declare or define an instance of the reducer type and its functions for each
+/* Declares or defines an instance of the reducer type and its functions for each
* numeric type.
*/
CILK_C_REDUCER_OPADD_INSTANCE(char, char)
@@ -683,8 +694,8 @@ CILK_C_REDUCER_OPADD_INSTANCE(long double, longdouble)
__CILKRTS_END_EXTERN_C
-//@}
+///@}
-//@}
+///@}
#endif /* REDUCER_OPADD_H_INCLUDED */
diff --git a/libcilkrts/include/cilk/reducer_opand.h b/libcilkrts/include/cilk/reducer_opand.h
index 8a086c91818..44d537d4f36 100644
--- a/libcilkrts/include/cilk/reducer_opand.h
+++ b/libcilkrts/include/cilk/reducer_opand.h
@@ -1,10 +1,8 @@
/* reducer_opand.h -*- C++ -*-
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -19,7 +17,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -32,11 +29,25 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
*/
/** @file reducer_opand.h
*
- * @brief Defines classes for doing parallel bitwise and reductions.
+ * @brief Defines classes for doing parallel bitwise AND reductions.
*
* @ingroup ReducersAnd
*
@@ -48,16 +59,16 @@
#include <cilk/reducer.h>
-/** @defgroup ReducersAnd Bitwise And Reducers
+/** @defgroup ReducersAnd Bitwise AND Reducers
*
- * Bitwise and reducers allow the computation of the bitwise and of a set of
+ * Bitwise AND reducers allow the computation of the bitwise AND of a set of
* values in parallel.
*
* @ingroup Reducers
*
- * You should be familiar with @ref pagereducers "Cilk reducers", described in
- * file `reducers.md`, and particularly with @ref reducers_using, before trying
- * to use the information in this file.
+ * You should be familiar with @ref pagereducers "Intel(R) Cilk(TM) Plus reducers",
+ * described in file `reducers.md`, and particularly with @ref reducers_using,
+ * before trying to use the information in this file.
*
* @section redopand_usage Usage Example
*
@@ -72,19 +83,18 @@
*
* @subsection redopand_monoid_values Value Set
*
- * The value set of a bitwise and reducer is the set of values of `Type`,
+ * The value set of a bitwise AND reducer is the set of values of `Type`,
* which is expected to be a builtin integer type which has a representation
* as a sequence of bits (or something like it, such as `bool` or
* `std::bitset`).
*
* @subsection redopand_monoid_operator Operator
*
- * The operator of a bitwise and reducer is the bitwise and operator, defined
- * by the “`&`” binary operator on `Type`.
+ * The bitwise AND operator is defined by the "`&`" binary operator on `Type`.
*
* @subsection redopand_monoid_identity Identity
*
- * The identity value of the reducer is the value whose representation
+ * The identity value of the reducer is the value whose representation
* contains all 1-bits. This is expected to be the value of the expression
* `~Type()` (i.e., the bitwise negation operator applied to the default value
* of the value type).
@@ -106,7 +116,7 @@
*
* @subsection redopand_initial Initial Values
*
- * If a bitwise and reducer is constructed without an explicit initial value,
+ * If a bitwise AND reducer is constructed without an explicit initial value,
* then its initial value will be its identity value, as long as `Type`
* satisfies the requirements of @ref redopand_types.
*
@@ -121,17 +131,17 @@
* `Type` must be `Copy Constructible`, `Default Constructible`, and
* `Assignable`.
*
- * The operator “`&=`” must be defined on `Type`, with `x &= a` having the
+ * The operator "`&=`" must be defined on `Type`, with `x &= a` having the
* same meaning as `x = x & a`.
*
* The expression `~ Type()` must be a valid expression which yields the
* identity value (the value of `Type` whose representation consists of all
* 1-bits).
*
- * @section redopand_in_c Bitwise And Reducers in C
+ * @section redopand_in_c Bitwise AND Reducers in C
*
* The @ref CILK_C_REDUCER_OPAND and @ref CILK_C_REDUCER_OPAND_TYPE macros can
- * be used to do bitwise and reductions in C. For example:
+ * be used to do bitwise AND reductions in C. For example:
*
* CILK_C_REDUCER_OPAND(r, uint, ~0);
* CILK_C_REGISTER_REDUCER(r);
@@ -148,14 +158,14 @@
namespace cilk {
-/** The bitwise and reducer view class.
+/** The bitwise AND reducer view class.
*
- * This is the view class for reducers created with
- * `cilk::reducer< cilk::op_and<Type> >`. It holds the accumulator variable
- * for the reduction, and allows only `and` operations to be performed on it.
+ * This is the view class for reducers created with
+ * `cilk::reducer< cilk::op_and<Type> >`. It holds the accumulator variable
+ * for the reduction, and allows only AND operations to be performed on it.
*
- * @note The reducer “dereference” operation (`reducer::operator *()`)
- * yields a reference to the view. Thus, for example, the view class’s
+ * @note The reducer "dereference" operation (`reducer::operator *()`)
+ * yields a reference to the view. Thus, for example, the view class's
* `&=` operation would be used in an expression like `*r &= a`, where
* `r` is an opmod reducer variable.
*
@@ -172,18 +182,18 @@ template <typename Type>
class op_and_view : public scalar_view<Type>
{
typedef scalar_view<Type> base;
-
+
public:
/** Class to represent the right-hand side of `*reducer = *reducer & value`.
*
* The only assignment operator for the op_and_view class takes an
- * rhs_proxy as its operand. This results in the syntactic restriction
+ * rhs_proxy as its operand. This results in the syntactic restriction
* that the only expressions that can be assigned to an op_and_view are
- * ones which generate an rhs_proxy — that is, expressions of the form
+ * ones which generate an rhs_proxy - that is, expressions of the form
* `op_and_view & value ... & value`.
*
* @warning
- * The lhs and rhs views in such an assignment must be the same;
+ * The lhs and rhs views in such an assignment must be the same;
* otherwise, the behavior will be undefined. (I.e., `v1 = v1 & x` is
* legal; `v1 = v2 & x` is illegal.) This condition will be checked with
* a runtime assertion when compiled in debug mode.
@@ -205,12 +215,12 @@ public:
rhs_proxy(); // Disable default constructor
public:
- /** Bitwise and with an additional rhs value. If `v` is an op_and_view
+ /** Bitwise AND with an additional `rhs` value. If `v` is an op_and_view
* and `a1` is a value, then the expression `v & a1` invokes the
- * view’s `operator&()` to create an rhs_proxy for `(v, a1)`; then
- * `v & a1 & a2` invokes the rhs_proxy’s `operator&()` to create a new
+ * view's `operator&()` to create an rhs_proxy for `(v, a1)`; then
+ * `v & a1 & a2` invokes the rhs_proxy's `operator&()` to create a new
* rhs_proxy for `(v, a1&a2)`. This allows the right-hand side of an
- * assignment to be not just `view & value`, but
+ * assignment to be not just `view & value`, but
* `view & value & value ... & value`. The effect is that
*
* v = v & a1 & a2 ... & an;
@@ -231,13 +241,13 @@ public:
/** Construct with a specified initial value.
*/
explicit op_and_view(const Type& v) : base(v) {}
-
-
- /** Reduction operation.
+
+
+ /** Reduces the views of two strands.
*
* This function is invoked by the @ref op_and monoid to combine the views
* of two strands when the right strand merges with the left one. It
- * “ands” the value contained in the left-strand view with the value
+ * "ANDs" the value contained in the left-strand view with the value
* contained in the right-strand view, and leaves the value in the
* right-strand view undefined.
*
@@ -248,25 +258,25 @@ public:
* reduce operation.
*/
void reduce(op_and_view* right) { this->m_value &= right->m_value; }
-
+
/** @name Accumulator variable updates.
*
- * These functions support the various syntaxes for “anding” the
+ * These functions support the various syntaxes for "ANDing" the
* accumulator variable contained in the view with some value.
*/
- //@{
+ ///@{
- /** And the accumulator variable with @a x.
+ /** Performs AND between the accumulator variable and @a x.
*/
op_and_view& operator&=(const Type& x) { this->m_value &= x; return *this; }
- /** Create an object representing `*this & x`.
+ /** Creates an object representing `*this & x`.
*
* @see rhs_proxy
*/
rhs_proxy operator&(const Type& x) const { return rhs_proxy(this, x); }
- /** Assign the result of a `view & value` expression to the view. Note that
+ /** Assigns the result of a `view & value` expression to the view. Note that
* this is the only assignment operator for this class.
*
* @see rhs_proxy
@@ -276,23 +286,23 @@ public:
this->m_value &= rhs.m_value;
return *this;
}
-
- //@}
+
+ ///@}
};
-/** Monoid class for bitwise and reductions. Instantiate the cilk::reducer
- * template class with an op_and monoid to create a bitwise and reducer
- * class. For example, to compute the bitwise and of a set of `unsigned long`
+/** Monoid class for bitwise AND reductions. Instantiate the cilk::reducer
+ * template class with an op_and monoid to create a bitwise AND reducer
+ * class. For example, to compute the bitwise AND of a set of `unsigned long`
* values:
*
* cilk::reducer< cilk::op_and<unsigned long> > r;
*
* @tparam Type The reducer value type.
* @tparam Align If `false` (the default), reducers instantiated on this
- * monoid will be naturally aligned (the Cilk library 1.0
+ * monoid will be naturally aligned (the Intel Cilk Plus library 1.0
* behavior). If `true`, reducers instantiated on this monoid
- * will be cache-aligned for binary compatibility with
- * reducers in Cilk library version 0.9.
+ * will be cache-aligned for binary compatibility with
+ * reducers in Intel Cilk Plus library version 0.9.
*
* @see ReducersAnd
* @see op_and_view
@@ -302,22 +312,22 @@ public:
template <typename Type, bool Align = false>
struct op_and : public monoid_with_view<op_and_view<Type>, Align> {};
-/** Deprecated bitwise and reducer class.
+/** Deprecated bitwise AND reducer class.
*
* reducer_opand is the same as @ref reducer<@ref op_and>, except that
* reducer_opand is a proxy for the contained view, so that accumulator
* variable update operations can be applied directly to the reducer. For
- * example, a value is anded with a `reducer<%op_and>` with `*r &= a`, but a
- * value can be anded with a `%reducer_opand` with `r &= a`.
+ * example, a value is "ANDed" with a `reducer<%op_and>` with `*r &= a`, but a
+ * value can be "ANDed" with a `%reducer_opand` with `r &= a`.
*
* @deprecated Users are strongly encouraged to use `reducer<monoid>`
- * reducers rather than the old wrappers like reducer_opand.
+ * reducers rather than the old wrappers like reducer_opand.
* The `reducer<monoid>` reducers show the reducer/monoid/view
* architecture more clearly, are more consistent in their
* implementation, and present a simpler model for new
* user-implemented reducers.
*
- * @note Implicit conversions are provided between `%reducer_opand`
+ * @note Implicit conversions are provided between `%reducer_opand`
* and `reducer<%op_and>`. This allows incremental code
* conversion: old code that used `%reducer_opand` can pass a
* `%reducer_opand` to a converted function that now expects a
@@ -341,20 +351,20 @@ class reducer_opand : public reducer< op_and<Type, true> >
public:
/// The view type for the reducer.
typedef typename base::view_type view_type;
-
- /// The view’s rhs proxy type.
+
+ /// The view's rhs proxy type.
typedef typename view_type::rhs_proxy rhs_proxy;
-
+
/// The view type for the reducer.
typedef view_type View;
/// The monoid type for the reducer.
typedef typename base::monoid_type Monoid;
-
+
/** @name Constructors
*/
- //@{
-
+ ///@{
+
/** Default constructor.
*
* Constructs the wrapper with the default initial value of `Type()`
@@ -367,13 +377,13 @@ public:
* Constructs the wrapper with a specified initial value.
*/
explicit reducer_opand(const Type& initial_value) : base(initial_value) {}
-
- //@}
+
+ ///@}
/** @name Forwarded functions
* @details Functions that update the contained accumulator variable are
* simply forwarded to the contained @ref op_and_view. */
- //@{
+ ///@{
/// @copydoc op_and_view::operator&=(const Type&)
reducer_opand& operator&=(const Type& x)
@@ -381,26 +391,26 @@ public:
view() &= x;
return *this;
}
-
+
// The legacy definition of reducer_opand::operator&() has different
// behavior and a different return type than this definition. The legacy
// version is defined as a member function, so this new version is defined
- // as a free function to give it a different signature, so that they won’t
+ // as a free function to give it a different signature, so that they won't
// end up sharing a single object file entry.
-
+
/// @copydoc op_and_view::operator&(const Type&) const
friend rhs_proxy operator&(const reducer_opand& r, const Type& x)
- {
- return r.view() & x;
+ {
+ return r.view() & x;
}
/// @copydoc op_and_view::operator=(const rhs_proxy&)
- reducer_opand& operator=(const rhs_proxy& temp)
- {
+ reducer_opand& operator=(const rhs_proxy& temp)
+ {
view() = temp;
- return *this;
+ return *this;
}
- //@}
+ ///@}
/** @name Dereference
* @details Dereferencing a wrapper is a no-op. It simply returns the
@@ -419,25 +429,25 @@ public:
* // operator &= is a wrapper member function that
* // calls the corresponding view function
*/
- //@{
+ ///@{
reducer_opand& operator*() { return *this; }
reducer_opand const& operator*() const { return *this; }
reducer_opand* operator->() { return this; }
reducer_opand const* operator->() const { return this; }
- //@}
-
+ ///@}
+
/** @name Upcast
- * @details In Cilk library 0.9, reducers were always cache-aligned. In
- * library 1.0, reducer cache alignment is optional. By default, reducers
- * are unaligned (i.e., just naturally aligned), but legacy wrappers
- * inherit from cache-aligned reducers for binary compatibility.
+ * @details In Intel Cilk Plus library 0.9, reducers were always cache-aligned.
+ * In library 1.0, reducer cache alignment is optional. By default,
+ * reducers are unaligned (i.e., just naturally aligned), but legacy
+ * wrappers inherit from cache-aligned reducers for binary compatibility.
*
* This means that a wrapper will automatically be upcast to its aligned
* reducer base class. The following conversion operators provide
* pseudo-upcasts to the corresponding unaligned reducer class.
*/
- //@{
+ ///@{
operator reducer< op_and<Type, false> >& ()
{
return *reinterpret_cast< reducer< op_and<Type, false> >* >(this);
@@ -446,14 +456,14 @@ public:
{
return *reinterpret_cast< const reducer< op_and<Type, false> >* >(this);
}
- //@}
+ ///@}
};
/// @cond internal
/** Metafunction specialization for reducer conversion.
*
- * This specialization of the @ref legacy_reducer_downcast template class
- * defined in reducer.h causes the `reducer< op_and<Type> >` class to have an
+ * This specialization of the @ref legacy_reducer_downcast template class
+ * defined in reducer.h causes the `reducer< op_and<Type> >` class to have an
* `operator reducer_opand<Type>& ()` conversion operator that statically
* downcasts the `reducer<op_and>` to the corresponding `reducer_opand` type.
* (The reverse conversion, from `reducer_opand` to `reducer<op_and>`, is just
@@ -475,7 +485,7 @@ struct legacy_reducer_downcast<reducer<op_and<Type, Align> > >
/** @ingroup ReducersAdd
*/
-//@{
+///@{
/** @name C language reducer macros
*
@@ -483,13 +493,13 @@ struct legacy_reducer_downcast<reducer<op_and<Type, Align> > >
*
* @see @ref page_reducers_in_c
*/
- //@{
-
+ ///@{
+
__CILKRTS_BEGIN_EXTERN_C
-/** Opand reducer type name.
+/** Declares `opand` reducer type name.
*
- * This macro expands into the identifier which is the name of the op_and
+ * This macro expands into the identifier which is the name of the op_and
* reducer type for a specified numeric type.
*
* @param tn The @ref reducers_c_type_names "numeric type name" specifying
@@ -501,7 +511,7 @@ __CILKRTS_BEGIN_EXTERN_C
#define CILK_C_REDUCER_OPAND_TYPE(tn) \
__CILKRTS_MKIDENT(cilk_c_reducer_opand_,tn)
-/** Declare an op_and reducer object.
+/** Declares an op_and reducer object.
*
* This macro expands into a declaration of an op_and reducer object for a
* specified numeric type. For example:
@@ -526,29 +536,29 @@ __CILKRTS_BEGIN_EXTERN_C
/// @cond internal
-/** Declare the op_and reducer functions for a numeric type.
+/** Declares the op_and reducer functions for a numeric type.
*
* This macro expands into external function declarations for functions which
* implement the reducer functionality for the op_and reducer type for a
* specified numeric type.
*
* @param t The value type of the reducer.
- * @param tn The value “type name” identifier, used to construct the reducer
+ * @param tn The value "type name" identifier, used to construct the reducer
* type name, function names, etc.
*/
#define CILK_C_REDUCER_OPAND_DECLARATION(t,tn) \
typedef CILK_C_DECLARE_REDUCER(t) CILK_C_REDUCER_OPAND_TYPE(tn); \
__CILKRTS_DECLARE_REDUCER_REDUCE(cilk_c_reducer_opand,tn,l,r); \
__CILKRTS_DECLARE_REDUCER_IDENTITY(cilk_c_reducer_opand,tn);
-
-/** Define the op_and reducer functions for a numeric type.
+
+/** Defines the op_and reducer functions for a numeric type.
*
* This macro expands into function definitions for functions which implement
* the reducer functionality for the op_and reducer type for a specified
* numeric type.
*
* @param t The value type of the reducer.
- * @param tn The value “type name” identifier, used to construct the reducer
+ * @param tn The value "type name" identifier, used to construct the reducer
* type name, function names, etc.
*/
#define CILK_C_REDUCER_OPAND_DEFINITION(t,tn) \
@@ -557,10 +567,10 @@ __CILKRTS_BEGIN_EXTERN_C
{ *(t*)l &= *(t*)r; } \
__CILKRTS_DECLARE_REDUCER_IDENTITY(cilk_c_reducer_opand,tn) \
{ *(t*)v = ~((t)0); }
-
-//@{
-/** @def CILK_C_REDUCER_OPAND_INSTANCE
- * @brief Declare or define implementation functions for a reducer type.
+
+///@{
+/** @def CILK_C_REDUCER_OPAND_INSTANCE
+ * @brief Declares or defines implementation functions for a reducer type.
*
* In the runtime source file c_reducers.c, the macro `CILK_C_DEFINE_REDUCERS`
* will be defined, and this macro will generate reducer implementation
@@ -574,9 +584,9 @@ __CILKRTS_BEGIN_EXTERN_C
# define CILK_C_REDUCER_OPAND_INSTANCE(t,tn) \
CILK_C_REDUCER_OPAND_DECLARATION(t,tn)
#endif
-//@}
+///@}
-/* Declare or define an instance of the reducer type and its functions for
+/* Declares or defines an instance of the reducer type and its functions for
* each numeric type.
*/
CILK_C_REDUCER_OPAND_INSTANCE(char, char)
@@ -597,8 +607,8 @@ CILK_C_REDUCER_OPAND_INSTANCE(unsigned long long, ulonglong)
__CILKRTS_END_EXTERN_C
-//@}
+///@}
-//@}
+///@}
#endif /* REDUCER_OPAND_H_INCLUDED */
diff --git a/libcilkrts/include/cilk/reducer_opmul.h b/libcilkrts/include/cilk/reducer_opmul.h
index 271529d787b..8a3e2d2a2a5 100644
--- a/libcilkrts/include/cilk/reducer_opmul.h
+++ b/libcilkrts/include/cilk/reducer_opmul.h
@@ -1,10 +1,8 @@
/* reducer_opmul.h -*- C++ -*-
*
- * @copyright
- * Copyright (C) 2012-2013, Intel Corporation
+ * Copyright (C) 2012-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -19,7 +17,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -32,6 +29,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
*/
/** @file reducer_opmul.h
@@ -55,9 +66,9 @@
*
* @ingroup Reducers
*
- * You should be familiar with @ref pagereducers "Cilk reducers", described in
- * file `reducers.md`, and particularly with @ref reducers_using, before trying
- * to use the information in this file.
+ * You should be familiar with @ref pagereducers "Intel(R) Cilk(TM) Plus reducers",
+ * described in file `reducers.md`, and particularly with @ref reducers_using,
+ * before trying to use the information in this file.
*
* @section redopmul_usage Usage Example
*
@@ -79,11 +90,11 @@
* @subsection redopmul_monoid_operator Operator
*
* The operator of a multiplication reducer is the multiplication operation,
- * defined by the “`*`” binary operator on `Type`.
+ * defined by the "`*`" binary operator on `Type`.
*
* @subsection redopmul_monoid_identity Identity
*
- * The identity value of the reducer is the numeric value “`1`”. This is
+ * The identity value of the reducer is the numeric value "`1`". This is
* expected to be the value of the expression `Type(1)`.
*
* @section redopmul_operations Operations
@@ -119,18 +130,18 @@
* not really associative. For example, `(1e200 * 1e-200) * 1e-200 == 1e-200`,
* but `1e200 * (1e-200 * 1e-200 == 0.
*
- * In many cases, this won’t matter, but computations which have been
+ * In many cases, this won't matter, but computations which have been
* carefully ordered to control overflow and underflow may not deal well with
* being reassociated. In general, you should be sure to understand the
- * floating-point behavior of your program before doing any transformation
- * that will reassociate its computations.
+ * floating-point behavior of your program before doing any transformation
+ * that will reassociate its computations.
*
* @section redopmul_types Type and Operator Requirements
*
- * `Type` must be `Copy Constructible`, `Default Constructible`, and
+ * `Type` must be `Copy Constructible`, `Default Constructible`, and
* `Assignable`.
*
- * The operator “`*=`” must be defined on `Type`, with `x *= a` having the same
+ * The operator "`*=`" must be defined on `Type`, with `x *= a` having the same
* meaning as `x = x * a`.
*
* The expression `Type(1)` must be a valid expression which yields the
@@ -158,18 +169,18 @@ namespace cilk {
/** The multiplication reducer view class.
*
- * This is the view class for reducers created with
- * `cilk::reducer< cilk::op_mul<Type> >`. It holds the accumulator variable
- * for the reduction, and allows only multiplication operations to be
+ * This is the view class for reducers created with
+ * `cilk::reducer< cilk::op_mul<Type> >`. It holds the accumulator variable
+ * for the reduction, and allows only multiplication operations to be
* performed on it.
*
- * @note The reducer “dereference” operation (`reducer::operator *()`)
- * yields a reference to the view. Thus, for example, the view class’s
+ * @note The reducer "dereference" operation (`reducer::operator *()`)
+ * yields a reference to the view. Thus, for example, the view class's
* `*=` operation would be used in an expression like `*r *= a`, where
* `r` is an op_mul reducer variable.
*
- * @tparam Type The type of the contained accumulator variable. This will
- * be the value type of a monoid_with_view that is
+ * @tparam Type The type of the contained accumulator variable. This will
+ * be the value type of a monoid_with_view that is
* instantiated with this view.
*
* @see ReducersMul
@@ -181,18 +192,18 @@ template <typename Type>
class op_mul_view : public scalar_view<Type>
{
typedef scalar_view<Type> base;
-
+
public:
/** Class to represent the right-hand side of `*reducer = *reducer * value`.
*
- * The only assignment operator for the op_mul_view class takes an
- * rhs_proxy as its operand. This results in the syntactic restriction
+ * The only assignment operator for the op_mul_view class takes an
+ * rhs_proxy as its operand. This results in the syntactic restriction
* that the only expressions that can be assigned to an op_mul_view are
- * ones which generate an rhs_proxy — that is, expressions of the form
+ * ones which generate an rhs_proxy - that is, expressions of the form
* `op_mul_view * value ... * value`.
*
* @warning
- * The lhs and rhs views in such an assignment must be the same;
+ * The lhs and rhs views in such an assignment must be the same;
* otherwise, the behavior will be undefined. (I.e., `v1 = v1 * x` is
* legal; `v1 = v2 * x` is illegal.) This condition will be checked with a
* runtime assertion when compiled in debug mode.
@@ -213,12 +224,12 @@ public:
rhs_proxy(); // Disable default constructor
public:
- /** Multiply by an additional rhs value. If `v` is an op_mul_view and
- * `a1` is a value, then the expression `v * a1` invokes the view’s
- * `operator*()` to create an rhs_proxy for `(v, a1)`; then
- * `v * a1 * a2` invokes the rhs_proxy’s `operator*()` to create a
+ /** Multiplies by an additional `rhs` value. If `v` is an op_mul_view and
+ * `a1` is a value, then the expression `v * a1` invokes the view's
+ * `operator*()` to create an rhs_proxy for `(v, a1)`; then
+ * `v * a1 * a2` invokes the rhs_proxy's `operator*()` to create a
* new rhs_proxy for `(v, a1*a2)`. This allows the right-hand side of
- * an assignment to be not just `view * value`, but
+ * an assignment to be not just `view * value`, but
* `view * value * value ... * value`. The effect is that
*
* v = v * a1 * a2 ... * an;
@@ -231,7 +242,7 @@ public:
};
- /** Default/identity constructor. This constructor initializes the
+ /** Default/identity constructor. This constructor initializes the
* contained value to `Type(1)`, which is expected to be the identity
* value for multiplication on `Type`.
*/
@@ -240,8 +251,8 @@ public:
/** Construct with a specified initial value.
*/
explicit op_mul_view(const Type& v) : base(v) {}
-
- /** Reduction operation.
+
+ /** Reduces two strand views.
*
* This function is invoked by the @ref op_mul monoid to combine the views
* of two strands when the right strand merges with the left one. It
@@ -256,25 +267,25 @@ public:
* reduce operation.
*/
void reduce(op_mul_view* right) { this->m_value *= right->m_value; }
-
+
/** @name Accumulator variable updates.
*
* These functions support the various syntaxes for multiplying the
* accumulator variable contained in the view by some value.
*/
- //@{
+ ///@{
- /** Multiply the accumulator variable by @a x.
+ /** Multiplies the accumulator variable by @a x.
*/
op_mul_view& operator*=(const Type& x) { this->m_value *= x; return *this; }
- /** Create an object representing `*this * x`.
+ /** Creates an object representing `*this * x`.
*
* @see rhs_proxy
*/
rhs_proxy operator*(const Type& x) const { return rhs_proxy(this, x); }
- /** Assign the result of a `view * value` expression to the view. Note that
+ /** Assigns the result of a `view * value` expression to the view. Note that
* this is the only assignment operator for this class.
*
* @see rhs_proxy
@@ -284,8 +295,8 @@ public:
this->m_value *= rhs.m_value;
return *this;
}
-
- //@}
+
+ ///@}
};
/** Monoid class for multiplication reductions. Instantiate the cilk::reducer
@@ -309,7 +320,7 @@ struct op_mul : public monoid_with_view< op_mul_view<Type> > {};
/** @ingroup ReducersAdd
*/
-//@{
+///@{
/** @name C language reducer macros
*
@@ -318,11 +329,11 @@ struct op_mul : public monoid_with_view< op_mul_view<Type> > {};
*
* @see @ref page_reducers_in_c
*/
- //@{
-
+ ///@{
+
__CILKRTS_BEGIN_EXTERN_C
-/** Opmul reducer type name.
+/** Declares `opmul` reducer type name.
*
* This macro expands into the identifier which is the name of the op_mul
* reducer type for a specified numeric type.
@@ -336,7 +347,7 @@ __CILKRTS_BEGIN_EXTERN_C
#define CILK_C_REDUCER_OPMUL_TYPE(tn) \
__CILKRTS_MKIDENT(cilk_c_reducer_opmul_,tn)
-/** Declare an op_mul reducer object.
+/** Declares an op_mul reducer object.
*
* This macro expands into a declaration of an op_mul reducer object for a
* specified numeric type. For example:
@@ -361,29 +372,29 @@ __CILKRTS_BEGIN_EXTERN_C
/// @cond internal
-/** Declare the op_mul reducer functions for a numeric type.
+/** Declares the op_mul reducer functions for a numeric type.
*
- * This macro expands into external function declarations for functions which
+ * This macro expands into external function declarations for functions which
* implement the reducer functionality for the op_mul reducer type for a
* specified numeric type.
*
* @param t The value type of the reducer.
- * @param tn The value “type name” identifier, used to construct the reducer
+ * @param tn The value "type name" identifier, used to construct the reducer
* type name, function names, etc.
*/
#define CILK_C_REDUCER_OPMUL_DECLARATION(t,tn) \
typedef CILK_C_DECLARE_REDUCER(t) CILK_C_REDUCER_OPMUL_TYPE(tn); \
__CILKRTS_DECLARE_REDUCER_REDUCE(cilk_c_reducer_opmul,tn,l,r); \
__CILKRTS_DECLARE_REDUCER_IDENTITY(cilk_c_reducer_opmul,tn);
-
-/** Define the op_mul reducer functions for a numeric type.
+
+/** Defines the op_mul reducer functions for a numeric type.
*
* This macro expands into function definitions for functions which implement
* the reducer functionality for the op_mul reducer type for a specified
* numeric type.
*
* @param t The value type of the reducer.
- * @param tn The value “type name” identifier, used to construct the reducer
+ * @param tn The value "type name" identifier, used to construct the reducer
* type name, function names, etc.
*/
#define CILK_C_REDUCER_OPMUL_DEFINITION(t,tn) \
@@ -392,10 +403,10 @@ __CILKRTS_BEGIN_EXTERN_C
{ *(t*)l *= *(t*)r; } \
__CILKRTS_DECLARE_REDUCER_IDENTITY(cilk_c_reducer_opmul,tn) \
{ *(t*)v = 1; }
-
-//@{
-/** @def CILK_C_REDUCER_OPMUL_INSTANCE
- * @brief Declare or define implementation functions for a reducer type.
+
+///@{
+/** @def CILK_C_REDUCER_OPMUL_INSTANCE
+ * @brief Declares or defines implementation functions for a reducer type.
*
* In the runtime source file c_reducers.c, the macro `CILK_C_DEFINE_REDUCERS`
* will be defined, and this macro will generate reducer implementation
@@ -409,9 +420,9 @@ __CILKRTS_BEGIN_EXTERN_C
# define CILK_C_REDUCER_OPMUL_INSTANCE(t,tn) \
CILK_C_REDUCER_OPMUL_DECLARATION(t,tn)
#endif
-//@}
+///@}
-/* Declare or define an instance of the reducer type and its functions for each
+/* Declares or defines an instance of the reducer type and its functions for each
* numeric type.
*/
CILK_C_REDUCER_OPMUL_INSTANCE(char, char)
@@ -435,8 +446,8 @@ CILK_C_REDUCER_OPMUL_INSTANCE(long double, longdouble)
__CILKRTS_END_EXTERN_C
-//@}
+///@}
-//@}
+///@}
#endif /* REDUCER_OPMUL_H_INCLUDED */
diff --git a/libcilkrts/include/cilk/reducer_opor.h b/libcilkrts/include/cilk/reducer_opor.h
index 5c8e7bd972e..8d6d5202488 100644
--- a/libcilkrts/include/cilk/reducer_opor.h
+++ b/libcilkrts/include/cilk/reducer_opor.h
@@ -1,10 +1,8 @@
/* reducer_opor.h -*- C++ -*-
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -19,7 +17,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -32,11 +29,25 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
*/
/** @file reducer_opor.h
*
- * @brief Defines classes for doing parallel bitwise or reductions.
+ * @brief Defines classes for doing parallel bitwise OR reductions.
*
* @ingroup ReducersOr
*
@@ -48,16 +59,16 @@
#include <cilk/reducer.h>
-/** @defgroup ReducersOr Bitwise Or Reducers
+/** @defgroup ReducersOr Bitwise `OR` Reducers
*
- * Bitwise and reducers allow the computation of the bitwise and of a set of
+ * Bitwise `OR` reducers allow the computation of the bitwise `OR` of a set of
* values in parallel.
*
* @ingroup Reducers
*
- * You should be familiar with @ref pagereducers "Cilk reducers", described in
- * file `reducers.md`, and particularly with @ref reducers_using, before trying
- * to use the information in this file.
+ * You should be familiar with @ref pagereducers "Intel(R) Cilk(TM) Plus reducers",
+ * described in file `reducers.md`, and particularly with @ref reducers_using,
+ * before trying to use the information in this file.
*
* @section redopor_usage Usage Example
*
@@ -72,18 +83,18 @@
*
* @subsection redopor_monoid_values Value Set
*
- * The value set of a bitwise or reducer is the set of values of `Type`, which
+ * The value set of a bitwise `OR` reducer is the set of values of `Type`, which
* is expected to be a builtin integer type which has a representation as a
* sequence of bits (or something like it, such as `bool` or `std::bitset`).
*
* @subsection redopor_monoid_operator Operator
*
- * The operator of a bitwise or reducer is the bitwise or operator, defined by
- * the “`|`” binary operator on `Type`.
+ * The operator of a bitwise `OR` reducer is the bitwise OR operator, defined by
+ * the "`|`" binary operator on `Type`.
*
* @subsection redopor_monoid_identity Identity
*
- * The identity value of the reducer is the value whose representation
+ * The identity value of the reducer is the value whose representation
* contains all 0-bits. This is expected to be the value of the default
* constructor `Type()`.
*
@@ -104,8 +115,8 @@
*
* @subsection redopor_initial Initial Values
*
- * If a bitwise or reducer is constructed without an explicit initial value,
- * then its initial value will be its identity value, as long as `Type`
+ * If a bitwise OR reducer is constructed without an explicit initial value,
+ * then its initial value will be its identity value, as long as `Type`
* satisfies the requirements of @ref redopor_types.
*
* @subsection redopor_view_ops View Operations
@@ -119,17 +130,17 @@
* `Type` must be `Copy Constructible`, `Default Constructible`, and
* `Assignable`.
*
- * The operator “`|=`” must be defined on `Type`, with `x |= a` having the
+ * The operator "`|=`" must be defined on `Type`, with `x |= a` having the
* same meaning as `x = x | a`.
*
* The expression `Type()` must be a valid expression which yields the
* identity value (the value of `Type` whose representation consists of all
* 0-bits).
*
- * @section redopor_in_c Bitwise Or Reducers in C
+ * @section redopor_in_c Bitwise OR Reducers in C
*
* The @ref CILK_C_REDUCER_OPOR and @ref CILK_C_REDUCER_OPOR_TYPE macros can
- * be used to do bitwise or reductions in C. For example:
+ * be used to do bitwise OR reductions in C. For example:
*
* CILK_C_REDUCER_OPOR(r, uint, 0);
* CILK_C_REGISTER_REDUCER(r);
@@ -146,14 +157,14 @@
namespace cilk {
-/** The bitwise or reducer view class.
+/** The bitwise OR reducer view class.
*
- * This is the view class for reducers created with
+ * This is the view class for reducers created with
* `cilk::reducer< cilk::op_or<Type> >`. It holds the accumulator variable for
* the reduction, and allows only `or` operations to be performed on it.
*
- * @note The reducer “dereference” operation (`reducer::operator *()`)
- * yields a reference to the view. Thus, for example, the view class’s
+ * @note The reducer "dereference" operation (`reducer::operator *()`)
+ * yields a reference to the view. Thus, for example, the view class's
* `|=` operation would be used in an expression like `*r |= a`, where
* `r` is an opmod reducer variable.
*
@@ -170,18 +181,18 @@ template <typename Type>
class op_or_view : public scalar_view<Type>
{
typedef scalar_view<Type> base;
-
+
public:
/** Class to represent the right-hand side of `*reducer = *reducer | value`.
*
- * The only assignment operator for the op_or_view class takes an
+ * The only assignment operator for the op_or_view class takes an
* rhs_proxy as its operand. This results in the syntactic restriction
* that the only expressions that can be assigned to an op_or_view are
- * ones which generate an rhs_proxy — that is, expressions of the form
+ * ones which generate an rhs_proxy - that is, expressions of the form
* `op_or_view | value ... | value`.
*
* @warning
- * The lhs and rhs views in such an assignment must be the same;
+ * The lhs and rhs views in such an assignment must be the same;
* otherwise, the behavior will be undefined. (I.e., `v1 = v1 | x` is
* legal; `v1 = v2 | x` is illegal.) This condition will be checked with
* a runtime assertion when compiled in debug mode.
@@ -202,12 +213,12 @@ public:
rhs_proxy(); // Disable default constructor
public:
- /** Bitwise or with an additional rhs value. If `v` is an op_or_view
- * and `a1` is a value, then the expression `v | a1` invokes the
- * view’s `operator|()` to create an rhs_proxy for `(v, a1)`; then
- * `v | a1 | a2` invokes the rhs_proxy’s `operator|()` to create a new
+ /** bitwise OR with an additional rhs value. If `v` is an op_or_view
+ * and `a1` is a value, then the expression `v | a1` invokes the
+ * view's `operator|()` to create an rhs_proxy for `(v, a1)`; then
+ * `v | a1 | a2` invokes the rhs_proxy's `operator|()` to create a new
* rhs_proxy for `(v, a1|a2)`. This allows the right-hand side of an
- * assignment to be not just `view | value`, but
+ * assignment to be not just `view | value`, but
( `view | value | value ... | value`. The effect is that
*
* v = v | a1 | a2 ... | an;
@@ -228,12 +239,12 @@ public:
/** Construct with a specified initial value.
*/
explicit op_or_view(const Type& v) : base(v) {}
-
- /** Reduction operation.
+
+ /** Reduces the views of two strands.
*
* This function is invoked by the @ref op_or monoid to combine the views
* of two strands when the right strand merges with the left one. It
- * “ors” the value contained in the left-strand view by the value
+ * "ORs" the value contained in the left-strand view by the value
* contained in the right-strand view, and leaves the value in the
* right-strand view undefined.
*
@@ -244,25 +255,25 @@ public:
* reduce operation.
*/
void reduce(op_or_view* right) { this->m_value |= right->m_value; }
-
+
/** @name Accumulator variable updates.
*
- * These functions support the various syntaxes for “oring” the
+ * These functions support the various syntaxes for "ORing" the
* accumulator variable contained in the view with some value.
*/
- //@{
+ ///@{
- /** Or the accumulator variable with @a x.
+ /** Perfoms an OR operation between the accumulator variable and @a x.
*/
op_or_view& operator|=(const Type& x) { this->m_value |= x; return *this; }
- /** Create an object representing `*this | x`.
+ /** Creates an object representing `*this | x`.
*
* @see rhs_proxy
*/
rhs_proxy operator|(const Type& x) const { return rhs_proxy(this, x); }
- /** Assign the result of a `view | value` expression to the view. Note that
+ /** Assigns the result of a `view | value` expression to the view. Note that
* this is the only assignment operator for this class.
*
* @see rhs_proxy
@@ -272,23 +283,23 @@ public:
this->m_value |= rhs.m_value;
return *this;
}
-
- //@}
+
+ ///@}
};
-/** Monoid class for bitwise or reductions. Instantiate the cilk::reducer
- * template class with an op_or monoid to create a bitwise or reducer
- * class. For example, to compute the bitwise or of a set of `unsigned long`
+/** Monoid class for bitwise OR reductions. Instantiate the cilk::reducer
+ * template class with an op_or monoid to create a bitwise OR reducer
+ * class. For example, to compute the bitwise OR of a set of `unsigned long`
* values:
*
* cilk::reducer< cilk::op_or<unsigned long> > r;
*
* @tparam Type The reducer value type.
* @tparam Align If `false` (the default), reducers instantiated on this
- * monoid will be naturally aligned (the Cilk library 1.0
+ * monoid will be naturally aligned (the Intel Cilk Plus library 1.0
* behavior). If `true`, reducers instantiated on this monoid
- * will be cache-aligned for binary compatibility with
- * reducers in Cilk library version 0.9.
+ * will be cache-aligned for binary compatibility with
+ * reducers in Intel Cilk Plus library version 0.9.
*
* @see ReducersOr
* @see op_or_view
@@ -298,22 +309,22 @@ public:
template <typename Type, bool Align = false>
struct op_or : public monoid_with_view<op_or_view<Type>, Align> {};
-/** Deprecated bitwise or reducer class.
+/** Deprecated bitwise OR reducer class.
*
* reducer_opor is the same as @ref reducer<@ref op_or>, except that
* reducer_opor is a proxy for the contained view, so that accumulator
* variable update operations can be applied directly to the reducer. For
- * example, a value is ored with a `reducer<%op_or>` with `*r |= a`, but a
- * value can be ored with a `%reducer_opor` with `r |= a`.
+ * example, a value is "ORed" with a `reducer<%op_or>` with `*r |= a`, but a
+ * value can be "ORed" with a `%reducer_opor` with `r |= a`.
*
* @deprecated Users are strongly encouraged to use `reducer<monoid>`
- * reducers rather than the old wrappers like reducer_opor.
+ * reducers rather than the old wrappers like reducer_opor.
* The `reducer<monoid>` reducers show the reducer/monoid/view
* architecture more clearly, are more consistent in their
* implementation, and present a simpler model for new
* user-implemented reducers.
*
- * @note Implicit conversions are provided between `%reducer_opor`
+ * @note Implicit conversions are provided between `%reducer_opor`
* and `reducer<%op_or>`. This allows incremental code
* conversion: old code that used `%reducer_opor` can pass a
* `%reducer_opor` to a converted function that now expects a
@@ -337,20 +348,20 @@ class reducer_opor : public reducer< op_or<Type, true> >
public:
/// The view type for the reducer.
typedef typename base::view_type view_type;
-
- /// The view’s rhs proxy type.
+
+ /// The view's rhs proxy type.
typedef typename view_type::rhs_proxy rhs_proxy;
-
+
/// The view type for the reducer.
typedef view_type View;
/// The monoid type for the reducer.
typedef typename base::monoid_type Monoid;
-
+
/** @name Constructors
*/
- //@{
-
+ ///@{
+
/** Default (identity) constructor.
*
* Constructs the wrapper with the default initial value of `Type()`.
@@ -362,38 +373,38 @@ class reducer_opor : public reducer< op_or<Type, true> >
* Constructs the wrapper with a specified initial value.
*/
explicit reducer_opor(const Type& initial_value) : base(initial_value) {}
-
- //@}
+
+ ///@}
/** @name Forwarded functions
* @details Functions that update the contained accumulator variable are
* simply forwarded to the contained @ref op_and_view. */
- //@{
+ ///@{
/// @copydoc op_or_view::operator|=(const Type&)
reducer_opor& operator|=(const Type& x)
{
- view() |= x; return *this;
+ view() |= x; return *this;
}
-
+
// The legacy definition of reducer_opor::operator|() has different
// behavior and a different return type than this definition. The legacy
// version is defined as a member function, so this new version is defined
- // as a free function to give it a different signature, so that they won’t
+ // as a free function to give it a different signature, so that they won't
// end up sharing a single object file entry.
/// @copydoc op_or_view::operator|(const Type&) const
friend rhs_proxy operator|(const reducer_opor& r, const Type& x)
- {
- return r.view() | x;
+ {
+ return r.view() | x;
}
/// @copydoc op_and_view::operator=(const rhs_proxy&)
reducer_opor& operator=(const rhs_proxy& temp)
{
- view() = temp; return *this;
+ view() = temp; return *this;
}
- //@}
+ ///@}
/** @name Dereference
* @details Dereferencing a wrapper is a no-op. It simply returns the
@@ -412,25 +423,25 @@ class reducer_opor : public reducer< op_or<Type, true> >
* // operator &= is a wrapper member function that
* // calls the corresponding view function
*/
- //@{
+ ///@{
reducer_opor& operator*() { return *this; }
reducer_opor const& operator*() const { return *this; }
reducer_opor* operator->() { return this; }
reducer_opor const* operator->() const { return this; }
- //@}
-
+ ///@}
+
/** @name Upcast
- * @details In Cilk library 0.9, reducers were always cache-aligned. In
- * library 1.0, reducer cache alignment is optional. By default, reducers
- * are unaligned (i.e., just naturally aligned), but legacy wrappers
- * inherit from cache-aligned reducers for binary compatibility.
+ * @details In Intel Cilk Plus library 0.9, reducers were always cache-aligned.
+ * In library 1.0, reducer cache alignment is optional. By default,
+ * reducers are unaligned (i.e., just naturally aligned), but legacy
+ * wrappers inherit from cache-aligned reducers for binary compatibility.
*
* This means that a wrapper will automatically be upcast to its aligned
* reducer base class. The following conversion operators provide
* pseudo-upcasts to the corresponding unaligned reducer class.
*/
- //@{
+ ///@{
operator reducer< op_or<Type, false> >& ()
{
return *reinterpret_cast< reducer< op_or<Type, false> >* >(this);
@@ -439,15 +450,15 @@ class reducer_opor : public reducer< op_or<Type, true> >
{
return *reinterpret_cast< const reducer< op_or<Type, false> >* >(this);
}
- //@}
-
+ ///@}
+
};
/// @cond internal
/** Metafunction specialization for reducer conversion.
*
- * This specialization of the @ref legacy_reducer_downcast template class
- * defined in reducer.h causes the `reducer< op_or<Type> >` class to have an
+ * This specialization of the @ref legacy_reducer_downcast template class
+ * defined in reducer.h causes the `reducer< op_or<Type> >` class to have an
* `operator reducer_opor<Type>& ()` conversion operator that statically
* downcasts the `reducer<op_or>` to the corresponding `reducer_opor` type.
* (The reverse conversion, from `reducer_opor` to `reducer<op_or>`, is just
@@ -469,7 +480,7 @@ struct legacy_reducer_downcast<reducer<op_or<Type, Align> > >
/** @ingroup ReducersOr
*/
-//@{
+///@{
/** @name C language reducer macros
*
@@ -477,11 +488,11 @@ struct legacy_reducer_downcast<reducer<op_or<Type, Align> > >
*
* @see @ref page_reducers_in_c
*/
- //@{
-
+ ///@{
+
__CILKRTS_BEGIN_EXTERN_C
-/** Opor reducer type name.
+/** Declares OPOR reducer type name.
*
* This macro expands into the identifier which is the name of the op_or
* reducer type for a specified numeric type.
@@ -495,7 +506,7 @@ __CILKRTS_BEGIN_EXTERN_C
#define CILK_C_REDUCER_OPOR_TYPE(tn) \
__CILKRTS_MKIDENT(cilk_c_reducer_opor_,tn)
-/** Declare an op_or reducer object.
+/** Declares an op_or reducer object.
*
* This macro expands into a declaration of an op_or reducer object for a
* specified numeric type. For example:
@@ -520,29 +531,29 @@ __CILKRTS_BEGIN_EXTERN_C
/// @cond internal
-/** Declare the op_or reducer functions for a numeric type.
+/** Declares the op_or reducer functions for a numeric type.
*
* This macro expands into external function declarations for functions which
* implement the reducer functionality for the op_or reducer type for a
* specified numeric type.
*
* @param t The value type of the reducer.
- * @param tn The value “type name” identifier, used to construct the reducer
+ * @param tn The value "type name" identifier, used to construct the reducer
* type name, function names, etc.
*/
#define CILK_C_REDUCER_OPOR_DECLARATION(t,tn) \
typedef CILK_C_DECLARE_REDUCER(t) CILK_C_REDUCER_OPOR_TYPE(tn); \
__CILKRTS_DECLARE_REDUCER_REDUCE(cilk_c_reducer_opor,tn,l,r); \
__CILKRTS_DECLARE_REDUCER_IDENTITY(cilk_c_reducer_opor,tn);
-
-/** Define the op_or reducer functions for a numeric type.
+
+/** Defines the op_or reducer functions for a numeric type.
*
* This macro expands into function definitions for functions which implement
- * the reducer functionality for the op_or reducer type for a specified
+ * the reducer functionality for the op_or reducer type for a specified
* numeric type.
*
* @param t The value type of the reducer.
- * @param tn The value “type name” identifier, used to construct the reducer
+ * @param tn The value "type name" identifier, used to construct the reducer
* type name, function names, etc.
*/
#define CILK_C_REDUCER_OPOR_DEFINITION(t,tn) \
@@ -551,10 +562,10 @@ __CILKRTS_BEGIN_EXTERN_C
{ *(t*)l |= *(t*)r; } \
__CILKRTS_DECLARE_REDUCER_IDENTITY(cilk_c_reducer_opor,tn) \
{ *(t*)v = 0; }
-
-//@{
-/** @def CILK_C_REDUCER_OPOR_INSTANCE
- * @brief Declare or define implementation functions for a reducer type.
+
+///@{
+/** @def CILK_C_REDUCER_OPOR_INSTANCE
+ * @brief Declares or defines implementation functions for a reducer type.
*
* In the runtime source file c_reducers.c, the macro `CILK_C_DEFINE_REDUCERS`
* will be defined, and this macro will generate reducer implementation
@@ -568,9 +579,9 @@ __CILKRTS_BEGIN_EXTERN_C
# define CILK_C_REDUCER_OPOR_INSTANCE(t,tn) \
CILK_C_REDUCER_OPOR_DECLARATION(t,tn)
#endif
-//@}
+///@}
-/* Declare or define an instance of the reducer type and its functions for each
+/* Declare or define an instance of the reducer type and its functions for each
* numeric type.
*/
CILK_C_REDUCER_OPOR_INSTANCE(char, char)
@@ -591,8 +602,8 @@ CILK_C_REDUCER_OPOR_INSTANCE(unsigned long long, ulonglong)
__CILKRTS_END_EXTERN_C
-//@}
+///@}
-//@}
+///@}
#endif /* REDUCER_OPOR_H_INCLUDED */
diff --git a/libcilkrts/include/cilk/reducer_opxor.h b/libcilkrts/include/cilk/reducer_opxor.h
index fed49943ef6..cb6560f9c57 100644
--- a/libcilkrts/include/cilk/reducer_opxor.h
+++ b/libcilkrts/include/cilk/reducer_opxor.h
@@ -1,10 +1,8 @@
/* reducer_opxor.h -*- C++ -*-
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -19,7 +17,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -32,6 +29,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
*/
/** @file reducer_opxor.h
@@ -48,16 +59,16 @@
#include <cilk/reducer.h>
-/** @defgroup ReducersXor Bitwise Xor Reducers
+/** @defgroup ReducersXor Bitwise XOR Reducers
*
- * Bitwise and reducers allow the computation of the bitwise and of a set of
+ * Bitwise XOR reducers allow the computation of the bitwise XOR of a set of
* values in parallel.
*
* @ingroup Reducers
*
- * You should be familiar with @ref pagereducers "Cilk reducers", described in
- * file `reducers.md`, and particularly with @ref reducers_using, before trying
- * to use the information in this file.
+ * You should be familiar with @ref pagereducers "Intel(R) Cilk(TM) Plus reducers",
+ * described in file `reducers.md`, and particularly with @ref reducers_using,
+ * before trying to use the information in this file.
*
* @section redopxor_usage Usage Example
*
@@ -72,18 +83,17 @@
*
* @subsection redopxor_monoid_values Value Set
*
- * The value set of a bitwise xor reducer is the set of values of `Type`, which
+ * The value set of a bitwise XOR reducer is the set of values of `Type`, which
* is expected to be a builtin integer type which has a representation as a
* sequence of bits (or something like it, such as `bool` or `std::bitset`).
*
* @subsection redopxor_monoid_operator Operator
*
- * The operator of a bitwise xor reducer is the bitwise xor operator, defined
- * by the “`^`” binary operator on `Type`.
+ * The bitwise XOR operator is defined by the "`^`" binary operator on `Type`.
*
* @subsection redopxor_monoid_identity Identity
*
- * The identity value of the reducer is the value whose representation
+ * The identity value of the reducer is the value whose representation
* contains all 0-bits. This is expected to be the value of the default
* constructor `Type()`.
*
@@ -104,8 +114,8 @@
*
* @subsection redopxor_initial Initial Values
*
- * If a bitwise xor reducer is constructed without an explicit initial value,
- * then its initial value will be its identity value, as long as `Type`
+ * If a bitwise XOR reducer is constructed without an explicit initial value,
+ * then its initial value will be its identity value, as long as `Type`
* satisfies the requirements of @ref redopxor_types.
*
* @subsection redopxor_view_ops View Operations
@@ -119,17 +129,17 @@
* `Type` must be `Copy Constructible`, `Default Constructible`, and
* `Assignable`.
*
- * The operator “`^=`” must be defined on `Type`, with `x ^= a` having the
+ * The operator "`^=`" must be defined on `Type`, with `x ^= a` having the
* same meaning as `x = x ^ a`.
*
* The expression `Type()` must be a valid expression which yields the
* identity value (the value of `Type` whose representation consists of all
* 0-bits).
*
- * @section redopxor_in_c Bitwise Xor Reducers in C
+ * @section redopxor_in_c Bitwise XOR Reducers in C
*
* The @ref CILK_C_REDUCER_OPXOR and @ref CILK_C_REDUCER_OPXOR_TYPE macros can
- * be used to do bitwise xor reductions in C. For example:
+ * be used to do bitwise XOR reductions in C. For example:
*
* CILK_C_REDUCER_OPXOR(r, uint, 0);
* CILK_C_REGISTER_REDUCER(r);
@@ -146,14 +156,14 @@
namespace cilk {
-/** The bitwise xor reducer view class.
+/** The bitwise XOR reducer view class.
*
- * This is the view class for reducers created with
- * `cilk::reducer< cilk::op_xor<Type> >`. It holds the accumulator variable
+ * This is the view class for reducers created with
+ * `cilk::reducer< cilk::op_xor<Type> >`. It holds the accumulator variable
* for the reduction, and allows only `xor` operations to be performed on it.
*
- * @note The reducer “dereference” operation (`reducer::operator *()`)
- * yields a reference to the view. Thus, for example, the view class’s
+ * @note The reducer "dereference" operation (`reducer::operator *()`)
+ * yields a reference to the view. Thus, for example, the view class's
* `^=` operation would be used in an expression like `*r ^= a`, where
* `r` is an opmod reducer variable.
*
@@ -170,18 +180,18 @@ template <typename Type>
class op_xor_view : public scalar_view<Type>
{
typedef scalar_view<Type> base;
-
+
public:
/** Class to represent the right-hand side of `*reducer = *reducer ^ value`.
*
- * The only assignment operator for the op_xor_view class takes an
+ * The only assignment operator for the op_xor_view class takes an
* rhs_proxy as its operand. This results in the syntactic restriction
* that the only expressions that can be assigned to an op_xor_view are
- * ones which generate an rhs_proxy — that is, expressions of the form
+ * ones which generate an rhs_proxy - that is, expressions of the form
* `op_xor_view ^ value ... ^ value`.
*
* @warning
- * The lhs and rhs views in such an assignment must be the same;
+ * The lhs and rhs views in such an assignment must be the same;
* otherwise, the behavior will be undefined. (I.e., `v1 = v1 ^ x` is
* legal; `v1 = v2 ^ x` is illegal.) This condition will be checked with
* a runtime assertion when compiled in debug mode.
@@ -202,12 +212,12 @@ public:
rhs_proxy(); // Disable default constructor
public:
- /** Bitwise xor with an additional rhs value. If `v` is an op_xor_view
- * and `a1` is a value, then the expression `v ^ a1` invokes the
- * view’s `operator^()` to create an rhs_proxy for `(v, a1)`; then
- * `v ^ a1 ^ a2` invokes the rhs_proxy’s `operator^()` to create a new
+ /** bitwise XOR with an additional rhs value. If `v` is an op_xor_view
+ * and `a1` is a value, then the expression `v ^ a1` invokes the
+ * view's `operator^()` to create an rhs_proxy for `(v, a1)`; then
+ * `v ^ a1 ^ a2` invokes the rhs_proxy's `operator^()` to create a new
* rhs_proxy for `(v, a1^a2)`. This allows the right-hand side of an
- * assignment to be not just `view ^ value`, but
+ * assignment to be not just `view ^ value`, but
( `view ^ value ^ value ... ^ value`. The effect is that
*
* v = v ^ a1 ^ a2 ... ^ an;
@@ -228,12 +238,12 @@ public:
/** Construct with a specified initial value.
*/
explicit op_xor_view(const Type& v) : base(v) {}
-
- /** Reduction operation.
+
+ /** Reduces the views of two strands.
*
* This function is invoked by the @ref op_xor monoid to combine the views
* of two strands when the right strand merges with the left one. It
- * “xors” the value contained in the left-strand view by the value
+ * "XORs" the value contained in the left-strand view by the value
* contained in the right-strand view, and leaves the value in the
* right-strand view undefined.
*
@@ -244,25 +254,25 @@ public:
* reduce operation.
*/
void reduce(op_xor_view* right) { this->m_value ^= right->m_value; }
-
+
/** @name Accumulator variable updates.
*
- * These functions support the various syntaxes for “xoring” the
+ * These functions support the various syntaxes for "XORing" the
* accumulator variable contained in the view with some value.
*/
- //@{
+ ///@{
- /** Xor the accumulator variable with @a x.
+ /** Performs XOR operation between the accumulator variable and @a x.
*/
op_xor_view& operator^=(const Type& x) { this->m_value ^= x; return *this; }
- /** Create an object representing `*this ^ x`.
+ /** Creates an object representing `*this ^ x`.
*
* @see rhs_proxy
*/
rhs_proxy operator^(const Type& x) const { return rhs_proxy(this, x); }
- /** Assign the result of a `view ^ value` expression to the view. Note that
+ /** Assigns the result of a `view ^ value` expression to the view. Note that
* this is the only assignment operator for this class.
*
* @see rhs_proxy
@@ -272,23 +282,23 @@ public:
this->m_value ^= rhs.m_value;
return *this;
}
-
- //@}
+
+ ///@}
};
-/** Monoid class for bitwise xor reductions. Instantiate the cilk::reducer
- * template class with an op_xor monoid to create a bitwise xor reducer
- * class. For example, to compute the bitwise xor of a set of `unsigned long`
+/** Monoid class for bitwise XOR reductions. Instantiate the cilk::reducer
+ * template class with an op_xor monoid to create a bitwise XOR reducer
+ * class. For example, to compute the bitwise XOR of a set of `unsigned long`
* values:
*
* cilk::reducer< cilk::op_xor<unsigned long> > r;
*
* @tparam Type The reducer value type.
* @tparam Align If `false` (the default), reducers instantiated on this
- * monoid will be naturally aligned (the Cilk library 1.0
+ * monoid will be naturally aligned (the Intel Cilk Plus library 1.0
* behavior). If `true`, reducers instantiated on this monoid
- * will be cache-aligned for binary compatibility with
- * reducers in Cilk library version 0.9.
+ * will be cache-aligned for binary compatibility with
+ * reducers in Intel Cilk Plus library version 0.9.
*
* @see ReducersXor
* @see op_xor_view
@@ -298,22 +308,22 @@ public:
template <typename Type, bool Align = false>
struct op_xor : public monoid_with_view<op_xor_view<Type>, Align> {};
-/** Deprecated bitwise xor reducer class.
+/** Deprecated bitwise XOR reducer class.
*
* reducer_opxor is the same as @ref reducer<@ref op_xor>, except that
* reducer_opxor is a proxy for the contained view, so that accumulator
* variable update operations can be applied directly to the reducer. For
- * example, a value is xored with a `reducer<%op_xor>` with `*r ^= a`, but a
- * value can be xored with a `%reducer_opxor` with `r ^= a`.
+ * example, a value is "XORed" with a `reducer<%op_xor>` with `*r ^= a`, but a
+ * value can be "XORed" with a `%reducer_opxor` with `r ^= a`.
*
* @deprecated Users are strongly encouraged to use `reducer<monoid>`
- * reducers rather than the old wrappers like reducer_opand.
+ * reducers rather than the old wrappers like reducer_opand.
* The `reducer<monoid>` reducers show the reducer/monoid/view
* architecture more clearly, are more consistent in their
* implementation, and present a simpler model for new
* user-implemented reducers.
*
- * @note Implicit conversions are provided between `%reducer_opxor`
+ * @note Implicit conversions are provided between `%reducer_opxor`
* and `reducer<%op_xor>`. This allows incremental code
* conversion: old code that used `%reducer_opxor` can pass a
* `%reducer_opxor` to a converted function that now expects a
@@ -337,20 +347,20 @@ class reducer_opxor : public reducer< op_xor<Type, true> >
public:
/// The view type for the reducer.
typedef typename base::view_type view_type;
-
- /// The view’s rhs proxy type.
+
+ /// The view's rhs proxy type.
typedef typename view_type::rhs_proxy rhs_proxy;
-
+
/// The view type for the reducer.
typedef view_type View;
/// The monoid type for the reducer.
typedef typename base::monoid_type Monoid;
-
+
/** @name Constructors
*/
- //@{
-
+ ///@{
+
/** Default (identity) constructor.
*
* Constructs the wrapper with the default initial value of `Type()`.
@@ -362,38 +372,38 @@ class reducer_opxor : public reducer< op_xor<Type, true> >
* Constructs the wrapper with a specified initial value.
*/
explicit reducer_opxor(const Type& initial_value) : base(initial_value) {}
-
- //@}
+
+ ///@}
/** @name Forwarded functions
* @details Functions that update the contained accumulator variable are
* simply forwarded to the contained @ref op_and_view. */
- //@{
+ ///@{
/// @copydoc op_xor_view::operator^=(const Type&)
reducer_opxor& operator^=(const Type& x)
{
- view() ^= x; return *this;
+ view() ^= x; return *this;
}
-
+
// The legacy definition of reducer_opxor::operator^() has different
// behavior and a different return type than this definition. The legacy
// version is defined as a member function, so this new version is defined
- // as a free function to give it a different signature, so that they won’t
+ // as a free function to give it a different signature, so that they won't
// end up sharing a single object file entry.
/// @copydoc op_xor_view::operator^(const Type&) const
friend rhs_proxy operator^(const reducer_opxor& r, const Type& x)
- {
- return r.view() ^ x;
+ {
+ return r.view() ^ x;
}
/// @copydoc op_and_view::operator=(const rhs_proxy&)
reducer_opxor& operator=(const rhs_proxy& temp)
{
- view() = temp; return *this;
+ view() = temp; return *this;
}
- //@}
+ ///@}
/** @name Dereference
* @details Dereferencing a wrapper is a no-op. It simply returns the
@@ -412,25 +422,25 @@ class reducer_opxor : public reducer< op_xor<Type, true> >
* // operator &= is a wrapper member function that
* // calls the corresponding view function
*/
- //@{
+ ///@{
reducer_opxor& operator*() { return *this; }
reducer_opxor const& operator*() const { return *this; }
reducer_opxor* operator->() { return this; }
reducer_opxor const* operator->() const { return this; }
- //@}
-
+ ///@}
+
/** @name Upcast
- * @details In Cilk library 0.9, reducers were always cache-aligned. In
- * library 1.0, reducer cache alignment is optional. By default, reducers
- * are unaligned (i.e., just naturally aligned), but legacy wrappers
- * inherit from cache-aligned reducers for binary compatibility.
+ * @details In Intel Cilk Plus library 0.9, reducers were always cache-aligned.
+ * In library 1.0, reducer cache alignment is optional. By default,
+ * reducers are unaligned (i.e., just naturally aligned), but legacy
+ * wrappers inherit from cache-aligned reducers for binary compatibility.
*
* This means that a wrapper will automatically be upcast to its aligned
* reducer base class. The following conversion operators provide
* pseudo-upcasts to the corresponding unaligned reducer class.
*/
- //@{
+ ///@{
operator reducer< op_xor<Type, false> >& ()
{
return *reinterpret_cast< reducer< op_xor<Type, false> >* >(this);
@@ -439,15 +449,15 @@ class reducer_opxor : public reducer< op_xor<Type, true> >
{
return *reinterpret_cast< const reducer< op_xor<Type, false> >* >(this);
}
- //@}
-
+ ///@}
+
};
/// @cond internal
/** Metafunction specialization for reducer conversion.
*
- * This specialization of the @ref legacy_reducer_downcast template class
- * defined in reducer.h causes the `reducer< op_xor<Type> >` class to have an
+ * This specialization of the @ref legacy_reducer_downcast template class
+ * defined in reducer.h causes the `reducer< op_xor<Type> >` class to have an
* `operator reducer_opxor<Type>& ()` conversion operator that statically
* downcasts the `reducer<op_xor>` to the corresponding `reducer_opxor` type.
* (The reverse conversion, from `reducer_opxor` to `reducer<op_xor>`, is just
@@ -469,7 +479,7 @@ struct legacy_reducer_downcast<reducer<op_xor<Type, Align> > >
/** @ingroup ReducersXor
*/
-//@{
+///@{
/** @name C language reducer macros
*
@@ -477,11 +487,11 @@ struct legacy_reducer_downcast<reducer<op_xor<Type, Align> > >
*
* @see @ref page_reducers_in_c
*/
- //@{
-
+ ///@{
+
__CILKRTS_BEGIN_EXTERN_C
-/** Opxor reducer type name.
+/** Declares OPXOR reducer type name.
*
* This macro expands into the identifier which is the name of the op_xor
* reducer type for a specified numeric type.
@@ -495,7 +505,7 @@ __CILKRTS_BEGIN_EXTERN_C
#define CILK_C_REDUCER_OPXOR_TYPE(tn) \
__CILKRTS_MKIDENT(cilk_c_reducer_opxor_,tn)
-/** Declare an op_xor reducer object.
+/** Declares an op_xor reducer object.
*
* This macro expands into a declaration of an op_xor reducer object for a
* specified numeric type. For example:
@@ -520,29 +530,29 @@ __CILKRTS_BEGIN_EXTERN_C
/// @cond internal
-/** Declare the op_xor reducer functions for a numeric type.
+/** Declares the op_xor reducer functions for a numeric type.
*
* This macro expands into external function declarations for functions which
* implement the reducer functionality for the op_xor reducer type for a
* specified numeric type.
*
* @param t The value type of the reducer.
- * @param tn The value “type name” identifier, used to construct the reducer
+ * @param tn The value "type name" identifier, used to construct the reducer
* type name, function names, etc.
*/
#define CILK_C_REDUCER_OPXOR_DECLARATION(t,tn) \
typedef CILK_C_DECLARE_REDUCER(t) CILK_C_REDUCER_OPXOR_TYPE(tn); \
__CILKRTS_DECLARE_REDUCER_REDUCE(cilk_c_reducer_opxor,tn,l,r); \
__CILKRTS_DECLARE_REDUCER_IDENTITY(cilk_c_reducer_opxor,tn);
-
-/** Define the op_xor reducer functions for a numeric type.
+
+/** Defines the op_xor reducer functions for a numeric type.
*
* This macro expands into function definitions for functions which implement
- * the reducer functionality for the op_xor reducer type for a specified
+ * the reducer functionality for the op_xor reducer type for a specified
* numeric type.
*
* @param t The value type of the reducer.
- * @param tn The value “type name” identifier, used to construct the reducer
+ * @param tn The value "type name" identifier, used to construct the reducer
* type name, function names, etc.
*/
#define CILK_C_REDUCER_OPXOR_DEFINITION(t,tn) \
@@ -551,10 +561,10 @@ __CILKRTS_BEGIN_EXTERN_C
{ *(t*)l ^= *(t*)r; } \
__CILKRTS_DECLARE_REDUCER_IDENTITY(cilk_c_reducer_opxor,tn) \
{ *(t*)v = 0; }
-
-//@{
-/** @def CILK_C_REDUCER_OPXOR_INSTANCE
- * @brief Declare or define implementation functions for a reducer type.
+
+///@{
+/** @def CILK_C_REDUCER_OPXOR_INSTANCE
+ * @brief Declares or defines implementation functions for a reducer type.
*
* In the runtime source file c_reducers.c, the macro `CILK_C_DEFINE_REDUCERS`
* will be defined, and this macro will generate reducer implementation
@@ -568,9 +578,9 @@ __CILKRTS_BEGIN_EXTERN_C
# define CILK_C_REDUCER_OPXOR_INSTANCE(t,tn) \
CILK_C_REDUCER_OPXOR_DECLARATION(t,tn)
#endif
-//@}
+///@}
-/* Declare or define an instance of the reducer type and its functions for each
+/* Declares or defines an instance of the reducer type and its functions for each
* numeric type.
*/
CILK_C_REDUCER_OPXOR_INSTANCE(char, char)
@@ -591,8 +601,8 @@ CILK_C_REDUCER_OPXOR_INSTANCE(unsigned long long, ulonglong)
__CILKRTS_END_EXTERN_C
-//@}
+///@}
-//@}
+///@}
#endif /* REDUCER_OPXOR_H_INCLUDED */
diff --git a/libcilkrts/include/cilk/reducer_ostream.h b/libcilkrts/include/cilk/reducer_ostream.h
index d9addeee89f..793c3c5020c 100644
--- a/libcilkrts/include/cilk/reducer_ostream.h
+++ b/libcilkrts/include/cilk/reducer_ostream.h
@@ -1,9 +1,8 @@
-/*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+/* reducer_ostream.h -*- C++ -*-
+ *
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -18,7 +17,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -31,263 +29,489 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
- *
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
*/
-/*
- * reducer_ostream.h
- *
- * Purpose: Hyper-object to write to 'std::ostream's
- *
- * Classes: reducer_ostream
- *
- * Description:
- * ============
- * Output streams ('std::ostream's) are a convenient means of writing text to
- * files, the user console, or sockets. In a serial program, text is written
- * to an ostream in a specific, logical order. For example, computing while
- * traversing a data structure and printing them to an 'ostream' will result
- * in the values being printed in the order of traversal. In a parallel
- * version of the same program, however, different parts of the data structure
- * may be traversed in a different order, resulting in a non-deterministic
- * ordering of the stream. Worse, multiple strands may write to the same
- * stream simultaneously, resulting in a data race. Replacing the
- * 'std::ostream' with a 'cilk::reducer_ostream' will solve both problems: Data
- * will appeaer in the stream in the same order as it would for the serial
- * program, and there will be no races (no locks) on the common stream.
- *
- * Usage Example:
- * ==============
- * Assume we wish to traverse an array of objects, performing an operation on
- * each object and writing the result to a file. Without a reducer_ostream,
- * we have a race on the 'output' file stream:
- *..
- * void compute(std::ostream& os, double x)
- * {
- * // Perform some significant computation and print the result:
- * os << std::asin(x);
- * }
- *
- * int test()
- * {
- * const std::size_t ARRAY_SIZE = 1000000;
- * extern double myArray[ARRAY_SIZE];
- *
- * std::ofstream output("output.txt");
- * cilk_for (std::size_t i = 0; i < ARRAY_SIZE; ++i)
- * {
- * compute(output, myArray[i]);
- * }
+/** @file reducer_ostream.h
*
- * return 0;
- * }
- *..
- * The race is solved by using a reducer_ostream to proxy the 'output' file:
- *..
- * void compute(cilk::reducer_ostream& os, double x)
- * {
- * // Perform some significant computation and print the result:
- * *os << std::asin(x);
- * }
- *
- * int test()
- * {
- * const std::size_t ARRAY_SIZE = 1000000;
- * extern double myArray[ARRAY_SIZE];
- *
- * std::ofstream output("output.txt");
- * cilk::reducer_ostream hyper_output(output);
- * cilk_for (std::size_t i = 0; i < ARRAY_SIZE; ++i)
- * {
- * compute(hyper_output, myArray[i]);
- * }
+ * @brief Defines a class for writing to an ostream in parallel.
*
- * return 0;
- * }
- *..
- *
- * Limitations:
- * ============
- * There are two possible values for the formatting flags immediately after a
- * 'cilk_spawn' statement: they may either have the value that was set by the
- * spawn function, or they may have default values. Because of
- * non-determinism in the processor scheduling, there is no way to determine
- * which it will be. Similarly, the formatting flags after a 'cilk_sync' may
- * or may not have the same value as before the sync. Therefore, one must use
- * a disciplined coding style to avoid formatting errors. There are two
- * approaches to mitigating the problem: The first is to eliminate the
- * difference between the two possible outcomes by ensuring that the spawned
- * function always returns the flags to their initial state:
- *..
- * void compute(cilk::reducer_ostream& os, double x)
- * {
- * // Perform some significant computation and print the result:
- * int saveprec = os.precision(5);
- * os << std::asin(x);
- * os.precision(saveprec);
- * }
- *..
- * The second approach is to write your streaming operations such that they
- * don't depend on the previous state of the formatting flags by setting any
- * important flags before every block of output:
- *..
- * cilk_spawn compute(hyper_output, value);
- *
- * hyper_output->precision(2); // Don't depend on previous precision
- * *hyper_output << f();
- * *hyper_output << g();
- *..
- * Another concern is memory usage. A reducer_ostream will buffer as much text
- * as necessary to ensure that the order of output matches that of the serial
- * version of the program. If all spawn branches perform an equal amount of
- * output, then one can expect that half of the output before a sync will be
- * buffered in memory. This hyperobject is therefore not well suited for
- * serializing very large quantities of text output.
+ * @ingroup ReducersOstream
+ *
+ * @see @ref ReducersOstream
*/
#ifndef REDUCER_OSTREAM_H_INCLUDED
#define REDUCER_OSTREAM_H_INCLUDED
#include <cilk/reducer.h>
-#include <iostream>
+#include <ostream>
#include <sstream>
+/** @defgroup ReducersOstream Ostream Reducers
+ *
+ * Ostream reducers allow multiple strands to write to an ostream in parallel.
+ *
+ * @ingroup Reducers
+ *
+ * You should be familiar with @ref pagereducers "Intel(R) Cilk(TM) Plus reducers",
+ * described in file reducers.md, and particularly with @ref reducers_using,
+ * before trying to use the information in this file.
+ *
+ * @section redostream_usage Usage Example
+ *
+ * One of the most common debugging techniques is adding `print` statements
+ * to the code being debugged. When the code is parallelized, the results can
+ * be less than satisfactory, as output from multiple strands is mingled in an
+ * unpredictable way. Like other reducers, an ostream reducer requires minimal
+ * recoding to guarantee that the output from parallelized computation will be
+ * ordered the same as though the computation were executed serially.
+ *
+ * cilk::reducer<cilk::op_ostream> r(std::cerr);
+ * cilk_for (int i = 0; i != data.size(); ++i) {
+ * *r << "Iteration " << i << ":\n";
+ * ... some computation ...
+ * *r << " Step 1:" << some information;
+ * ... some more computation ...
+ * *r << " Step 2:" << some more information;
+ * ... still more computation ...
+ * *r << " Step 3:" << still more information;
+ * }
+ *
+ * Output on standard error:
+ *
+ * Iteration 1:
+ * Step 1: ...
+ * Step 2: ...
+ * Step 3: ...
+ * Iteration 2:
+ * Step 1: ...
+ * Step 2: ...
+ * Step 3: ...
+ * Iteration 3:
+ * Step 1: ...
+ * Step 2: ...
+ * Step 3: ...
+ * ...
+ *
+ * @section redostream_overview Overview
+ *
+ * An "ostream reducer" is not really a reducer. It uses the reducer
+ * technology to coordinate operations on parallel strands to achieve
+ * the same behavior in a parallel computation that would be seen in a
+ * serial computation, but it does not have a monoid. It has a "monoid
+ * class," because that is part of the implementation framework, but it
+ * does not represent a mathematical monoid: there is no value type, no
+ * associative operation, and no identity value. The reducer is used for
+ * its side effect rather than to construct a value.
+ *
+ * You might think of an ostream reducer as a relative of a
+ * @ref ReducersString "string reducer" which uses stream output
+ * syntax (`stream << value`) instead of string append syntax
+ * (`string += value`), and which writes its result string to an
+ * ostream instead of making it available as the reducer value.
+ *
+ * Another difference is that "real" reducers protect their contained
+ * value quite strongly from improper access by the user. Ostream reducers,
+ * on the other hand, pretty much have to expose the ostream, since normal
+ * use of an ostream involves accessing its internal state. Furthermore,
+ * the ostream reducer just coordinates output to an existing ostream -
+ * there is nothing to keep the user from writing directly to the attached
+ * stream, with unpredictable results.
+ *
+ * @section redostream_operations Operations
+ *
+ * In the operation descriptions below, the type name `Ostream` refers to the
+ * reducer's ostream type, `std::basic_ostream<Char, Traits>`.
+ *
+ * @subsection redostream_constructors Constructors
+ *
+ * The only constructor is
+ *
+ * reducer(const Ostream& os)
+ *
+ * This creates a reducer that is associated with the existing ostream `os`.
+ * Anything "written to" the reducer will (eventually) be written to `os`.
+ *
+ * @subsection redostream_get_set Set and Get
+ *
+ * Just as a stream does not have a "value," neither does an ostream
+ * reducer. Therefore, none of the usual `set_value`, `get_value`,
+ * `move_in`, or `move_out` functions are available for ostream reducers.
+ *
+ * @subsection redostream_initial Initial Values
+ *
+ * Ostream reducers do not have default constructors.
+ *
+ * @subsection redostream_view_ops View Operations
+ *
+ * An ostream reducer view is actually a kind of `std::ostream`. Therefore,
+ * any operation that can be used on an ostream can be used on an ostream
+ * reducer view. For example:
+ *
+ * reducer<op_ostream> r(cout);
+ * *r << setw(5) << (x=1) << endl;
+ *
+ *
+ * @section redostream_performance Performance Considerations
+ *
+ * Ostream reducers work by creating a string stream for each non-leftmost
+ * view. When two strands are merged, the contents of the string buffer of the
+ * right view are written to the left view. Since all non-leftmost strands are
+ * eventually merged, all output is eventually written to the associated
+ * ostream.
+ *
+ * This implementation has two consequences.
+ *
+ * First, all output written to an ostream reducer on a stolen strand is kept
+ * in memory (in a string buffer) until the strand is merged with the leftmost
+ * strand. This means that some portion of the output written to an ostream
+ * reducer during a parallel computation - half of the total output, on
+ * average - will temporarily be held in memory during the computation.
+ * Obviously, ostream reducers will work better for small and moderate amounts
+ * of output.
+ *
+ * Second, buffered ostream reducer content must be copied at every merge.
+ * The total amount of copying is potentially proportional to the total amount
+ * of output multiplied by the number of strands stolen during the computation.
+ *
+ * In short, writing to an ostream in a parallel computation with an ostream
+ * reducer will always be less efficient than writing the same output directly
+ * to the ostream in a serial computation. The value of the ostream
+ * reducer is not in the writing of the ostream itself, but in removing the
+ * race and serialization obstacles that the ostream output would cause in an
+ * otherwise parallelizable computation.
+ *
+ *
+ * @section redostream_state Stream State
+ *
+ * The reducer implementation can correctly order the output that is written
+ * to an ostream. However, an ostream has additional state that controls its
+ * behavior, such as its formatting attributes, error state, extensible arrays, * and registered callbacks. If these are modified during the computation, the * reducer implementation cannot guarantee that they will be the same in a
+ * parallel computation as in a serial computation. In particular:
+ *
+ * - In the serial execution, the ostream state in the continuation of a
+ * spawn will be the same as the state at the end of the spawned function.
+ * In the parallel execution, if the continuation is stolen, its view will
+ * contain a newly created ostream with the default initial state.
+ * - In the serial execution, the ostream state following a sync is the same
+ * as the state before the sync. In the parallel execution, if the
+ * continuation is stolen, then the state following the sync will be the
+ * same as the state at the end of some spawned function.
+ *
+ * In short, you must not make any assumptions about the stream state of an
+ * ostream reducer:
+ *
+ * - Following a `cilk_spawn`.
+ * - Following a `cilk_sync`.
+ * - At the start of an iteration of a `cilk_for` loop.
+ * - Following the completion of a `cilk_for` loop.
+ *
+ * @section redostream_types Type and Operator Requirements
+ *
+ * `std::basic_ostream<Char, Traits>` must be a valid type.
+*/
+
namespace cilk {
-/**
- * @brief Class 'reducer_ostream' is the representation of a hyperobject for
- * output text streaming.
+/** @ingroup ReducersOstream */
+//@{
+
+/** The ostream reducer view class.
+ *
+ * This is the view class for reducers created with
+ * `cilk::reducer< cilk::op_basic_ostream<Char, Traits> >`. It holds the
+ * actual ostream for a parallel strand, and allows only stream output
+ * operations to be performed on it.
+ *
+ * @note The reducer "dereference" operation (`reducer::operator *()`)
+ * yields a reference to the view. Thus, for example, the view
+ * class's `<<` operation would be used in an expression like
+ * `*r << "x = " << x`, where `r` is an ostream reducer.
+ *
+ * @tparam Char The ostream element type (not the ostream type).
+ * @tparam Traits The character traits type.
+ *
+ * @see ReducersOstream
+ * @see op_basic_ostream
*/
-class reducer_ostream
+template<typename Char, typename Traits>
+class op_basic_ostream_view : public std::basic_ostream<Char, Traits>
{
+ typedef std::basic_ostream<Char, Traits> base;
+ typedef std::basic_ostream<Char, Traits> ostream_type;
+
+ // A non-leftmost view is associated with a private string buffer. (The
+ // leftmost view is associated with the buffer of the reducer's associated
+ // ostream, so its private buffer is unused.)
+ //
+ std::basic_stringbuf<Char, Traits> m_buffer;
+
public:
- /// Internal representation of the per-strand view of the data for reducer_ostream
- class View: public std::ostream
+
+ /** Value type. Required by @ref monoid_with_view.
+ */
+ typedef ostream_type value_type;
+
+ /** Reduce operation. Required by @ref monoid_with_view.
+ */
+ void reduce(op_basic_ostream_view* other)
{
- public:
- /// Type of the std::stream reducer_ostream is based on
- typedef std::ostream Base;
-
- friend class reducer_ostream;
-
- View():
- std::ostream(0)
- {
- Base::rdbuf(&strbuf_);
- };
-
- private:
- void use_ostream (const std::ostream &os)
- {
- Base::rdbuf(os.rdbuf());
- Base::flags(os.flags()); // Copy formatting flags
- Base::setstate(os.rdstate()); // Copy error state
+ // Writing an empty buffer results in failure. Testing `sgetc()` is the
+ // easiest way of checking for an empty buffer.
+ if (other->m_buffer.sgetc() != Traits::eof()) {
+ *this << (&other->m_buffer);
}
+ }
- private:
- std::stringbuf strbuf_;
- };
+ /** Non-leftmost (identity) view constructor. The view is associated with
+ * its internal buffer. Required by @ref monoid_base.
+ */
+ op_basic_ostream_view() : base(&m_buffer) {}
-public:
- /// Definition of data view, operation, and identity for reducer_ostream
- struct Monoid: monoid_base< View >
+ /** Leftmost view constructor. The view is associated with an existing
+ * ostream.
+ */
+ op_basic_ostream_view(const ostream_type& os) : base(0)
{
- static void reduce (View *left, View *right);
- };
+ base::rdbuf(os.rdbuf()); // Copy stream buffer
+ base::flags(os.flags()); // Copy formatting flags
+ base::setstate(os.rdstate()); // Copy error state
+ }
-private:
- // Hyperobject to serve up views
- reducer<Monoid> imp_;
+ /** Sets/gets.
+ *
+ * These are all no-ops.
+ */
+ //@{
- // Methods that provide the API for the reducer
-public:
+ void view_set_value(const value_type&)
+ { assert("set_value() is not allowed on ostream reducers" && 0); }
+ const value_type& view_get_value() const
+ { assert("get_value() is not allowed on ostream reducers" && 0);
+ return *this; }
+ typedef value_type const& return_type_for_get_value;
+ void view_move_in(const value_type&)
+ { assert("move_in() is not allowed on ostream reducers" && 0); }
+ void view_move_out(const value_type&)
+ { assert("move_out() is not allowed on ostream reducers" && 0); }
- // Construct an initial 'reducer_ostream' from an 'std::ostream'. The
- // specified 'os' stream is used as the eventual destination for all
- // text streamed to this hyperobject.
- explicit reducer_ostream(const std::ostream &os);
+ //@}
+};
- // Return a modifiable reference to the underlying 'ostream' object.
- std::ostream& get_reference();
+/** Ostream monoid class. Instantiate the cilk::reducer template class with an
+ * op_basic_ostream monoid to create an ostream reducer class:
+ *
+ * cilk::reducer< cilk::op_basic_string<char> > r;
+ *
+ * @tparam Char The stream element type (not the stream type).
+ * @tparam Traits The character traits type.
+ *
+ * @see ReducersOstream
+ * @see op_basic_ostream_view
+ * @see reducer_ostream
+ * @see op_ostream
+ * @see op_wostream
+ */
+template<typename Char,
+ typename Traits = std::char_traits<Char>,
+ bool Align = false>
+class op_basic_ostream :
+ public monoid_with_view< op_basic_ostream_view<Char, Traits>, Align >
+{
+ typedef monoid_with_view< op_basic_ostream_view<Char, Traits>, Align >
+ base;
+ typedef std::basic_ostream<Char, Traits> ostream_type;
+ typedef provisional_guard<typename base::view_type> view_guard;
- /**
- * Append data from some type to the reducer_ostream
- *
- * @param v Value to be appended to the reducer_ostream
+public:
+
+ /** View type of the monoid.
*/
- template<typename T>
- std::ostream &
- operator<< (const T &v)
- {
- return imp_.view() << v;
- }
+ typedef typename base::view_type view_type;
- /**
- * Append data from a std::ostream to the reducer_ostream
+ /** @name Construct function.
*
- * @param _Pfn std::ostream to copy from
+ * The only supported ostream reducer constructor takes a reference to
+ * an existing ostream.
+ *
+ * @param os The ostream destination for receive all data written to the
+ * reducer.
*/
- std::ostream &
- operator<< (std::ostream &(*_Pfn)(std::ostream &))
+ static void construct(
+ op_basic_ostream* monoid,
+ view_type* view,
+ const ostream_type& os)
{
- View &v = imp_.view();
-
- return ((*_Pfn)(v));
+ view_guard vg( new((void*) view) view_type(os) );
+ vg.confirm_if( new((void*) monoid) op_basic_ostream );
}
-
- reducer_ostream& operator*() { return *this; }
- reducer_ostream const& operator*() const { return *this; }
-
- reducer_ostream* operator->() { return this; }
- reducer_ostream const* operator->() const { return this; }
};
-// -------------------------------------------
-// class reducer_ostream::Monoid
-// -------------------------------------------
+/**
+ * Convenience typedef for narrow ostreams.
+ */
+typedef op_basic_ostream<char> op_ostream;
/**
- * Appends string from "right" reducer_basic_string onto the end of
- * the "left". When done, the "right" reducer_basic_string is empty.
+ * Convenience typedef for wide ostreams.
*/
-void
-reducer_ostream::Monoid::reduce(View *left, View *right)
-{
- left->operator<< (&right->strbuf_);
-}
+typedef op_basic_ostream<wchar_t> op_wostream;
-// --------------------------
-// class reducer_ostream
-// --------------------------
+/// @cond internal
-/**
- * Construct a reducer_ostream which will write to the specified std::ostream
+class reducer_ostream;
+
+/** Metafunction specialization for reducer conversion.
*
- * @param os std::ostream to write to
+ * This specialization of the @ref legacy_reducer_downcast template class
+ * defined in reducer.h causes the `reducer<op_basic_ostream<char> >` class
+ * to have an `operator reducer_ostream& ()` conversion operator that
+ * statically downcasts the `reducer<op_basic_ostream<char> >` to
+ * `reducer_ostream`. (The reverse conversion, from `reducer_ostream` to
+ * `reducer<op_basic_ostream<char> >`, is just an upcast, which is provided
+ * for free by the language.)
*/
-inline
-reducer_ostream::reducer_ostream(const std::ostream &os) :
- imp_()
+template<bool Align>
+struct legacy_reducer_downcast<
+ reducer<op_basic_ostream<char, std::char_traits<char>, Align> > >
{
- View &v = imp_.view();
+ typedef reducer_ostream type;
+};
- v.use_ostream(os);
-}
+/// @endcond
-/**
- * Get a reference to the std::ostream
+/** Deprecated ostream reducer class.
+ *
+ * reducer_ostream is the same as @ref cilk::reducer<@ref op_ostream>, except
+ * that reducer_ostream is a proxy for the contained view, so that ostream
+ * operations can be applied directly to the reducer. For example, a number is
+ * written to a `reducer<op_ostream>` with `*r << x`, but a number can be
+ * written to a `reducer_ostream` with `r << x`.
+ *
+ * @deprecated Users are strongly encouraged to use `reducer<monoid>`
+ * reducers rather than the old wrappers like reducer_ostream. The
+ * `reducer<monoid>` reducers show the reducer/monoid/view
+ * architecture more clearly, are more consistent in their
+ * implementation, and present a simpler model for new
+ * user-implemented reducers.
+ *
+ * @note Implicit conversions are provided between `%reducer_ostream`
+ * and `reducer<%op_ostream>`. This allows incremental code
+ * conversion: old code that used `%reducer_ostream` can pass a
+ * `%reducer_ostream` to a converted function that now expects a
+ * pointer or reference to a `reducer<%op_ostream>`, and vice versa.
+ *
+ * @tparam Char The stream element type (not the stream type).
+ * @tparam Traits The character traits type.
+ *
+ * @see op_ostream
+ * @see reducer
+ * @see ReducersOstream
*/
-inline
-std::ostream &
-reducer_ostream::get_reference()
+class reducer_ostream :
+ public reducer<op_basic_ostream<char, std::char_traits<char>, true> >
{
- View &v = imp_.view();
+ typedef reducer<op_basic_ostream<char, std::char_traits<char>, true> > base;
+ using base::view;
+public:
- return v;
-}
+ /// The view type for the reducer.
+ typedef base::view_type View;
-} // namespace cilk
+ /// The monoid type for the reducer.
+ typedef base::monoid_type Monoid;
+
+ /** Constructs an initial `reducer_ostream` from a `std::ostream`. The
+ * specified stream is used as the eventual destination for all text
+ * streamed to this hyperobject.
+ */
+ explicit reducer_ostream(const std::ostream &os) : base(os) {}
+
+ /** Returns a modifiable reference to the underlying 'ostream' object.
+ */
+ std::ostream& get_reference() { return view(); }
+
+ /** Writes to the ostream.
+ */
+ template<typename T>
+ std::ostream& operator<< (const T &v)
+ {
+ return view() << v;
+ }
+
+ /**
+ * Calls a manipulator.
+ *
+ * @param _Pfn Pointer to the manipulator function.
+ */
+ reducer_ostream& operator<< (std::ostream &(*_Pfn)(std::ostream &))
+ {
+ (*_Pfn)(view());
+ return *this;
+ }
+
+ /** @name Dereference
+ * @details Dereferencing a wrapper is a no-op. It simply returns the
+ * wrapper. Combined with the rule that the wrapper forwards view
+ * operations to its contained view, this means that view operations can
+ * be written the same way on reducers and wrappers, which is convenient
+ * for incrementally converting old code using wrappers to use reducers
+ * instead. That is:
+ *
+ * reducer<op_ostream> r;
+ * *r << "a"; // *r returns the view
+ * // operator<<() is a view member function
+ *
+ * reducer_ostream w;
+ * *w << "a"; // *w returns the wrapper
+ * // operator<<() is a wrapper member function
+ * // that calls the corresponding view function
+ */
+ //@{
+ reducer_ostream& operator*() { return *this; }
+ reducer_ostream const& operator*() const { return *this; }
-#endif // REDUCER_OSTREAM_H_INCLUDED
+ reducer_ostream* operator->() { return this; }
+ reducer_ostream const* operator->() const { return this; }
+ //@}
+
+ /** @name Upcast
+ * @details In Intel Cilk Plus library 0.9, reducers were always cache-aligned.
+ * In library 1.0, reducer cache alignment is optional. By default,
+ * reducers are unaligned (i.e., just naturally aligned), but legacy
+ * wrappers inherit from cache-aligned reducers for binary compatibility.
+ *
+ * This means that a wrapper will automatically be upcast to its aligned
+ * reducer base class. The following conversion operators provide
+ * pseudo-upcasts to the corresponding unaligned reducer class.
+ */
+ //@{
+ operator reducer<op_ostream>& ()
+ {
+ return *reinterpret_cast< reducer<op_ostream>* >(this);
+ }
+ operator const reducer<op_ostream>& () const
+ {
+ return *reinterpret_cast< const reducer<op_ostream>* >(this);
+ }
+ //@}
+};
+
+} // namespace cilk
+#endif // REDUCER_OSTREAM_H_INCLUDED
diff --git a/libcilkrts/include/cilk/reducer_string.h b/libcilkrts/include/cilk/reducer_string.h
index 0d70dd8b30a..9af65d55341 100644
--- a/libcilkrts/include/cilk/reducer_string.h
+++ b/libcilkrts/include/cilk/reducer_string.h
@@ -1,10 +1,8 @@
/* reducer_string.h -*- C++ -*-
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -19,7 +17,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -32,6 +29,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
*/
/** @file reducer_string.h
@@ -52,14 +63,14 @@
/** @defgroup ReducersString String Reducers
*
- * String reducers allow the creation of a string by concatenating a set of
+ * String reducers allow the creation of a string by concatenating a set of
* strings or characters in parallel.
*
* @ingroup Reducers
*
- * You should be familiar with @ref pagereducers "Cilk reducers", described in
- * file reducers.md, and particularly with @ref reducers_using, before trying
- * to use the information in this file.
+ * You should be familiar with @ref pagereducers "Intel(R) Cilk(TM) Plus reducers",
+ * described in file reducers.md, and particularly with @ref reducers_using,
+ * before trying to use the information in this file.
*
* @section redstring_usage Usage Example
*
@@ -79,24 +90,24 @@
* @subsection redstring_monoid_values Value Set
*
* The value set of a string reducer is the set of values of the class
- * `std::basic_string<Char, Traits, Alloc>`, which we refer to as “the
- * reducer’s string type”.
+ * `std::basic_string<Char, Traits, Alloc>`, which we refer to as "the
+ * reducer's string type".
*
* @subsection redstring_monoid_operator Operator
*
- * The operator of a string reducer is the string concatenation operator,
- * defined by the “`+`” binary operator on the reducer’s string type.
+ * The operator of a string reducer is the string concatenation operator,
+ * defined by the "`+`" binary operator on the reducer's string type.
*
* @subsection redstring_monoid_identity Identity
*
- * The identity value of a string reducer is the empty string, which is the
+ * The identity value of a string reducer is the empty string, which is the
* value of the expression
* `std::basic_string<Char, Traits, Alloc>([allocator])`.
*
* @section redstring_operations Operations
*
* In the operation descriptions below, the type name `String` refers to the
- * reducer’s string type, `std::basic_string<Char, Traits, Alloc>`.
+ * reducer's string type, `std::basic_string<Char, Traits, Alloc>`.
*
* @subsection redstring_constructors Constructors
*
@@ -151,8 +162,8 @@
* the string computation.
*
* The strings for new views are created (by the view identity constructor)
- * using the same allocator as the string that was created when the reducer
- * was constructed. Note that this allocator is determined when the reducer is
+ * using the same allocator as the string that was created when the reducer
+ * was constructed. Note that this allocator is determined when the reducer is
* constructed. The following two examples may have very different behavior:
*
* string<Char, Traits, Allocator> a_string;
@@ -166,7 +177,7 @@
* ... parallel computation ...
* reducer2.move_out(a_string);
*
- * * `reducer1` will be constructed with the same allocator as `a_string`,
+ * * `reducer1` will be constructed with the same allocator as `a_string`,
* because the string was specified in the constructor. The `move_in`
* and `move_out` can therefore be done with a `swap` in constant time.
* * `reducer2` will be constructed with a _default_ allocator of type
@@ -175,8 +186,8 @@
* in _O(N)_ time.
*
* (All instances of an allocator type with no internal state (like
- * `std::allocator`) are “the same”. You only need to worry about the “same
- * allocator” issue when you create string reducers with custom allocator
+ * `std::allocator`) are "the same". You only need to worry about the "same
+ * allocator" issue when you create string reducers with custom allocator
* types.)
*
* @section redstring_types Type and Operator Requirements
@@ -192,12 +203,12 @@ namespace cilk {
/** The string append reducer view class.
*
* This is the view class for reducers created with
- * `cilk::reducer< cilk::op_basic_string<Type, Traits, Allocator> >`. It holds
+ * `cilk::reducer< cilk::op_basic_string<Char, Traits, Allocator> >`. It holds
* the accumulator variable for the reduction, and allows only append
* operations to be performed on it.
*
- * @note The reducer “dereference” operation (`reducer::operator *()`)
- * yields a reference to the view. Thus, for example, the view class’s
+ * @note The reducer "dereference" operation (`reducer::operator *()`)
+ * yields a reference to the view. Thus, for example, the view class's
* `append` operation would be used in an expression like
* `r->append(a)`, where `r` is a string append reducer variable.
*
@@ -215,7 +226,7 @@ class op_basic_string_view
typedef std::list<string_type> list_type;
typedef typename string_type::size_type size_type;
- // The view's value is represented by a list of strings and a single
+ // The view's value is represented by a list of strings and a single
// string. The value is the concatenation of the strings in the list with
// the single string at the end. All string operations apply to the single
// string; reduce operations cause lists of partial strings from multiple
@@ -224,7 +235,7 @@ class op_basic_string_view
mutable string_type m_string;
mutable list_type m_list;
- // Before returning the value of the reducer, concatenate all the strings
+ // Before returning the value of the reducer, concatenate all the strings
// in the list with the single string.
//
void flatten() const
@@ -263,11 +274,11 @@ public:
return m_string.get_allocator();
}
- /** Reduction operation.
+ /** Reduces the views of two strands.
*
* This function is invoked by the @ref op_basic_string monoid to combine
- * the views of two strands when the right strand merges with the left
- * one. It appends the value contained in the right-strand view to the
+ * the views of two strands when the right strand merges with the left
+ * one. It appends the value contained in the right-strand view to the
* value contained in the left-strand view, and leaves the value in the
* right-strand view undefined.
*
@@ -294,7 +305,7 @@ public:
//@}
- /** @name Pass constructor arguments through to the string constructor.
+ /** @name Passes constructor arguments to the string constructor.
*/
//@{
@@ -351,16 +362,18 @@ public:
m_string.clear();
}
- void view_set_value(const string_type& s)
+ void view_set_value(const string_type& s)
{ m_list.clear(); m_string = s; }
- string_type const& view_get_value() const
+ string_type const& view_get_value() const
{ flatten(); return m_string; }
- string_type & view_get_reference()
+ typedef string_type const& return_type_for_get_value;
+
+ string_type & view_get_reference()
{ flatten(); return m_string; }
- string_type const& view_get_reference() const
+ string_type const& view_get_reference() const
{ flatten(); return m_string; }
//@}
@@ -403,10 +416,10 @@ public:
* @tparam Traits The character traits type.
* @tparam Alloc The string allocator type.
* @tparam Align If `false` (the default), reducers instantiated on this
- * monoid will be naturally aligned (the Cilk library 1.0
+ * monoid will be naturally aligned (the Intel Cilk Plus library 1.0
* behavior). If `true`, reducers instantiated on this monoid
- * will be cache-aligned for binary compatibility with
- * reducers in Cilk library version 0.9.
+ * will be cache-aligned for binary compatibility with
+ * reducers in Intel Cilk Plus library version 0.9.
*
* @see ReducersString
* @see op_basic_string_view
@@ -418,11 +431,13 @@ template<typename Char,
typename Traits = std::char_traits<Char>,
typename Alloc = std::allocator<Char>,
bool Align = false>
-class op_basic_string :
+class op_basic_string :
public monoid_with_view< op_basic_string_view<Char, Traits, Alloc>, Align >
{
typedef monoid_with_view< op_basic_string_view<Char, Traits, Alloc>, Align >
base;
+ typedef provisional_guard<typename base::view_type> view_guard;
+
Alloc m_allocator;
public:
@@ -442,7 +457,7 @@ public:
op_basic_string(const Alloc& allocator = Alloc()) : m_allocator(allocator)
{}
- /** Create an identity view.
+ /** Creates an identity view.
*
* String view identity constructors take the string allocator as an
* argument.
@@ -450,48 +465,67 @@ public:
* @param v The address of the uninitialized memory in which the view
* will be constructed.
*/
- void identity(view_type *v) const { ::new((void*) v) view_type(m_allocator); }
+ void identity(view_type *v) const
+ { ::new((void*) v) view_type(m_allocator); }
/** @name Construct functions
*
* A string append reduction monoid must have a copy of the allocator of
- * the leftmost view’s string, so that it can use it in the `identity`
+ * the leftmost view's string, so that it can use it in the `identity`
* operation. This, in turn, requires that string reduction monoids have a
* specialized `construct()` function.
*
* All string reducer monoid `construct()` functions first construct the
* leftmost view, using the arguments that were passed in from the reducer
- * constructor. They then call the view’s `get_allocator()` function to
+ * constructor. They then call the view's `get_allocator()` function to
* get the string allocator from the string in the leftmost view, and pass
* that to the monoid constructor.
*/
//@{
static void construct(op_basic_string* monoid, view_type* view)
- { provisional( new ((void*)view) view_type() ).confirm_if(
- new ((void*)monoid) op_basic_string(view->get_allocator()) ); }
+ {
+ view_guard vg( new((void*) view) view_type() );
+ vg.confirm_if(
+ new((void*) monoid) op_basic_string(view->get_allocator()) );
+ }
template <typename T1>
- static void construct(op_basic_string* monoid, view_type* view, const T1& x1)
- { provisional( new ((void*)view) view_type(x1) ).confirm_if(
- new ((void*)monoid) op_basic_string(view->get_allocator()) ); }
+ static void construct(op_basic_string* monoid, view_type* view,
+ const T1& x1)
+ {
+ view_guard vg( new((void*) view) view_type(x1) );
+ vg.confirm_if(
+ new((void*) monoid) op_basic_string(view->get_allocator()) );
+ }
template <typename T1, typename T2>
- static void construct(op_basic_string* monoid, view_type* view, const T1& x1, const T2& x2)
- { provisional( new ((void*)view) view_type(x1, x2) ).confirm_if(
- new ((void*)monoid) op_basic_string(view->get_allocator()) ); }
+ static void construct(op_basic_string* monoid, view_type* view,
+ const T1& x1, const T2& x2)
+ {
+ view_guard vg( new((void*) view) view_type(x1, x2) );
+ vg.confirm_if(
+ new((void*) monoid) op_basic_string(view->get_allocator()) );
+ }
template <typename T1, typename T2, typename T3>
- static void construct(op_basic_string* monoid, view_type* view, const T1& x1, const T2& x2,
- const T3& x3)
- { provisional( new ((void*)view) view_type(x1, x2, x3) ).confirm_if(
- new ((void*)monoid) op_basic_string(view->get_allocator()) ); }
+ static void construct(op_basic_string* monoid, view_type* view,
+ const T1& x1, const T2& x2, const T3& x3)
+ {
+ view_guard vg( new((void*) view) view_type(x1, x2, x3) );
+ vg.confirm_if(
+ new((void*) monoid) op_basic_string(view->get_allocator()) );
+ }
template <typename T1, typename T2, typename T3, typename T4>
- static void construct(op_basic_string* monoid, view_type* view, const T1& x1, const T2& x2,
- const T3& x3, const T4& x4)
- { provisional( new ((void*)view) view_type(x1, x2, x3, x4) ).confirm_if(
- new ((void*)monoid) op_basic_string(view->get_allocator()) ); }
+ static void construct(op_basic_string* monoid, view_type* view,
+ const T1& x1, const T2& x2, const T3& x3,
+ const T4& x4)
+ {
+ view_guard vg( new((void*) view) view_type(x1, x2, x3, x4) );
+ vg.confirm_if(
+ new((void*) monoid) op_basic_string(view->get_allocator()) );
+ }
//@}
};
@@ -500,7 +534,7 @@ public:
/** Convenience typedef for 8-bit strings
*/
typedef op_basic_string<char> op_string;
-
+
/** Convenience typedef for 16-bit strings
*/
typedef op_basic_string<wchar_t> op_wstring;
@@ -516,13 +550,13 @@ typedef op_basic_string<wchar_t> op_wstring;
* with `r.push_back(a)`.
*
* @deprecated Users are strongly encouraged to use `reducer<monoid>`
- * reducers rather than the old wrappers like reducer_basic_string.
+ * reducers rather than the old wrappers like reducer_basic_string.
* The `reducer<monoid>` reducers show the reducer/monoid/view
* architecture more clearly, are more consistent in their
* implementation, and present a simpler model for new
* user-implemented reducers.
*
- * @note Implicit conversions are provided between `%reducer_basic_string`
+ * @note Implicit conversions are provided between `%reducer_basic_string`
* and `reducer<%op_basic_string>`. This allows incremental code
* conversion: old code that used `%reducer_basic_string` can pass a
* `%reducer_basic_string` to a converted function that now expects a
@@ -540,17 +574,17 @@ typedef op_basic_string<wchar_t> op_wstring;
template<typename Char,
typename Traits = std::char_traits<Char>,
typename Alloc = std::allocator<Char> >
-class reducer_basic_string :
+class reducer_basic_string :
public reducer< op_basic_string<Char, Traits, Alloc, true> >
{
typedef reducer< op_basic_string<Char, Traits, Alloc, true> > base;
using base::view;
public:
- /// The reducer’s string type.
+ /// The reducer's string type.
typedef typename base::value_type string_type;
- /// The reducer’s primitive component type.
+ /// The reducer's primitive component type.
typedef Char basic_value_type;
/// The string size type.
@@ -566,7 +600,7 @@ public:
/** @name Constructors
*/
//@{
-
+
/** @name Forward constructor calls to the base class.
*
* All basic_string constructor forms are supported.
@@ -575,15 +609,15 @@ public:
reducer_basic_string() {}
template <typename T1>
- reducer_basic_string(const T1& x1) :
+ reducer_basic_string(const T1& x1) :
base(x1) {}
template <typename T1, typename T2>
- reducer_basic_string(const T1& x1, const T2& x2) :
+ reducer_basic_string(const T1& x1, const T2& x2) :
base(x1, x2) {}
template <typename T1, typename T2, typename T3>
- reducer_basic_string(const T1& x1, const T2& x2, const T3& x3) :
+ reducer_basic_string(const T1& x1, const T2& x2, const T3& x3) :
base(x1, x2, x3) {}
template <typename T1, typename T2, typename T3, typename T4>
@@ -591,18 +625,18 @@ public:
base(x1, x2, x3, x4) {}
//@}
- /** Allow mutable access to the string within the current view.
+ /** Allows mutable access to the string within the current view.
*
- * @warning If this method is called before the parallel calculation is
+ * @warning If this method is called before the parallel calculation is
* complete, the string returned by this method will be a
* partial result.
*
* @returns A mutable reference to the string within the current view.
*/
- string_type &get_reference()
+ string_type &get_reference()
{ return view().view_get_reference(); }
- /** Allow read-only access to the string within the current view.
+ /** Allows read-only access to the string within the current view.
*
* @warning If this method is called before the parallel calculation is
* complete, the string returned by this method will be a
@@ -610,10 +644,10 @@ public:
*
* @returns A const reference to the string within the current view.
*/
- string_type const &get_reference() const
+ string_type const &get_reference() const
{ return view().view_get_reference(); }
- /** @name Append to the string.
+ /** @name Appends to the string.
*
* These operations are simply forwarded to the view.
*/
@@ -629,7 +663,7 @@ public:
void append(size_type count, Char ch)
{ view().append(count, ch); }
- // Append to the string
+ // Appends to the string
reducer_basic_string<Char, Traits, Alloc> &operator+=(Char ch)
{ view() += ch; return *this; }
reducer_basic_string<Char, Traits, Alloc> &operator+=(const Char *ptr)
@@ -664,10 +698,10 @@ public:
//@}
/** @name Upcast
- * @details In Cilk library 0.9, reducers were always cache-aligned. In
- * library 1.0, reducer cache alignment is optional. By default, reducers
- * are unaligned (i.e., just naturally aligned), but legacy wrappers
- * inherit from cache-aligned reducers for binary compatibility.
+ * @details In Intel Cilk Plus library 0.9, reducers were always cache-aligned.
+ * In library 1.0, reducer cache alignment is optional. By default,
+ * reducers are unaligned (i.e., just naturally aligned), but legacy
+ * wrappers inherit from cache-aligned reducers for binary compatibility.
*
* This means that a wrapper will automatically be upcast to its aligned
* reducer base class. The following conversion operators provide
@@ -676,14 +710,14 @@ public:
//@{
operator reducer< op_basic_string<Char, Traits, Alloc, false> >& ()
{
- return *reinterpret_cast< reducer<
- op_basic_string<Char, Traits, Alloc, false> >*
+ return *reinterpret_cast< reducer<
+ op_basic_string<Char, Traits, Alloc, false> >*
>(this);
}
operator const reducer< op_basic_string<Char, Traits, Alloc, false> >& () const
{
return *reinterpret_cast< const reducer<
- op_basic_string<Char, Traits, Alloc, false> >*
+ op_basic_string<Char, Traits, Alloc, false> >*
>(this);
}
//@}
@@ -703,11 +737,11 @@ typedef reducer_basic_string<wchar_t> reducer_wstring;
/// @cond internal
/** Metafunction specialization for reducer conversion.
*
- * This specialization of the @ref legacy_reducer_downcast template class
+ * This specialization of the @ref legacy_reducer_downcast template class
* defined in reducer.h causes the `reducer< op_basic_string<Char> >` class to
* have an `operator reducer_basic_string<Char>& ()` conversion operator that
* statically downcasts the `reducer<op_basic_string>` to the corresponding
- * `reducer_basic_string` type. (The reverse conversion, from
+ * `reducer_basic_string` type. (The reverse conversion, from
* `reducer_basic_string` to `reducer<op_basic_string>`, is just an upcast,
* which is provided for free by the language.)
*
diff --git a/libcilkrts/include/cilk/reducer_vector.h b/libcilkrts/include/cilk/reducer_vector.h
new file mode 100644
index 00000000000..fa53eee1d24
--- /dev/null
+++ b/libcilkrts/include/cilk/reducer_vector.h
@@ -0,0 +1,533 @@
+/* reducer_vector.h -*- C++ -*-
+ *
+ * Copyright (C) 2009-2016, Intel Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
+ * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
+ */
+
+/** @file reducer_vector.h
+ *
+ * @brief Defines classes for doing parallel vector creation by appending.
+ *
+ * @ingroup ReducersVector
+ *
+ * @see ReducersVector
+ */
+
+#ifndef REDUCER_VECTOR_H_INCLUDED
+#define REDUCER_VECTOR_H_INCLUDED
+
+#include <cilk/reducer.h>
+#include <vector>
+#include <list>
+
+/** @defgroup ReducersVector Vector Reducers
+ *
+ * Vector reducers allow the creation of a standard vector by
+ * appending a set of elements in parallel.
+ *
+ * @ingroup Reducers
+ *
+ * You should be familiar with @ref pagereducers "Intel(R) Cilk(TM) Plus reducers",
+ * described in file `reducers.md`, and particularly with @ref reducers_using,
+ * before trying to use the information in this file.
+ *
+ * @section redvector_usage Usage Example
+ *
+ * typedef ... SourceData;
+ * typedef ... ResultData;
+ * vector<SourceData> input;
+ * ResultData expensive_computation(const SourceData& x);
+ * cilk::reducer< cilk::op_vector<ResultData> > r;
+ * cilk_for (int i = 0; i != input.size(); ++i) {
+ * r->push_back(expensive_computation(input[i]));
+ * }
+ * vector result;
+ * r.move_out(result);
+ *
+ * @section redvector_monoid The Monoid
+ *
+ * @subsection redvector_monoid_values Value Set
+ *
+ * The value set of a vector reducer is the set of values of the class
+ * `std::vector<Type, Alloc>`, which we refer to as "the reducer's vector
+ * type".
+ *
+ * @subsection redvector_monoid_operator Operator
+ *
+ * The operator of a vector reducer is vector concatenation.
+ *
+ * @subsection redvector_monoid_identity Identity
+ *
+ * The identity value of a vector reducer is the empty vector, which is the
+ * value of the expression `std::vector<Type, Alloc>([allocator])`.
+ *
+ * @section redvector_operations Operations
+ *
+ * In the operation descriptions below, the type name `Vector` refers to
+ * the reducer's vector type, `std::vector<Type, Alloc>`.
+ *
+ * @subsection redvector_constructors Constructors
+ *
+ * Any argument list which is valid for a `std::vector` constructor is valid
+ * for a vector reducer constructor. The usual move-in constructor is also
+ * provided:
+ *
+ * reducer(move_in(Vector& variable))
+ *
+ * @subsection redvector_get_set Set and Get
+ *
+ * void r.set_value(const Vector& value)
+ * const Vector& = r.get_value() const
+ * void r.move_in(Vector& variable)
+ * void r.move_out(Vector& variable)
+ *
+ * @subsection redvector_initial Initial Values
+ *
+ * A vector reducer with no constructor arguments, or with only an allocator
+ * argument, will initially contain the identity value, an empty vector.
+ *
+ * @subsection redvector_view_ops View Operations
+ *
+ * The view of a vector reducer provides the following member functions:
+ *
+ * void push_back(const Type& element)
+ * void insert_back(const Type& element)
+ * void insert_back(Vector::size_type n, const Type& element)
+ * template <typename Iter> void insert_back(Iter first, Iter last)
+ *
+ * The `push_back` functions is the same as the corresponding `std::vector`
+ * function. The `insert_back` function is the same as the `std::vector`
+ * `insert` function, with the first parameter fixed to the end of the vector.
+ *
+ * @section redvector_performance Performance Considerations
+ *
+ * Vector reducers work by creating a vector for each view, collecting those
+ * vectors in a list, and then concatenating them into a single result vector
+ * at the end of the computation. This last step takes place in serial code,
+ * and necessarily takes time proportional to the length of the result vector.
+ * Thus, a parallel vector reducer cannot actually speed up the time spent
+ * directly creating the vector. This trivial example would probably be slower
+ * (because of reducer overhead) than the corresponding serial code:
+ *
+ * vector<T> a;
+ * reducer<op_vector<T> > r;
+ * cilk_for (int i = 0; i != a.length(); ++i) {
+ * r->push_back(a[i]);
+ * }
+ * vector<T> result;
+ * r.move_out(result);
+ *
+ * What a vector reducer _can_ do is to allow the _remainder_ of the
+ * computation to be done in parallel, without having to worry about
+ * managing the vector computation.
+ *
+ * The vectors for new views are created (by the view identity constructor)
+ * using the same allocator as the vector that was created when the reducer
+ * was constructed. Note that this allocator is determined when the reducer
+ * is constructed. The following two examples may have very different
+ * behavior:
+ *
+ * vector<Type, Allocator> a_vector;
+ *
+ * reducer< op_vector<Type, Allocator> reducer1(move_in(a_vector));
+ * ... parallel computation ...
+ * reducer1.move_out(a_vector);
+ *
+ * reducer< op_vector<Type, Allocator> reducer2;
+ * reducer2.move_in(a_vector);
+ * ... parallel computation ...
+ * reducer2.move_out(a_vector);
+ *
+ * * `reducer1` will be constructed with the same allocator as `a_vector`,
+ * because the vector was specified in the constructor. The `move_in`
+ * and`move_out` can therefore be done with a `swap` in constant time.
+ * * `reducer2` will be constructed with a _default_ allocator of type
+ * `Allocator`, which may not be the same as the allocator of `a_vector`.
+ * Therefore, the `move_in` and `move_out` may have to be done with a
+ * copy in _O(N)_ time.
+ *
+ * (All instances of an allocator class with no internal state (like
+ * `std::allocator`) are "the same". You only need to worry about the "same
+ * allocator" issue when you create vector reducers with a custom allocator
+ * class that has data members.)
+ *
+ * @section redvector_types Type and Operator Requirements
+ *
+ * `std::vector<Type, Alloc>` must be a valid type.
+*/
+
+namespace cilk {
+
+/** @ingroup ReducersVector */
+//@{
+
+/** @brief The vector reducer view class.
+ *
+ * This is the view class for reducers created with
+ * `cilk::reducer< cilk::op_vector<Type, Allocator> >`. It holds the
+ * accumulator variable for the reduction, and allows only append operations
+ * to be performed on it.
+ *
+ * @note The reducer "dereference" operation (`reducer::operator *()`)
+ * yields a reference to the view. Thus, for example, the view
+ * class's `push_back` operation would be used in an expression like
+ * `r->push_back(a)`, where `r` is a vector reducer variable.
+ *
+ * @tparam Type The vector element type (not the vector type).
+ * @tparam Alloc The vector allocator type.
+ *
+ * @see @ref ReducersVector
+ * @see op_vector
+ */
+template<typename Type, typename Alloc>
+class op_vector_view
+{
+ typedef std::vector<Type, Alloc> vector_type;
+ typedef std::list<vector_type, typename Alloc::template rebind<vector_type>::other>
+ list_type;
+ typedef typename vector_type::size_type size_type;
+
+ // The view's value is represented by a list of vectors and a single
+ // vector. The value is the concatenation of the vectors in the list with
+ // the single vector at the end. All vector operations apply to the single
+ // vector; reduce operations cause lists of partial vectors from multiple
+ // strands to be combined.
+ //
+ mutable vector_type m_vector;
+ mutable list_type m_list;
+
+ // Before returning the value of the reducer, concatenate all the vectors
+ // in the list with the single vector.
+ //
+ void flatten() const
+ {
+ if (m_list.empty()) return;
+
+ typename list_type::iterator i;
+
+ size_type len = m_vector.size();
+ for (i = m_list.begin(); i != m_list.end(); ++i)
+ len += i->size();
+
+ vector_type result(get_allocator());
+ result.reserve(len);
+
+ for (i = m_list.begin(); i != m_list.end(); ++i)
+ result.insert(result.end(), i->begin(), i->end());
+ m_list.clear();
+
+ result.insert(result.end(), m_vector.begin(), m_vector.end());
+ result.swap(m_vector);
+ }
+
+public:
+
+ /** @name Monoid support.
+ */
+ //@{
+
+ /// Required by cilk::monoid_with_view
+ typedef vector_type value_type;
+
+ /// Required by @ref op_vector
+ Alloc get_allocator() const
+ {
+ return m_vector.get_allocator();
+ }
+
+ /** Reduces the views of two strands.
+ *
+ * This function is invoked by the @ref op_vector monoid to combine
+ * the views of two strands when the right strand merges with the left
+ * one. It appends the value contained in the right-strand view to the
+ * value contained in the left-strand view, and leaves the value in the
+ * right-strand view undefined.
+ *
+ * @param other A pointer to the right-strand view. (`this` points to
+ * the left-strand view.)
+ *
+ * @note Used only by the @ref op_vector monoid to implement the
+ * monoid reduce operation.
+ */
+ void reduce(op_vector_view* other)
+ {
+ if (!other->m_vector.empty() || !other->m_list.empty()) {
+ // (list, string) + (other_list, other_string) =>
+ // (list + {string} + other_list, other_string)
+ if (!m_vector.empty()) {
+ // simulate m_list.push_back(std::move(m_vector))
+ m_list.push_back(vector_type(get_allocator()));
+ m_list.back().swap(m_vector);
+ }
+ m_list.splice(m_list.end(), other->m_list);
+ m_vector.swap(other->m_vector);
+ }
+ }
+
+ //@}
+
+ /** @name Passes constructor arguments to the vector constructor.
+ */
+ //@{
+
+ op_vector_view() :
+ m_vector(), m_list(get_allocator()) {}
+
+ template <typename T1>
+ op_vector_view(const T1& x1) :
+ m_vector(x1), m_list(get_allocator()) {}
+
+ template <typename T1, typename T2>
+ op_vector_view(const T1& x1, const T2& x2) :
+ m_vector(x1, x2), m_list(get_allocator()) {}
+
+ template <typename T1, typename T2, typename T3>
+ op_vector_view(const T1& x1, const T2& x2, const T3& x3) :
+ m_vector(x1, x2, x3), m_list(get_allocator()) {}
+
+ template <typename T1, typename T2, typename T3, typename T4>
+ op_vector_view(const T1& x1, const T2& x2, const T3& x3, const T4& x4) :
+ m_vector(x1, x2, x3, x4), m_list(get_allocator()) {}
+
+ //@}
+
+ /** Move-in constructor.
+ */
+ explicit op_vector_view(cilk::move_in_wrapper<value_type> w) :
+ m_vector(w.value().get_allocator()),
+ m_list(w.value().get_allocator())
+ {
+ m_vector.swap(w.value());
+ }
+
+ /** @name Reducer support.
+ */
+ //@{
+
+ void view_move_in(vector_type& v)
+ {
+ m_list.clear();
+ if (get_allocator() == v.get_allocator()) {
+ // Equal allocators. Do a (fast) swap.
+ m_vector.swap(v);
+ }
+ else {
+ // Unequal allocators. Do a (slow) copy.
+ m_vector = v;
+ }
+ v.clear();
+ }
+
+ void view_move_out(vector_type& v)
+ {
+ flatten();
+ if (get_allocator() == v.get_allocator()) {
+ // Equal allocators. Do a (fast) swap.
+ m_vector.swap(v);
+ }
+ else {
+ // Unequal allocators. Do a (slow) copy.
+ v = m_vector;
+ m_vector.clear();
+ }
+ }
+
+ void view_set_value(const vector_type& v)
+ {
+ m_list.clear();
+ m_vector = v;
+ }
+
+ vector_type const& view_get_value() const
+ {
+ flatten();
+ return m_vector;
+ }
+
+ typedef vector_type const& return_type_for_get_value;
+
+ //@}
+
+ /** @name View modifier operations.
+ *
+ * @details These simply wrap the corresponding operations on the
+ * underlying vector.
+ */
+ //@{
+
+ /** Adds an element at the end of the list.
+ *
+ * Equivalent to `vector.push_back(…)`
+ */
+ void push_back(const Type x)
+ {
+ m_vector.push_back(x);
+ }
+
+ /** @name Insert elements at the end of the vector.
+ *
+ * Equivalent to `vector.insert(vector.end(), …)`
+ */
+ //@{
+
+ void insert_back(const Type& element)
+ { m_vector.insert(m_vector.end(), element); }
+
+ void insert_back(typename vector_type::size_type n, const Type& element)
+ { m_vector.insert(m_vector.end(), n, element); }
+
+ template <typename Iter>
+ void insert_back(Iter first, Iter last)
+ { m_vector.insert(m_vector.end(), first, last); }
+
+ //@}
+
+ //@}
+};
+
+
+/** @brief The vector append monoid class.
+ *
+ * Instantiate the cilk::reducer template class with an op_vector monoid to
+ * create a vector reducer class. For example, to concatenate a
+ * collection of integers:
+ *
+ * cilk::reducer< cilk::op_vector<int> > r;
+ *
+ * @tparam Type The vector element type (not the vector type).
+ * @tparam Alloc The vector allocator type.
+ *
+ * @see ReducersVector
+ * @see op_vector_view
+ * @ingroup ReducersVector
+ */
+template<typename Type, typename Alloc = std::allocator<Type> >
+class op_vector :
+ public cilk::monoid_with_view< op_vector_view<Type, Alloc>, false >
+{
+ typedef cilk::monoid_with_view< op_vector_view<Type, Alloc>, false > base;
+ typedef provisional_guard<typename base::view_type> view_guard;
+
+ // The allocator to be used when constructing new views.
+ Alloc m_allocator;
+
+public:
+
+ /// View type.
+ typedef typename base::view_type view_type;
+
+ /** Constructor.
+ *
+ * There is no default constructor for vector monoids, because the
+ * allocator must always be specified.
+ *
+ * @param allocator The list allocator to be used when
+ * identity-constructing new views.
+ */
+ op_vector(const Alloc& allocator = Alloc()) : m_allocator(allocator) {}
+
+ /** Creates an identity view.
+ *
+ * Vector view identity constructors take the vector allocator as an
+ * argument.
+ *
+ * @param v The address of the uninitialized memory in which the view
+ * will be constructed.
+ */
+ void identity(view_type *v) const
+ {
+ ::new((void*) v) view_type(m_allocator);
+ }
+
+ /** @name construct functions
+ *
+ * A vector append monoid must have a copy of the allocator of
+ * the leftmost view's vector, so that it can use it in the `identity`
+ * operation. This, in turn, requires that vector append monoids have a
+ * specialized `construct()` function.
+ *
+ * All vector append monoid `construct()` functions first construct the
+ * leftmost view, using the arguments that were passed in from the reducer
+ * constructor. They then call the view's `get_allocator()` function to
+ * get the vector allocator from the vector in the leftmost view, and pass
+ * that to the monoid constructor.
+ */
+ //@{
+
+ static void construct(op_vector* monoid, view_type* view)
+ {
+ view_guard vg( new((void*) view) view_type() );
+ vg.confirm_if( new((void*) monoid) op_vector(view->get_allocator()) );
+ }
+
+ template <typename T1>
+ static void construct(op_vector* monoid, view_type* view, const T1& x1)
+ {
+ view_guard vg( new((void*) view) view_type(x1) );
+ vg.confirm_if( new((void*) monoid) op_vector(view->get_allocator()) );
+ }
+
+ template <typename T1, typename T2>
+ static void construct(op_vector* monoid, view_type* view,
+ const T1& x1, const T2& x2)
+ {
+ view_guard vg( new((void*) view) view_type(x1, x2) );
+ vg.confirm_if( new((void*) monoid) op_vector(view->get_allocator()) );
+ }
+
+ template <typename T1, typename T2, typename T3>
+ static void construct(op_vector* monoid, view_type* view,
+ const T1& x1, const T2& x2, const T3& x3)
+ {
+ view_guard vg( new((void*) view) view_type(x1, x2, x3) );
+ vg.confirm_if( new((void*) monoid) op_vector(view->get_allocator()) );
+ }
+
+ //@}
+};
+
+
+} // namespace cilk
+
+#endif // REDUCER_VECTOR_H_INCLUDED
diff --git a/libcilkrts/include/cilktools/cilkscreen.h b/libcilkrts/include/cilktools/cilkscreen.h
index c6986ae7b08..1e26c450ebe 100644
--- a/libcilkrts/include/cilktools/cilkscreen.h
+++ b/libcilkrts/include/cilktools/cilkscreen.h
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2010-2013, Intel Corporation
+ * Copyright (C) 2010-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
*
**************************************************************************/
diff --git a/libcilkrts/include/cilktools/cilkview.h b/libcilkrts/include/cilktools/cilkview.h
index eb7d9d8c0e4..e98489368af 100644
--- a/libcilkrts/include/cilktools/cilkview.h
+++ b/libcilkrts/include/cilktools/cilkview.h
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2010-2013, Intel Corporation
+ * Copyright (C) 2010-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
*
**************************************************************************/
diff --git a/libcilkrts/include/cilktools/fake_mutex.h b/libcilkrts/include/cilktools/fake_mutex.h
index 9ae0678112f..b7facf83f6d 100644
--- a/libcilkrts/include/cilktools/fake_mutex.h
+++ b/libcilkrts/include/cilktools/fake_mutex.h
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2013, Intel Corporation
+ * Copyright (C) 2013-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
*
**************************************************************************
*
diff --git a/libcilkrts/include/cilktools/lock_guard.h b/libcilkrts/include/cilktools/lock_guard.h
index d513e2b9734..e2e16382b75 100644
--- a/libcilkrts/include/cilktools/lock_guard.h
+++ b/libcilkrts/include/cilktools/lock_guard.h
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2011-2013, Intel Corporation
+ * Copyright (C) 2011-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
*
**************************************************************************
*
diff --git a/libcilkrts/include/internal/abi.h b/libcilkrts/include/internal/abi.h
index f45b5bcb178..3f38485d26b 100644
--- a/libcilkrts/include/internal/abi.h
+++ b/libcilkrts/include/internal/abi.h
@@ -1,11 +1,9 @@
/*
* abi.h
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -20,7 +18,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -33,6 +30,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
*
******************************************************************************/
@@ -461,6 +472,20 @@ CILK_ABI(void) __cilkrts_enter_frame_fast_1(__cilkrts_stack_frame *sf);
CILK_ABI(void) __cilkrts_leave_frame(__cilkrts_stack_frame *sf);
/**
+ * Suspends the runtime by notifying the workers that they should not try to
+ * steal. This function is supposed to be called from a non-parallel region
+ * (i.e., after cilk_sync in the top-level spawning function). Otherwise,
+ * which workers are sleeping or busy is unpredictable in general.
+ * The runtime can be resumed by calling __cilkrts_resume().
+ */
+CILK_ABI(void) __cilkrts_suspend(void);
+
+/**
+ * Resumes the runtime by notifying the workers that they can steal.
+ */
+CILK_ABI(void) __cilkrts_resume(void);
+
+/**
* Wait for any spawned children of this function to complete before
* continuing. This function will only return when the join counter
* has gone to 0. Other workers will re-enter the scheduling loop to
diff --git a/libcilkrts/include/internal/cilk_fake.h b/libcilkrts/include/internal/cilk_fake.h
index 2386dd6bffa..7d09de29c1e 100644
--- a/libcilkrts/include/internal/cilk_fake.h
+++ b/libcilkrts/include/internal/cilk_fake.h
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2011-2013, Intel Corporation
+ * Copyright (C) 2011-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
**************************************************************************/
/**
diff --git a/libcilkrts/include/internal/cilk_version.h b/libcilkrts/include/internal/cilk_version.h
index f628338f7d2..95e1f2ec544 100644
--- a/libcilkrts/include/internal/cilk_version.h
+++ b/libcilkrts/include/internal/cilk_version.h
@@ -1,10 +1,8 @@
// cilk_version.h
//
-// @copyright
-// Copyright (C) 2009-2013, Intel Corporation
+// Copyright (C) 2009-2016, Intel Corporation
// All rights reserved.
//
-// @copyright
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
@@ -19,7 +17,6 @@
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
-// @copyright
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -32,16 +29,30 @@
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
// WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
+//
+// *********************************************************************
+//
+// PLEASE NOTE: This file is a downstream copy of a file mainitained in
+// a repository at cilkplus.org. Changes made to this file that are not
+// submitted through the contribution process detailed at
+// http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+// time that a new version is released. Changes only submitted to the
+// GNU compiler collection or posted to the git repository at
+// https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+// not tracked.
+//
+// We welcome your contributions to this open source project. Thank you
+// for your assistance in helping us improve Cilk Plus.
// DO NOT EDIT THIS FILE!
//
// It was automatically generated by cilkrts/include/internal/Makefile
#define VERSION_MAJOR 2
#define VERSION_MINOR 0
-#define VERSION_BUILD 3902
+#define VERSION_BUILD 4420
#define VERSION_REV 0
-#define VERSION_STRING "2,0,3902,0"
-#define VERSION_HASH "b4e38f4f7e3e"
-#define VERSION_BRANCH "v14.0"
-#define TBB_REV_NUMBER ""
-#define VERSION_YEAR "2013"
+#define VERSION_STRING "2,0,4420,0"
+#define VERSION_HASH "3b2d6aa9059c"
+#define VERSION_BRANCH "eng"
+#define TBB_REV_NUMBER "14788"
+#define VERSION_YEAR "2015"
diff --git a/libcilkrts/include/internal/metacall.h b/libcilkrts/include/internal/metacall.h
index 886f49f9f83..00aa0f1598a 100644
--- a/libcilkrts/include/internal/metacall.h
+++ b/libcilkrts/include/internal/metacall.h
@@ -1,11 +1,9 @@
// -*- C++ -*-
/*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -20,7 +18,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -33,6 +30,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
*
******************************************************************************
*
diff --git a/libcilkrts/include/internal/rev.mk b/libcilkrts/include/internal/rev.mk
index f65ad6d57d0..96ffdc4aa4e 100644
--- a/libcilkrts/include/internal/rev.mk
+++ b/libcilkrts/include/internal/rev.mk
@@ -1,10 +1,8 @@
#########################################################################
#
-# @copyright
-# Copyright (C) 2011-2013, Intel Corporation
+# Copyright (C) 2011-2016, Intel Corporation
# All rights reserved.
#
-# @copyright
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
@@ -19,7 +17,6 @@
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
-# @copyright
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -32,10 +29,24 @@
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
# WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
+#
+# *********************************************************************
+#
+# PLEASE NOTE: This file is a downstream copy of a file mainitained in
+# a repository at cilkplus.org. Changes made to this file that are not
+# submitted through the contribution process detailed at
+# http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+# time that a new version is released. Changes only submitted to the
+# GNU compiler collection or posted to the git repository at
+# https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+# not tracked.
+#
+# We welcome your contributions to this open source project. Thank you
+# for your assistance in helping us improve Cilk Plus.
###########################################################################
# DO NOT EDIT THIS FILE!
#
# It was automatically generated by cilkrts/include/internal/Makefile
-CILK_REVISION = 3902
+CILK_REVISION = 4420
diff --git a/libcilkrts/mk/cilk-version.mk b/libcilkrts/mk/cilk-version.mk
index 76f3f4ee38e..49f524a6809 100644
--- a/libcilkrts/mk/cilk-version.mk
+++ b/libcilkrts/mk/cilk-version.mk
@@ -1,10 +1,8 @@
#########################################################################
#
-# @copyright
-# Copyright (C) 2009-2013, Intel Corporation
+# Copyright (C) 2009-2016, Intel Corporation
# All rights reserved.
#
-# @copyright
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
@@ -19,7 +17,6 @@
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
-# @copyright
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -32,6 +29,20 @@
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
# WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
+#
+# *********************************************************************
+#
+# PLEASE NOTE: This file is a downstream copy of a file mainitained in
+# a repository at cilkplus.org. Changes made to this file that are not
+# submitted through the contribution process detailed at
+# http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+# time that a new version is released. Changes only submitted to the
+# GNU compiler collection or posted to the git repository at
+# https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+# not tracked.
+#
+# We welcome your contributions to this open source project. Thank you
+# for your assistance in helping us improve Cilk Plus.
###########################################################################
# cilk-version.mk
#
diff --git a/libcilkrts/runtime/acknowledgements.dox b/libcilkrts/runtime/acknowledgements.dox
index 79b5d876f33..7f6271ccafa 100644
--- a/libcilkrts/runtime/acknowledgements.dox
+++ b/libcilkrts/runtime/acknowledgements.dox
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
**************************************************************************/
/*
diff --git a/libcilkrts/runtime/bug.cpp b/libcilkrts/runtime/bug.cpp
index dbdf1fd3216..f2109852a57 100644
--- a/libcilkrts/runtime/bug.cpp
+++ b/libcilkrts/runtime/bug.cpp
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
**************************************************************************/
#include "bug.h"
@@ -54,7 +65,7 @@ __CILKRTS_BEGIN_EXTERN_C
COMMON_PORTABLE const char *const __cilkrts_assertion_failed =
"%s:%d: cilk assertion failed: %s\n";
-COMMON_PORTABLE void __cilkrts_bug(const char *fmt,...) cilk_nothrow
+COMMON_PORTABLE NORETURN __cilkrts_bug(const char *fmt,...) cilk_nothrow
{
#if defined (_WIN32) && defined(_DEBUG)
_CRTIMP void __cdecl _wassert(__in_z const wchar_t * _Message,
diff --git a/libcilkrts/runtime/bug.h b/libcilkrts/runtime/bug.h
index 1a64bea3a54..3b5493bace6 100644
--- a/libcilkrts/runtime/bug.h
+++ b/libcilkrts/runtime/bug.h
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
**************************************************************************/
/**
diff --git a/libcilkrts/runtime/c_reducers.c b/libcilkrts/runtime/c_reducers.c
index 52615e93f43..f99ecbe6dd3 100644
--- a/libcilkrts/runtime/c_reducers.c
+++ b/libcilkrts/runtime/c_reducers.c
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2010-2013, Intel Corporation
+ * Copyright (C) 2010-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
*
**************************************************************************/
@@ -47,6 +58,13 @@
#define CILK_C_DEFINE_REDUCERS
+#ifdef _WRS_KERNEL
+#define WCHAR_MIN 0
+#define WCHAR_MAX USHRT_MAX
+#define WINT_MIN INT_MIN
+#define WINT_MAX INT_MAX
+#endif
+
#include <cilk/reducer_opadd.h>
#include <cilk/reducer_opand.h>
#include <cilk/reducer_opmul.h>
diff --git a/libcilkrts/runtime/cilk-abi-cilk-for.cpp b/libcilkrts/runtime/cilk-abi-cilk-for.cpp
index 4cd04f521cf..6e7c08a08af 100644
--- a/libcilkrts/runtime/cilk-abi-cilk-for.cpp
+++ b/libcilkrts/runtime/cilk-abi-cilk-for.cpp
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2011, 2013, Intel Corporation
+ * Copyright (C) 2011-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
*
**************************************************************************/
@@ -405,6 +416,9 @@ CILK_ABI_THROWS_VOID __cilkrts_cilk_for_32(__cilk_abi_f32_t body, void *data,
CILK_ABI_THROWS_VOID __cilkrts_cilk_for_64(__cilk_abi_f64_t body, void *data,
cilk64_t count, int grain)
{
+ // Cilkscreen should not report this call in a stack trace
+ NOTIFY_ZC_INTRINSIC((char *)"cilkscreen_hide_call", 0);
+
// Check for an empty range here as an optimization - don't need to do any
// __cilkrts_stack_frame initialization
if (count > 0)
diff --git a/libcilkrts/runtime/cilk-abi-vla-internal.c b/libcilkrts/runtime/cilk-abi-vla-internal.c
index 6fb92677ad0..b7696611165 100644
--- a/libcilkrts/runtime/cilk-abi-vla-internal.c
+++ b/libcilkrts/runtime/cilk-abi-vla-internal.c
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2013, Intel Corporation
+ * Copyright (C) 2013-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
**************************************************************************/
/*
diff --git a/libcilkrts/runtime/cilk-abi-vla-internal.h b/libcilkrts/runtime/cilk-abi-vla-internal.h
index 909f08fa471..57fe51ce4c7 100644
--- a/libcilkrts/runtime/cilk-abi-vla-internal.h
+++ b/libcilkrts/runtime/cilk-abi-vla-internal.h
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2013, Intel Corporation
+ * Copyright (C) 2013-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
**************************************************************************/
/**
diff --git a/libcilkrts/runtime/cilk-abi.c b/libcilkrts/runtime/cilk-abi.c
index 1da05239ebc..35bb413bf0a 100644
--- a/libcilkrts/runtime/cilk-abi.c
+++ b/libcilkrts/runtime/cilk-abi.c
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2010-2013, Intel Corporation
+ * Copyright (C) 2010-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
*
**************************************************************************/
@@ -296,6 +307,45 @@ CILK_ABI_VOID __cilkrts_sync(__cilkrts_stack_frame *sf)
__cilkrts_c_sync(w, sf);
}
+/**
+ * Suspends the runtime by notifying the workers that they should not try to
+ * steal. This function is supposed to be called from a non-parallel region
+ * (i.e., after cilk_sync in the top-level spawning function). Otherwise,
+ * which workers are sleeping or busy is unpredictable in general.
+ * The runtime can be resumed by calling __cilkrts_resume().
+ */
+CILK_ABI_VOID __cilkrts_suspend(void)
+{
+ global_state_t *g = cilkg_get_global_state();
+ if (NULL == g || g->P < 2)
+ return;
+ __cilkrts_worker *w = __cilkrts_get_tls_worker();
+ // Do nothing if worker/frame is not available
+ if (NULL == w || NULL == w->current_stack_frame)
+ return;
+ // Do nothing if this was called within a parallel region.
+ __cilkrts_stack_frame *sf = w->current_stack_frame;
+ if (0 == (sf->flags & CILK_FRAME_LAST) || (sf->flags & CILK_FRAME_UNSYNCHED))
+ return;
+ __cilkrts_worker *root = g->workers[0];
+ root->l->steal_failure_count = g->max_steal_failures + 1;
+ CILK_ASSERT(root->l->signal_node);
+ signal_node_msg(root->l->signal_node, 0);
+}
+
+/**
+ * Resumes the runtime by notifying the workers that they can steal.
+ */
+CILK_ABI_VOID __cilkrts_resume(void)
+{
+ global_state_t *g = cilkg_get_global_state();
+ if (NULL == g || g->P < 2)
+ return;
+ __cilkrts_worker *root = g->workers[0];
+ CILK_ASSERT(root->l->signal_node);
+ signal_node_msg(root->l->signal_node, 1);
+}
+
/*
* __cilkrts_get_sf
*
@@ -391,6 +441,10 @@ CILK_ABI_WORKER_PTR BIND_THREAD_RTN(void)
__cilkrts_set_tls_worker(w);
__cilkrts_cilkscreen_establish_worker(w);
+
+
+ START_INTERVAL(w, INTERVAL_IN_SCHEDULER);
+ START_INTERVAL(w, INTERVAL_IN_RUNTIME);
{
full_frame *ff = __cilkrts_make_full_frame(w, 0);
@@ -462,13 +516,10 @@ CILK_ABI_WORKER_PTR BIND_THREAD_RTN(void)
global_os_mutex_unlock();
- /* If there's only 1 worker, the counts will be started in
- * __cilkrts_scheduler */
- if (g->P > 1)
- {
- START_INTERVAL(w, INTERVAL_IN_SCHEDULER);
- START_INTERVAL(w, INTERVAL_WORKING);
- }
+ /* We are about to switch back into user code after binding the
+ thread. Start working again. */
+ STOP_INTERVAL(w, INTERVAL_IN_RUNTIME);
+ START_INTERVAL(w, INTERVAL_WORKING);
ITT_SYNC_RELEASING(&unique_obj);
diff --git a/libcilkrts/runtime/cilk-ittnotify.h b/libcilkrts/runtime/cilk-ittnotify.h
index ff995db6fbb..256f334dcea 100644
--- a/libcilkrts/runtime/cilk-ittnotify.h
+++ b/libcilkrts/runtime/cilk-ittnotify.h
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
**************************************************************************/
#ifndef INCLUDED_CILK_ITTNOTIFY_DOT_H
diff --git a/libcilkrts/runtime/cilk-tbb-interop.h b/libcilkrts/runtime/cilk-tbb-interop.h
index cc5cff4b57e..c073ab172c6 100644
--- a/libcilkrts/runtime/cilk-tbb-interop.h
+++ b/libcilkrts/runtime/cilk-tbb-interop.h
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
**************************************************************************/
/**
diff --git a/libcilkrts/runtime/cilk_api.c b/libcilkrts/runtime/cilk_api.c
index bbca984bc03..62798d29c76 100644
--- a/libcilkrts/runtime/cilk_api.c
+++ b/libcilkrts/runtime/cilk_api.c
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
**************************************************************************/
/*
diff --git a/libcilkrts/runtime/cilk_fiber-unix.cpp b/libcilkrts/runtime/cilk_fiber-unix.cpp
index b0ed53ad052..d59bfcae4cb 100644
--- a/libcilkrts/runtime/cilk_fiber-unix.cpp
+++ b/libcilkrts/runtime/cilk_fiber-unix.cpp
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2012-2013, Intel Corporation
+ * Copyright (C) 2012-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
**************************************************************************/
#include "cilk_fiber-unix.h"
@@ -47,33 +58,32 @@
#include <errno.h>
#include <sys/mman.h>
#include <unistd.h>
-
-// You'd think that getting a defintion for alloca would be easy. But you'd
-// be wrong. Here's a variant on what's recommended in the autoconf doc. I've
-// remove the Windows portion since this is Unix-specific code.
-#if defined HAVE_ALLOCA_H
-# include <alloca.h>
-#elif defined __GNUC__
-# define alloca __builtin_alloca
-#elif defined _AIX
-# define alloca __alloca
-#else
-# include <stddef.h>
-# ifdef __cplusplus
-extern "C"
-# endif
-void *alloca (size_t);
-#endif
+#include "declare-alloca.h"
// MAP_ANON is deprecated on Linux, but seems to be required on Mac...
#ifndef MAP_ANONYMOUS
-#define MAP_ANONYMOUS MAP_ANON
+# define MAP_ANONYMOUS MAP_ANON
+#endif
+
+// MAP_STACK and MAP_GROWSDOWN have no affect in Linux as of 2014-04-04, but
+// could be very useful in future versions. If they are not defined, then set
+// them to zero (no bits set).
+#ifndef MAP_STACK
+# define MAP_STACK 0
+#endif
+#ifndef MAP_GROWSDOWN
+# define MAP_GROWSDOWN 0
#endif
// Magic number for sanity checking fiber structure
const unsigned magic_number = 0x5afef00d;
-int cilk_fiber_sysdep::s_page_size = getpagesize();
+// Page size for stacks
+#ifdef _WRS_KERNEL
+long cilk_fiber_sysdep::s_page_size = 4096;
+#else
+long cilk_fiber_sysdep::s_page_size = sysconf(_SC_PAGESIZE);
+#endif
cilk_fiber_sysdep::cilk_fiber_sysdep(std::size_t stack_size)
: cilk_fiber(stack_size)
@@ -270,7 +280,7 @@ void cilk_fiber_sysdep::make_stack(size_t stack_size)
p = (char*)mmap(0, rounded_stack_size,
PROT_READ|PROT_WRITE,
- MAP_PRIVATE|MAP_ANONYMOUS,
+ MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK|MAP_GROWSDOWN,
-1, 0);
if (MAP_FAILED == p) {
// For whatever reason (probably ran out of memory), mmap() failed.
diff --git a/libcilkrts/runtime/cilk_fiber-unix.h b/libcilkrts/runtime/cilk_fiber-unix.h
index 9f47d5b0437..5ebe840616f 100644
--- a/libcilkrts/runtime/cilk_fiber-unix.h
+++ b/libcilkrts/runtime/cilk_fiber-unix.h
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2012-2013, Intel Corporation
+ * Copyright (C) 2012-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
**************************************************************************/
#ifndef INCLUDED_CILK_FIBER_UNIX_DOT_H
@@ -126,13 +137,12 @@ struct cilk_fiber_sysdep : public cilk_fiber
inline char* get_stack_base_sysdep() { return m_stack_base; }
private:
- char* m_stack_base; ///< The base of this fiber's stack.
- char* m_stack; // Stack memory (low address)
- __CILK_JUMP_BUFFER m_resume_jmpbuf; // Place to resume fiber
- unsigned m_magic; // Magic number for checking
+ char* m_stack_base; ///< The base of this fiber's stack.
+ char* m_stack; ///< Stack memory (low address)
+ __CILK_JUMP_BUFFER m_resume_jmpbuf; ///< Place to resume fiber
+ unsigned m_magic; ///< Magic number for checking
- static int s_page_size; // Page size for
- // stacks.
+ static long s_page_size; ///< Page size for stacks.
// Allocate memory for a stack. This method
// initializes m_stack and m_stack_base.
diff --git a/libcilkrts/runtime/cilk_fiber.cpp b/libcilkrts/runtime/cilk_fiber.cpp
index 0c66f234d3b..218c73ba813 100644
--- a/libcilkrts/runtime/cilk_fiber.cpp
+++ b/libcilkrts/runtime/cilk_fiber.cpp
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2012-2013, Intel Corporation
+ * Copyright (C) 2012-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
**************************************************************************/
/* Implementations of non-platform-specific aspects of cilk_fiber, especially
diff --git a/libcilkrts/runtime/cilk_fiber.h b/libcilkrts/runtime/cilk_fiber.h
index 2671f924681..d91687aa57a 100644
--- a/libcilkrts/runtime/cilk_fiber.h
+++ b/libcilkrts/runtime/cilk_fiber.h
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2012-2013, Intel Corporation
+ * Copyright (C) 2012-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
**************************************************************************/
/**
diff --git a/libcilkrts/runtime/cilk_malloc.c b/libcilkrts/runtime/cilk_malloc.c
index 9d02c52d037..3ddaad67af3 100644
--- a/libcilkrts/runtime/cilk_malloc.c
+++ b/libcilkrts/runtime/cilk_malloc.c
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,12 +31,26 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
**************************************************************************/
#include "cilk_malloc.h"
#include <stdlib.h>
-#if defined _WIN32 || defined _WIN64 || defined __linux__
+#if defined _WIN32 || defined _WIN64 || defined __GLIBC__ || defined __linux__
#include <malloc.h>
#define HAS_MEMALIGN 1
#endif
diff --git a/libcilkrts/runtime/cilk_malloc.h b/libcilkrts/runtime/cilk_malloc.h
index fa0fa6d5c9d..d8ed58d2445 100644
--- a/libcilkrts/runtime/cilk_malloc.h
+++ b/libcilkrts/runtime/cilk_malloc.h
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
**************************************************************************/
/**
diff --git a/libcilkrts/runtime/cilk_str_mem.h b/libcilkrts/runtime/cilk_str_mem.h
new file mode 100644
index 00000000000..0da50b40928
--- /dev/null
+++ b/libcilkrts/runtime/cilk_str_mem.h
@@ -0,0 +1,94 @@
+/* cilk_str_mem.h -*-C-*-
+ *
+ *************************************************************************
+ *
+ * Copyright (C) 2014-2016, Intel Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
+ * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
+ **************************************************************************/
+
+/**
+ * @file cilk_str_mem.h
+ *
+ * @breif Interface to safe string/memmory C API to replace banned C API.
+ */
+
+#ifndef INCLUDED_CILK_STR_MEM_DOT_H
+#define INCLUDED_CILK_STR_MEM_DOT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _WIN32
+
+# include "safe_lib.h"
+# include "snprintf_s.h"
+
+#define cilk_strlen(str) strnlen_s(str, RSIZE_MAX_STR)
+#define cilk_strcpy_s strcpy_s
+// Different sprintf entries with different argument lists.
+#define cilk_snprintf_s snprintf_s_s
+#define cilk_snprintf_i snprintf_s_i
+#define cilk_snprintf_l snprintf_s_l
+#define cilk_snprintf_si snprintf_s_si
+#define cilk_snprintf_sl snprintf_s_sl
+
+#else // ! defined _WIN32
+
+#define CILK_MAX_STR (4UL << 10) // 4KB
+#define cilk_strlen(str) strnlen_s(str, CILK_MAX_STR)
+#define cilk_strcpy_s strcpy_s
+#define cilk_snprintf_s sprintf_s
+#define cilk_snprintf_i sprintf_s
+#define cilk_snprintf_l sprintf_s
+#define cilk_snprintf_si sprintf_s
+#define cilk_snprintf_sl sprintf_s
+
+#endif // ! defined _WIN32
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // INCLUDED_CILK_STR_MEM_DOT_H
diff --git a/libcilkrts/runtime/component.h b/libcilkrts/runtime/component.h
index 64ff3e5fc42..34776233f32 100644
--- a/libcilkrts/runtime/component.h
+++ b/libcilkrts/runtime/component.h
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
**************************************************************************/
#ifndef INCLUDED_COMPONENT_DOT_H
diff --git a/libcilkrts/runtime/config/arm/cilk-abi-vla.c b/libcilkrts/runtime/config/arm/cilk-abi-vla.c
new file mode 100644
index 00000000000..cf88d997046
--- /dev/null
+++ b/libcilkrts/runtime/config/arm/cilk-abi-vla.c
@@ -0,0 +1,115 @@
+/* cilk-abi-vla.cpp -*-C++-*-
+ *
+ *************************************************************************
+ *
+ * Copyright (C) 2013-2016, Intel Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
+ * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
+ *
+ **************************************************************************/
+
+/*
+ * Implementation of Variable Length Array (VLA) ABI.
+ *
+ * The compiler calls these functions to allocate Variable Length Arrays
+ * at runtime. The compiler must guarantee that __cilkrts_stack_free() is
+ * called to cleanup any memory allocated by __cilkrts_stack_alloc().
+ *
+ * This generic implementation always allocates the memory from the heap.
+ * Optimally, the implementation should expand the frame of the calling
+ * function if possible, since that will be faster. See the x86 version
+ * for one possible implementation.
+ */
+
+#include <assert.h>
+#include <stdlib.h>
+#include <stdint.h>
+
+#include "internal/abi.h"
+#include "cilk-abi-vla-internal.h"
+
+// Allocate space for a variable length array
+CILK_ABI(__cilkrts_void_ptr)
+__cilkrts_stack_alloc(
+ __cilkrts_stack_frame *sf,
+ size_t size,
+ size_t distance_from_sp_to_alloca_area,
+ uint32_t align, // align is always >= minimum stack alignment and
+ // >= ptr_size as well, and must be a power of 2.
+ uint32_t needs_tag // non-zero if the pointer being returned needs to
+ // be tagged
+)
+{
+ // full_size will be a multiple of align, and contains
+ // enough extra space to allocate a marker.
+ size_t full_size = (size + align - 1) & ~(align - 1);
+
+ // Allocate memory from the heap. The compiler is responsible
+ // for guaranteeing us a chance to free it before the function
+ // exits
+
+ return (void *)vla_internal_heap_alloc(sf, full_size, align);
+}
+
+// Free the space allocated for a variable length array.
+CILK_ABI(void)
+__cilkrts_stack_free(
+ __cilkrts_stack_frame *sf,
+ void *p,
+ size_t size,
+ size_t distance_from_sp_to_alloca_area,
+ uint32_t align, // same requirements as for align in allocation,
+ // and must match alignment that was passed when
+ // doing the allocation
+ uint32_t known_from_stack // non-zero if this is known to be allocated
+ // on the stack, and therefore has no tag
+)
+{
+ // full_size will be a multiple of align, and contains
+ // enough extra space to allocate a marker if one was needed.
+ size_t full_size = (size + align - 1) & ~(align - 1);
+
+ // Just free the allocated memory to the heap since we don't know
+ // how to expand/contract the calling frame
+ vla_internal_heap_free(p, full_size);
+}
diff --git a/libcilkrts/runtime/config/arm/os-fence.h b/libcilkrts/runtime/config/arm/os-fence.h
new file mode 100644
index 00000000000..67e157a19e5
--- /dev/null
+++ b/libcilkrts/runtime/config/arm/os-fence.h
@@ -0,0 +1,64 @@
+/* os.h -*-C++-*-
+ *
+ *************************************************************************
+ *
+ * Copyright (C) 2009-2016, Intel Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
+ * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
+ **************************************************************************/
+
+/*
+ * void __cilkrts_fence(void)
+ *
+ * Executes an MFENCE instruction to serialize all load and store instructions
+ * that were issued prior the MFENCE instruction. This serializing operation
+ * guarantees that every load and store instruction that precedes the MFENCE
+ * instruction is globally visible before any load or store instruction that
+ * follows the MFENCE instruction. The MFENCE instruction is ordered with
+ * respect to all load and store instructions, other MFENCE instructions, any
+ * SFENCE and LFENCE instructions, and any serializing instructions (such as
+ * the CPUID instruction).
+ */
+
+// COMMON_SYSDEP void __cilkrts_fence(void); ///< MFENCE instruction
+# define __cilkrts_fence() __asm__ __volatile__ ("mcr p15,0,%[t],c7,c10,4\n" :: [t] "r" (0) : "memory");
diff --git a/libcilkrts/runtime/config/arm/os-unix-sysdep.c b/libcilkrts/runtime/config/arm/os-unix-sysdep.c
new file mode 100644
index 00000000000..02d8c2bebff
--- /dev/null
+++ b/libcilkrts/runtime/config/arm/os-unix-sysdep.c
@@ -0,0 +1,105 @@
+/* os-unix-sysdep.c -*-C-*-
+ *
+ *************************************************************************
+ *
+ * Copyright (C) 2009-2016, Intel Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
+ * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
+ *************************************************************************
+ *
+ * This file contains generic implementations of system-specific code for
+ * Unix-based systems
+ */
+
+#include "os.h"
+#include "sysdep.h"
+
+/*
+ * The cycle counter is used for debugging. This funciton is only called if
+ * CILK_PROFILE is defined when the runtime is built.
+ */
+COMMON_SYSDEP unsigned long long __cilkrts_getticks(void)
+{
+# warning "unimplemented cycle counter"
+ return 0;
+}
+
+/*
+ * A "short pause" - called from the Cilk runtime's spinloops.
+ */
+COMMON_SYSDEP void __cilkrts_short_pause(void)
+{
+# warning __cilkrts_short_pause empty
+}
+
+/*
+ * Interlocked exchange - used to implement the Cilk runtime's spinloops
+ */
+COMMON_SYSDEP int __cilkrts_xchg(volatile int *ptr, int x)
+{
+ x = __sync_lock_test_and_set(ptr, x);
+ return x;
+}
+
+
+/*
+ * Restore the floating point state that is stored in a stack frame at each
+ * spawn. This should be called each time a frame is resumed.
+ *
+ * Only valid for IA32 and Intel64 processors.
+ */
+void restore_x86_fp_state (__cilkrts_stack_frame *sf)
+{
+}
+
+
+/*
+ * Save the floating point state to the __cilkrts_stack_frame at each spawn.
+ *
+ * Architecture-specific - Should only be needed on IA32 and Intel64
+ * processors.
+ */
+void sysdep_save_fp_ctrl_state(__cilkrts_stack_frame *sf)
+{
+}
+
diff --git a/libcilkrts/runtime/config/generic/cilk-abi-vla.c b/libcilkrts/runtime/config/generic/cilk-abi-vla.c
index 98fefa101bd..d0b65381069 100644
--- a/libcilkrts/runtime/config/generic/cilk-abi-vla.c
+++ b/libcilkrts/runtime/config/generic/cilk-abi-vla.c
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2013, Intel Corporation
+ * Copyright (C) 2013-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
*
**************************************************************************/
@@ -103,5 +114,5 @@ __cilkrts_stack_free(
// Just free the allocated memory to the heap since we don't know
// how to expand/contract the calling frame
- vla_internal_heap_free(t, full_size);
+ vla_internal_heap_free(p, full_size);
}
diff --git a/libcilkrts/runtime/config/generic/os-fence.h b/libcilkrts/runtime/config/generic/os-fence.h
index 841307a5296..231f136bd5e 100644
--- a/libcilkrts/runtime/config/generic/os-fence.h
+++ b/libcilkrts/runtime/config/generic/os-fence.h
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
**************************************************************************/
/*
diff --git a/libcilkrts/runtime/config/generic/os-unix-sysdep.c b/libcilkrts/runtime/config/generic/os-unix-sysdep.c
index fda7fc414bc..02d8c2bebff 100644
--- a/libcilkrts/runtime/config/generic/os-unix-sysdep.c
+++ b/libcilkrts/runtime/config/generic/os-unix-sysdep.c
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
*************************************************************************
*
* This file contains generic implementations of system-specific code for
diff --git a/libcilkrts/runtime/config/x86/cilk-abi-vla.c b/libcilkrts/runtime/config/x86/cilk-abi-vla.c
index 38c2630a1e6..873757f98d8 100644
--- a/libcilkrts/runtime/config/x86/cilk-abi-vla.c
+++ b/libcilkrts/runtime/config/x86/cilk-abi-vla.c
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2013, Intel Corporation
+ * Copyright (C) 2013-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
*
**************************************************************************/
@@ -58,37 +69,21 @@
#include <assert.h>
#include <stdlib.h>
#include <stdint.h>
-
-// Getting a definition for alloca appears to be a pain in the butt. Here's
-// a variant on what's recommended in the autoconf doc
-#if defined _MSC_VER
-# include <malloc.h>
-# define alloca _alloca
-#elif defined HAVE_ALLOCA_H
-# include <alloca.h>
-#elif defined __GNUC__
-# define alloca __builtin_alloca
-#elif defined _AIX
-# define alloca __alloca
-#else
-# include <stddef.h>
-# ifdef __cplusplus
-extern "C"
-# endif
-void *alloca (size_t);
-#endif
+#include "declare-alloca.h"
#ifdef _WIN32
-# define INLINE static __inline
-# pragma warning(disable:1025) // Don't whine about zero extending result of unary operation
+# define INLINE static __inline
+# pragma warning(disable:1025) // Don't whine about zero extending result of unary operation
#else
-# define INLINE static inline
+# define INLINE static inline
#endif
#include "internal/abi.h"
#include "cilk-abi-vla-internal.h"
+#ifdef __INTEL_COMPILER
+// These functions are used only within __INTEL_COMPILER.
#if defined(__x86_64) || defined(_M_X64)
INLINE void setsp(void *val)
{
@@ -151,7 +146,7 @@ INLINE void copy_frame_up_and_move_bp(
"movq %2, %%rcx;"
"shrq $3, %%rcx;"
"std; rep movsq; cld;"
- "movl %3, %%rbp;" :
+ "movq %3, %%rbp;" :
:
"rm"(dst), "rm"(src), "rm"(cpy_bytes), "rm"(new_ebp) :
"rsi", "rdi", "rcx", "rbp", "memory");
@@ -226,6 +221,7 @@ INLINE void copy_frame_up_and_move_bp(
}
#endif
+#endif // __INTEL_COMPILER
#define c_cilk_ptr_from_heap 0xc2f2f00d
#define c_cilk_ptr_from_stack 0xc3f30d0f
@@ -241,11 +237,17 @@ __cilkrts_stack_alloc(
// be tagged
)
{
-#ifdef __INTEL_COMPILER
// full_size will be a multiple of align, and contains
// enough extra space to allocate a marker.
size_t full_size = (size + align - 1) & ~(align - 1);
+#ifndef __INTEL_COMPILER
+ // Allocate memory from the heap. The compiler is responsible
+ // for guaranteeing us a chance to free it before the function
+ // exits
+ return (void *)vla_internal_heap_alloc(sf, full_size, align);
+
+#else
if (needs_tag) {
full_size += align;
}
@@ -336,10 +338,7 @@ __cilkrts_stack_alloc(
}
return t;
-#else // Not __INTEL_COMPILER
- // Not supported unless we can figure out how to get the size of the frame
- return NULL;
-#endif
+#endif // __INTEL_COMPILER
}
// This frees the space allocated for a variable length array.
@@ -356,12 +355,17 @@ __cilkrts_stack_free(
// on the stack, and therefore has no tag
)
{
-#ifdef __INTEL_COMPILER
- uint32_t *t = (uint32_t*)p;
-
// full_size will be a multiple of align, and contains
// enough extra space to allocate a marker if one was needed.
size_t full_size = (size + align - 1) & ~(align - 1);
+
+#ifndef __INTEL_COMPILER
+ // Just free the allocated memory to the heap since we don't know
+ // how to expand/contract the calling frame
+ vla_internal_heap_free(p, full_size);
+
+#else
+ uint32_t *t = (uint32_t*)p;
if (known_from_stack == 0) {
// if the compiler hasn't told the run-time that this is
// known to be on the stack, then this pointer must have been
@@ -435,7 +439,5 @@ __cilkrts_stack_free(
else {
vla_internal_heap_free(t, full_size);
}
-#else // Not __INTEL_COMPILER
- // Not supported unless we can figure out how to get the size of the frame
-#endif
+#endif // __INTEL_COMPILER
}
diff --git a/libcilkrts/runtime/config/x86/os-fence.h b/libcilkrts/runtime/config/x86/os-fence.h
index ec704e94ef2..520eb425541 100644
--- a/libcilkrts/runtime/config/x86/os-fence.h
+++ b/libcilkrts/runtime/config/x86/os-fence.h
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
**************************************************************************/
/* gcc before 4.4 does not implement __sync_synchronize properly */
diff --git a/libcilkrts/runtime/config/x86/os-unix-sysdep.c b/libcilkrts/runtime/config/x86/os-unix-sysdep.c
index cbc77343215..ce043803b02 100644
--- a/libcilkrts/runtime/config/x86/os-unix-sysdep.c
+++ b/libcilkrts/runtime/config/x86/os-unix-sysdep.c
@@ -2,7 +2,7 @@
*
*************************************************************************
*
- * Copyright (C) 2009-2014, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
*************************************************************************
*
* This file contains system-specific code for Unix systems
@@ -96,7 +110,7 @@ COMMON_SYSDEP int __cilkrts_xchg(volatile int *ptr, int x)
* This declaration should generate an error when the Intel compiler adds
* supprt for the intrinsic.
*/
-#ifdef __INTEL_COMPILER
+#if defined(__INTEL_COMPILER) || defined(__clang__)
static inline int __builtin_cpu_supports(const char *feature)
{
return 1;
@@ -124,7 +138,6 @@ void restore_x86_fp_state (__cilkrts_stack_frame *sf) {
#endif
}
-
void sysdep_save_fp_ctrl_state(__cilkrts_stack_frame *sf)
{
// If we're not going to restore, don't bother saving it
@@ -135,7 +148,7 @@ void sysdep_save_fp_ctrl_state(__cilkrts_stack_frame *sf)
{
__asm__ ("stmxcsr %0" : "=m" (sf->mxcsr));
}
- __asm__ ("fnstcw %0" : "=m" (sf->fpcsr));
+ __asm__ ("fnstcw %0" : "=m" (sf->fpcsr));
}
#endif
}
diff --git a/libcilkrts/runtime/symbol_test.c b/libcilkrts/runtime/declare-alloca.h
index 8291d369a65..b0ed8b2fe0a 100644
--- a/libcilkrts/runtime/symbol_test.c
+++ b/libcilkrts/runtime/declare-alloca.h
@@ -1,12 +1,10 @@
-/* symbol_test.c -*-C-*-
+/* cilk-abi-vla.cpp -*-C++-*-
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2013-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,30 +31,41 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
+ *
**************************************************************************/
-/* simple program to verify that there are no undefined symbols in the runtime.
- * If the runtime uses any symbols that are not defined, compiling this program
- * will cause a linker error.
+/*
+ * You'd think that getting a declaration for alloca would be easy. But you'd
+ * be wrong. Here's a variant on what's recommended in the autoconf doc
*/
-#define _Cilk_for for
-extern void* __cilkrts_global_state;
-void *volatile p;
-
-void foo () { }
-int main ()
-{
- int i;
- long long j;
-
- _Cilk_spawn foo();
- _Cilk_for (i = 0; i < 2; ++i)
- foo();
- _Cilk_for (j = 0; j < 2; ++j)
- foo();
- p = __cilkrts_global_state;
- return 0;
-}
-
-/* End symbol_test.c */
+#if defined _MSC_VER
+# include <malloc.h>
+# define alloca _alloca
+#elif defined HAVE_ALLOCA_H
+# include <alloca.h>
+#elif defined __GNUC__
+# define alloca __builtin_alloca
+#elif defined _AIX
+# define alloca __alloca
+#else
+# include <stddef.h>
+# ifdef __cplusplus
+extern "C"
+# endif
+void *alloca (size_t);
+#endif
diff --git a/libcilkrts/runtime/doxygen-layout.xml b/libcilkrts/runtime/doxygen-layout.xml
index fabe0ab3cd8..3083cb6c0e3 100644
--- a/libcilkrts/runtime/doxygen-layout.xml
+++ b/libcilkrts/runtime/doxygen-layout.xml
@@ -1,11 +1,9 @@
<doxygenlayout version="1.0">
<!--
-# @copyright
-# Copyright (C) 2011-2013, Intel Corporation
+# Copyright (C) 2011-2016, Intel Corporation
# All rights reserved.
#
-# @copyright
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
@@ -20,7 +18,6 @@
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
-# @copyright
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -33,6 +30,20 @@
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
# WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
+#
+# *********************************************************************
+#
+# PLEASE NOTE: This file is a downstream copy of a file mainitained in
+# a repository at cilkplus.org. Changes made to this file that are not
+# submitted through the contribution process detailed at
+# http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+# time that a new version is released. Changes only submitted to the
+# GNU compiler collection or posted to the git repository at
+# https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+# not tracked.
+#
+# We welcome your contributions to this open source project. Thank you
+# for your assistance in helping us improve Cilk Plus.
-->
<!-- Navigation index tabs for HTML output -->
diff --git a/libcilkrts/runtime/doxygen.cfg b/libcilkrts/runtime/doxygen.cfg
index 684dcb51b51..f9bf047d4b2 100644
--- a/libcilkrts/runtime/doxygen.cfg
+++ b/libcilkrts/runtime/doxygen.cfg
@@ -1,10 +1,8 @@
# Doxyfile 1.7.4
-# @copyright
-# Copyright (C) 2011-2013, Intel Corporation
+# Copyright (C) 2011-2016, Intel Corporation
# All rights reserved.
#
-# @copyright
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
@@ -19,7 +17,6 @@
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
-# @copyright
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -32,6 +29,20 @@
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
# WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
+#
+# *********************************************************************
+#
+# PLEASE NOTE: This file is a downstream copy of a file mainitained in
+# a repository at cilkplus.org. Changes made to this file that are not
+# submitted through the contribution process detailed at
+# http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+# time that a new version is released. Changes only submitted to the
+# GNU compiler collection or posted to the git repository at
+# https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+# not tracked.
+#
+# We welcome your contributions to this open source project. Thank you
+# for your assistance in helping us improve Cilk Plus.
# This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project.
diff --git a/libcilkrts/runtime/except-gcc.cpp b/libcilkrts/runtime/except-gcc.cpp
index bd08d1826b3..4940acb41f7 100644
--- a/libcilkrts/runtime/except-gcc.cpp
+++ b/libcilkrts/runtime/except-gcc.cpp
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
**************************************************************************/
#include "except-gcc.h"
@@ -100,12 +111,12 @@ static void
decode_exceptions(char *out, size_t len, struct pending_exception_info *info)
{
if (info->empty())
- snprintf(out, len, "[empty]");
+ cilk_snprintf_s(out, len, "%s", "[empty]");
else if (info->rethrow)
- snprintf(out, len, "[rethrow %p]",
- info->runtime_state.caughtExceptions);
+ cilk_snprintf_l(out, len, "[rethrow %p]",
+ info->runtime_state.caughtExceptions);
else
- snprintf(out, len, "[throw %p]", (void *)info->active);
+ cilk_snprintf_l(out, len, "[throw %p]", (void *)info->active);
}
#endif
diff --git a/libcilkrts/runtime/except-gcc.h b/libcilkrts/runtime/except-gcc.h
index aa76adbc233..3ef40616269 100644
--- a/libcilkrts/runtime/except-gcc.h
+++ b/libcilkrts/runtime/except-gcc.h
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
**************************************************************************/
/**
diff --git a/libcilkrts/runtime/except.h b/libcilkrts/runtime/except.h
index 58e2238c581..6df7443e01a 100644
--- a/libcilkrts/runtime/except.h
+++ b/libcilkrts/runtime/except.h
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
**************************************************************************/
/**
diff --git a/libcilkrts/runtime/frame_malloc.c b/libcilkrts/runtime/frame_malloc.c
index 0b38bd209a9..9cbea45d22c 100644
--- a/libcilkrts/runtime/frame_malloc.c
+++ b/libcilkrts/runtime/frame_malloc.c
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
**************************************************************************/
#include "frame_malloc.h"
diff --git a/libcilkrts/runtime/frame_malloc.h b/libcilkrts/runtime/frame_malloc.h
index d412fb620fe..6f4521e2bc3 100644
--- a/libcilkrts/runtime/frame_malloc.h
+++ b/libcilkrts/runtime/frame_malloc.h
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
**************************************************************************/
/**
diff --git a/libcilkrts/runtime/full_frame.c b/libcilkrts/runtime/full_frame.c
index 9ccfd110d6b..5d1f2a1b5d0 100644
--- a/libcilkrts/runtime/full_frame.c
+++ b/libcilkrts/runtime/full_frame.c
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2010-2013, Intel Corporation
+ * Copyright (C) 2010-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
*
**************************************************************************/
diff --git a/libcilkrts/runtime/full_frame.h b/libcilkrts/runtime/full_frame.h
index 327a3337afe..185675db959 100644
--- a/libcilkrts/runtime/full_frame.h
+++ b/libcilkrts/runtime/full_frame.h
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
**************************************************************************/
#ifndef INCLUDED_FULL_FRAME_DOT_H
diff --git a/libcilkrts/runtime/global_state.cpp b/libcilkrts/runtime/global_state.cpp
index 02de54f43b1..2af6697b27a 100644
--- a/libcilkrts/runtime/global_state.cpp
+++ b/libcilkrts/runtime/global_state.cpp
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
**************************************************************************/
#include "global_state.h"
@@ -57,7 +68,7 @@
// TBD: There is a race when multiple threads try to initialize the
// user_settable_values??
-//
+//
// Set to true if the user settable values portion of the global state
// singleton is initialized, even if the rest of the singleton is not
// initialized.
@@ -69,9 +80,10 @@ namespace {
// cilkg_get_user_settable_values() is called and partially-zero-filled until
// cilkg_init_global_state() is called. The first field is filled in with
// the size of a void* for the debugger and must be valid before initialization
-global_state_t global_state_singleton =
+static global_state_t global_state_singleton =
{
- sizeof(void *), // addr_size
+ sizeof(void *), // addr_size
+ GLOBAL_STATE_VERSION, // structure version
};
@@ -93,13 +105,15 @@ inline bool strmatch(const char* a, const char* b)
return 0 == std::strcmp(a, b);
}
-// Returns the integer value represented by the null-terminated string at 's'.
+// Returns the integer value represented by the null-terminated, decimal string
+// at 's'.
+
inline long to_long(const char* s)
{
char *end;
errno = 0;
- return std::strtol(s, &end, 0);
+ return std::strtol(s, &end, 10);
}
#ifdef _WIN32
@@ -571,7 +585,6 @@ global_state_t* cilkg_init_global_state()
void cilkg_publish_global_state(global_state_t* g)
{
-
// TBD: which one of these needs to be executed first? I say
// cilkg_singleton_ptr needs to be set last, with a mfence in
// between, since it is the flag that cilkg_is_published_is
@@ -584,7 +597,15 @@ void cilkg_publish_global_state(global_state_t* g)
void cilkg_deinit_global_state()
{
cilkg_singleton_ptr = NULL;
- __cilkrts_global_state = NULL;
+
+ // The pointer to the global state needs to remain valid for the
+ // debugger. Thus, we can't clear the following pointer.
+ // __cilkrts_global_state = NULL;
+
+
+ // We also don't reset the global state, so that if we resume
+ // execution after ending Cilk, user set variables (e.g., # of
+ // workers) remains valid.
}
int cilkg_is_published(void)
diff --git a/libcilkrts/runtime/global_state.h b/libcilkrts/runtime/global_state.h
index ef455e479d5..527a4b54e45 100644
--- a/libcilkrts/runtime/global_state.h
+++ b/libcilkrts/runtime/global_state.h
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
**************************************************************************/
/**
@@ -70,6 +81,16 @@ enum record_replay_t {
};
/**
+ * @brief Global state structure version.
+ *
+ * Since the global state is exposed for debugger access, we need a version
+ * number to let it know that the version of the structure is what it expects
+ * to see. If any of the fields marked as (fixed) below are changed, the
+ * version number needs to be bumped.
+ */
+#define GLOBAL_STATE_VERSION 0
+
+/**
* @brief The global state is a structure that is shared by all workers in
* Cilk.
*
@@ -109,7 +130,9 @@ struct global_state_t { /* COMMON_PORTABLE */
* debugger integration library will need to be changed to match!!!
*************************************************************************/
- int addr_size; ///< Number of bytes for an address, used by debugger (fixed)
+ uint16_t addr_size; ///< Number of bytes for an address, used by debugger (fixed)
+
+ uint16_t version; ///< Version of this structure (fixed)
int system_workers; ///< Number of system workers (fixed)
diff --git a/libcilkrts/runtime/jmpbuf.c b/libcilkrts/runtime/jmpbuf.c
index 39b51a593ce..857e0210749 100644
--- a/libcilkrts/runtime/jmpbuf.c
+++ b/libcilkrts/runtime/jmpbuf.c
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
**************************************************************************/
#include "jmpbuf.h"
diff --git a/libcilkrts/runtime/jmpbuf.h b/libcilkrts/runtime/jmpbuf.h
index 60573f3a5fa..0ce7ff8dbb2 100644
--- a/libcilkrts/runtime/jmpbuf.h
+++ b/libcilkrts/runtime/jmpbuf.h
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
**************************************************************************/
/**
diff --git a/libcilkrts/runtime/linux-symbols.ver b/libcilkrts/runtime/linux-symbols.ver
index aeb4a5fb13d..d6568421a50 100644
--- a/libcilkrts/runtime/linux-symbols.ver
+++ b/libcilkrts/runtime/linux-symbols.ver
@@ -1,11 +1,9 @@
/*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -20,7 +18,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -33,6 +30,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
**************************************************************************/
CILKABI0
@@ -87,11 +98,13 @@ CILKABI1
__cilkrts_get_sf;
__cilkrts_get_stack_size;
__cilkrts_get_worker_rank;
+ __cilkrts_resume;
__cilkrts_save_fp_ctrl_state;
__cilkrts_stack_alloc;
__cilkrts_stack_free;
+ __cilkrts_suspend;
__cilkrts_watch_stack;
-} CILKABI0;
+};
CILKLIB1.02
{
diff --git a/libcilkrts/runtime/local_state.c b/libcilkrts/runtime/local_state.c
index 14ac8271936..ae070d4158d 100644
--- a/libcilkrts/runtime/local_state.c
+++ b/libcilkrts/runtime/local_state.c
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2010-2013, Intel Corporation
+ * Copyright (C) 2010-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
*
**************************************************************************/
diff --git a/libcilkrts/runtime/local_state.h b/libcilkrts/runtime/local_state.h
index 03f39897f51..d16599f1add 100644
--- a/libcilkrts/runtime/local_state.h
+++ b/libcilkrts/runtime/local_state.h
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
**************************************************************************/
/**
diff --git a/libcilkrts/runtime/mac-symbols.txt b/libcilkrts/runtime/mac-symbols.txt
index 38d83a8675d..efec3e984fd 100644
--- a/libcilkrts/runtime/mac-symbols.txt
+++ b/libcilkrts/runtime/mac-symbols.txt
@@ -7,7 +7,7 @@ ___cilkrts_bump_worker_rank
___cilkrts_bump_worker_rank_internal
___cilkrts_cilk_for_32
___cilkrts_cilk_for_64
-___cilkrts_debugger_notification
+
___cilkrts_dump_stats
___cilkrts_end_cilk
___cilkrts_enter_frame
@@ -33,15 +33,17 @@ ___cilkrts_hyperobject_alloc
___cilkrts_hyperobject_dealloc
___cilkrts_hyperobject_noop_destroy
___cilkrts_init
-___cilkrts_irml_version
+
___cilkrts_leave_frame
___cilkrts_metacall
+___cilkrts_resume
___cilkrts_rethrow
___cilkrts_return_exception
___cilkrts_save_fp_ctrl_state
___cilkrts_set_param
___cilkrts_stack_alloc
___cilkrts_stack_free
+___cilkrts_suspend
___cilkrts_sync
___cilkrts_synched
___cilkrts_watch_stack
diff --git a/libcilkrts/runtime/metacall_impl.c b/libcilkrts/runtime/metacall_impl.c
index ce1c51a202b..e5b3f0f9d8b 100644
--- a/libcilkrts/runtime/metacall_impl.c
+++ b/libcilkrts/runtime/metacall_impl.c
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
**************************************************************************/
#include "metacall_impl.h"
diff --git a/libcilkrts/runtime/metacall_impl.h b/libcilkrts/runtime/metacall_impl.h
index 90cc7f95168..d395c523570 100644
--- a/libcilkrts/runtime/metacall_impl.h
+++ b/libcilkrts/runtime/metacall_impl.h
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2010-2013, Intel Corporation
+ * Copyright (C) 2010-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
*
**************************************************************************/
diff --git a/libcilkrts/runtime/os-unix.c b/libcilkrts/runtime/os-unix.c
index cb582dd7591..d339daf7026 100644
--- a/libcilkrts/runtime/os-unix.c
+++ b/libcilkrts/runtime/os-unix.c
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,15 +31,22 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
**************************************************************************/
-#ifdef __linux__
- // define _GNU_SOURCE before *any* #include.
- // Even <stdint.h> will break later #includes if this macro is not
- // already defined when it is #included.
-# define _GNU_SOURCE
-#endif
-
#include "os.h"
#include "bug.h"
#include "cilk_malloc.h"
@@ -51,22 +55,27 @@
#if defined __linux__
# include <sys/sysinfo.h>
# include <sys/syscall.h>
+
#elif defined __APPLE__
# include <sys/sysctl.h>
// Uses sysconf(_SC_NPROCESSORS_ONLN) in verbose output
-#elif defined __DragonFly__
-// No additional include files
-#elif defined __FreeBSD__
-// No additional include files
-#elif defined __CYGWIN__
-// Cygwin on Windows - no additional include files
+
#elif defined __VXWORKS__
# include <vxWorks.h>
# include <vxCpuLib.h>
-# include <taskLib.h>
+# include <taskLib.h>
+
// Solaris
#elif defined __sun__ && defined __svr4__
# include <sched.h>
+
+// OSes we know about which don't require any additional files
+#elif defined __CYGWIN__ || \
+ defined __DragonFly__ || \
+ defined __FreeBSD__ || \
+ defined __GNU__
+// No additional include files
+
#else
# error "Unsupported OS"
#endif
@@ -311,39 +320,67 @@ static pid_t linux_gettid(void)
* mask is set by the offload library to force the offload code away from
* cores that have offload support threads running on them.
*/
-static int linux_get_affinity_count (int tid)
+static int linux_get_affinity_count ()
{
-#if !defined HAVE_PTHREAD_AFFINITY_NP
- return 0;
+ long system_cores = sysconf(_SC_NPROCESSORS_ONLN);
+ int affinity_cores = 0;
+
+#if defined HAVE_PTHREAD_AFFINITY_NP
+
+#if defined (CPU_ALLOC_SIZE) && ! defined(DONT_USE_CPU_ALLOC_SIZE)
+ // Statically allocated cpu_set_t's max out at 1024 cores. If
+ // CPU_ALLOC_SIZE is available, use it to support large numbers of cores
+ size_t cpusetsize = CPU_ALLOC_SIZE(system_cores);
+ cpu_set_t *process_mask = (cpu_set_t *)__cilkrts_malloc(cpusetsize);
+
+ // Get the affinity mask for this thread
+ int err = pthread_getaffinity_np(pthread_self(),
+ cpusetsize,
+ process_mask);
+
+ // Count the available cores.
+ if (0 == err)
+ affinity_cores = CPU_COUNT_S(cpusetsize, process_mask);
+
+ __cilkrts_free(process_mask);
+
#else
+ // CPU_ALLOC_SIZE isn't available, or this is the Intel compiler build
+ // and we have to support RHEL5. Use a statically allocated cpu_set_t
cpu_set_t process_mask;
// Extract the thread affinity mask
- int err = sched_getaffinity (tid, sizeof(process_mask),&process_mask);
+ int err = pthread_getaffinity_np(pthread_self(),
+ sizeof(process_mask),
+ &process_mask);
- if (0 != err)
+ if (0 == err)
{
- return 0;
- }
-
- // We have extracted the mask OK, so now we can count the number of threads
- // in it. This is linear in the maximum number of CPUs available, We
- // could do a logarithmic version, if we assume the format of the mask,
- // but it's not really worth it. We only call this at thread startup
- // anyway.
- int available_procs = 0;
- int i;
- for (i = 0; i < CPU_SETSIZE; i++)
- {
- if (CPU_ISSET(i, &process_mask))
+ // We have extracted the mask OK, so now we can count the number of
+ // threads in it. This is linear in the maximum number of CPUs
+ // available, We could do a logarithmic version, if we assume the
+ // format of the mask, but it's not really worth it. We only call
+ // this at thread startup anyway.
+ int i;
+ for (i = 0; i < CPU_SETSIZE; i++)
{
- available_procs++;
+ if (CPU_ISSET(i, &process_mask))
+ {
+ affinity_cores++;
+ }
}
}
-
- return available_procs;
-#endif
+#endif // CPU_ALLOC_SIZE
+#endif // ! defined HAVE_PTHREAD_AFFINITY_NP
+
+ // If we've got a count of cores this thread is supposed to use, that's
+ // the number or cores we'll use. Otherwise, default to the number of
+ // cores on the system.
+ if (0 == affinity_cores)
+ return system_cores;
+ else
+ return affinity_cores;
}
#endif // defined (__linux__) && ! defined(__ANDROID__)
@@ -356,43 +393,56 @@ static int linux_get_affinity_count (int tid)
COMMON_SYSDEP int __cilkrts_hardware_cpu_count(void)
{
-#if defined __ANDROID__ || (defined(__sun__) && defined(__svr4__))
- return sysconf (_SC_NPROCESSORS_ONLN);
+#if defined __ANDROID__ || \
+ defined __CYGWIN__ || \
+ defined __DragonFly__ || \
+ defined __FreeBSD__ || \
+ (defined(__sun__) && defined(__svr4__))
+ return (int)sysconf(_SC_NPROCESSORS_ONLN);
#elif defined __MIC__
/// HACK: Usually, the 3rd and 4th hyperthreads are not beneficial
/// on KNC. Also, ignore the last core.
- int P = sysconf (_SC_NPROCESSORS_ONLN);
- return P/2 - 2;
+ int count = (int)sysconf (_SC_NPROCESSORS_ONLN);
+ return count/2 - 2;
#elif defined __linux__
- int affinity_count = linux_get_affinity_count(linux_gettid());
-
- return (0 != affinity_count) ? affinity_count : sysconf (_SC_NPROCESSORS_ONLN);
+ return linux_get_affinity_count();
#elif defined __APPLE__
- int count = 0;
- int cmd[2] = { CTL_HW, HW_NCPU };
+ int count;
size_t len = sizeof count;
- int status = sysctl(cmd, 2, &count, &len, 0, 0);
- assert(status >= 0);
- assert((unsigned)count == count);
+ int status = sysctlbyname("hw.logicalcpu", &count, &len, 0, 0);
+ assert(0 == status);
return count;
-#elif defined __FreeBSD__ || defined __CYGWIN__ || defined __DragonFly__
- int ncores = sysconf(_SC_NPROCESSORS_ONLN);
-
- return ncores;
- // Just get the number of processors
-// return sysconf(_SC_NPROCESSORS_ONLN);
#elif defined __VXWORKS__
- return __builtin_popcount( vxCpuEnabledGet() );
+ return __builtin_popcount(vxCpuEnabledGet());
#else
-#error "Unknown architecture"
+#error "Unsupported architecture"
+#endif
+}
+
+COMMON_SYSDEP void __cilkrts_idle(void)
+{
+ // This is another version of __cilkrts_yield() to be used when
+ // silencing workers that are not stealing work.
+#if defined(__ANDROID__) || \
+ defined(__FreeBSD__) || \
+ defined(__VXWORKS__) || \
+ (defined(__sun__) && defined(__svr4__))
+ sched_yield();
+#elif defined(__MIC__)
+ _mm_delay_32(1024);
+#elif defined(__linux__) || \
+ defined(__APPLE__)
+ usleep(10000);
+#else
+# error "Unsupported architecture"
#endif
}
COMMON_SYSDEP void __cilkrts_sleep(void)
{
#ifdef __VXWORKS__
- taskDelay(1);
+ taskDelay(1);
#else
usleep(1);
#endif
@@ -400,13 +450,14 @@ COMMON_SYSDEP void __cilkrts_sleep(void)
COMMON_SYSDEP void __cilkrts_yield(void)
{
-#if __APPLE__ || __FreeBSD__ || __VXWORKS__
- // On MacOS, call sched_yield to yield quantum. I'm not sure why we
+#if defined(__ANDROID__) || \
+ defined(__APPLE__) || \
+ defined(__FreeBSD__) || \
+ defined(__VXWORKS__) || \
+ (defined(__sun__) && defined(__svr4__))
+ // Call sched_yield to yield quantum. I'm not sure why we
// don't do this on Linux also.
sched_yield();
-#elif defined(__DragonFly__)
- // On DragonFly BSD, call sched_yield to yield quantum.
- sched_yield();
#elif defined(__MIC__)
// On MIC, pthread_yield() really trashes things. Arch's measurements
// showed that calling _mm_delay_32() (or doing nothing) was a better
@@ -414,14 +465,12 @@ COMMON_SYSDEP void __cilkrts_yield(void)
// giving up the processor and latency starting up when work becomes
// available
_mm_delay_32(1024);
-#elif defined(__ANDROID__) || (defined(__sun__) && defined(__svr4__))
- // On Android and Solaris, call sched_yield to yield quantum. I'm not
- // sure why we don't do this on Linux also.
- sched_yield();
-#else
+#elif defined(__linux__)
// On Linux, call pthread_yield (which in turn will call sched_yield)
// to yield quantum.
pthread_yield();
+#else
+# error "Unsupported architecture"
#endif
}
@@ -434,11 +483,10 @@ COMMON_SYSDEP __STDNS size_t cilkos_getenv(char* value, __STDNS size_t vallen,
const char* envstr = getenv(varname);
if (envstr)
{
- size_t len = strlen(envstr);
+ size_t len = cilk_strlen(envstr);
if (len > vallen - 1)
return len + 1;
-
- strcpy(value, envstr);
+ cilk_strcpy_s(value, vallen, envstr);
return len;
}
else
@@ -479,11 +527,25 @@ COMMON_SYSDEP void cilkos_warning(const char *fmt, ...)
fflush(stderr);
}
+#ifdef __VXWORKS__
+#ifdef _WRS_KERNEL
+void cilkStart()
+{
+ __cilkrts_init_tls_variables();
+}
+#else
+_WRS_CONSTRUCTOR(cilkInit, 100)
+{
+ __cilkrts_init_tls_variables();
+}
+#endif
+#else
static void __attribute__((constructor)) init_once()
{
/*__cilkrts_debugger_notification_internal(CILK_DB_RUNTIME_LOADED);*/
__cilkrts_init_tls_variables();
}
+#endif
#define PAGE 4096
diff --git a/libcilkrts/runtime/os.h b/libcilkrts/runtime/os.h
index 8066f0313c2..bfdf0203c22 100644
--- a/libcilkrts/runtime/os.h
+++ b/libcilkrts/runtime/os.h
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
**************************************************************************/
/**
@@ -49,6 +60,7 @@
#include "rts-common.h"
#include "cilk/common.h"
#include "cilk-tbb-interop.h"
+#include "cilk_str_mem.h"
#ifdef __cplusplus
# include <cstddef>
@@ -156,6 +168,7 @@ COMMON_SYSDEP int __cilkrts_xchg(volatile int *ptr, int x);
COMMON_SYSDEP void __cilkrts_sleep(void); ///< Sleep briefly
COMMON_SYSDEP void __cilkrts_yield(void); ///< Yield quantum
+COMMON_SYSDEP void __cilkrts_idle(void); ///< Idle
/**
* @brief Gets environment variable 'varname' and copy its value into 'value'.
diff --git a/libcilkrts/runtime/os_mutex-unix.c b/libcilkrts/runtime/os_mutex-unix.c
index af398cdd089..e0f058eb4a9 100644
--- a/libcilkrts/runtime/os_mutex-unix.c
+++ b/libcilkrts/runtime/os_mutex-unix.c
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
**************************************************************************/
#include "os_mutex.h"
diff --git a/libcilkrts/runtime/os_mutex.h b/libcilkrts/runtime/os_mutex.h
index 71d9eb14e51..e2c12061a64 100644
--- a/libcilkrts/runtime/os_mutex.h
+++ b/libcilkrts/runtime/os_mutex.h
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
**************************************************************************/
/**
diff --git a/libcilkrts/runtime/pedigrees.c b/libcilkrts/runtime/pedigrees.c
index dee4d9cb411..19b390ac74a 100644
--- a/libcilkrts/runtime/pedigrees.c
+++ b/libcilkrts/runtime/pedigrees.c
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2007-2013, Intel Corporation
+ * Copyright (C) 2007-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
*
**************************************************************************/
diff --git a/libcilkrts/runtime/pedigrees.h b/libcilkrts/runtime/pedigrees.h
index 3f6ebb977f9..0e5c8d70da8 100644
--- a/libcilkrts/runtime/pedigrees.h
+++ b/libcilkrts/runtime/pedigrees.h
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
**************************************************************************/
#ifndef INCLUDED_PEDIGREES_DOT_H
diff --git a/libcilkrts/runtime/record-replay.cpp b/libcilkrts/runtime/record-replay.cpp
index bc5a79f2411..293c99ae65f 100644
--- a/libcilkrts/runtime/record-replay.cpp
+++ b/libcilkrts/runtime/record-replay.cpp
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2012-2013, Intel Corporation
+ * Copyright (C) 2012-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
*
**************************************************************************/
@@ -46,8 +57,8 @@
#include <stdlib.h>
// clang is really strict about printf formats, so use the annoying integer
-// printf macros. Unfortunately they're not avaiable on Windows
-#ifdef _WIN32
+// printf macros. Unfortunately they're not available on Windows (or on VxWorks)
+#if defined(_WIN32) || defined(_WRS_KERNEL)
#define PRIu64 "llu"
#else
#define __STDC_FORMAT_MACROS 1
@@ -251,10 +262,9 @@ char * walk_pedigree_nodes(char *p, const __cilkrts_pedigree *pnode)
if (pnode->parent)
{
p = walk_pedigree_nodes(p, pnode->parent);
- p += sprintf(p, "_");
+ p += cilk_snprintf_s(p, PEDIGREE_BUFF_SIZE, "%s", (char *) "_");
}
-
- return p + sprintf(p, "%" PRIu64, pnode->rank);
+ return p + cilk_snprintf_l(p, PEDIGREE_BUFF_SIZE, "%" PRIu64, pnode->rank);
}
/**
@@ -278,7 +288,7 @@ void write_to_replay_log (__cilkrts_worker *w, const char *type,
// If we don't have an initial pedigree node, just use "0" to fill the slot
if (NULL == initial_node)
- strcpy(pedigree, "0");
+ cilk_strcpy_s(pedigree, PEDIGREE_BUFF_SIZE, "0");
else
walk_pedigree_nodes(pedigree, initial_node);
@@ -544,7 +554,9 @@ void load_recorded_log(__cilkrts_worker *w)
FILE *f;
// Open the log for reading
- sprintf(local_replay_file_name, "%s%d.cilklog", w->g->record_replay_file_name, w->self);
+ cilk_snprintf_si(local_replay_file_name, sizeof(local_replay_file_name),
+ "%s%d.cilklog", w->g->record_replay_file_name, w->self);
+
f = fopen(local_replay_file_name, "r");
// Make sure we found a log!
@@ -701,7 +713,8 @@ void replay_init_workers(global_state_t *g)
for(i = 0; i < g->total_workers; ++i)
{
__cilkrts_worker *w = g->workers[i];
- sprintf(worker_file_name, "replay_log_%d.cilklog", w->self);
+ cilk_snprintf_i(worker_file_name, sizeof(worker_file_name),
+ "replay_log_%d.cilklog", w->self);
w->l->record_replay_fptr = fopen(worker_file_name, "w+");
CILK_ASSERT(NULL != w->l->record_replay_fptr);
}
@@ -717,9 +730,8 @@ void replay_init_workers(global_state_t *g)
for(i = 0; i < g->total_workers; ++i)
{
__cilkrts_worker *w = g->workers[i];
- sprintf(worker_file_name, "%s%d.cilklog",
- g->record_replay_file_name,
- w->self);
+ cilk_snprintf_si(worker_file_name, sizeof(worker_file_name),
+ "%s%d.cilklog", g->record_replay_file_name, w->self);
w->l->record_replay_fptr = fopen(worker_file_name, "w+");
CILK_ASSERT(NULL != w->l->record_replay_fptr);
}
diff --git a/libcilkrts/runtime/record-replay.h b/libcilkrts/runtime/record-replay.h
index c1c5a68f579..a68790fc92c 100644
--- a/libcilkrts/runtime/record-replay.h
+++ b/libcilkrts/runtime/record-replay.h
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2012-2013, Intel Corporation
+ * Copyright (C) 2012-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
*
**************************************************************************/
diff --git a/libcilkrts/runtime/reducer_impl.cpp b/libcilkrts/runtime/reducer_impl.cpp
index f20b9bc4592..f3acb3c30f1 100644
--- a/libcilkrts/runtime/reducer_impl.cpp
+++ b/libcilkrts/runtime/reducer_impl.cpp
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
*
* Patents Pending, Intel Corporation.
**************************************************************************/
diff --git a/libcilkrts/runtime/reducer_impl.h b/libcilkrts/runtime/reducer_impl.h
index 3425967ad8d..722eac14d10 100644
--- a/libcilkrts/runtime/reducer_impl.h
+++ b/libcilkrts/runtime/reducer_impl.h
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
**************************************************************************/
/**
diff --git a/libcilkrts/runtime/rts-common.h b/libcilkrts/runtime/rts-common.h
index 4ffde7ccb1e..75a5efe7dba 100644
--- a/libcilkrts/runtime/rts-common.h
+++ b/libcilkrts/runtime/rts-common.h
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
**************************************************************************/
#ifndef INCLUDED_RTS_COMMON_DOT_H
@@ -64,8 +75,8 @@
#define COMMON_SYSDEP
#define NON_COMMON
-#if !(defined __GNUC__ || defined __ICC)
-# define __builtin_expect(a_, b_) a_
+#if !(defined __GNUC__ || defined __ICC) || defined(_WRS_KERNEL)
+# define __builtin_expect(a_, b_) (a_)
#endif
#ifdef __cplusplus
@@ -103,7 +114,7 @@
* intrinsics (__notify_intrinsic()). For those that don't, #undef the
* following definition:
*/
-//#define ENABLE_NOTIFY_ZC_INTRINSIC 1
+#define ENABLE_NOTIFY_ZC_INTRINSIC 1
#if defined(__INTEL_COMPILER)
/* The notify intrinsic was introduced in ICC 12.0. */
@@ -112,12 +123,16 @@
# endif
#elif defined(__VXWORKS__)
# undef ENABLE_NOTIFY_ZC_INTRINSIC
+#elif defined(__GNUC__)
+# // GCC doesn't support the notify intrinsic as of 4.9
+# undef ENABLE_NOTIFY_ZC_INTRINSIC
#elif defined(__clang__)
# if !defined(__has_extension) || !__has_extension(notify_zc_intrinsic)
# undef ENABLE_NOTIFY_ZC_INTRINSIC
# endif
-#elif defined(__arm__)
-// __notify_zc_intrinsic not yet supported by gcc for ARM
+#elif ! (defined(__x86_64__) || defined(__i386) \
+ || defined(_M_X64) || defined(_M_IX86))
+// __notify_zc_intrinsic currently supported only for intel architecture
# undef ENABLE_NOTIFY_ZC_INTRINSIC
#endif
diff --git a/libcilkrts/runtime/scheduler.c b/libcilkrts/runtime/scheduler.c
index bab6430d9db..538c43104f3 100644
--- a/libcilkrts/runtime/scheduler.c
+++ b/libcilkrts/runtime/scheduler.c
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2007-2013, Intel Corporation
+ * Copyright (C) 2007-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
*
**************************************************************************/
@@ -1778,7 +1789,15 @@ static full_frame* check_for_work(__cilkrts_worker *w)
if (NULL == ff) {
// Punish the worker for failing to steal.
// No quantum for you!
- __cilkrts_yield();
+ if (w->l->steal_failure_count > 30000) {
+ // Punish more if the worker has been doing unsuccessful steals
+ // for a long time. After return from the idle state, it will
+ // be given a grace period to react quickly.
+ __cilkrts_idle();
+ w->l->steal_failure_count -= 300;
+ } else {
+ __cilkrts_yield();
+ }
w->l->steal_failure_count++;
} else {
// Reset steal_failure_count since there is obviously still work to
@@ -1808,6 +1827,7 @@ static full_frame* search_until_work_found_or_done(__cilkrts_worker *w)
ff = check_for_work(w);
break;
case SCHEDULE_WAIT: // go into wait-mode.
+ START_INTERVAL(w, INTERVAL_SCHEDULE_WAIT);
CILK_ASSERT(WORKER_SYSTEM == w->l->type);
// If we are about to wait, then we better not have
// a frame that we should execute...
@@ -1818,6 +1838,7 @@ static full_frame* search_until_work_found_or_done(__cilkrts_worker *w)
// Runtime is waking up.
notify_children_run(w);
w->l->steal_failure_count = 0;
+ STOP_INTERVAL(w, INTERVAL_SCHEDULE_WAIT);
break;
case SCHEDULE_EXIT: // exit the scheduler.
CILK_ASSERT(WORKER_USER != w->l->type);
@@ -2006,9 +2027,6 @@ static void worker_scheduler_init_function(__cilkrts_worker *w)
// The startup work varies, depending on the worker type.
switch (w->l->type) {
case WORKER_USER:
- // Stop working once we've entered the scheduler.
- // For user workers, INTERVAL_IN_SCHEDULER counts the time
- // since we called bind_thread.
break;
case WORKER_SYSTEM:
@@ -2022,11 +2040,6 @@ static void worker_scheduler_init_function(__cilkrts_worker *w)
// Runtime is waking up.
notify_children_run(w);
w->l->steal_failure_count = 0;
-
- // For system threads, count all the time this thread is
- // alive in the scheduling loop.
- START_INTERVAL(w, INTERVAL_IN_SCHEDULER);
- START_INTERVAL(w, INTERVAL_WORKING);
break;
default:
__cilkrts_bug("Unknown worker %p of type %d entering scheduling loop\n",
@@ -2047,8 +2060,6 @@ static void worker_scheduler_terminate_function(__cilkrts_worker *w)
// A user worker should never finish by falling through the
// scheduling loop.
CILK_ASSERT(WORKER_USER != w->l->type);
- STOP_INTERVAL(w, INTERVAL_IN_RUNTIME);
- STOP_INTERVAL(w, INTERVAL_IN_SCHEDULER);
}
/**
@@ -2060,30 +2071,36 @@ static void worker_scheduler_terminate_function(__cilkrts_worker *w)
*/
static void worker_scheduler_function(__cilkrts_worker *w)
{
+ START_INTERVAL(w, INTERVAL_INIT_WORKER);
worker_scheduler_init_function(w);
-
+ STOP_INTERVAL(w, INTERVAL_INIT_WORKER);
+
// The main scheduling loop body.
while (!w->g->work_done) {
- // Set intervals. Now we are in the runtime instead of working.
- START_INTERVAL(w, INTERVAL_IN_RUNTIME);
- STOP_INTERVAL(w, INTERVAL_WORKING);
-
// Execute the "body" of the scheduling loop, and figure
// out the fiber to jump to next.
+ START_INTERVAL(w, INTERVAL_SCHED_LOOP);
cilk_fiber* fiber_to_resume
= worker_scheduling_loop_body(w->l->scheduling_fiber, w);
-
+ STOP_INTERVAL(w, INTERVAL_SCHED_LOOP);
+
if (fiber_to_resume) {
// Suspend the current fiber and resume next one.
NOTE_INTERVAL(w, INTERVAL_SUSPEND_RESUME_OTHER);
+
+ // Whenever we jump to resume user code, we stop being in
+ // the runtime, and start working.
STOP_INTERVAL(w, INTERVAL_IN_RUNTIME);
START_INTERVAL(w, INTERVAL_WORKING);
cilk_fiber_suspend_self_and_resume_other(w->l->scheduling_fiber,
fiber_to_resume);
-
// Return here only when this (scheduling) fiber is
// resumed (i.e., this worker wants to reenter the runtime).
+
+ // We've already switched from WORKING to IN_RUNTIME in
+ // the runtime code that handles the fiber switch. Thus, at
+ // this point we are IN_RUNTIME already.
}
}
@@ -2183,6 +2200,8 @@ NORETURN __cilkrts_c_sync(__cilkrts_worker *w,
__cilkrts_stack_frame *sf_at_sync)
{
full_frame *ff;
+ STOP_INTERVAL(w, INTERVAL_WORKING);
+ START_INTERVAL(w, INTERVAL_IN_RUNTIME);
// Claim: This read of w->l->frame_ff can occur without
// holding the worker lock because when w has reached a sync
@@ -2343,6 +2362,11 @@ void __cilkrts_c_THE_exception_check(__cilkrts_worker *w,
int stolen_p;
__cilkrts_stack_frame *saved_sf = NULL;
+ // For the exception check, stop working and count as time in
+ // runtime.
+ STOP_INTERVAL(w, INTERVAL_WORKING);
+ START_INTERVAL(w, INTERVAL_IN_RUNTIME);
+
START_INTERVAL(w, INTERVAL_THE_EXCEPTION_CHECK);
BEGIN_WITH_WORKER_LOCK(w) {
@@ -2410,6 +2434,11 @@ void __cilkrts_c_THE_exception_check(__cilkrts_worker *w,
else
{
NOTE_INTERVAL(w, INTERVAL_THE_EXCEPTION_CHECK_USELESS);
+
+ // If we fail the exception check and return, then switch back
+ // to working.
+ STOP_INTERVAL(w, INTERVAL_IN_RUNTIME);
+ START_INTERVAL(w, INTERVAL_WORKING);
return;
}
}
@@ -2419,6 +2448,9 @@ NORETURN __cilkrts_exception_from_spawn(__cilkrts_worker *w,
__cilkrts_stack_frame *returning_sf)
{
full_frame *ff = w->l->frame_ff;
+ STOP_INTERVAL(w, INTERVAL_WORKING);
+ START_INTERVAL(w, INTERVAL_IN_RUNTIME);
+
// This is almost the same as THE_exception_check, except
// the detach didn't happen, we don't need to undo the tail
// update.
@@ -2551,6 +2583,10 @@ __cilkrts_stack_frame *simulate_pop_tail(__cilkrts_worker *w)
void __cilkrts_return(__cilkrts_worker *w)
{
full_frame *ff, *parent_ff;
+
+ // Count time during the return as in the runtime.
+ STOP_INTERVAL(w, INTERVAL_WORKING);
+ START_INTERVAL(w, INTERVAL_IN_RUNTIME);
START_INTERVAL(w, INTERVAL_RETURNING);
BEGIN_WITH_WORKER_LOCK_OPTIONAL(w) {
@@ -2604,6 +2640,8 @@ void __cilkrts_return(__cilkrts_worker *w)
} END_WITH_WORKER_LOCK_OPTIONAL(w);
STOP_INTERVAL(w, INTERVAL_RETURNING);
+ STOP_INTERVAL(w, INTERVAL_IN_RUNTIME);
+ START_INTERVAL(w, INTERVAL_WORKING);
}
static void __cilkrts_unbind_thread()
@@ -2619,13 +2657,10 @@ static void __cilkrts_unbind_thread()
if (w) {
g = w->g;
- // If there's only 1 worker, the counts will be stopped in
- // __cilkrts_scheduler
- if (g->P > 1)
- {
- STOP_INTERVAL(w, INTERVAL_WORKING);
- STOP_INTERVAL(w, INTERVAL_IN_SCHEDULER);
- }
+
+ // Matches the START in bind_thread in cilk-abi.c.
+ STOP_INTERVAL(w, INTERVAL_IN_RUNTIME);
+ STOP_INTERVAL(w, INTERVAL_IN_SCHEDULER);
__cilkrts_set_tls_worker(0);
@@ -2658,6 +2693,11 @@ void __cilkrts_c_return_from_initial(__cilkrts_worker *w)
{
struct cilkred_map *rm;
+ // When we are returning from the initial frame, switch from
+ // INTERVAL_WORKING into INTERVAL_IN_RUNTIME.
+ STOP_INTERVAL(w, INTERVAL_WORKING);
+ START_INTERVAL(w, INTERVAL_IN_RUNTIME);
+
/* This is only called on a user thread worker. */
CILK_ASSERT(w->l->type == WORKER_USER);
@@ -3629,6 +3669,11 @@ slow_path_reductions_for_spawn_return(__cilkrts_worker *w,
// We have reductions to execute (and we can't hold locks).
__cilkrts_frame_unlock(w, ff->parent);
+ // After we've released the lock, start counting time as
+ // WORKING again.
+ STOP_INTERVAL(w, INTERVAL_IN_RUNTIME);
+ START_INTERVAL(w, INTERVAL_WORKING);
+
// Merge all reducers into the left map.
left_map = repeated_merge_reducer_maps(&w,
left_map,
@@ -3649,6 +3694,9 @@ slow_path_reductions_for_spawn_return(__cilkrts_worker *w,
ff->pending_exception = w->l->pending_exception;
w->l->pending_exception = NULL;
+ STOP_INTERVAL(w, INTERVAL_WORKING);
+ START_INTERVAL(w, INTERVAL_IN_RUNTIME);
+
// Lock ff->parent for the next loop around.
__cilkrts_frame_lock(w, ff->parent);
@@ -3809,6 +3857,11 @@ slow_path_reductions_for_sync(__cilkrts_worker *w,
return w;
}
} END_WITH_FRAME_LOCK(w, ff);
+
+ // After we've released the lock, start counting time as
+ // WORKING again.
+ STOP_INTERVAL(w, INTERVAL_IN_RUNTIME);
+ START_INTERVAL(w, INTERVAL_WORKING);
// If we get here, we have a nontrivial reduction to execute.
middle_map = repeated_merge_reducer_maps(&w,
@@ -3816,6 +3869,9 @@ slow_path_reductions_for_sync(__cilkrts_worker *w,
middle_map);
verify_current_wkr(w);
+ STOP_INTERVAL(w, INTERVAL_WORKING);
+ START_INTERVAL(w, INTERVAL_IN_RUNTIME);
+
// Save any exceptions generated because of the reduction
// process. These get merged the next time around the
// loop.
diff --git a/libcilkrts/runtime/scheduler.h b/libcilkrts/runtime/scheduler.h
index 543adaf68e0..74c45096fca 100644
--- a/libcilkrts/runtime/scheduler.h
+++ b/libcilkrts/runtime/scheduler.h
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
**************************************************************************/
/**
diff --git a/libcilkrts/runtime/signal_node.c b/libcilkrts/runtime/signal_node.c
index 92c404b482c..bdf820c7a8e 100644
--- a/libcilkrts/runtime/signal_node.c
+++ b/libcilkrts/runtime/signal_node.c
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2011-2013, Intel Corporation
+ * Copyright (C) 2011-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
*
**************************************************************************/
diff --git a/libcilkrts/runtime/signal_node.h b/libcilkrts/runtime/signal_node.h
index 0a1fe200201..354b4ac7456 100644
--- a/libcilkrts/runtime/signal_node.h
+++ b/libcilkrts/runtime/signal_node.h
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
**************************************************************************/
/**
diff --git a/libcilkrts/runtime/spin_mutex.c b/libcilkrts/runtime/spin_mutex.c
index 03908f26322..f9d8c47675a 100644
--- a/libcilkrts/runtime/spin_mutex.c
+++ b/libcilkrts/runtime/spin_mutex.c
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
**************************************************************************/
#include "spin_mutex.h"
diff --git a/libcilkrts/runtime/spin_mutex.h b/libcilkrts/runtime/spin_mutex.h
index b0045ab9313..d46b956f974 100644
--- a/libcilkrts/runtime/spin_mutex.h
+++ b/libcilkrts/runtime/spin_mutex.h
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
**************************************************************************/
/**
diff --git a/libcilkrts/runtime/sslib/ignore_handler_s.c b/libcilkrts/runtime/sslib/ignore_handler_s.c
new file mode 100644
index 00000000000..54b65c9a23f
--- /dev/null
+++ b/libcilkrts/runtime/sslib/ignore_handler_s.c
@@ -0,0 +1,72 @@
+/*------------------------------------------------------------------
+ * ignore_handler_s.c
+ *
+ * 2012, Jonathan Toppins <jtoppins@users.sourceforge.net>
+ *
+ * Copyright (c) 2012 Cisco Systems
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *------------------------------------------------------------------
+ */
+
+#include "safeclib_private.h"
+
+/**
+ * NAME
+ * ignore_handler_s
+ *
+ * SYNOPSIS
+ * #include "safe_lib.h"
+ * void ignore_handler_s(const char *msg, void *ptr, errno_t error)
+ *
+ * DESCRIPTION
+ * This function simply returns to the caller.
+ *
+ * SPECIFIED IN
+ * ISO/IEC JTC1 SC22 WG14 N1172, Programming languages, environments
+ * and system software interfaces, Extensions to the C Library,
+ * Part I: Bounds-checking interfaces
+ *
+ * INPUT PARAMETERS
+ * msg Pointer to the message describing the error
+ *
+ * ptr Pointer to aassociated data. Can be NULL.
+ *
+ * error The error code encountered.
+ *
+ * RETURN VALUE
+ * Returns no value.
+ *
+ * ALSO SEE
+ * abort_handler_s()
+ *
+ */
+
+void ignore_handler_s(const char *msg, void *ptr, errno_t error)
+{
+
+ sldebug_printf("IGNORE CONSTRAINT HANDLER: (%u) %s\n", error,
+ (msg) ? msg : "Null message");
+ return;
+}
+EXPORT_SYMBOL(ignore_handler_s);
diff --git a/libcilkrts/runtime/sslib/safe_lib.h b/libcilkrts/runtime/sslib/safe_lib.h
new file mode 100644
index 00000000000..9ffb24e72ab
--- /dev/null
+++ b/libcilkrts/runtime/sslib/safe_lib.h
@@ -0,0 +1,61 @@
+/*------------------------------------------------------------------
+ * safe_lib.h -- Safe C Library
+ *
+ * October 2008, Bo Berry
+ * Modified 2012, Jonathan Toppins <jtoppins@users.sourceforge.net>
+ *
+ * Copyright (c) 2008-2013 by Cisco Systems, Inc
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *------------------------------------------------------------------
+ */
+
+#ifndef __SAFE_LIB_H__
+#define __SAFE_LIB_H__
+
+#include "safe_types.h"
+#include "safe_lib_errno.h"
+
+/* C11 appendix K types - specific for bounds checking */
+typedef size_t rsize_t;
+
+/*
+ * We depart from the standard and allow memory and string operations to
+ * have different max sizes. See the respective safe_mem_lib.h or
+ * safe_str_lib.h files.
+ */
+/* #define RSIZE_MAX (~(rsize_t)0) - leave here for completeness */
+
+typedef void (*constraint_handler_t) (const char * /* msg */,
+ void * /* ptr */,
+ errno_t /* error */);
+
+extern void abort_handler_s(const char *msg, void *ptr, errno_t error);
+extern void ignore_handler_s(const char *msg, void *ptr, errno_t error);
+
+#define sl_default_handler ignore_handler_s
+
+//#include "safe_mem_lib.h"
+#include "safe_str_lib.h"
+
+#endif /* __SAFE_LIB_H__ */
diff --git a/libcilkrts/runtime/sslib/safe_lib_errno.h b/libcilkrts/runtime/sslib/safe_lib_errno.h
new file mode 100644
index 00000000000..8f27111c353
--- /dev/null
+++ b/libcilkrts/runtime/sslib/safe_lib_errno.h
@@ -0,0 +1,100 @@
+/*------------------------------------------------------------------
+ * safe_lib_errno.h -- Safe C Lib Error codes
+ *
+ * October 2008, Bo Berry
+ * Modified 2012, Jonathan Toppins <jtoppins@users.sourceforge.net>
+ *
+ * Copyright (c) 2008-2013 by Cisco Systems, Inc
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *------------------------------------------------------------------
+ */
+
+#ifndef __SAFE_LIB_ERRNO_H__
+#define __SAFE_LIB_ERRNO_H__
+
+#ifdef __KERNEL__
+# include <linux/errno.h>
+#else
+#include <errno.h>
+#endif /* __KERNEL__ */
+
+/*
+ * Safe Lib specific errno codes. These can be added to the errno.h file
+ * if desired.
+ */
+#ifndef ESNULLP
+#define ESNULLP ( 400 ) /* null ptr */
+#endif
+
+#ifndef ESZEROL
+#define ESZEROL ( 401 ) /* length is zero */
+#endif
+
+#ifndef ESLEMIN
+#define ESLEMIN ( 402 ) /* length is below min */
+#endif
+
+#ifndef ESLEMAX
+#define ESLEMAX ( 403 ) /* length exceeds max */
+#endif
+
+#ifndef ESOVRLP
+#define ESOVRLP ( 404 ) /* overlap undefined */
+#endif
+
+#ifndef ESEMPTY
+#define ESEMPTY ( 405 ) /* empty string */
+#endif
+
+#ifndef ESNOSPC
+#define ESNOSPC ( 406 ) /* not enough space for s2 */
+#endif
+
+#ifndef ESUNTERM
+#define ESUNTERM ( 407 ) /* unterminated string */
+#endif
+
+#ifndef ESNODIFF
+#define ESNODIFF ( 408 ) /* no difference */
+#endif
+
+#ifndef ESNOTFND
+#define ESNOTFND ( 409 ) /* not found */
+#endif
+
+/* Additional for safe snprintf_s interfaces */
+#ifndef ESBADFMT
+#define ESBADFMT ( 410 ) /* bad format string */
+#endif
+
+#ifndef ESFMTTYP
+#define ESFMTTYP ( 411 ) /* bad format type */
+#endif
+
+/* EOK may or may not be defined in errno.h */
+#ifndef EOK
+#define EOK ( 0 )
+#endif
+
+#endif /* __SAFE_LIB_ERRNO_H__ */
diff --git a/libcilkrts/runtime/sslib/safe_str_constraint.c b/libcilkrts/runtime/sslib/safe_str_constraint.c
new file mode 100644
index 00000000000..17e7fbbb4d2
--- /dev/null
+++ b/libcilkrts/runtime/sslib/safe_str_constraint.c
@@ -0,0 +1,146 @@
+/*------------------------------------------------------------------
+ * safe_str_constraint.c
+ *
+ * October 2008, Bo Berry
+ * 2012, Jonathan Toppins <jtoppins@users.sourceforge.net>
+ *
+ * Copyright (c) 2008, 2009, 2012 Cisco Systems
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *------------------------------------------------------------------
+ */
+
+#include "safeclib_private.h"
+#include "safe_str_constraint.h"
+#include "safe_str_lib.h"
+
+
+static constraint_handler_t str_handler = NULL;
+
+
+/**
+ * NAME
+ * set_str_constraint_handler_s
+ *
+ * SYNOPSIS
+ * #include "safe_str_lib.h"
+ * constraint_handler_t
+ * set_str_constraint_handler_s(constraint_handler_t handler)
+ *
+ * DESCRIPTION
+ * The set_str_constraint_handler_s function sets the runtime-constraint
+ * handler to be handler. The runtime-constraint handler is the function to
+ * be called when a library function detects a runtime-constraint
+ * violation. Only the most recent handler registered with
+ * set_str_constraint_handler_s is called when a runtime-constraint
+ * violation occurs.
+ * When the handler is called, it is passed the following arguments in
+ * the following order:
+ * 1. A pointer to a character string describing the
+ * runtime-constraint violation.
+ * 2. A null pointer or a pointer to an implementation defined
+ * object.
+ * 3. If the function calling the handler has a return type declared
+ * as errno_t, the return value of the function is passed.
+ * Otherwise, a positive value of type errno_t is passed.
+ * The implementation has a default constraint handler that is used if no
+ * calls to the set_constraint_handler_s function have been made. The
+ * behavior of the default handler is implementation-defined, and it may
+ * cause the program to exit or abort. If the handler argument to
+ * set_constraint_handler_s is a null pointer, the implementation default
+ * handler becomes the current constraint handler.
+ *
+ * SPECIFIED IN
+ * ISO/IEC JTC1 SC22 WG14 N1172, Programming languages, environments
+ * and system software interfaces, Extensions to the C Library,
+ * Part I: Bounds-checking interfaces
+ *
+ * INPUT PARAMETERS
+ * *msg Pointer to the message describing the error
+ *
+ * *ptr Pointer to aassociated data. Can be NULL.
+ *
+ * error The error code encountered.
+ *
+ * OUTPUT PARAMETERS
+ * none
+ *
+ * RETURN VALUE
+ * none
+ *
+ * ALSO SEE
+ * set_str_constraint_handler_s()
+ */
+constraint_handler_t
+set_str_constraint_handler_s (constraint_handler_t handler)
+{
+ constraint_handler_t prev_handler = str_handler;
+ if (NULL == handler) {
+ str_handler = sl_default_handler;
+ } else {
+ str_handler = handler;
+ }
+ return prev_handler;
+}
+EXPORT_SYMBOL(set_str_constraint_handler_s);
+
+
+/**
+ * NAME
+ * invoke_safe_str_constraint_handler
+ *
+ * SYNOPSIS
+ * #include "safe_str_constraint.h"
+ * void
+ * invoke_safe_str_constraint_handler (const char *msg,
+ * void *ptr,
+ * errno_t error)
+ *
+ * DESCRIPTION
+ * Invokes the currently set constraint handler or the default.
+ *
+ * INPUT PARAMETERS
+ * *msg Pointer to the message describing the error
+ *
+ * *ptr Pointer to aassociated data. Can be NULL.
+ *
+ * error The error code encountered.
+ *
+ * OUTPUT PARAMETERS
+ * none
+ *
+ * RETURN VALUE
+ * none
+ *
+ */
+void
+invoke_safe_str_constraint_handler (const char *msg,
+ void *ptr,
+ errno_t error)
+{
+ if (NULL != str_handler) {
+ str_handler(msg, ptr, error);
+ } else {
+ sl_default_handler(msg, ptr, error);
+ }
+}
diff --git a/libcilkrts/runtime/sslib/safe_str_constraint.h b/libcilkrts/runtime/sslib/safe_str_constraint.h
new file mode 100644
index 00000000000..a1fba3e7e85
--- /dev/null
+++ b/libcilkrts/runtime/sslib/safe_str_constraint.h
@@ -0,0 +1,78 @@
+/*------------------------------------------------------------------
+ * safe_str_constraint.h
+ *
+ * October 2008, Bo Berry
+ *
+ * Copyright (c) 2008-2011 Cisco Systems
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *------------------------------------------------------------------
+ */
+
+#ifndef __SAFE_STR_CONSTRAINT_H__
+#define __SAFE_STR_CONSTRAINT_H__
+
+#include "safeclib_private.h"
+
+/*
+ * Function used by the libraries to invoke the registered
+ * runtime-constraint handler. Always needed.
+ */
+extern void invoke_safe_str_constraint_handler(
+ const char *msg,
+ void *ptr,
+ errno_t error);
+
+
+/*
+ * Safe C Lib internal string routine to consolidate error handling
+ */
+static inline void handle_error(char *orig_dest, rsize_t orig_dmax,
+ char *err_msg, errno_t err_code)
+{
+#ifdef SAFECLIB_STR_NULL_SLACK
+ /* null string to eliminate partial copy */
+ while (orig_dmax) { *orig_dest = '\0'; orig_dmax--; orig_dest++; }
+#else
+ *orig_dest = '\0';
+#endif
+
+ invoke_safe_str_constraint_handler(err_msg, NULL, err_code);
+ return;
+}
+
+static inline void handle_wc_error(wchar_t *orig_dest, rsize_t orig_dmax,
+ char *err_msg, errno_t err_code)
+{
+#ifdef SAFECLIB_STR_NULL_SLACK
+ /* null string to eliminate partial copy */
+ while (orig_dmax) { *orig_dest = L'\0'; orig_dmax--; orig_dest++; }
+#else
+ *orig_dest = L'\0';
+#endif
+
+ invoke_safe_str_constraint_handler(err_msg, NULL, err_code);
+ return;
+}
+
+#endif /* __SAFE_STR_CONSTRAINT_H__ */
diff --git a/libcilkrts/runtime/sslib/safe_str_lib.h b/libcilkrts/runtime/sslib/safe_str_lib.h
new file mode 100644
index 00000000000..3bc841ea551
--- /dev/null
+++ b/libcilkrts/runtime/sslib/safe_str_lib.h
@@ -0,0 +1,70 @@
+/*------------------------------------------------------------------
+ * safe_str_lib.h -- Safe C Library String APIs
+ *
+ * October 2008, Bo Berry
+ *
+ * Copyright (c) 2008-2011, 2013 by Cisco Systems, Inc.
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *------------------------------------------------------------------
+ */
+
+#ifndef __SAFE_STR_LIB_H__
+#define __SAFE_STR_LIB_H__
+
+#include "safe_lib.h"
+
+/*
+ * The shortest string is a null string!!
+ */
+#define RSIZE_MIN_STR ( 1 )
+
+/* maximum sring length */
+#define RSIZE_MAX_STR ( 4UL << 10 ) /* 4KB */
+
+
+/* The makeup of a password */
+#define SAFE_STR_MIN_LOWERCASE ( 2 )
+#define SAFE_STR_MIN_UPPERCASE ( 2 )
+#define SAFE_STR_MIN_NUMBERS ( 1 )
+#define SAFE_STR_MIN_SPECIALS ( 1 )
+
+#define SAFE_STR_PASSWORD_MIN_LENGTH ( 6 )
+#define SAFE_STR_PASSWORD_MAX_LENGTH ( 32 )
+
+
+/* set string constraint handler */
+extern constraint_handler_t
+set_str_constraint_handler_s(constraint_handler_t handler);
+
+
+/* string copy */
+extern errno_t
+strcpy_s(char *dest, rsize_t dmax, const char *src);
+
+/* string length */
+extern rsize_t
+strnlen_s (const char *s, rsize_t smax);
+
+
+#endif /* __SAFE_STR_LIB_H__ */
diff --git a/libcilkrts/runtime/sslib/safe_types.h b/libcilkrts/runtime/sslib/safe_types.h
new file mode 100644
index 00000000000..5c2df9c6128
--- /dev/null
+++ b/libcilkrts/runtime/sslib/safe_types.h
@@ -0,0 +1,61 @@
+/*------------------------------------------------------------------
+ * safe_types.h - C99 std types & defs or Linux kernel equivalents
+ *
+ * March 2007, Bo Berry
+ * Modified 2012, Jonathan Toppins <jtoppins@users.sourceforge.net>
+ *
+ * Copyright (c) 2007-2013 by Cisco Systems, Inc
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *------------------------------------------------------------------
+ */
+
+#ifndef __SAFE_TYPES_H__
+#define __SAFE_TYPES_H__
+
+#ifdef __KERNEL__
+/* linux kernel environment */
+
+#include <linux/stddef.h>
+#include <linux/types.h>
+#include <linux/errno.h>
+
+/* errno_t isn't defined in the kernel */
+typedef int errno_t;
+
+#else
+
+#include <stdio.h>
+#include <sys/types.h>
+#ifndef _WRS_KERNEL
+#include <inttypes.h>
+#endif
+#include <stdint.h>
+#include <errno.h>
+
+typedef int errno_t;
+
+#include <stdbool.h>
+
+#endif /* __KERNEL__ */
+#endif /* __SAFE_TYPES_H__ */
diff --git a/libcilkrts/runtime/sslib/safeclib_private.h b/libcilkrts/runtime/sslib/safeclib_private.h
new file mode 100644
index 00000000000..7280e879a8e
--- /dev/null
+++ b/libcilkrts/runtime/sslib/safeclib_private.h
@@ -0,0 +1,93 @@
+/*------------------------------------------------------------------
+ * safeclib_private.h - Internal library references
+ *
+ * 2012, Jonathan Toppins <jtoppins@users.sourceforge.net>
+ *
+ * Copyright (c) 2012, 2013 by Cisco Systems, Inc
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *------------------------------------------------------------------
+ */
+
+#ifndef __SAFECLIB_PRIVATE_H__
+#define __SAFECLIB_PRIVATE_H__
+
+#ifdef __KERNEL__
+/* linux kernel environment */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/ctype.h>
+
+#define RCNEGATE(x) ( -(x) )
+
+#define slprintf(...) printk(KERN_EMERG __VA_ARGS__)
+#define slabort()
+#ifdef DEBUG
+#define sldebug_printf(...) printk(KERN_DEBUG __VA_ARGS__)
+#endif
+
+#else /* !__KERNEL__ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#ifdef STDC_HEADERS
+# include <ctype.h>
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# ifdef HAVE_STDLIB_H
+# include <stdlib.h>
+# endif
+#endif
+#ifdef HAVE_STRING_H
+# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
+# include <memory.h>
+# endif
+# include <string.h>
+#endif
+#ifdef HAVE_LIMITS_H
+# include <limits.h>
+#endif
+
+#define EXPORT_SYMBOL(sym)
+#define RCNEGATE(x) (x)
+
+#define slprintf(...) fprintf(stderr, __VA_ARGS__)
+#define slabort() abort()
+#ifdef DEBUG
+#define sldebug_printf(...) printf(__VA_ARGS__)
+#endif
+
+#endif /* __KERNEL__ */
+
+#ifndef sldebug_printf
+#define sldebug_printf(...)
+#endif
+
+#include "safe_lib.h"
+
+#endif /* __SAFECLIB_PRIVATE_H__ */
diff --git a/libcilkrts/runtime/sslib/snprintf_s.h b/libcilkrts/runtime/sslib/snprintf_s.h
new file mode 100644
index 00000000000..b4abb8652c1
--- /dev/null
+++ b/libcilkrts/runtime/sslib/snprintf_s.h
@@ -0,0 +1,49 @@
+/*------------------------------------------------------------------
+ * sprintf_s.h -- Safe Sprintf Interfaces
+ *
+ * August 2014, D Wheeler
+ *
+ * Copyright (c) 2014 by Intel Corp
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *------------------------------------------------------------------
+ */
+#ifndef SPRINTF_S_H_
+#define SPRINTF_S_H_
+
+#include <safe_lib_errno.h>
+
+
+#define SNPRFNEGATE(x) (-1*(x))
+
+
+
+int snprintf_s_s(char *dest, rsize_t dmax, const char *format, char *s);
+int snprintf_s_i(char *dest, rsize_t dmax, const char *format, int a);
+int snprintf_s_si(char *dest, rsize_t dmax, const char *format, char *s, int a);
+int snprintf_s_l(char *dest, rsize_t dmax, const char *format, long a);
+int snprintf_s_sl(char *dest, rsize_t dmax, const char *format, char *s, long a);
+
+
+
+#endif /* SPRINTF_S_H_ */
diff --git a/libcilkrts/runtime/sslib/snprintf_support.c b/libcilkrts/runtime/sslib/snprintf_support.c
new file mode 100644
index 00000000000..5ee0e3dd36b
--- /dev/null
+++ b/libcilkrts/runtime/sslib/snprintf_support.c
@@ -0,0 +1,353 @@
+/*------------------------------------------------------------------
+ * snprintf_support.c
+ *
+ * August 2014, D Wheeler
+ *
+ * Copyright (c) 2014 by Intel Corp
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *------------------------------------------------------------------
+ */
+#include "safeclib_private.h"
+#include "safe_str_constraint.h"
+#include "safe_str_lib.h"
+#include "snprintf_s.h"
+
+#define FMT_CHAR 'c'
+#define FMT_WCHAR 'C'
+#define FMT_SHORT 'h'
+#define FMT_INT 'd'
+#define FMT_LONG 'l'
+#define FMT_STRING 's'
+#define FMT_WSTRING 'S'
+#define FMT_DOUBLE 'g'
+#define FMT_LDOUBLE 'G'
+#define FMT_VOID 'p'
+#define FMT_PCHAR '1'
+#define FMT_PSHORT '2'
+#define FMT_PINT '3'
+#define FMT_PLONG '4'
+
+
+
+#define MAX_FORMAT_ELEMENTS 16
+
+#define CHK_FORMAT(X,Y) (((X)==(Y))?1:0)
+
+
+unsigned int
+parse_format(const char *format, char pformatList[], unsigned int maxFormats)
+{
+ unsigned int numFormats = 0;
+ unsigned int index = 0;
+ unsigned int start = 0;
+ char lmod = 0;
+
+ while (index < RSIZE_MAX_STR && format[index] != '\0' && numFormats < maxFormats)
+ {
+ if (format[index] == '%') {
+ start = index; // remember where the format string started
+ // Check for flags
+ switch( format[++index]) {
+ case '\0': continue; // skip - end of format string
+ case '%' : continue; // skip - actually a percent character
+ case '#' : // convert to alternate form
+ case '0' : // zero pad
+ case '-' : // left adjust
+ case ' ' : // pad with spaces
+ case '+' : // force a sign be used
+ index++; // skip the flag character
+ break;
+ }
+ // check for and skip the optional field width
+ while ( format[index] != '\0' && format[index] >= '0' && format[index] <= '9') {
+ index++;
+ }
+ // Check for an skip the optional precision
+ if ( format[index] != '\0' && format[index] == '.') {
+ index++; // skip the period
+ while ( format[index] != '\0' && format[index] >= '0' && format[index] <= '9') {
+ index++;
+ }
+ }
+ // Check for and skip the optional length modifiers
+ lmod = ' ';
+ switch( format[index]) {
+ case 'h' : if ( format[++index] == 'h') {
+ ++index; //also recognize the 'hh' modifier
+ lmod = 'H'; // for char
+ } else {
+ lmod = 'h'; // for short
+ }
+ break;
+ case 'l' : if ( format[++index] == 'l') {
+ ++index; //also recognize the 'll' modifier
+ lmod = 'd'; // for long long
+ } else {
+ lmod = 'l'; // for long
+ }
+ break;
+ case 'L' : lmod = 'L'; break;
+ case 'j' :
+ case 'z' :
+ case 't' : index++;
+ break;
+ }
+
+ // Recognize and record the actual modifier
+ switch( format[index]) {
+ case 'c' :
+ if ( lmod == 'l') {
+ pformatList[numFormats] = FMT_WCHAR; // store the format character
+ } else {
+ pformatList[numFormats] = FMT_CHAR;
+ }
+ numFormats++;
+ index++; // skip the format character
+ break;
+
+ case 'd' : case 'i' : // signed
+ case 'o' : case 'u' : // unsigned
+ case 'x' : case 'X' : // unsigned
+ if ( lmod == 'H') {
+ pformatList[numFormats] = FMT_CHAR; // store the format character
+ } else if ( lmod == 'l') {
+ pformatList[numFormats] = FMT_LONG; // store the format character
+ } else if ( lmod == 'h') {
+ pformatList[numFormats] = FMT_SHORT; // store the format character
+ } else{
+ pformatList[numFormats] = FMT_INT;
+ }
+ numFormats++;
+ index++; // skip the format character
+ break;
+
+ case 'e' : case 'E' :
+ case 'f' : case 'F' :
+ case 'g' : case 'G' :
+ case 'a' : case 'A' :
+ if ( lmod == 'L') {
+ pformatList[numFormats] = FMT_LDOUBLE; // store the format character
+ } else{
+ pformatList[numFormats] = FMT_DOUBLE;
+ }
+ numFormats++;
+ index++; // skip the format character
+ break;
+
+ case 's' :
+ if ( lmod == 'l' || lmod == 'L') {
+ pformatList[numFormats] = FMT_WSTRING; // store the format character
+ } else {
+ pformatList[numFormats] = FMT_STRING;
+ }
+ numFormats++;
+ index++; // skip the format character
+ break;
+
+ case 'p' :
+ pformatList[numFormats] = FMT_VOID;
+ numFormats++;
+ index++; // skip the format character
+ break;
+
+ case 'n' :
+ if ( lmod == 'H') {
+ pformatList[numFormats] = FMT_PCHAR; // store the format character
+ } else if ( lmod == 'l') {
+ pformatList[numFormats] = FMT_PLONG; // store the format character
+ } else if ( lmod == 'h') {
+ pformatList[numFormats] = FMT_PSHORT; // store the format character
+ } else{
+ pformatList[numFormats] = FMT_PINT;
+ }
+ numFormats++;
+ index++; // skip the format character
+ break;
+ case 'm' :
+ // Does not represent an argument in the call stack
+ index++; // skip the format character
+ continue;
+ default:
+ printf("failed to recognize format string [");
+ for (;start<index; start++) { printf("%c", format[start]); }
+ puts("]");
+ break;
+ }
+ }
+ if (format[index] != '%')
+ // don't know why it skips over blindly, not handling cases such as "%s%d".
+ index++; // move past this character
+ }
+
+ return numFormats;
+}
+
+unsigned int
+check_integer_format(const char format)
+{
+ unsigned int retValue = 0; // default failure
+ switch( format) {
+ case FMT_CHAR :
+ case FMT_SHORT :
+ case FMT_INT :
+ retValue = 1;
+ break;
+ }
+ return retValue;
+}
+
+
+
+inline int snprintf_s_i(char *dest, rsize_t dmax, const char *format, int a)
+{
+ char pformatList[MAX_FORMAT_ELEMENTS];
+ unsigned int index = 0;
+
+ // Determine the number of format options in the format string
+ unsigned int nfo = parse_format(format, &pformatList[0], MAX_FORMAT_ELEMENTS);
+
+ // Check that there are not too many format options
+ if ( nfo != 1 ) {
+ dest[0] = '\0';
+ return SNPRFNEGATE(ESBADFMT);
+ }
+ // Check that the format is for an integer type
+ if ( check_integer_format(pformatList[index]) == 0) {
+ dest[0] = '\0';
+ return SNPRFNEGATE(ESFMTTYP);
+ }
+ index++;
+
+ return snprintf(dest, dmax, format, a);
+}
+
+
+
+inline int snprintf_s_l(char *dest, rsize_t dmax, const char *format, long a)
+{
+ char pformatList[MAX_FORMAT_ELEMENTS];
+ unsigned int index = 0;
+
+ // Determine the number of format options in the format string
+ unsigned int nfo = parse_format(format, &pformatList[0], MAX_FORMAT_ELEMENTS);
+
+ // Check that there are not too many format options
+ if ( nfo != 1 ) {
+ dest[0] = '\0';
+ return SNPRFNEGATE(ESBADFMT);
+ }
+ // Check that the format is for an long type
+ if ( CHK_FORMAT(FMT_LONG, pformatList[index]) == 0) {
+ dest[0] = '\0';
+ return SNPRFNEGATE(ESFMTTYP);
+ }
+ index++;
+
+ return snprintf(dest, dmax, format, a);
+}
+
+
+inline int snprintf_s_si(char *dest, rsize_t dmax, const char *format, char *s, int a)
+{
+ char pformatList[MAX_FORMAT_ELEMENTS];
+ unsigned int index = 0;
+
+ // Determine the number of format options in the format string
+ unsigned int nfo = parse_format(format, &pformatList[0], MAX_FORMAT_ELEMENTS);
+
+ // Check that there are not too many format options
+ if ( nfo != 2 ) {
+ dest[0] = '\0';
+ return SNPRFNEGATE(ESBADFMT);
+ }
+ // Check first format is of string type
+ if ( CHK_FORMAT(FMT_STRING, pformatList[index]) == 0) {
+ dest[0] = '\0';
+ return SNPRFNEGATE(ESFMTTYP);
+ }
+ index++;
+
+ // Check that the format is for an integer type
+ if ( check_integer_format(pformatList[index]) == 0) {
+ dest[0] = '\0';
+ return SNPRFNEGATE(ESFMTTYP);
+ }
+ index++;
+
+ return snprintf(dest, dmax, format, s, a);
+}
+
+
+inline int snprintf_s_sl(char *dest, rsize_t dmax, const char *format, char *s, long a)
+{
+ char pformatList[MAX_FORMAT_ELEMENTS];
+ unsigned int index = 0;
+
+ // Determine the number of format options in the format string
+ unsigned int nfo = parse_format(format, &pformatList[0], MAX_FORMAT_ELEMENTS);
+
+ // Check that there are not too many format options
+ if ( nfo != 2 ) {
+ dest[0] = '\0';
+ return SNPRFNEGATE(ESBADFMT);
+ }
+ // Check first format is of string type
+ if ( CHK_FORMAT(FMT_STRING, pformatList[index]) == 0) {
+ dest[0] = '\0';
+ return SNPRFNEGATE(ESFMTTYP);
+ }
+ index++;
+
+ // Check that the format is for an integer type
+ if ( CHK_FORMAT(FMT_LONG, pformatList[index]) == 0) {
+ dest[0] = '\0';
+ return SNPRFNEGATE(ESFMTTYP);
+ }
+ index++;
+
+ return snprintf(dest, dmax, format, s, a);
+}
+
+inline int snprintf_s_s(char *dest, rsize_t dmax, const char *format, char *s)
+{
+ char pformatList[MAX_FORMAT_ELEMENTS];
+ unsigned int index = 0;
+
+ // Determine the number of format options in the format string
+ unsigned int nfo = parse_format(format, &pformatList[0], MAX_FORMAT_ELEMENTS);
+
+ // Check that there are not too many format options
+ if ( nfo != 1 ) {
+ dest[0] = '\0';
+ return SNPRFNEGATE(ESBADFMT);
+ }
+ // Check first format is of string type
+ if ( CHK_FORMAT(FMT_STRING, pformatList[index]) == 0) {
+ dest[0] = '\0';
+ return SNPRFNEGATE(ESFMTTYP);
+ }
+ index++;
+
+ return snprintf(dest, dmax, format, s);
+}
diff --git a/libcilkrts/runtime/sslib/strcpy_s.c b/libcilkrts/runtime/sslib/strcpy_s.c
new file mode 100644
index 00000000000..a0cbd6dc930
--- /dev/null
+++ b/libcilkrts/runtime/sslib/strcpy_s.c
@@ -0,0 +1,198 @@
+/*------------------------------------------------------------------
+ * strcpy_s.c
+ *
+ * October 2008, Bo Berry
+ *
+ * Copyright (c) 2008-2011 by Cisco Systems, Inc
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *------------------------------------------------------------------
+ */
+
+#include "safeclib_private.h"
+#include "safe_str_constraint.h"
+#include "safe_str_lib.h"
+
+
+/**
+ * NAME
+ * strcpy_s
+ *
+ * SYNOPSIS
+ * #include "safe_str_lib.h"
+ * errno_t
+ * strcpy_s(char *dest, rsize_t dmax, const char *src)
+ *
+ * DESCRIPTION
+ * The strcpy_s function copies the string pointed to by src
+ * (including the terminating null character) into the array
+ * pointed to by dest. All elements following the terminating
+ * null character (if any) written by strcpy_s in the array
+ * of dmax characters pointed to by dest are nulled when
+ * strcpy_s returns.
+ *
+ * SPECIFIED IN
+ * ISO/IEC TR 24731, Programming languages, environments
+ * and system software interfaces, Extensions to the C Library,
+ * Part I: Bounds-checking interfaces
+ *
+ * INPUT PARAMETERS
+ * dest pointer to string that will be replaced by src.
+ *
+ * dmax restricted maximum length of dest
+ *
+ * src pointer to the string that will be copied
+ * to dest
+ *
+ * OUTPUT PARAMETERS
+ * dest updated
+ *
+ * RUNTIME CONSTRAINTS
+ * Neither dest nor src shall be a null pointer.
+ * dmax shall not be greater than RSIZE_MAX_STR.
+ * dmax shall not equal zero.
+ * dmax shall be greater than strnlen_s(src, dmax).
+ * Copying shall not take place between objects that overlap.
+ * If there is a runtime-constraint violation, then if dest
+ * is not a null pointer and destmax is greater than zero and
+ * not greater than RSIZE_MAX_STR, then strcpy_s nulls dest.
+ *
+ * RETURN VALUE
+ * EOK successful operation, the characters in src were
+ * copied into dest and the result is null terminated.
+ * ESNULLP NULL pointer
+ * ESZEROL zero length
+ * ESLEMAX length exceeds max limit
+ * ESOVRLP strings overlap
+ * ESNOSPC not enough space to copy src
+ *
+ * ALSO SEE
+ * strcat_s(), strncat_s(), strncpy_s()
+ *
+ */
+errno_t
+strcpy_s (char *dest, rsize_t dmax, const char *src)
+{
+ rsize_t orig_dmax;
+ char *orig_dest;
+ const char *overlap_bumper;
+
+ if (dest == NULL) {
+ invoke_safe_str_constraint_handler("strcpy_s: dest is null",
+ NULL, ESNULLP);
+ return RCNEGATE(ESNULLP);
+ }
+
+ if (dmax == 0) {
+ invoke_safe_str_constraint_handler("strcpy_s: dmax is 0",
+ NULL, ESZEROL);
+ return RCNEGATE(ESZEROL);
+ }
+
+ if (dmax > RSIZE_MAX_STR) {
+ invoke_safe_str_constraint_handler("strcpy_s: dmax exceeds max",
+ NULL, ESLEMAX);
+ return RCNEGATE(ESLEMAX);
+ }
+
+ if (src == NULL) {
+#ifdef SAFECLIB_STR_NULL_SLACK
+ /* null string to clear data */
+ while (dmax) { *dest = '\0'; dmax--; dest++; }
+#else
+ *dest = '\0';
+#endif
+ invoke_safe_str_constraint_handler("strcpy_s: src is null",
+ NULL, ESNULLP);
+ return RCNEGATE(ESNULLP);
+ }
+
+ if (dest == src) {
+ return RCNEGATE(EOK);
+ }
+
+ /* hold base of dest in case src was not copied */
+ orig_dmax = dmax;
+ orig_dest = dest;
+
+ if (dest < src) {
+ overlap_bumper = src;
+
+ while (dmax > 0) {
+ if (dest == overlap_bumper) {
+ handle_error(orig_dest, orig_dmax, "strcpy_s: "
+ "overlapping objects",
+ ESOVRLP);
+ return RCNEGATE(ESOVRLP);
+ }
+
+ *dest = *src;
+ if (*dest == '\0') {
+#ifdef SAFECLIB_STR_NULL_SLACK
+ /* null slack to clear any data */
+ while (dmax) { *dest = '\0'; dmax--; dest++; }
+#endif
+ return RCNEGATE(EOK);
+ }
+
+ dmax--;
+ dest++;
+ src++;
+ }
+
+ } else {
+ overlap_bumper = dest;
+
+ while (dmax > 0) {
+ if (src == overlap_bumper) {
+ handle_error(orig_dest, orig_dmax, "strcpy_s: "
+ "overlapping objects",
+ ESOVRLP);
+ return RCNEGATE(ESOVRLP);
+ }
+
+ *dest = *src;
+ if (*dest == '\0') {
+#ifdef SAFECLIB_STR_NULL_SLACK
+ /* null slack to clear any data */
+ while (dmax) { *dest = '\0'; dmax--; dest++; }
+#endif
+ return RCNEGATE(EOK);
+ }
+
+ dmax--;
+ dest++;
+ src++;
+ }
+ }
+
+ /*
+ * the entire src must have been copied, if not reset dest
+ * to null the string.
+ */
+ handle_error(orig_dest, orig_dmax, "strcpy_s: not "
+ "enough space for src",
+ ESNOSPC);
+ return RCNEGATE(ESNOSPC);
+}
+EXPORT_SYMBOL(strcpy_s);
diff --git a/libcilkrts/runtime/sslib/strncpy_s.c b/libcilkrts/runtime/sslib/strncpy_s.c
new file mode 100644
index 00000000000..e1cdd6b1721
--- /dev/null
+++ b/libcilkrts/runtime/sslib/strncpy_s.c
@@ -0,0 +1,238 @@
+/*------------------------------------------------------------------
+ * strncpy_s.c
+ *
+ * October 2008, Bo Berry
+ *
+ * Copyright (c) 2008-2011 by Cisco Systems, Inc
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *------------------------------------------------------------------
+ */
+
+#include "safeclib_private.h"
+#include "safe_str_constraint.h"
+#include "safe_str_lib.h"
+
+
+/*
+ * NAME
+ * strncpy_s
+ *
+ * SYNOPSIS
+ * #include "safe_str_lib.h"
+ * errno_t
+ * strncpy_s(char *dest, rsize_t dmax, const char *src, rsize_t slen)
+ *
+ * DESCRIPTION
+ * The strncpy_s function copies not more than slen successive characters
+ * (characters that follow a null character are not copied) from the
+ * array pointed to by src to the array pointed to by dest. If no null
+ * character was copied from src, then dest[n] is set to a null character.
+ *
+ * All elements following the terminating null character (if any)
+ * written by strncpy_s in the array of dmax characters pointed to
+ * by dest take on the null value when strncpy_s returns.
+ *
+ * Specicified in:
+ * ISO/IEC TR 24731-1, Programming languages, environments
+ * and system software interfaces, Extensions to the C Library,
+ * Part I: Bounds-checking interfaces
+ *
+ * INPUT PARAMETERS
+ * dest pointer to string that will be replaced by src.
+ * The resulting string is null terminated.
+ *
+ * dmax restricted maximum length of the resulting dest,
+ * including the null
+ *
+ * src pointer to the string that will be copied
+ * to string dest
+ *
+ * slen the maximum number of characters to copy from src
+ *
+ * OUTPUT PARAMETERS
+ * dest updated with src string
+ *
+ * RUNTIME CONSTRAINTS
+ * Neither dmax nor slen shall be equal to zero.
+ * Neither dmax nor slen shall be equal zero.
+ * Neither dmax nor slen shall be greater than RSIZE_MAX_STR.
+ * If slen is either greater than or equal to dmax, then dmax
+ * should be more than strnlen_s(src,dmax)
+ * Copying shall not take place between objects that overlap.
+ * If there is a runtime-constraint violation, then if dest
+ * is not a null pointer and dmax greater than RSIZE_MAX_STR,
+ * then strncpy_s nulls dest.
+ *
+ * RETURN VALUE
+ * EOK successful operation, the characters in src were copied
+ * to dest and the result is null terminated.
+ * ESNULLP NULL pointer
+ * ESZEROL zero length
+ * ESLEMAX length exceeds max limit
+ * ESOVRLP strings overlap
+ * ESNOSPC not enough space to copy src
+ *
+ * ALSO SEE
+ * strcat_s(), strncat_s(), strcpy_s()
+ *-
+ */
+errno_t
+strncpy_s (char *dest, rsize_t dmax, const char *src, rsize_t slen)
+{
+ rsize_t orig_dmax;
+ char *orig_dest;
+ const char *overlap_bumper;
+
+ if (dest == NULL) {
+ invoke_safe_str_constraint_handler("strncpy_s: dest is null",
+ NULL, ESNULLP);
+ return RCNEGATE(ESNULLP);
+ }
+
+ if (dmax == 0) {
+ invoke_safe_str_constraint_handler("strncpy_s: dmax is 0",
+ NULL, ESZEROL);
+ return RCNEGATE(ESZEROL);
+ }
+
+ if (dmax > RSIZE_MAX_STR) {
+ invoke_safe_str_constraint_handler("strncpy_s: dmax exceeds max",
+ NULL, ESLEMAX);
+ return RCNEGATE(ESLEMAX);
+ }
+
+ /* hold base in case src was not copied */
+ orig_dmax = dmax;
+ orig_dest = dest;
+
+ if (src == NULL) {
+ handle_error(orig_dest, orig_dmax, "strncpy_s: "
+ "src is null",
+ ESNULLP);
+ return RCNEGATE(ESNULLP);
+ }
+
+ if (slen == 0) {
+ handle_error(orig_dest, orig_dmax, "strncpy_s: "
+ "slen is zero",
+ ESZEROL);
+ return RCNEGATE(ESZEROL);
+ }
+
+ if (slen > RSIZE_MAX_STR) {
+ handle_error(orig_dest, orig_dmax, "strncpy_s: "
+ "slen exceeds max",
+ ESLEMAX);
+ return RCNEGATE(ESLEMAX);
+ }
+
+
+ if (dest < src) {
+ overlap_bumper = src;
+
+ while (dmax > 0) {
+ if (dest == overlap_bumper) {
+ handle_error(orig_dest, orig_dmax, "strncpy_s: "
+ "overlapping objects",
+ ESOVRLP);
+ return RCNEGATE(ESOVRLP);
+ }
+
+ if (slen == 0) {
+ /*
+ * Copying truncated to slen chars. Note that the TR says to
+ * copy slen chars plus the null char. We null the slack.
+ */
+#ifdef SAFECLIB_STR_NULL_SLACK
+ while (dmax) { *dest = '\0'; dmax--; dest++; }
+#else
+ *dest = '\0';
+#endif
+ return RCNEGATE(EOK);
+ }
+
+ *dest = *src;
+ if (*dest == '\0') {
+#ifdef SAFECLIB_STR_NULL_SLACK
+ /* null slack */
+ while (dmax) { *dest = '\0'; dmax--; dest++; }
+#endif
+ return RCNEGATE(EOK);
+ }
+
+ dmax--;
+ slen--;
+ dest++;
+ src++;
+ }
+
+ } else {
+ overlap_bumper = dest;
+
+ while (dmax > 0) {
+ if (src == overlap_bumper) {
+ handle_error(orig_dest, orig_dmax, "strncpy_s: "
+ "overlapping objects",
+ ESOVRLP);
+ return RCNEGATE(ESOVRLP);
+ }
+
+ if (slen == 0) {
+ /*
+ * Copying truncated to slen chars. Note that the TR says to
+ * copy slen chars plus the null char. We null the slack.
+ */
+#ifdef SAFECLIB_STR_NULL_SLACK
+ while (dmax) { *dest = '\0'; dmax--; dest++; }
+#else
+ *dest = '\0';
+#endif
+ return RCNEGATE(EOK);
+ }
+
+ *dest = *src;
+ if (*dest == '\0') {
+#ifdef SAFECLIB_STR_NULL_SLACK
+ /* null slack */
+ while (dmax) { *dest = '\0'; dmax--; dest++; }
+#endif
+ return RCNEGATE(EOK);
+ }
+
+ dmax--;
+ slen--;
+ dest++;
+ src++;
+ }
+ }
+
+ /*
+ * the entire src was not copied, so zero the string
+ */
+ handle_error(orig_dest, orig_dmax, "strncpy_s: not enough "
+ "space for src",
+ ESNOSPC);
+ return RCNEGATE(ESNOSPC);
+}
+EXPORT_SYMBOL(strncpy_s);
diff --git a/libcilkrts/runtime/sslib/strnlen_s.c b/libcilkrts/runtime/sslib/strnlen_s.c
new file mode 100644
index 00000000000..e3cab9a6428
--- /dev/null
+++ b/libcilkrts/runtime/sslib/strnlen_s.c
@@ -0,0 +1,112 @@
+/*------------------------------------------------------------------
+ * strnlen_s.c
+ *
+ * October 2008, Bo Berry
+ *
+ * Copyright (c) 2008-2011 by Cisco Systems, Inc
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *------------------------------------------------------------------
+ */
+
+#include "safeclib_private.h"
+#include "safe_str_constraint.h"
+#include "safe_str_lib.h"
+
+
+/**
+ * NAME
+ * strnlen_s
+ *
+ * SYNOPSIS
+ * #include "safe_str_lib.h"
+ * rsize_t
+ * strnlen_s(const char *dest, rsize_t dmax)
+ *
+ * DESCRIPTION
+ * The strnlen_s function computes the length of the string pointed
+ * to by dest.
+ *
+ * SPECIFIED IN
+ * ISO/IEC TR 24731-1, Programming languages, environments
+ * and system software interfaces, Extensions to the C Library,
+ * Part I: Bounds-checking interfaces
+ *
+ * INPUT PARAMETERS
+ * dest pointer to string
+ *
+ * dmax restricted maximum length.
+ *
+ * OUTPUT PARAMETERS
+ * none
+ *
+ * RUNTIME CONSTRAINTS
+ * dest shall not be a null pointer
+ * dmax shall not be greater than RSIZE_MAX_STR
+ * dmax shall not equal zero
+ *
+ * RETURN VALUE
+ * The function returns the string length, excluding the terminating
+ * null character. If dest is NULL, then strnlen_s returns 0.
+ *
+ * Otherwise, the strnlen_s function returns the number of characters
+ * that precede the terminating null character. If there is no null
+ * character in the first dmax characters of dest then strnlen_s returns
+ * dmax. At most the first dmax characters of dest are accessed
+ * by strnlen_s.
+ *
+ * ALSO SEE
+ * strnterminate_s()
+ *
+ */
+rsize_t
+strnlen_s (const char *dest, rsize_t dmax)
+{
+ rsize_t count;
+
+ if (dest == NULL) {
+ return RCNEGATE(0);
+ }
+
+ if (dmax == 0) {
+ invoke_safe_str_constraint_handler("strnlen_s: dmax is 0",
+ NULL, ESZEROL);
+ return RCNEGATE(0);
+ }
+
+ if (dmax > RSIZE_MAX_STR) {
+ invoke_safe_str_constraint_handler("strnlen_s: dmax exceeds max",
+ NULL, ESLEMAX);
+ return RCNEGATE(0);
+ }
+
+ count = 0;
+ while (*dest && dmax) {
+ count++;
+ dmax--;
+ dest++;
+ }
+
+ return RCNEGATE(count);
+}
+EXPORT_SYMBOL(strnlen_s);
diff --git a/libcilkrts/runtime/stats.c b/libcilkrts/runtime/stats.c
index 3a420745039..407a85ddd98 100644
--- a/libcilkrts/runtime/stats.c
+++ b/libcilkrts/runtime/stats.c
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
**************************************************************************/
#include "stats.h"
@@ -51,7 +62,8 @@ static const char *names[] = {
/*[INTERVAL_IN_SCHEDULER]*/ "in scheduler",
/*[INTERVAL_WORKING]*/ " of which: working",
/*[INTERVAL_IN_RUNTIME]*/ " of which: in runtime",
- /*[INTERVAL_STEALING]*/ " of which: stealing",
+ /*[INTERVAL_IN_SCHED_LOOP]*/ " of which: in sched loop",
+ /*[INTERVAL_STEALING]*/ " of which: stealing",
/*[INTERVAL_STEAL_SUCCESS]*/ "steal success: detach",
/*[INTERVAL_STEAL_FAIL_EMPTYQ]*/ "steal fail: empty queue",
/*[INTERVAL_STEAL_FAIL_LOCK]*/ "steal fail: victim locked",
@@ -81,6 +93,8 @@ static const char *names[] = {
/*[INTERVAL_FIBER_DEALLOCATE_FROM_THREAD]*/ "fiber_deallocate (thread)",
/*[INTERVAL_SUSPEND_RESUME_OTHER]*/ "fiber suspend self + resume",
/*[INTERVAL_DEALLOCATE_RESUME_OTHER]*/ "fiber deallocate self + resume",
+ /*[INTERVAL_INIT_WORKER]*/ "init worker thread",
+ /*[INTERVAL_SCHEDULE_WAIT]*/ "schedule wait state",
};
#endif
@@ -144,27 +158,32 @@ void __cilkrts_stop_interval(__cilkrts_worker *w, enum interval i)
void dump_stats_to_file(FILE *stat_file, statistics *s)
{
- int i;
- fprintf(stat_file, "\nCILK PLUS RUNTIME SYSTEM STATISTICS:\n\n");
-
- fprintf(stat_file,
- " %-32s: %15s %10s %12s %10s\n",
- "event",
- "count",
- "ticks",
- "ticks/count",
- "%total"
- );
- for (i = 0; i < INTERVAL_N; ++i) {
- fprintf(stat_file, " %-32s: %15llu", names[i], s->count[i]);
- if (s->accum[i]) {
- fprintf(stat_file, " %10.3g %12.3g %10.2f",
- (double)s->accum[i],
- (double)s->accum[i] / (double)s->count[i],
- 100.0 * (double)s->accum[i] /
- (double)s->accum[INTERVAL_IN_SCHEDULER]);
+ // Only print out stats for worker if they are nonzero.
+ if (s->accum[INTERVAL_IN_SCHEDULER] > 0) {
+ int i;
+ fprintf(stat_file, "\nCILK PLUS RUNTIME SYSTEM STATISTICS:\n\n");
+ fprintf(stat_file,
+ " %-32s: %15s %10s %12s %10s\n",
+ "event",
+ "count",
+ "ticks",
+ "ticks/count",
+ "%total"
+ );
+ for (i = 0; i < INTERVAL_N; ++i) {
+ fprintf(stat_file, " %-32s: %15llu", names[i], s->count[i]);
+ if (s->accum[i]) {
+ fprintf(stat_file, " %10.3g %12.3g %10.2f",
+ (double)s->accum[i],
+ (double)s->accum[i] / (double)s->count[i],
+ 100.0 * (double)s->accum[i] /
+ (double)s->accum[INTERVAL_IN_SCHEDULER]);
+ }
+ fprintf(stat_file, "\n");
}
- fprintf(stat_file, "\n");
+ }
+ else {
+ fprintf(stat_file, "empty statistics\n");
}
}
#endif // CILK_PROFILE
diff --git a/libcilkrts/runtime/stats.h b/libcilkrts/runtime/stats.h
index aaa99274765..befc620a4d0 100644
--- a/libcilkrts/runtime/stats.h
+++ b/libcilkrts/runtime/stats.h
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
**************************************************************************/
/**
@@ -63,12 +74,45 @@
__CILKRTS_BEGIN_EXTERN_C
+// Some notes on the stats we are counting for the Cilk Plus runtime.
+//
+// INTERVAL_IN_SCHEDULER:
+//
+// For a user worker, it starts counting when the worker thread is
+// bound, and stops when the worker thread is unbound.
+//
+// For a system worker, it starts counting when the worker thread is
+// created, and stops after it returns from the scheduling loop
+// (which usually won't happen unless __cilkrts_end_cilk() is
+// called.)
+//
+// INTERVAL_WORKING + INTERVAL_IN_RUNTIME should be equal to
+// INTERVAL_IN_SCHEDULER (modulo overheads in instrumentation).
+//
+// INTERVAL_IN_RUNTIME tries to count all the time spent inside
+// runtime code. (leave_frame and reudctions blur the accounting a
+// bit). We switch from WORKING to IN_RUNTIME from:
+//
+// 1. __cilkrts_leave_frame, when we start doing an exception check
+// and might jump into the runtime, either when returning from a
+// spawn or have an exception to process.
+//
+// 2. __cilkrts_c_sync, when we are at a sync and the frame has
+// been stolen from.
+//
+// We switch back to WORKING when we are returning to user code.
+//
+// We also switch back to WORKING when we need to do a slow merge of
+// reducer maps. Otherwise, parallel reductions can mess up the stat
+// collection.
+
/** @brief Events that we measure. */
enum interval
{
INTERVAL_IN_SCHEDULER, ///< Time threads spend "bound" to Cilk
INTERVAL_WORKING, ///< Time spent working
- INTERVAL_IN_RUNTIME, ///< Time spent executing runtime scheduling loop
+ INTERVAL_IN_RUNTIME, ///< Time spent executing runtime code
+ INTERVAL_SCHED_LOOP, ///< Time spent in scheduling loop
INTERVAL_STEALING, ///< Time spent stealing work
INTERVAL_STEAL_SUCCESS, ///< Time to do a successful steal
INTERVAL_STEAL_FAIL_EMPTYQ, ///< Count of steal failures due to lack of stealable work
@@ -99,6 +143,8 @@ enum interval
INTERVAL_FIBER_DEALLOCATE_FROM_THREAD, ///< Time spent calling cilk_fiber_deallocate (from thread)
INTERVAL_SUSPEND_RESUME_OTHER, ///< Count of fiber suspend_self_and_resume_other
INTERVAL_DEALLOCATE_RESUME_OTHER, ///< Count of fiber deallocate_self_and_resume_other
+ INTERVAL_INIT_WORKER, ///< Time spent on initialization of worker thread
+ INTERVAL_SCHEDULE_WAIT, ///< Time worker spends in SCHEDULE_WAIT state
INTERVAL_N ///< Number of intervals, must be last
};
diff --git a/libcilkrts/runtime/sysdep-unix.c b/libcilkrts/runtime/sysdep-unix.c
index 1f82b6288a1..611934a9bbf 100644
--- a/libcilkrts/runtime/sysdep-unix.c
+++ b/libcilkrts/runtime/sysdep-unix.c
@@ -3,11 +3,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2010-2013, Intel Corporation
+ * Copyright (C) 2010-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -22,7 +20,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -35,17 +32,24 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
*
**************************************************************************
*/
-#ifdef __linux__
- // define _GNU_SOURCE before *any* #include.
- // Even <stdint.h> will break later #includes if this macro is not
- // already defined when it is #included.
-# define _GNU_SOURCE
-#endif
-
#include "sysdep.h"
#include "os.h"
#include "bug.h"
@@ -80,24 +84,7 @@
#include <string.h>
#include <pthread.h>
#include <unistd.h>
-
-#if defined HAVE_ALLOCA_H
-# include <alloca.h>
-#elif defined __GNUC__
-# define alloca __builtin_alloca
-#elif defined _AIX
-# define alloca __alloca
-#else
-# include <stddef.h>
-# ifdef __cplusplus
-extern "C"
-# endif
-void *alloca (size_t);
-#endif
-
-#ifdef __APPLE__
-//# include <scheduler.h> // Angle brackets include Apple's scheduler.h, not ours.
-#endif
+#include "declare-alloca.h"
#ifdef __linux__
# include <sys/resource.h>
@@ -205,11 +192,17 @@ NON_COMMON void* scheduler_thread_proc_for_system_worker(void *arg)
__cilkrts_set_tls_worker(w);
+ START_INTERVAL(w, INTERVAL_IN_SCHEDULER);
+ START_INTERVAL(w, INTERVAL_IN_RUNTIME);
+ START_INTERVAL(w, INTERVAL_INIT_WORKER);
+
// Create a cilk fiber for this worker on this thread.
START_INTERVAL(w, INTERVAL_FIBER_ALLOCATE_FROM_THREAD) {
w->l->scheduling_fiber = cilk_fiber_allocate_from_thread();
cilk_fiber_set_owner(w->l->scheduling_fiber, w);
} STOP_INTERVAL(w, INTERVAL_FIBER_ALLOCATE_FROM_THREAD);
+
+ STOP_INTERVAL(w, INTERVAL_INIT_WORKER);
internal_run_scheduler_with_exceptions(w);
@@ -225,35 +218,11 @@ NON_COMMON void* scheduler_thread_proc_for_system_worker(void *arg)
w->l->scheduling_fiber = NULL;
} STOP_INTERVAL(w, INTERVAL_FIBER_DEALLOCATE_FROM_THREAD);
+ STOP_INTERVAL(w, INTERVAL_IN_RUNTIME);
+ STOP_INTERVAL(w, INTERVAL_IN_SCHEDULER);
return 0;
}
-
-/*
- * __cilkrts_user_worker_scheduling_stub
- *
- * Routine for the scheduling fiber created for an imported user
- * worker thread. This method is analogous to
- * scheduler_thread_proc_for_system_worker.
- *
- */
-void __cilkrts_user_worker_scheduling_stub(cilk_fiber* fiber, void* null_arg)
-{
- __cilkrts_worker *w = __cilkrts_get_tls_worker();
-
- // Sanity check.
- CILK_ASSERT(WORKER_USER == w->l->type);
-
- // Enter the scheduling loop on the user worker.
- // This function will never return.
- __cilkrts_run_scheduler_with_exceptions(w);
-
- // A WORKER_USER, at some point, will resume on the original stack and leave
- // Cilk. Under no circumstances do we ever exit off of the bottom of this
- // stack.
- CILK_ASSERT(0);
-}
-
/**
* We are exporting a function with this name to Inspector?
* What a confusing name...
@@ -266,8 +235,6 @@ void* __cilkrts_worker_stub(void* arg)
return scheduler_thread_proc_for_system_worker(arg);
}
-
-
// /* Return the lesser of the argument and the operating system
// limit on the number of workers (threads) that may or ought
// to be created. */
@@ -571,64 +538,51 @@ void __cilkrts_make_unrunnable_sysdep(__cilkrts_worker *w,
}
}
-/*
- * __cilkrts_sysdep_is_worker_thread_id
- *
- * Returns true if the thread ID specified matches the thread ID we saved
- * for a worker.
- */
-
-int __cilkrts_sysdep_is_worker_thread_id(global_state_t *g,
- int i,
- void *thread_id)
-{
-#if defined( __linux__) || defined(__VXWORKS__)
- pthread_t tid = *(pthread_t *)thread_id;
- if (i < 0 || i > g->total_workers)
- return 0;
- return g->sysdep->threads[i] == tid;
-#else
- // Needs to be implemented
- return 0;
-#endif
-}
-
-
-
-
/*************************************************************
Version information:
*************************************************************/
+#ifndef _WRS_KERNEL
#include <dlfcn.h>
+#endif
#include "internal/cilk_version.h"
#include <stdio.h>
+#ifndef _WRS_KERNEL
#include <sys/utsname.h>
+#endif
#ifdef __VXWORKS__
#include <version.h>
-# endif
+#endif
/* (Non-static) dummy function is used by get_runtime_path() to find the path
* to the .so containing the Cilk runtime.
*/
void dummy_function() { }
-/* return a string with the path to the Cilk runtime, or "unknown" if the path
+/*
+ * Return a string with the path to the Cilk runtime, or "unknown" if the path
* cannot be determined.
*/
static const char *get_runtime_path ()
{
-#ifdef __CYGWIN__
- // Cygwin doesn't support dladdr, which sucks
- return "unknown";
-#else
+ // dladdr is a glibc extension. If it's available, use it to find the path
+ // for libcilkrts.so
+#ifdef _GNU_SOURCE
Dl_info info;
- if (0 == dladdr(dummy_function, &info)) return "unknown";
- return info.dli_fname;
+ if (0 != dladdr(dummy_function, &info))
+ return info.dli_fname;
#endif
+
+ // If dladdr isn't available, or dladdr failed, we can't know the path for
+ // the shared object
+ return "unknown";
}
+#ifdef _WRS_KERNEL
+#include <version.h>
+#include <sysLib.h>
+#endif
/* if the environment variable, CILK_VERSION, is defined, writes the version
* information to the specified file.
* g is the global state that was just created, and n is the number of workers
@@ -640,7 +594,9 @@ static void write_version_file (global_state_t *g, int n)
char buf[256]; // print buffer.
time_t t;
FILE *fp;
+#ifndef _WRS_KERNEL
struct utsname sys_info;
+#endif
int err; // error code from system calls.
// if CILK_VERSION is not set, or if the file cannot be opened, fail
@@ -711,15 +667,22 @@ static void write_version_file (global_state_t *g, int n)
// System OS: Linux, release 2.6.28-19-generic
// System architecture: x86_64
- err = uname(&sys_info);
fprintf(fp, "\nSystem information\n");
fprintf(fp, "==================\n");
fprintf(fp, "Cilk runtime path: %s\n", get_runtime_path());
+#ifndef _WRS_KERNEL
+ err = uname(&sys_info);
fprintf(fp, "System OS: %s, release %s\n",
err < 0 ? "unknown" : sys_info.sysname,
err < 0 ? "?" : sys_info.release);
fprintf(fp, "System architecture: %s\n",
err < 0 ? "unknown" : sys_info.machine);
+#else
+ fprintf(fp, "System OS: %s, release %s\n",
+ "VxWorks", RUNTIME_NAME RUNTIME_VERSION);
+ fprintf(fp, "System architecture: %s\n",
+ sysModel());
+#endif
// Print thread info. E.g.,
// Thread information
@@ -792,10 +755,12 @@ void __cilkrts_establish_c_stack(void)
static __attribute__((noinline))
void internal_enforce_global_visibility()
{
+#ifndef __VXWORKS__
void* handle = dlopen( get_runtime_path(), RTLD_GLOBAL|RTLD_LAZY );
/* For proper reference counting, close the handle immediately. */
if( handle) dlclose(handle);
+#endif
}
/*
diff --git a/libcilkrts/runtime/sysdep.h b/libcilkrts/runtime/sysdep.h
index ea939acc124..76ebc63d733 100644
--- a/libcilkrts/runtime/sysdep.h
+++ b/libcilkrts/runtime/sysdep.h
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
**************************************************************************/
/**
diff --git a/libcilkrts/runtime/worker_mutex.c b/libcilkrts/runtime/worker_mutex.c
index 380d6255a0c..94e39b0beaa 100644
--- a/libcilkrts/runtime/worker_mutex.c
+++ b/libcilkrts/runtime/worker_mutex.c
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
**************************************************************************/
#include "worker_mutex.h"
diff --git a/libcilkrts/runtime/worker_mutex.h b/libcilkrts/runtime/worker_mutex.h
index c2c68247e0b..5faabd85d01 100644
--- a/libcilkrts/runtime/worker_mutex.h
+++ b/libcilkrts/runtime/worker_mutex.h
@@ -2,11 +2,9 @@
*
*************************************************************************
*
- * @copyright
- * Copyright (C) 2009-2013, Intel Corporation
+ * Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
- * @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * @copyright
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -34,6 +31,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
**************************************************************************/
/**