mirror of
https://github.com/XRPLF/rippled.git
synced 2026-04-29 15:37:57 +00:00
minor cleanup
Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com>
This commit is contained in:
@@ -25,18 +25,18 @@
|
|||||||
* -O1: Minimum optimization for reasonable performance
|
* -O1: Minimum optimization for reasonable performance
|
||||||
* -fsanitize=<types>: Enables sanitizer instrumentation
|
* -fsanitize=<types>: Enables sanitizer instrumentation
|
||||||
* -fsanitize-ignorelist=<path>: (Clang only) Compile-time ignorelist
|
* -fsanitize-ignorelist=<path>: (Clang only) Compile-time ignorelist
|
||||||
* -mcmodel=medium: (GCC only) Code model for large binaries
|
* -mcmodel=large: (GCC only) Code model for large binaries
|
||||||
* -Wno-stringop-overflow: (GCC only) Suppresses false positive warnings
|
* -Wno-stringop-overflow: (GCC only) Suppresses false positive warnings
|
||||||
* -Wno-tsan: (For GCC TSAN combination only) Suppresses atomic_thread_fence warnings
|
* -Wno-tsan: (For GCC TSAN combination only) Suppresses atomic_thread_fence warnings
|
||||||
|
|
||||||
- SANITIZERS_LINK_FLAGS: Linker flags for sanitizer runtime libraries.
|
- SANITIZERS_LINK_FLAGS: Linker flags for sanitizer runtime libraries.
|
||||||
Includes:
|
Includes:
|
||||||
* -fsanitize=<types>: Links sanitizer runtime libraries
|
* -fsanitize=<types>: Links sanitizer runtime libraries
|
||||||
* -mcmodel=medium: (GCC only) Matches compile-time code model
|
* -mcmodel=large: (GCC only) Matches compile-time code model
|
||||||
|
|
||||||
- SANITIZERS_RELOCATION_FLAGS: (GCC only) Code model flags for linking.
|
- SANITIZERS_RELOCATION_FLAGS: (GCC only) Code model flags for linking.
|
||||||
Used to handle large instrumented binaries on x86_64:
|
Used to handle large instrumented binaries on x86_64:
|
||||||
* -mcmodel=medium: For both ASAN and TSAN (large model collides with
|
* -mcmodel=large: For both ASAN and TSAN (large model collides with
|
||||||
* ASAN shadow memory; is incompatible with TSAN)
|
* ASAN shadow memory; is incompatible with TSAN)
|
||||||
#]===================================================================]
|
#]===================================================================]
|
||||||
|
|
||||||
@@ -147,9 +147,9 @@ if(is_gcc)
|
|||||||
list(APPEND SANITIZERS_COMPILE_FLAGS "-Wno-stringop-overflow")
|
list(APPEND SANITIZERS_COMPILE_FLAGS "-Wno-stringop-overflow")
|
||||||
|
|
||||||
if(is_amd64 AND enable_asan)
|
if(is_amd64 AND enable_asan)
|
||||||
message(STATUS " Using medium code model (-mcmodel=medium)")
|
message(STATUS " Using large code model (-mcmodel=large)")
|
||||||
list(APPEND SANITIZERS_COMPILE_FLAGS "-mcmodel=medium")
|
list(APPEND SANITIZERS_COMPILE_FLAGS "-mcmodel=large")
|
||||||
list(APPEND SANITIZERS_RELOCATION_FLAGS "-mcmodel=medium")
|
list(APPEND SANITIZERS_RELOCATION_FLAGS "-mcmodel=large")
|
||||||
elseif(enable_tsan)
|
elseif(enable_tsan)
|
||||||
# GCC doesn't support atomic_thread_fence with tsan. Suppress warnings.
|
# GCC doesn't support atomic_thread_fence with tsan. Suppress warnings.
|
||||||
list(APPEND SANITIZERS_COMPILE_FLAGS "-Wno-tsan")
|
list(APPEND SANITIZERS_COMPILE_FLAGS "-Wno-tsan")
|
||||||
|
|||||||
@@ -55,20 +55,13 @@ endif()
|
|||||||
# stack-use-after-scope errors. BOOST_USE_UCONTEXT ensures the ucontext backend
|
# stack-use-after-scope errors. BOOST_USE_UCONTEXT ensures the ucontext backend
|
||||||
# is selected (fcontext does not support ASAN annotations).
|
# is selected (fcontext does not support ASAN annotations).
|
||||||
# These defines must match what Boost was compiled with (see conan/profiles/sanitizers).
|
# These defines must match what Boost was compiled with (see conan/profiles/sanitizers).
|
||||||
if(enable_asan)
|
# TSAN also requires the ucontext backend so that Boost.Context uses
|
||||||
|
# POSIX ucontext (not fcontext assembly) for fiber switching. This
|
||||||
|
# allows TSAN to properly track context switches and avoids false positives.
|
||||||
|
# These defines must match what Boost was compiled with (see conan/profiles/sanitizers).
|
||||||
|
if(enable_asan OR enable_tsan)
|
||||||
target_compile_definitions(
|
target_compile_definitions(
|
||||||
xrpl_boost
|
xrpl_boost
|
||||||
INTERFACE BOOST_USE_ASAN BOOST_USE_UCONTEXT
|
INTERFACE BOOST_USE_ASAN BOOST_USE_UCONTEXT
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# TSAN also requires the ucontext backend so that Boost.Context uses
|
|
||||||
# POSIX ucontext (not fcontext assembly) for fiber switching. This
|
|
||||||
# allows TSAN to properly track context switches and avoids false positives.
|
|
||||||
# These defines must match what Boost was compiled with (see conan/profiles/sanitizers).
|
|
||||||
if(enable_tsan)
|
|
||||||
target_compile_definitions(
|
|
||||||
xrpl_boost
|
|
||||||
INTERFACE BOOST_USE_TSAN BOOST_USE_UCONTEXT
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ include(default)
|
|||||||
|
|
||||||
{% if "address" in sanitizers %}
|
{% if "address" in sanitizers %}
|
||||||
{% set _ = sanitizer_list.append("address") %}
|
{% set _ = sanitizer_list.append("address") %}
|
||||||
{% set model_code = "-mcmodel=medium" %}
|
{% set model_code = "-mcmodel=large" %}
|
||||||
{% set _ = defines.append("BOOST_USE_ASAN")%}
|
{% set _ = defines.append("BOOST_USE_ASAN")%}
|
||||||
{% set _ = defines.append("BOOST_USE_UCONTEXT")%}
|
{% set _ = defines.append("BOOST_USE_UCONTEXT")%}
|
||||||
{% elif "thread" in sanitizers %}
|
{% elif "thread" in sanitizers %}
|
||||||
|
|||||||
@@ -29,15 +29,15 @@ namespace test {
|
|||||||
* constraint).
|
* constraint).
|
||||||
*/
|
*/
|
||||||
#if defined(__SANITIZE_THREAD__) || defined(__SANITIZE_ADDRESS__)
|
#if defined(__SANITIZE_THREAD__) || defined(__SANITIZE_ADDRESS__)
|
||||||
inline constexpr std::size_t yieldStackSize = 4 * 1024 * 1024;
|
inline constexpr std::size_t yieldStackSize = 2 * 1024 * 1024;
|
||||||
#elif defined(__has_feature)
|
#elif defined(__has_feature)
|
||||||
#if __has_feature(thread_sanitizer) || __has_feature(address_sanitizer)
|
#if __has_feature(thread_sanitizer) || __has_feature(address_sanitizer)
|
||||||
inline constexpr std::size_t yieldStackSize = 4 * 1024 * 1024;
|
|
||||||
#else
|
|
||||||
inline constexpr std::size_t yieldStackSize = 2 * 1024 * 1024;
|
inline constexpr std::size_t yieldStackSize = 2 * 1024 * 1024;
|
||||||
|
#else
|
||||||
|
inline constexpr std::size_t yieldStackSize = 1.5 * 1024 * 1024;
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
inline constexpr std::size_t yieldStackSize = 2 * 1024 * 1024;
|
inline constexpr std::size_t yieldStackSize = 1.5 * 1024 * 1024;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** Mix-in to support tests using asio coroutines.
|
/** Mix-in to support tests using asio coroutines.
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ namespace xrpl {
|
|||||||
* Sanitizers significantly increase stack frame sizes
|
* Sanitizers significantly increase stack frame sizes
|
||||||
* (TSAN ~3-5x, ASAN ~2-3x), requiring larger coroutine stacks.
|
* (TSAN ~3-5x, ASAN ~2-3x), requiring larger coroutine stacks.
|
||||||
*/
|
*/
|
||||||
inline constexpr std::size_t coroStackSize = XRPL_SANITIZER_ACTIVE ? megabytes(4) : megabytes(2);
|
inline constexpr std::size_t coroStackSize = XRPL_SANITIZER_ACTIVE ? megabytes(2) : megabytes(1.5);
|
||||||
|
|
||||||
template <class F>
|
template <class F>
|
||||||
JobQueue::Coro::Coro(Coro_create_t, JobQueue& jq, JobType type, std::string const& name, F&& f)
|
JobQueue::Coro::Coro(Coro_create_t, JobQueue& jq, JobType type, std::string const& name, F&& f)
|
||||||
|
|||||||
@@ -23,10 +23,8 @@ public:
|
|||||||
virtual ~Manager() = 0;
|
virtual ~Manager() = 0;
|
||||||
|
|
||||||
/** Start the manager's background thread.
|
/** Start the manager's background thread.
|
||||||
|
|
||||||
Must be called after construction to begin periodic charge decay
|
Must be called after construction to begin periodic charge decay
|
||||||
and inactive-consumer sweeps.
|
and inactive-consumer sweeps.
|
||||||
|
|
||||||
@note Not thread-safe. Must be called exactly once, before any
|
@note Not thread-safe. Must be called exactly once, before any
|
||||||
concurrent access to the manager.
|
concurrent access to the manager.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -7,10 +7,8 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
/** Manages an io_context and its worker threads.
|
/** Manages an io_context and its worker threads.
|
||||||
*
|
|
||||||
* Ensures the io_context outlives all derived classes by joining worker
|
* Ensures the io_context outlives all derived classes by joining worker
|
||||||
* threads in the destructor. Supports immediate or deferred thread startup.
|
* threads in the destructor. Supports immediate or deferred thread startup.
|
||||||
*
|
|
||||||
* @note Thread-safe after construction completes. The deferred-start
|
* @note Thread-safe after construction completes. The deferred-start
|
||||||
* constructor and startIOThreads() must be called from a single thread.
|
* constructor and startIOThreads() must be called from a single thread.
|
||||||
*/
|
*/
|
||||||
@@ -42,7 +40,6 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** Tag type for deferred thread startup.
|
/** Tag type for deferred thread startup.
|
||||||
*
|
|
||||||
* Pass to the protected constructor to construct without starting IO
|
* Pass to the protected constructor to construct without starting IO
|
||||||
* threads. The derived class must call startIOThreads() once its own
|
* threads. The derived class must call startIOThreads() once its own
|
||||||
* construction is complete.
|
* construction is complete.
|
||||||
@@ -52,14 +49,12 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** Construct without starting IO threads.
|
/** Construct without starting IO threads.
|
||||||
*
|
|
||||||
* @param numberOfThreads Desired number of IO worker threads.
|
* @param numberOfThreads Desired number of IO worker threads.
|
||||||
* @param Tag to select deferred startup.
|
* @param Tag to select deferred startup.
|
||||||
*/
|
*/
|
||||||
BasicApp(std::size_t numberOfThreads, DeferStart);
|
BasicApp(std::size_t numberOfThreads, DeferStart);
|
||||||
|
|
||||||
/** Start the IO worker threads.
|
/** Start the IO worker threads.
|
||||||
*
|
|
||||||
* @note Must be called exactly once after the deferred-start constructor.
|
* @note Must be called exactly once after the deferred-start constructor.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
|
|||||||
Reference in New Issue
Block a user