list(APPEND JUNCTION_ALL_LIBRARIES ${TERVEL_LIBRARIES})
endif()
+# Optional: Locate libcuckoo and append it to the list of include dirs/libraries.
+if(JUNCTION_WITH_LIBCUCKOO)
+ find_package(LibCuckoo REQUIRED)
+ list(APPEND JUNCTION_ALL_INCLUDE_DIRS ${LIBCUCKOO_INCLUDE_DIRS})
+endif()
+
# If this is the root listfile, add all samples
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
file(GLOB children samples/*)
#cmakedefine01 JUNCTION_WITH_NBDS
#cmakedefine01 JUNCTION_WITH_TBB
#cmakedefine01 JUNCTION_WITH_TERVEL
+#cmakedefine01 JUNCTION_WITH_LIBCUCKOO
#cmakedefine01 NBDS_USE_TURF_HEAP
#cmakedefine01 TBB_USE_TURF_HEAP
#cmakedefine01 JUNCTION_TRACK_GRAMPA_STATS
--- /dev/null
+find_path(LIBCUCKOO_ROOT include/libcuckoo/cuckoohash_map.hh)
+
+if(LIBCUCKOO_ROOT)
+ set(LIBCUCKOO_FOUND TRUE)
+ set(LIBCUCKOO_INCLUDE_DIRS "${LIBCUCKOO_ROOT}/include")
+else()
+ message("Can't find libcuckoo!")
+ if(LibCuckoo_FIND_REQUIRED)
+ message(FATAL_ERROR "Missing required package libcuckoo")
+ endif()
+endif()
--- /dev/null
+/*------------------------------------------------------------------------
+ Junction: Concurrent data structures in C++
+ Copyright (c) 2016 Jeff Preshing
+
+ Distributed under the Simplified BSD License.
+ Original location: https://github.com/preshing/junction
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the LICENSE file for more information.
+------------------------------------------------------------------------*/
+
+#ifndef JUNCTION_EXTRA_IMPL_MAPADAPTER_LIBCUCKOO_H
+#define JUNCTION_EXTRA_IMPL_MAPADAPTER_LIBCUCKOO_H
+
+#include <junction/Core.h>
+
+#if !JUNCTION_WITH_LIBCUCKOO
+#error "You must configure with JUNCTION_WITH_LIBCUCKOO=1!"
+#endif
+
+#include <libcuckoo/cuckoohash_map.hh>
+
+namespace junction {
+namespace extra {
+
+class MapAdapter {
+public:
+ static TURF_CONSTEXPR const char* MapName = "libcuckoo cuckoohash_map";
+
+ MapAdapter(ureg) {
+ }
+
+ class ThreadContext {
+ public:
+ ThreadContext(MapAdapter&, ureg) {
+ }
+
+ void registerThread() {
+ }
+
+ void unregisterThread() {
+ }
+
+ void update() {
+ }
+ };
+
+ class Map {
+ private:
+ cuckoohash_map<u32, void*> m_map;
+
+ public:
+ Map(ureg capacity) : m_map(capacity) {
+ }
+
+ void insert(u32 key, void* value) {
+ m_map.insert(key, value);
+ }
+
+ void* get(u32 key) {
+ void* result;
+ return m_map.find(key, result) ? result : NULL;
+ }
+
+ void erase(u32 key) {
+ m_map.erase(key);
+ }
+ };
+
+ static ureg getInitialCapacity(ureg maxPopulation) {
+ return maxPopulation / 4;
+ }
+};
+
+} // namespace extra
+} // namespace junction
+
+#endif // JUNCTION_EXTRA_IMPL_MAPADAPTER_LIBCUCKOO_H
ALL_MAPS = [
('folly', colorTuple('606080')),
- ('tervel', colorTuple('9090b0')),
- ('stdmap', colorTuple('606080')),
+ ('tervel', colorTuple('408040')),
+ ('stdmap', colorTuple('b0b090')),
('nbds', colorTuple('9090b0')),
- ('michael', colorTuple('606080')),
- ('tbb', colorTuple('9090b0')),
('linear', colorTuple('ff4040')),
- ('grampa', colorTuple('ff4040')),
- ('leapfrog', colorTuple('ff4040')),
+ ('michael', colorTuple('202020')),
+ ('tbb', colorTuple('0090b0')),
+ ('cuckoo', colorTuple('d040d0')),
+ ('grampa', colorTuple('ff6040')),
+ ('leapfrog', colorTuple('ff8040')),
]
#---------------------------------------------------
('nbds', 'junction/extra/impl/MapAdapter_NBDS.h', ['-DJUNCTION_WITH_NBDS=1'], ['-i10000', '-c200']),
('tbb', 'junction/extra/impl/MapAdapter_TBB.h', ['-DJUNCTION_WITH_TBB=1'], ['-i10000', '-c200']),
('tervel', 'junction/extra/impl/MapAdapter_Tervel.h', ['-DJUNCTION_WITH_TERVEL=1'], ['-i1000', '-c20']),
+ ('cuckoo', 'junction/extra/impl/MapAdapter_LibCuckoo.h', ['-DJUNCTION_WITH_LIBCUCKOO=1', '-DTURF_WITH_EXCEPTIONS=1'], ['-i5000', '-c20']),
]
# Scan arguments for path to CMakeLists.txt and args to pass through.