Flow compiling

This commit is contained in:
Markus Pilman 2022-06-27 17:05:55 -06:00
parent 542adb4b9f
commit 03d913a1de
123 changed files with 182 additions and 310 deletions

View File

@ -137,7 +137,6 @@ if(NOT WIN32)
test/apitester/TesterUtil.h
test/apitester/TesterWorkload.cpp
test/apitester/TesterWorkload.h
../../flow/SimpleOpt.h
)
if(OPEN_FOR_IDE)
@ -193,7 +192,7 @@ if(NOT WIN32)
else()
target_link_libraries(fdb_c_api_tester PRIVATE fdb_c fdb_cpp toml11_target Threads::Threads fmt::fmt boost_target)
endif()
target_include_directories(fdb_c_api_tester PRIVATE "${CMAKE_BINARY_DIR}/flow/include")
target_include_directories(fdb_c_api_tester PRIVATE "${CMAKE_BINARY_DIR}/flow/include" SimpleOpt)
# do not set RPATH for mako
set_property(TARGET mako PROPERTY SKIP_BUILD_RPATH TRUE)

View File

@ -24,7 +24,7 @@
#include "TesterTransactionExecutor.h"
#include "TesterTestSpec.h"
#include "TesterUtil.h"
#include "flow/SimpleOpt.h"
#include "SimpleOpt/SimpleOpt.h"
#include "test/fdb_api.hpp"
#include <memory>

View File

@ -16,7 +16,7 @@ set(SRCS
fdb_flow.actor.cpp
fdb_flow.h)
add_flow_target(STATIC_LIBRARY NAME fdb_flow SRCS ${SRCS} NO_COPY_HDR)
add_flow_target(STATIC_LIBRARY NAME fdb_flow SRCS ${SRCS})
target_link_libraries(fdb_flow PUBLIC fdb_c)
target_link_libraries(fdb_flow PUBLIC fdbclient)
target_include_directories(fdb_flow PUBLIC

View File

@ -64,9 +64,8 @@ function(generate_coverage_xml)
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Generate coverage xml")
endif()
add_custom_target(coverage_${target_name} DEPENDS ${target_file})
add_custom_target(coverage_${target_name} ALL DEPENDS ${target_file})
add_dependencies(coverage_${target_name} coveragetool)
add_dependencies(${target_name} coverage_${target_name})
endfunction()
# This function asserts that `versions.h` does not exist in the source
@ -190,7 +189,7 @@ endfunction()
function(add_flow_target)
set(options EXECUTABLE STATIC_LIBRARY
DYNAMIC_LIBRARY NO_COPY_HDR)
DYNAMIC_LIBRARY)
set(oneValueArgs NAME)
set(multiValueArgs SRCS COVERAGE_FILTER_OUT DISABLE_ACTOR_DIAGNOSTICS ADDL_SRCS)
cmake_parse_arguments(AFT "${options}" "${oneValueArgs}" "${multiValueArgs}" "${ARGN}")
@ -200,9 +199,6 @@ function(add_flow_target)
if(NOT AFT_SRCS)
message(FATAL_ERROR "No sources provided")
endif()
if(NOT AFT_NO_COPY_HDR)
copy_headers(NAME ${AFT_NAME} SRCS "${AFT_SRCS};${AFT_DISABLE_ACTOR_DIAGNOSTICS}" OUT_DIR incl_dir INC_DIR include_dir)
endif()
#foreach(src IN LISTS AFT_SRCS)
# is_header(h "${src}")
# if(NOT h)
@ -214,6 +210,7 @@ function(add_flow_target)
set(sources ${AFT_SRCS} ${AFT_ADDL_SRCS})
add_library(${AFT_NAME} OBJECT ${sources})
else()
create_build_dirs(${AFT_SRCS} ${AFT_DISABLE_ACTOR_DIAGNOSTICS})
foreach(src IN LISTS AFT_SRCS AFT_DISABLE_ACTOR_DIAGNOSTICS)
is_header(hdr ${src})
set(in_filename "${src}")
@ -229,26 +226,11 @@ function(add_flow_target)
set(out_filename "${src}")
endif()
if(hdr AND NOT AFT_NO_COPY_HDR)
set(in_file "${incl_dir}/${in_filename}")
set(out_file "${incl_dir}/${out_filename}")
set(in_file "${CMAKE_CURRENT_SOURCE_DIR}/${in_filename}")
if(is_actor_file)
set(out_file "${CMAKE_CURRENT_BINARY_DIR}/${out_filename}")
else()
set(in_file "${CMAKE_CURRENT_SOURCE_DIR}/${in_filename}")
if(is_actor_file)
set(out_file "${CMAKE_CURRENT_BINARY_DIR}/${out_filename}")
else()
set(out_file "${in_file}")
endif()
endif()
is_prefix(in_src_dir "${CMAKE_CURRENT_SOURCE_DIR}" ${src})
is_prefix(in_bin_dir "${CMAKE_CURRENT_BINARY_DIR}" ${src})
if(NOT AFT_NO_COPY_HDR)
is_prefix(in_incl_dir "${incl_dir}" ${src})
endif()
if(in_src_dir OR in_bin_dir)
set(in_file "${src}")
set(out_file "${src}")
set(out_file "${in_file}")
endif()
list(APPEND sources ${out_file})
@ -307,10 +289,6 @@ function(add_flow_target)
set_property(TARGET ${AFT_NAME} PROPERTY COVERAGE_FILTERS ${AFT_SRCS})
add_custom_target(${AFT_NAME}_actors DEPENDS ${generated_files})
if(NOT AFT_NO_COPY_HDR)
target_include_directories("${AFT_NAME}" PUBLIC "${include_dir}")
add_dependencies(${AFT_NAME}_actors actorcompiler "${AFT_NAME}_incl")
endif()
add_dependencies(${AFT_NAME} ${AFT_NAME}_actors)
if(NOT WIN32)
assert_no_version_h(${AFT_NAME}_actors)

View File

@ -29,3 +29,17 @@ function(is_prefix out prefix str)
endif()
set(${out} ${res} PARENT_SCOPE)
endfunction()
function(create_build_dirs)
foreach(src IN LISTS ARGV)
get_filename_component(d "${src}" DIRECTORY)
if(IS_ABSOLUTE "${d}")
file(RELATIVE_PATH d "${CMAKE_CURRENT_SOURCE_DIR}" "${src}")
endif()
list(APPEND dirs "${d}")
endforeach()
list(REMOVE_DUPLICATES dirs)
foreach(dir IN LISTS dirs)
make_directory("${CMAKE_CURRENT_BINARY_DIR}/${dir}")
endforeach()
endfunction()

View File

@ -1,6 +1,10 @@
add_library(rapidjson INTERFACE)
target_include_directories(rapidjson INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/rapidjson)
add_subdirectory(crc32)
add_subdirectory(stacktrace)
add_subdirectory(folly_memcpy)
add_subdirectory(SimpleOpt)
add_subdirectory(fmt-8.1.1)
if(NOT WIN32)
add_subdirectory(debug_determinism)

View File

@ -0,0 +1,2 @@
add_library(SimpleOpt INTERFACE)
target_include_directories(SimpleOpt INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/include")

View File

@ -78,7 +78,7 @@
<li> Include the SimpleOpt.h header file
<pre>
\#include "flow/SimpleOpt.h"
\#include "SimpleOpt/SimpleOpt.h"
</pre>
<li> Define an array of valid options for your program.

View File

@ -0,0 +1,2 @@
add_library(crc32 STATIC crc32.S crc32_wrapper.c crc32c.cpp)
target_include_directories(crc32 PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")

View File

@ -58,7 +58,7 @@
#ifdef CRC32_CONSTANTS_HEADER
#include CRC32_CONSTANTS_HEADER
#else
#include "crc32_constants.h"
#include "crc32/crc32_constants.h"
#endif
.text

View File

@ -15,7 +15,7 @@
#ifdef CRC32_CONSTANTS_HEADER
#include CRC32_CONSTANTS_HEADER
#else
#include "crc32_constants.h"
#include "crc32/crc32_constants.h"
#endif
#define VMX_ALIGN 16

View File

@ -25,7 +25,7 @@
#define _CRT_SECURE_NO_WARNINGS
#endif
#include "flow/crc32c.h"
#include "crc32/crc32c.h"
#if !defined(__aarch64__) && !defined(__powerpc64__)
#include <nmmintrin.h>
@ -34,9 +34,40 @@
#include <stdlib.h>
#include <random>
#include <algorithm>
#include "flow/Platform.h"
#include "crc32c-generated-constants.cpp"
// CRC32C
#ifdef __aarch64__
// aarch64
#include <inttypes.h>
static inline uint32_t hwCrc32cU8(unsigned int crc, unsigned char v) {
uint32_t ret;
asm volatile("crc32cb %w[r], %w[c], %w[v]" : [r] "=r"(ret) : [c] "r"(crc), [v] "r"(v));
return ret;
}
static inline uint32_t hwCrc32cU32(unsigned int crc, unsigned int v) {
uint32_t ret;
asm volatile("crc32cw %w[r], %w[c], %w[v]" : [r] "=r"(ret) : [c] "r"(crc), [v] "r"(v));
return ret;
}
#ifdef _M_X64
static inline uint64_t hwCrc32cU64(uint64_t crc, uint64_t v) {
uint64_t ret;
asm volatile("crc32cx %w[r], %w[c], %x[v]" : [r] "=r"(ret) : [c] "r"(crc), [v] "r"(v));
return ret;
}
#endif
#else
#ifndef __powerpc64__
// Intel
#define hwCrc32cU8(c, v) _mm_crc32_u8(c, v)
#define hwCrc32cU32(c, v) _mm_crc32_u32(c, v)
#ifdef _M_X64
#define hwCrc32cU64(c, v) _mm_crc32_u64(c, v)
#endif
#endif
#endif
[[maybe_unused]] static uint32_t append_trivial(uint32_t crc, const uint8_t* input, size_t length) {
for (size_t i = 0; i < length; ++i) {
crc = crc ^ input[i];
@ -278,7 +309,25 @@ uint32_t ppc_hw(uint32_t crc, const uint8_t* input, size_t length) {
}
#endif
static bool hw_available = platform::isHwCrcSupported();
bool isHwCrcSupported() {
#if defined(_WIN32)
int info[4];
__cpuid(info, 1);
return (info[2] & (1 << 20)) != 0;
#elif defined(__aarch64__)
return true; /* force to use crc instructions */
#elif defined(__powerpc64__)
return false; /* force not to use crc instructions */
#elif defined(__unixish__)
uint32_t eax, ebx, ecx, edx, level = 1, count = 0;
__cpuid_count(level, count, eax, ebx, ecx, edx);
return ((ecx >> 20) & 1) != 0;
#else
#error Port me!
#endif
}
static bool hw_available = isHwCrcSupported();
extern "C" uint32_t crc32c_append(uint32_t crc, const uint8_t* input, size_t length) {
if (hw_available) {

View File

@ -0,0 +1,4 @@
if(UNIX AND NOT APPLE)
add_library(folly_memcpy STATIC folly_memcpy.S)
target_include_directories(folly_memcpy PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
endif()

View File

@ -0,0 +1,11 @@
add_library(stacktrace STATIC stacktrace.amalgamation.cpp)
target_include_directories(stacktrace PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
if (USE_ASAN)
target_compile_definitions(stacktrace PRIVATE ADDRESS_SANITIZER)
elseif(USE_MSAN)
target_compile_definitions(stacktrace PRIVATE MEMORY_SANITIZER)
elseif(USE_UBSAN)
target_compile_definitions(stacktrace PRIVATE UNDEFINED_BEHAVIOR_SANITIZER)
elseif(USE_TSAN)
target_compile_definitions(stacktrace PRIVATE THREAD_SANITIZER DYNAMIC_ANNOTATIONS_EXTERNAL_IMPL=1)
endif()

View File

@ -23,7 +23,7 @@
#pragma once
#include <cinttypes>
#include "flow/SimpleOpt.h"
#include "SimpleOpt/SimpleOpt.h"
#include "flow/TLSConfig.actor.h"
namespace file_converter {

View File

@ -74,7 +74,7 @@
#include "fdbclient/versions.h"
#include "fdbclient/BuildFlags.h"
#include "flow/SimpleOpt.h"
#include "SimpleOpt/SimpleOpt.h"
#include "flow/actorcompiler.h" // This must be the last #include.
// Type of program being executed

View File

@ -51,7 +51,7 @@
#include "flow/TLSConfig.actor.h"
#include "flow/ThreadHelper.actor.h"
#include "flow/SimpleOpt.h"
#include "SimpleOpt/SimpleOpt.h"
#include "fdbcli/FlowLineNoise.h"
#include "fdbcli/fdbcli.actor.h"

View File

@ -21,7 +21,7 @@
// TODO this should really be renamed "TSSComparison.cpp"
#include "fdbclient/StorageServerInterface.h"
#include "fdbclient/BlobWorkerInterface.h"
#include "flow/crc32c.h" // for crc32c_append, to checksum values in tss trace events
#include "crc32/crc32c.h" // for crc32c_append, to checksum values in tss trace events
// Includes template specializations for all tss operations on storage server types.
// New StorageServerInterface reply types must be added here or it won't compile.

View File

@ -75,7 +75,7 @@
#include <pwd.h>
#include <grp.h>
#include "flow/SimpleOpt.h"
#include "SimpleOpt/SimpleOpt.h"
#include "fdbclient/SimpleIni.h"
#include "fdbclient/versions.h"

View File

@ -40,7 +40,7 @@
#include "flow/Knobs.h"
#include "flow/Histogram.h"
#include "flow/UnitTest.h"
#include "flow/crc32c.h"
#include "crc32/crc32c.h"
#include "flow/genericactors.actor.h"
#include "flow/actorcompiler.h" // This must be the last #include.

View File

@ -19,7 +19,7 @@
*/
#include "flow/IAsyncFile.h"
#include "flow/crc32c.h"
#include "crc32/crc32c.h"
#if VALGRIND
#include <memcheck.h>

View File

@ -40,7 +40,7 @@
#include "fdbrpc/AsyncFileEncrypted.h"
#include "fdbrpc/AsyncFileNonDurable.actor.h"
#include "fdbrpc/AsyncFileChaos.h"
#include "flow/crc32c.h"
#include "crc32/crc32c.h"
#include "fdbrpc/TraceFileIO.h"
#include "flow/FaultInjection.h"
#include "flow/flow.h"

View File

@ -22,7 +22,7 @@
#include "flow/IAsyncFile.h"
#include "fdbserver/Knobs.h"
#include "fdbrpc/simulator.h"
#include "flow/crc32c.h"
#include "crc32/crc32c.h"
#include "flow/genericactors.actor.h"
#include "flow/xxhash.h"

View File

@ -20,7 +20,7 @@
#define SQLITE_THREADSAFE 0 // also in sqlite3.amalgamation.c!
#include "fmt/format.h"
#include "flow/crc32c.h"
#include "crc32/crc32c.h"
#include "fdbserver/IKeyValueStore.h"
#include "fdbserver/CoroFlow.h"
#include "fdbserver/Knobs.h"

View File

@ -74,7 +74,7 @@
#include "flow/DeterministicRandom.h"
#include "flow/Platform.h"
#include "flow/ProtocolVersion.h"
#include "flow/SimpleOpt.h"
#include "SimpleOpt/SimpleOpt.h"
#include "flow/SystemMonitor.h"
#include "flow/TLSConfig.actor.h"
#include "fdbclient/Tracing.h"

View File

@ -24,7 +24,7 @@
#include "fdbserver/workloads/BulkSetup.actor.h"
#include "fdbclient/ReadYourWrites.h"
#include "fdbclient/zipf.h"
#include "flow/crc32c.h"
#include "crc32/crc32c.h"
#include "flow/actorcompiler.h"
enum {

View File

@ -28,7 +28,7 @@
#include <stdint.h>
#include <time.h>
#include "flow/SimpleOpt.h"
#include "SimpleOpt/SimpleOpt.h"
#include "fdbclient/SimpleIni.h"
#include "fdbclient/versions.h"

View File

@ -18,7 +18,7 @@
* limitations under the License.
*/
#include "Arena.h"
#include "flow/Arena.h"
#include "flow/UnitTest.h"

View File

@ -1,145 +1,6 @@
find_package(Threads REQUIRED)
set(FLOW_SRCS
ActorCollection.actor.cpp
ActorCollection.h
Arena.cpp
Arena.h
ArgParseUtil.h
AsioReactor.h
BooleanParam.h
BlobCipher.h
BlobCipher.cpp
CompressedInt.actor.cpp
CompressedInt.h
DebugTrace.h
Deque.cpp
Deque.h
DeterministicRandom.cpp
DeterministicRandom.h
Error.cpp
Error.h
EventTypes.actor.h
EncryptUtils.h
EncryptUtils.cpp
FastAlloc.cpp
FastAlloc.h
FastRef.h
FaultInjection.cpp
FaultInjection.h
FileIdentifier.h
FileTraceLogWriter.cpp
FileTraceLogWriter.h
Hash3.c
Hash3.h
Histogram.cpp
Histogram.h
Hostname.actor.cpp
Hostname.h
IAsyncFile.h
IAsyncFile.actor.cpp
IDispatched.h
IRandom.h
IRateControl.h
IThreadPoolTest.actor.cpp
IThreadPool.cpp
IThreadPool.h
ITrace.h
IndexedSet.actor.h
IndexedSet.cpp
IndexedSet.h
JsonTraceLogFormatter.cpp
JsonTraceLogFormatter.h
Knobs.cpp
Knobs.h
MetricSample.h
MkCert.h
MkCert.cpp
Net2.actor.cpp
Net2Packet.cpp
Net2Packet.h
ObjectSerializer.h
ObjectSerializerTraits.h
PKey.h
PKey.cpp
Platform.actor.cpp
Platform.actor.h
Platform.h
Profiler.actor.cpp
Profiler.h
ProtocolVersion.h
ScopeExit.h
SendBufferIterator.h
SimpleOpt.h
StreamCipher.cpp
StreamCipher.h
SystemMonitor.cpp
SystemMonitor.h
TDMetric.actor.h
TDMetric.cpp
TLSConfig.actor.cpp
TLSConfig.actor.h
ThreadHelper.actor.h
ThreadHelper.actor.cpp
ThreadPrimitives.cpp
ThreadPrimitives.h
ThreadSafeQueue.h
Trace.cpp
Trace.h
TreeBenchmark.h
TypeTraits.h
UnitTest.cpp
UnitTest.h
Util.h
WriteOnlySet.h
WriteOnlySet.actor.cpp
XmlTraceLogFormatter.cpp
XmlTraceLogFormatter.h
actorcompiler.h
crc32c.h
crc32c.cpp
ppc-asm.h
crc32.S
crc32_wrapper.h
crc32_wrapper.c
error_definitions.h
${CMAKE_CURRENT_BINARY_DIR}/include/flow/SourceVersion.h
flat_buffers.cpp
flat_buffers.h
flow.cpp
flow.h
folly_memcpy.h
genericactors.actor.cpp
genericactors.actor.h
network.cpp
network.h
rte_memcpy.h
serialize.cpp
serialize.h
sse2neon.h
singleton.h
stacktrace.h
test_memcpy.cpp
test_memcpy_perf.cpp
unactorcompiler.h
version.cpp
xxhash.c
xxhash.h)
add_library(stacktrace stacktrace.amalgamation.cpp stacktrace.h)
if (USE_ASAN)
target_compile_definitions(stacktrace PRIVATE ADDRESS_SANITIZER)
elseif(USE_MSAN)
target_compile_definitions(stacktrace PRIVATE MEMORY_SANITIZER)
elseif(USE_UBSAN)
target_compile_definitions(stacktrace PRIVATE UNDEFINED_BEHAVIOR_SANITIZER)
elseif(USE_TSAN)
target_compile_definitions(stacktrace PRIVATE THREAD_SANITIZER DYNAMIC_ANNOTATIONS_EXTERNAL_IMPL=1)
endif()
if(UNIX AND NOT APPLE)
list(APPEND FLOW_SRCS folly_memcpy.S)
endif()
file(GLOB_RECURSE FLOW_SRCS LIST_DIRECTORIES true RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" CONFIGURE_DEPENDS "*.cpp" "*.h")
if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
list(APPEND FLOW_SRCS aarch64/memcmp.S aarch64/memcpy.S)
@ -150,75 +11,67 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/SourceVersion.h.cmake ${CMAKE_CURRENT
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/include/flow/config.h)
add_flow_target(STATIC_LIBRARY NAME flow SRCS ${FLOW_SRCS})
target_link_libraries(flow PRIVATE stacktrace)
target_link_libraries(flow PUBLIC fmt::fmt)
add_flow_target(STATIC_LIBRARY NAME flow_sampling SRCS ${FLOW_SRCS})
target_link_libraries(flow_sampling PRIVATE stacktrace)
target_link_libraries(flow_sampling PUBLIC fmt::fmt)
foreach(ft flow flow_sampling)
target_include_directories(${ft} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" "${CMAKE_CURRENT_BINARY_DIR}/include")
target_link_libraries(${ft} PRIVATE stacktrace)
target_link_libraries(${ft} PUBLIC fmt::fmt SimpleOpt crc32)
if(UNIX AND NOT APPLE)
target_link_libraries(${ft} PRIVATE folly_memcpy)
target_compile_definitions(${ft} PRIVATE WITH_FOLLY_MEMCPY)
endif()
if (NOT APPLE AND NOT WIN32)
set (FLOW_LIBS ${FLOW_LIBS} rt)
elseif(WIN32)
target_link_libraries(${ft} PUBLIC winmm.lib)
target_link_libraries(${ft} PUBLIC psapi.lib)
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
set (FLOW_LIBS ${FLOW_LIBS} execinfo devstat)
find_library(EIO eio)
if(EIO)
target_link_libraries(${ft} PUBLIC ${EIO})
endif()
endif()
target_link_libraries(${ft} PRIVATE ${FLOW_LIBS})
if(USE_VALGRIND)
target_link_libraries(${ft} PUBLIC Valgrind)
endif()
target_link_libraries(${ft} PUBLIC OpenSSL::SSL)
if(USE_WOLFSSL)
target_include_directories(${ft} SYSTEM BEFORE PUBLIC ${WOLFSSL_INCLUDE_DIR}/wolfssl)
endif()
target_link_libraries(${ft} PUBLIC Threads::Threads ${CMAKE_DL_LIBS})
if(USE_SANITIZER)
target_link_libraries(${ft} PUBLIC boost_asan)
else()
target_link_libraries(${ft} PUBLIC boost_target)
endif()
if(USE_VALGRIND)
target_link_libraries(${ft} PUBLIC Valgrind)
endif()
if(APPLE)
find_library(IO_KIT IOKit)
find_library(CORE_FOUNDATION CoreFoundation)
target_link_libraries(${ft} PRIVATE ${IO_KIT} ${CORE_FOUNDATION})
endif()
endforeach()
target_compile_definitions(flow_sampling PRIVATE -DENABLE_SAMPLING)
if(WIN32)
add_dependencies(flow_sampling_actors flow_actors)
endif()
if (NOT APPLE AND NOT WIN32)
set (FLOW_LIBS ${FLOW_LIBS} rt)
elseif(WIN32)
target_link_libraries(flow PUBLIC winmm.lib)
target_link_libraries(flow PUBLIC psapi.lib)
target_link_libraries(flow_sampling PUBLIC winmm.lib)
target_link_libraries(flow_sampling PUBLIC psapi.lib)
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
set (FLOW_LIBS ${FLOW_LIBS} execinfo devstat)
find_library(EIO eio)
if(EIO)
target_link_libraries(flow PUBLIC ${EIO})
target_link_libraries(flow_sampling PUBLIC ${EIO})
endif()
endif()
target_link_libraries(flow PRIVATE ${FLOW_LIBS})
target_link_libraries(flow_sampling PRIVATE ${FLOW_LIBS})
if(USE_VALGRIND)
target_link_libraries(flow PUBLIC Valgrind)
target_link_libraries(flow_sampling PUBLIC Valgrind)
endif()
target_link_libraries(flow PUBLIC OpenSSL::SSL)
target_link_libraries(flow_sampling PUBLIC OpenSSL::SSL)
if(USE_WOLFSSL)
target_include_directories(flow SYSTEM BEFORE PUBLIC ${WOLFSSL_INCLUDE_DIR}/wolfssl)
target_include_directories(flow_sampling SYSTEM BEFORE PUBLIC ${WOLFSSL_INCLUDE_DIR}/wolfssl)
endif()
target_link_libraries(flow PUBLIC Threads::Threads ${CMAKE_DL_LIBS})
target_link_libraries(flow_sampling PUBLIC Threads::Threads ${CMAKE_DL_LIBS})
if(USE_SANITIZER)
target_link_libraries(flow PUBLIC boost_asan)
target_link_libraries(flow_sampling PUBLIC boost_asan)
else()
target_link_libraries(flow PUBLIC boost_target)
target_link_libraries(flow_sampling PUBLIC boost_target)
endif()
if(USE_VALGRIND)
target_link_libraries(flow PUBLIC Valgrind)
target_link_libraries(flow_sampling PUBLIC Valgrind)
endif()
if(APPLE)
find_library(IO_KIT IOKit)
find_library(CORE_FOUNDATION CoreFoundation)
target_link_libraries(flow PRIVATE ${IO_KIT} ${CORE_FOUNDATION})
target_link_libraries(flow_sampling PRIVATE ${IO_KIT} ${CORE_FOUNDATION})
endif()
add_executable(mkcert MkCertCli.cpp)
target_link_libraries(mkcert PUBLIC fmt::fmt flow)
target_link_libraries(mkcert PUBLIC flow)
add_executable(mtls_unittest TLSTest.cpp)
target_link_libraries(mtls_unittest PUBLIC fmt::fmt flow)
if(USE_SANITIZER)
target_link_libraries(mtls_unittest PUBLIC boost_asan)
else()
target_link_libraries(mtls_unittest PUBLIC boost_target)
endif()
target_link_libraries(mtls_unittest PUBLIC flow)
add_test(NAME mutual_tls_unittest
COMMAND $<TARGET_FILE:mtls_unittest>)

View File

@ -184,7 +184,7 @@ ErrorCodeTable::ErrorCodeTable() {
#define ERROR(name, number, description) \
addCode(number, #name, description); \
enum { Duplicate_Error_Code_##number = 0 };
#include "error_definitions.h"
#include "flow/error_definitions.h"
}
void ErrorCodeTable::addCode(int code, const char* name, const char* description) {

View File

@ -25,7 +25,7 @@
#include "flow/Error.h"
#include "flow/Knobs.h"
#include "flow/UnitTest.h"
#include "flow/crc32c.h"
#include "crc32/crc32c.h"
#include "flow/flow.h"
#include <atomic>

View File

@ -30,7 +30,7 @@
#include "flow/network.h"
#include "flow/Platform.h"
#include "flow/ScopeExit.h"
#include "flow/SimpleOpt.h"
#include "SimpleOpt/SimpleOpt.h"
#include "flow/TLSConfig.actor.h"
#include "flow/Trace.h"

View File

@ -96,7 +96,7 @@
#include <ifaddrs.h>
#include <arpa/inet.h>
#include "flow/stacktrace.h"
#include "stacktrace/stacktrace.h"
#ifdef __linux__
/* Needed for memory allocation */
@ -3244,24 +3244,6 @@ int eraseDirectoryRecursive(std::string const& dir) {
return __eraseDirectoryRecurseiveCount;
}
bool isHwCrcSupported() {
#if defined(_WIN32)
int info[4];
__cpuid(info, 1);
return (info[2] & (1 << 20)) != 0;
#elif defined(__aarch64__)
return true; /* force to use crc instructions */
#elif defined(__powerpc64__)
return false; /* force not to use crc instructions */
#elif defined(__unixish__)
uint32_t eax, ebx, ecx, edx, level = 1, count = 0;
__cpuid_count(level, count, eax, ebx, ecx, edx);
return ((ecx >> 20) & 1) != 0;
#else
#error Port me!
#endif
}
TmpFile::TmpFile() : filename("") {
createTmpFile(boost::filesystem::temp_directory_path().string(), TmpFile::defaultPrefix);
}

View File

@ -22,7 +22,9 @@
#include "flow/DeterministicRandom.h"
#include "flow/UnitTest.h"
#include "flow/rte_memcpy.h"
#include "flow/folly_memcpy.h"
#ifdef WITH_FOLLY_MEMCPY
#include "folly_memcpy.h"
#endif
#include <stdarg.h>
#include <cinttypes>

View File

@ -420,8 +420,6 @@ std::string format_backtrace(void** addresses, int numAddresses);
// Avoid in production code: not atomic, not fast, not reliable in all environments
int eraseDirectoryRecursive(std::string const& directory);
bool isHwCrcSupported();
// Creates a temporary file; file gets destroyed/deleted along with object destruction.
// If 'tmpDir' is empty, code defaults to 'boost::filesystem::temp_directory_path()'
// If 'pattern' is empty, code defaults to 'fdbtmp'
@ -840,34 +838,6 @@ inline void fdb_probe_actor_enter(const char* name, unsigned long id, int index)
inline void fdb_probe_actor_exit(const char* name, unsigned long id, int index) {}
#endif
// CRC32C
#ifdef __aarch64__
// aarch64
#include <inttypes.h>
static inline uint32_t hwCrc32cU8(unsigned int crc, unsigned char v) {
uint32_t ret;
asm volatile("crc32cb %w[r], %w[c], %w[v]" : [r] "=r"(ret) : [c] "r"(crc), [v] "r"(v));
return ret;
}
static inline uint32_t hwCrc32cU32(unsigned int crc, unsigned int v) {
uint32_t ret;
asm volatile("crc32cw %w[r], %w[c], %w[v]" : [r] "=r"(ret) : [c] "r"(crc), [v] "r"(v));
return ret;
}
static inline uint64_t hwCrc32cU64(uint64_t crc, uint64_t v) {
uint64_t ret;
asm volatile("crc32cx %w[r], %w[c], %x[v]" : [r] "=r"(ret) : [c] "r"(crc), [v] "r"(v));
return ret;
}
#else
#ifndef __powerpc64__
// Intel
#define hwCrc32cU8(c, v) _mm_crc32_u8(c, v)
#define hwCrc32cU32(c, v) _mm_crc32_u32(c, v)
#define hwCrc32cU64(c, v) _mm_crc32_u64(c, v)
#endif
#endif
#if defined(__aarch64__)
#define _MM_HINT_T0 0 /* dummy -- not used */
#endif

Some files were not shown because too many files have changed in this diff Show More