diff options
| author | Monty <monty@mariadb.org> | 2020-08-14 18:56:56 +0300 |
|---|---|---|
| committer | Monty <monty@mariadb.org> | 2021-01-19 18:20:24 +0200 |
| commit | 43cdfc5e69b3b9b975d85420bcc6008b65c78f72 (patch) | |
| tree | 6bfea761d706cacde442b0fdbd09702dba4ce592 | |
| parent | b6e62674ac06f122890fa026eb09a8717fd56a54 (diff) | |
| download | mariadb-git-43cdfc5e69b3b9b975d85420bcc6008b65c78f72.tar.gz | |
Optimize Sql_alloc
- Remove 'dummy_for_valgrind' overrun marker as this doesn't help much.
The element also distorts the sizes of objects a bit, which makes it
harder to calculate gain in object sizes when doing size optimizations.
- Avoid one extra call indirection when using thd_get_current_thd(), which
is used by Sql_alloc.
| -rw-r--r-- | sql/mysqld.cc | 8 | ||||
| -rw-r--r-- | sql/sql_alloc.h | 6 | ||||
| -rw-r--r-- | sql/sql_class.cc | 10 |
3 files changed, 9 insertions, 15 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc index d0477b0effd..cfe1b1e4e6d 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -667,7 +667,15 @@ static std::atomic<char*> shutdown_user; static thread_local THD *THR_THD; +/** + Get current THD object from thread local data + + @retval The THD object for the thread, NULL if not connection thread +*/ + MYSQL_THD _current_thd() { return THR_THD; } +THD *thd_get_current_thd() { return THR_THD; } + void set_current_thd(THD *thd) { THR_THD= thd; } /* diff --git a/sql/sql_alloc.h b/sql/sql_alloc.h index f475ecdff73..42cd743c628 100644 --- a/sql/sql_alloc.h +++ b/sql/sql_alloc.h @@ -20,7 +20,7 @@ THD *thd_get_current_thd(); -/* mysql standard class memory allocator */ +/* MariaDB standard class memory allocator */ class Sql_alloc { @@ -42,9 +42,5 @@ public: static void operator delete[](void *, MEM_ROOT *) { /* never called */ } static void operator delete[](void *ptr, size_t size) { TRASH_FREE(ptr, size); } -#ifdef HAVE_valgrind - bool dummy_for_valgrind; - inline Sql_alloc() :dummy_for_valgrind(0) {} -#endif }; #endif /* SQL_ALLOC_INCLUDED */ diff --git a/sql/sql_class.cc b/sql/sql_class.cc index d8ceefb5238..8f2922487fa 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -327,16 +327,6 @@ bool Foreign_key::validate(List<Create_field> &table_fields) ****************************************************************************/ /** - Get current THD object from thread local data - - @retval The THD object for the thread, NULL if not connection thread -*/ -THD *thd_get_current_thd() -{ - return current_thd; -} - -/** Clear errors from the previous THD @param thd THD object |
