-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
innobase/{lock0lock,dict0dict}: add noexcept
to lock/unlock methods
#3531
Conversation
Thank you! I knew that I think that this one needs to be rebased on the 10.6 branch, where the locking primitives were refactored and which most our customers using, as part of the MariaDB Enterprise Server offering. Can you also file a MDEV for this? |
a78b2a3
to
caf1f66
Compare
I created https://jira.mariadb.org/browse/MDEV-34973 and rebased the PR on branch 10.6 |
caf1f66
to
9b24dfb
Compare
I could not build the 10.5 branch because:
... and my bet that I could just fix the merge conflict and be done didn't work out. |
ed11519
to
e236afb
Compare
Hooray for try'n'error with CI logs. It now builds. |
By the way, I solved this problem. Just in case anybody else stumbles over this and finds this page: it was because I renamed the |
MariaDB is compiled with C++ exceptions enabled, and that disallows some optimizations (e.g. the stack must always be unwinding-safe). By adding `noexcept` to functions that are guaranteed to never throw, some of these optimizations can be regained. Low-level locking functions that are called often are a good candidate for this. This shrinks the executable a bit (tested with GCC 14 on aarch64): text data bss dec hex filename 24448910 2436488 9473185 36358583 22ac9b7 build/release/sql/mariadbd 24448622 2436488 9473537 36358647 22ac9f7 build/release/sql/mariadbd
Another chance for cutting back overhead due to C++ exceptions being enabled; the `dict_sys_t` class is a good candidate because its locking methods are called frequently. Binary size reduction this time: text data bss dec hex filename 24448622 2436488 9473537 36358647 22ac9f7 build/release/sql/mariadbd 24448474 2436488 9473601 36358563 22ac9a3 build/release/sql/mariadbd
e236afb
to
3da2f8c
Compare
@MaxKellermann I've reported it to git developers a year ago, https://www.spinics.net/lists/git/msg462320.html
|
@MaxKellermann did you see the difference in the binary output with/without noexcept? |
Yes and I described those change in the commit message & PR text.
With |
I see #if defined(__GNUC) && defined(__EXCEPTIONS)
#error "Please add -fno-exceptions to CXXFLAGS and reconfigure/recompile"
#endif The intention is clear, but the implementation is incorrect. Yes, GCC would define touch t.cc
g++ -E -dM -fno-exceptions t.cc|grep -i except
g++ -E -dM t.cc|grep -i except |
|
Description
MariaDB is compiled with C++ exceptions enabled, and that disallows
some optimizations (e.g. the stack must always be unwinding-safe). By
adding
noexcept
to functions that are guaranteed to never throw,some of these optimizations can be regained. Low-level locking
functions that are called often are a good candidate for this.
This shrinks the executable a bit (tested with GCC 14 on aarch64):
24448910 2436488 9473185 36358583 22ac9b7 build/release/sql/mariadbd
24448474 2436488 9473601 36358563 22ac9a3 build/release/sql/mariadbd
(See #3529 (comment))
Release Notes
No runtime effect.
How can this PR be tested?
No runtime effect.
Basing the PR against the correct MariaDB version
main
branch.PR quality check