0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-05-19 19:33:45 +02:00

ircd: Various symbol surface reductions and sorting.

This commit is contained in:
Jason Volk 2022-05-26 12:28:28 -07:00
parent 04558290c0
commit e51b855f2b
20 changed files with 82 additions and 51 deletions

View file

@ -275,14 +275,14 @@ struct ircd::allocator::callback<T>::allocator
}; };
template<class T> template<class T>
typename ircd::allocator::callback<T>::allocator inline typename ircd::allocator::callback<T>::allocator
ircd::allocator::callback<T>::operator()() ircd::allocator::callback<T>::operator()()
{ {
return ircd::allocator::callback<T>::allocator(*this); return ircd::allocator::callback<T>::allocator(*this);
} }
template<class T> template<class T>
ircd::allocator::callback<T>::operator inline ircd::allocator::callback<T>::operator
allocator() allocator()
{ {
return ircd::allocator::callback<T>::allocator(*this); return ircd::allocator::callback<T>::allocator(*this);
@ -423,7 +423,7 @@ struct ircd::allocator::fixed<T, SIZE>::allocator
template<class T, template<class T,
size_t SIZE> size_t SIZE>
typename ircd::allocator::fixed<T, SIZE>::allocator inline typename ircd::allocator::fixed<T, SIZE>::allocator
ircd::allocator::fixed<T, SIZE>::operator()() ircd::allocator::fixed<T, SIZE>::operator()()
{ {
return ircd::allocator::fixed<T, SIZE>::allocator(*this); return ircd::allocator::fixed<T, SIZE>::allocator(*this);
@ -431,7 +431,7 @@ ircd::allocator::fixed<T, SIZE>::operator()()
template<class T, template<class T,
size_t SIZE> size_t SIZE>
ircd::allocator::fixed<T, SIZE>::operator inline ircd::allocator::fixed<T, SIZE>::operator
allocator() allocator()
{ {
return ircd::allocator::fixed<T, SIZE>::allocator(*this); return ircd::allocator::fixed<T, SIZE>::allocator(*this);
@ -541,14 +541,14 @@ struct ircd::allocator::dynamic<T>::allocator
}; };
template<class T> template<class T>
typename ircd::allocator::dynamic<T>::allocator inline typename ircd::allocator::dynamic<T>::allocator
ircd::allocator::dynamic<T>::operator()() ircd::allocator::dynamic<T>::operator()()
{ {
return ircd::allocator::dynamic<T>::allocator(*this); return ircd::allocator::dynamic<T>::allocator(*this);
} }
template<class T> template<class T>
ircd::allocator::dynamic<T>::operator inline ircd::allocator::dynamic<T>::operator
allocator() allocator()
{ {
return ircd::allocator::dynamic<T>::allocator(*this); return ircd::allocator::dynamic<T>::allocator(*this);
@ -771,7 +771,7 @@ struct ircd::allocator::twolevel<T, L0_SIZE>::allocator
template<class T, template<class T,
size_t L0_SIZE> size_t L0_SIZE>
typename ircd::allocator::twolevel<T, L0_SIZE>::allocator inline typename ircd::allocator::twolevel<T, L0_SIZE>::allocator
ircd::allocator::twolevel<T, L0_SIZE>::operator()() ircd::allocator::twolevel<T, L0_SIZE>::operator()()
{ {
return ircd::allocator::twolevel<T, L0_SIZE>::allocator(*this); return ircd::allocator::twolevel<T, L0_SIZE>::allocator(*this);
@ -779,7 +779,7 @@ ircd::allocator::twolevel<T, L0_SIZE>::operator()()
template<class T, template<class T,
size_t L0_SIZE> size_t L0_SIZE>
ircd::allocator::twolevel<T, L0_SIZE>::operator inline ircd::allocator::twolevel<T, L0_SIZE>::operator
allocator() allocator()
{ {
return ircd::allocator::twolevel<T, L0_SIZE>::allocator(*this); return ircd::allocator::twolevel<T, L0_SIZE>::allocator(*this);

View file

@ -24,7 +24,8 @@ namespace ircd::cl
void log_platform_info(); void log_platform_info();
} }
class ircd::cl::init class [[gnu::visibility("hidden")]]
ircd::cl::init
{ {
size_t init_platforms(); size_t init_platforms();
size_t init_devices(); size_t init_devices();

View file

@ -116,7 +116,8 @@ struct ircd::client::settings
static ircd::conf::item<size_t> max_client_per_peer; static ircd::conf::item<size_t> max_client_per_peer;
}; };
struct ircd::client::init struct [[gnu::visibility("hidden")]]
ircd::client::init
{ {
init(); init();
~init() noexcept; ~init() noexcept;

View file

@ -46,7 +46,8 @@ namespace ircd
/// own after receiving an interruption without help from this action. Common /// own after receiving an interruption without help from this action. Common
/// use for this is with yields to asio. /// use for this is with yields to asio.
/// ///
struct ircd::ctx::continuation struct [[gnu::visibility("hidden")]]
ircd::ctx::continuation
{ {
static const predicate asio_predicate; static const predicate asio_predicate;
static const predicate true_predicate; static const predicate true_predicate;

View file

@ -49,7 +49,8 @@ struct ircd::ctx::ole::opts
int8_t prio {0}; int8_t prio {0};
}; };
struct ircd::ctx::ole::init struct [[gnu::visibility("hidden")]]
ircd::ctx::ole::init
{ {
init(); init();
~init() noexcept; ~init() noexcept;

View file

@ -83,7 +83,8 @@ namespace ircd
} }
/// Database subsystem initialization and destruction /// Database subsystem initialization and destruction
struct ircd::db::init struct [[gnu::visibility("hidden")]]
ircd::db::init
{ {
static const std::string direct_io_test_file_path; static const std::string direct_io_test_file_path;

View file

@ -220,7 +220,7 @@ namespace ircd
template<class E, template<class E,
class... args> class... args>
std::exception_ptr inline std::exception_ptr
ircd::make_exception_ptr(args&&... a) ircd::make_exception_ptr(args&&... a)
try try
{ {
@ -232,14 +232,14 @@ catch(const E &)
}; };
template<class... args> template<class... args>
void inline void
ircd::throw_system_error(args&&... a) ircd::throw_system_error(args&&... a)
{ {
throw make_system_error(std::forward<args>(a)...); throw make_system_error(std::forward<args>(a)...);
} }
template<class... args> template<class... args>
std::exception_ptr inline std::exception_ptr
ircd::make_system_eptr(args&&... a) ircd::make_system_eptr(args&&... a)
{ {
return std::make_exception_ptr(make_system_error(std::forward<args>(a)...)); return std::make_exception_ptr(make_system_error(std::forward<args>(a)...));

View file

@ -84,7 +84,8 @@ struct ircd::fs::aio::stats
stats(); stats();
}; };
struct ircd::fs::aio::init struct [[gnu::visibility("hidden")]]
ircd::fs::aio::init
{ {
init(); init();
~init() noexcept; ~init() noexcept;

View file

@ -78,7 +78,8 @@ namespace ircd::fs
} }
/// Filesystem interface init / fini held by ircd::main(). /// Filesystem interface init / fini held by ircd::main().
struct ircd::fs::init struct [[gnu::visibility("hidden")]]
ircd::fs::init
{ {
iou::init _iou_; iou::init _iou_;
aio::init _aio_; aio::init _aio_;

View file

@ -89,7 +89,8 @@ enum ircd::fs::iou::state
/// Internal use; this is simply declared here for when internal headers are /// Internal use; this is simply declared here for when internal headers are
/// not available for this build so a weak no-op definition can be defined. /// not available for this build so a weak no-op definition can be defined.
struct ircd::fs::iou::init struct [[gnu::visibility("hidden")]]
ircd::fs::iou::init
{ {
init(); init();
~init() noexcept; ~init() noexcept;

View file

@ -28,7 +28,8 @@ namespace ircd::magic
extern const info::versions version_api, version_abi; extern const info::versions version_api, version_abi;
} }
struct ircd::magic::init struct [[gnu::visibility("hidden")]]
ircd::magic::init
{ {
init(); init();
~init() noexcept; ~init() noexcept;

View file

@ -27,12 +27,6 @@ namespace ircd::magick
extern const info::versions version_api, version_abi; extern const info::versions version_api, version_abi;
} }
struct ircd::magick::init
{
init();
~init() noexcept;
};
/// Composite thumbnailer to resize close to the requested dimension but /// Composite thumbnailer to resize close to the requested dimension but
/// preserving original aspect ratio; then crop to requested dimension. /// preserving original aspect ratio; then crop to requested dimension.
struct ircd::magick::thumbcrop struct ircd::magick::thumbcrop
@ -111,6 +105,13 @@ struct ircd::magick::job
std::exception_ptr eptr; // apropos exception reference std::exception_ptr eptr; // apropos exception reference
}; };
struct [[gnu::visibility("hidden")]]
ircd::magick::init
{
init();
~init() noexcept;
};
// inline stubs when magick disabled/unavailable. // inline stubs when magick disabled/unavailable.
#if !IRCD_USE_MAGICK #if !IRCD_USE_MAGICK

View file

@ -73,7 +73,8 @@ namespace ircd
using net::socket; using net::socket;
} }
struct ircd::net::init struct [[gnu::visibility("hidden")]]
ircd::net::init
{ {
init(); init();
~init() noexcept; ~init() noexcept;

View file

@ -129,7 +129,7 @@ struct ircd::net::socket
}; };
template<class... args> template<class... args>
auto inline auto
ircd::net::socket::operator()(args&&... a) ircd::net::socket::operator()(args&&... a)
{ {
return this->wait(std::forward<args>(a)...); return this->wait(std::forward<args>(a)...);

View file

@ -212,7 +212,8 @@ class ircd::openssl::bignum
~bignum() noexcept; ~bignum() noexcept;
}; };
struct ircd::openssl::init struct [[gnu::visibility("hidden")]]
ircd::openssl::init
{ {
init(); init();
~init() noexcept; ~init() noexcept;

View file

@ -63,7 +63,8 @@ namespace ircd::server
/// Subsystem initialization / destruction from ircd::main /// Subsystem initialization / destruction from ircd::main
/// ///
struct ircd::server::init struct [[gnu::visibility("hidden")]]
ircd::server::init
{ {
// manual control panel // manual control panel
static void interrupt(); static void interrupt();

View file

@ -24,6 +24,10 @@ AM_CPPFLAGS = \
AM_LDFLAGS = \ AM_LDFLAGS = \
-version-info 3:2:0 \ -version-info 3:2:0 \
-Wl,--no-undefined-version \ -Wl,--no-undefined-version \
-Wl,--icf=all \
-Wl,--no-text-reorder \
-Wl,--sort-section=name \
-Wl,--sort-common=descending \
-Wl,--weak-unresolved-symbols \ -Wl,--weak-unresolved-symbols \
-Wl,--unresolved-symbols=ignore-in-shared-libs \ -Wl,--unresolved-symbols=ignore-in-shared-libs \
-Wl,--wrap=pthread_create \ -Wl,--wrap=pthread_create \

View file

@ -64,7 +64,7 @@ ircd::ctx::ctx::ios_handler
}; };
/// Points to the next context to spawn (internal use) /// Points to the next context to spawn (internal use)
[[gnu::visibility("internal")]] [[gnu::visibility("hidden")]]
decltype(ircd::ctx::ctx::spawning) decltype(ircd::ctx::ctx::spawning)
ircd::ctx::ctx::spawning; ircd::ctx::ctx::spawning;
@ -74,6 +74,7 @@ decltype(ircd::ctx::ctx::adjoindre)
ircd::ctx::ctx::adjoindre; ircd::ctx::ctx::adjoindre;
/// Internal context struct ctor /// Internal context struct ctor
[[gnu::visibility("hidden")]]
ircd::ctx::ctx::ctx(const string_view &name, ircd::ctx::ctx::ctx(const string_view &name,
const ircd::ctx::stack &stack, const ircd::ctx::stack &stack,
const context::flags &flags) const context::flags &flags)
@ -93,6 +94,7 @@ ircd::ctx::ctx::ctx(const string_view &name,
strlcpy(this->name, name); strlcpy(this->name, name);
} }
[[gnu::visibility("hidden")]]
ircd::ctx::ctx::~ctx() ircd::ctx::ctx::~ctx()
noexcept noexcept
{ {
@ -100,6 +102,7 @@ noexcept
} }
/// Internal wrapper for asio::spawn; never call directly. /// Internal wrapper for asio::spawn; never call directly.
[[gnu::visibility("hidden")]]
void void
IRCD_CTX_STACK_PROTECT IRCD_CTX_STACK_PROTECT
ircd::ctx::ctx::spawn(context::function func) ircd::ctx::ctx::spawn(context::function func)
@ -160,6 +163,7 @@ ircd::ctx::ctx::spawn(context::function func)
/// ///
/// This function is the first thing executed on the new context's stack /// This function is the first thing executed on the new context's stack
/// and calls the user's function. /// and calls the user's function.
[[gnu::visibility("hidden")]]
void void
IRCD_CTX_STACK_PROTECT IRCD_CTX_STACK_PROTECT
ircd::ctx::ctx::operator()(boost::asio::yield_context yc, ircd::ctx::ctx::operator()(boost::asio::yield_context yc,
@ -232,6 +236,7 @@ catch(const std::exception &e)
/// ///
/// This currently doesn't work yet because the suspension state of this /// This currently doesn't work yet because the suspension state of this
/// context has to be ready to be jumped to and that isn't implemented yet. /// context has to be ready to be jumped to and that isn't implemented yet.
[[gnu::visibility("hidden")]]
void void
IRCD_CTX_STACK_PROTECT IRCD_CTX_STACK_PROTECT
ircd::ctx::ctx::jump() ircd::ctx::ctx::jump()
@ -265,7 +270,7 @@ ircd::ctx::ctx::jump()
/// considered handled an another attempt to `wait()` can be made. Returns true /// considered handled an another attempt to `wait()` can be made. Returns true
/// if the context suspended and was notified. When a context wakes up the /// if the context suspended and was notified. When a context wakes up the
/// note counter is reset. /// note counter is reset.
[[gnu::hot]] [[gnu::visibility("hidden"), gnu::hot]]
bool bool
IRCD_CTX_STACK_PROTECT IRCD_CTX_STACK_PROTECT
ircd::ctx::ctx::wait() ircd::ctx::ctx::wait()
@ -320,6 +325,7 @@ ircd::ctx::ctx::wait()
/// ///
/// Returns true if this note was the first note received by this context /// Returns true if this note was the first note received by this context
/// while it's been suspended or false if it's already been notified. /// while it's been suspended or false if it's already been notified.
[[gnu::visibility("hidden"), gnu::hot]]
bool bool
ircd::ctx::ctx::note() ircd::ctx::ctx::note()
noexcept noexcept
@ -334,6 +340,7 @@ noexcept
} }
/// Wakes a context without a note (internal) /// Wakes a context without a note (internal)
[[gnu::visibility("hidden"), gnu::hot]]
bool bool
ircd::ctx::ctx::wake() ircd::ctx::ctx::wake()
noexcept try noexcept try
@ -370,7 +377,7 @@ catch(const std::exception &e)
/// Throws if this context has been flagged for interruption and clears /// Throws if this context has been flagged for interruption and clears
/// the flag. /// the flag.
[[gnu::hot]] [[gnu::visibility("hidden"), gnu::hot]]
void void
ircd::ctx::ctx::interruption_point() ircd::ctx::ctx::interruption_point()
{ {
@ -390,7 +397,7 @@ ircd::ctx::ctx::interruption_point()
/// Returns true if this context has been flagged for termination. Does not /// Returns true if this context has been flagged for termination. Does not
/// clear the flag. Sets the NOINTERRUPT flag so the context cannot be further /// clear the flag. Sets the NOINTERRUPT flag so the context cannot be further
// interrupted which simplifies the termination process. // interrupted which simplifies the termination process.
[[gnu::hot]] [[gnu::visibility("hidden"), gnu::hot]]
bool bool
ircd::ctx::ctx::termination_point(std::nothrow_t) ircd::ctx::ctx::termination_point(std::nothrow_t)
noexcept noexcept
@ -407,7 +414,7 @@ noexcept
/// Returns true if this context has been flagged for interruption and /// Returns true if this context has been flagged for interruption and
/// clears the flag. /// clears the flag.
[[gnu::hot]] [[gnu::visibility("hidden"), gnu::hot]]
bool bool
ircd::ctx::ctx::interruption_point(std::nothrow_t) ircd::ctx::ctx::interruption_point(std::nothrow_t)
noexcept noexcept
@ -424,7 +431,7 @@ noexcept
/// True if this context has been flagged for interruption or termination /// True if this context has been flagged for interruption or termination
/// and interrupts are not blocked. /// and interrupts are not blocked.
[[gnu::hot]] [[gnu::visibility("hidden"), gnu::hot]]
bool bool
ircd::ctx::ctx::interruption() ircd::ctx::ctx::interruption()
const noexcept const noexcept
@ -447,7 +454,7 @@ const noexcept
return true; return true;
} }
[[gnu::hot]] [[gnu::visibility("hidden"), gnu::hot]]
bool bool
ircd::ctx::ctx::started() ircd::ctx::ctx::started()
const noexcept const noexcept
@ -455,7 +462,7 @@ const noexcept
return stack.base != 0; return stack.base != 0;
} }
[[gnu::hot]] [[gnu::visibility("hidden"), gnu::hot]]
bool bool
ircd::ctx::ctx::finished() ircd::ctx::ctx::finished()
const noexcept const noexcept
@ -825,6 +832,7 @@ ircd::ctx::this_ctx::wait()
c.wait(); // now you're yielding with portals c.wait(); // now you're yielding with portals
} }
[[gnu::hot, gnu::noinline]]
size_t size_t
ircd::ctx::this_ctx::stack_at_here() ircd::ctx::this_ctx::stack_at_here()
{ {
@ -834,6 +842,7 @@ ircd::ctx::this_ctx::stack_at_here()
/// Throws interrupted if the currently running context was interrupted /// Throws interrupted if the currently running context was interrupted
/// and clears the interrupt flag. /// and clears the interrupt flag.
[[gnu::hot]]
void void
ircd::ctx::this_ctx::interruption_point() ircd::ctx::this_ctx::interruption_point()
{ {

View file

@ -22,20 +22,20 @@
/// The resolution is very low at 10ms but it is not expensive to use. /// The resolution is very low at 10ms but it is not expensive to use.
//#define RB_DEBUG_FS_AIO_SUBMIT_BLOCKING //#define RB_DEBUG_FS_AIO_SUBMIT_BLOCKING
#pragma GCC visibility push(hidden)
namespace ircd::fs::aio namespace ircd::fs::aio
{ {
struct system;
struct request;
size_t write(const fd &, const const_iovec_view &, const write_opts &); size_t write(const fd &, const const_iovec_view &, const write_opts &);
size_t read(const vector_view<read_op> &); size_t read(const vector_view<read_op> &);
size_t read(const fd &, const const_iovec_view &, const read_opts &); size_t read(const fd &, const const_iovec_view &, const read_opts &);
size_t fsync(const fd &, const sync_opts &); size_t fsync(const fd &, const sync_opts &);
} }
#pragma GCC visibility pop
/// AIO context instance from the system. Right now this is a singleton with /// AIO context instance from the system. Right now this is a singleton with
/// an extern instance pointer at fs::aio::context maintained by fs::aio::init. /// an extern instance pointer at fs::aio::context maintained by fs::aio::init.
struct ircd::fs::aio::system struct [[gnu::visibility("hidden")]]
ircd::fs::aio::system
{ {
struct aio_context; struct aio_context;
@ -100,7 +100,8 @@ struct ircd::fs::aio::system
~system() noexcept; ~system() noexcept;
}; };
struct ircd::fs::aio::system::aio_context struct [[gnu::visibility("internal")]]
ircd::fs::aio::system::aio_context
{ {
static constexpr uint MAGIC {0xA10A10A1}; static constexpr uint MAGIC {0xA10A10A1};
@ -117,7 +118,8 @@ struct ircd::fs::aio::system::aio_context
// 128 bytes + ring size // 128 bytes + ring size
/// Generic request control block. /// Generic request control block.
struct ircd::fs::aio::request struct [[gnu::visibility("hidden")]]
ircd::fs::aio::request
:iocb :iocb
{ {
struct read; struct read;
@ -152,7 +154,8 @@ struct ircd::fs::aio::request
}; };
/// Read request control block /// Read request control block
struct ircd::fs::aio::request::read struct [[gnu::visibility("hidden")]]
ircd::fs::aio::request::read
:request :request
{ {
read(ctx::dock &, const int &fd, const read_opts &, const const_iovec_view &); read(ctx::dock &, const int &fd, const read_opts &, const const_iovec_view &);
@ -160,7 +163,8 @@ struct ircd::fs::aio::request::read
}; };
/// Write request control block /// Write request control block
struct ircd::fs::aio::request::write struct [[gnu::visibility("hidden")]]
ircd::fs::aio::request::write
:request :request
{ {
write(ctx::dock &, const int &fd, const write_opts &, const const_iovec_view &); write(ctx::dock &, const int &fd, const write_opts &, const const_iovec_view &);
@ -168,7 +172,8 @@ struct ircd::fs::aio::request::write
}; };
/// fsync request control block /// fsync request control block
struct ircd::fs::aio::request::fsync struct [[gnu::visibility("hidden")]]
ircd::fs::aio::request::fsync
:request :request
{ {
fsync(ctx::dock &, const int &fd, const sync_opts &); fsync(ctx::dock &, const int &fd, const sync_opts &);

View file

@ -12,17 +12,17 @@
#define HAVE_FS_IOU_H #define HAVE_FS_IOU_H
#include <linux/io_uring.h> #include <linux/io_uring.h>
#pragma GCC visibility push(hidden)
namespace ircd::fs::iou namespace ircd::fs::iou
{ {
struct system;
struct request;
size_t write(const fd &, const const_iovec_view &, const write_opts &); size_t write(const fd &, const const_iovec_view &, const write_opts &);
size_t read(const fd &, const const_iovec_view &, const read_opts &); size_t read(const fd &, const const_iovec_view &, const read_opts &);
void fsync(const fd &, const sync_opts &); void fsync(const fd &, const sync_opts &);
} }
#pragma GCC visibility pop
struct ircd::fs::iou::system struct [[gnu::visibility("hidden")]]
ircd::fs::iou::system
{ {
ctx::dock dock; ctx::dock dock;