From f4b4aa9d1aff935621e6778e5fd0fb2d83d677eb Mon Sep 17 00:00:00 2001 From: xingyingone Date: Wed, 16 Aug 2023 17:12:58 +0800 Subject: [PATCH] [performance optimization] 1. The compiler optimization is obtained by introducing __restrict, which is inspired by clickhouse. 2. clickhouse uses this optimization to achieve a 1.6x performance improvement in the aggregate function scenario, and it is believed that mysql can also have certain performance benefits. And we can get detail information from https://github.com/ClickHouse/ClickHouse/pull/19946/commits/349d783089d55b9dd1bdeb8bff63fd07a0b0be42 --- include/my_alloc.h | 4 +- sql/auth/sql_auth_cache.cc | 2 +- sql/auth/sql_mfa.cc | 5 +- sql/create_field.h | 2 +- sql/dd/impl/sdi_api.cc | 3 +- sql/dd_sql_view.cc | 5 +- sql/event_data_objects.cc | 2 +- sql/field.cc | 7 +-- sql/field.h | 54 +++++++++---------- sql/histograms/equi_height.cc | 4 +- sql/histograms/singleton.cc | 4 +- sql/item_cmpfunc.cc | 7 +-- sql/item_cmpfunc.h | 19 ++++--- sql/iterators/timing_iterator.h | 5 +- sql/key_spec.h | 2 +- sql/lock.cc | 3 +- sql/parse_file.cc | 3 +- sql/parse_tree_helpers.h | 4 +- sql/parse_tree_nodes.cc | 20 +++---- .../group_index_skip_scan_plan.cc | 2 +- sql/range_optimizer/index_range_scan_plan.cc | 11 ++-- sql/range_optimizer/range_analysis.cc | 4 +- .../rowid_ordered_retrieval_plan.cc | 2 +- sql/range_optimizer/tree.cc | 2 +- sql/range_optimizer/tree.h | 6 +-- sql/sp.cc | 2 +- sql/sql_class.cc | 2 +- sql/sql_cursor.cc | 3 +- sql/sql_list.h | 6 +-- sql/sql_plugin.cc | 2 +- sql/table.cc | 9 ++-- sql/table_trigger_dispatcher.cc | 2 +- sql/thr_malloc.cc | 3 +- sql/trigger.cc | 2 +- sql/trigger_creation_ctx.cc | 3 +- sql/xa.cc | 2 +- storage/archive/ha_archive.cc | 2 +- storage/blackhole/ha_blackhole.cc | 4 +- storage/csv/ha_tina.cc | 2 +- storage/example/ha_example.cc | 2 +- storage/federated/ha_federated.cc | 2 +- storage/heap/ha_heap.cc | 2 +- storage/innobase/buf/buf0buf.cc | 2 +- storage/innobase/data/data0data.cc | 2 +- storage/innobase/fts/fts0fts.cc | 5 +- storage/innobase/handler/ha_innodb.cc | 3 +- storage/innobase/include/ut0mutex.h | 2 +- storage/innobase/include/ut0new.h | 7 +-- storage/innobase/os/os0file.cc | 4 +- storage/innobase/row/row0pread.cc | 2 +- storage/innobase/sync/sync0rw.cc | 2 +- storage/innobase/trx/trx0purge.cc | 3 +- storage/innobase/trx/trx0trx.cc | 4 +- storage/myisam/ha_myisam.cc | 2 +- storage/myisammrg/ha_myisammrg.cc | 3 +- storage/ndb/plugin/ha_ndbcluster.cc | 2 +- storage/ndb/plugin/ha_ndbinfo.cc | 2 +- storage/perfschema/ha_perfschema.cc | 2 +- storage/secondary_engine_mock/ha_mock.cc | 2 +- storage/temptable/src/plugin.cc | 2 +- unittest/gunit/get_diagnostics-t.cc | 14 ++--- unittest/gunit/graph_simplification-t.cc | 5 +- unittest/gunit/walk_access_paths-t.cc | 3 +- vio/vio.cc | 2 +- 64 files changed, 164 insertions(+), 143 deletions(-) diff --git a/include/my_alloc.h b/include/my_alloc.h index d087bfed55ce..17e8ac499e0c 100644 --- a/include/my_alloc.h +++ b/include/my_alloc.h @@ -488,8 +488,8 @@ template using unique_ptr_destroy_only = std::unique_ptr>; template -unique_ptr_destroy_only make_unique_destroy_only(MEM_ROOT *mem_root, - Args &&... args) { +unique_ptr_destroy_only make_unique_destroy_only( + MEM_ROOT* __restrict mem_root, Args &&...args) { return unique_ptr_destroy_only(new (mem_root) T(std::forward(args)...)); } diff --git a/sql/auth/sql_auth_cache.cc b/sql/auth/sql_auth_cache.cc index 0eefa6cfa58b..b392f0a6a485 100644 --- a/sql/auth/sql_auth_cache.cc +++ b/sql/auth/sql_auth_cache.cc @@ -486,7 +486,7 @@ void ACL_USER::set_host(MEM_ROOT *mem, const char *host_arg) { set_hostname(&host, host_arg, mem); } -void ACL_USER::set_mfa(MEM_ROOT *mem, I_multi_factor_auth *m) { +void ACL_USER::set_mfa(MEM_ROOT* __restrict mem, I_multi_factor_auth *m) { if (mem && m) { m_mfa = new (mem) Multi_factor_auth_list(mem); Multi_factor_auth_list *auth_list = m->get_multi_factor_auth_list(); diff --git a/sql/auth/sql_mfa.cc b/sql/auth/sql_mfa.cc index 048596ae0ed6..a566e9f0ded8 100644 --- a/sql/auth/sql_mfa.cc +++ b/sql/auth/sql_mfa.cc @@ -536,13 +536,14 @@ my_vector &Multi_factor_auth_list::get_mfa_list() { size_t Multi_factor_auth_list::get_mfa_list_size() { return m_factor.size(); } -Multi_factor_auth_info::Multi_factor_auth_info(MEM_ROOT *mem_root) +Multi_factor_auth_info::Multi_factor_auth_info(MEM_ROOT* __restrict mem_root) : m_mem_root(mem_root) { m_multi_factor_auth = new (m_mem_root) LEX_MFA; m_multi_factor_auth->reset(); } -Multi_factor_auth_info::Multi_factor_auth_info(MEM_ROOT *mem_root, LEX_MFA *m) +Multi_factor_auth_info::Multi_factor_auth_info(MEM_ROOT* __restrict mem_root, + LEX_MFA *m) : m_mem_root(mem_root) { m_multi_factor_auth = new (m_mem_root) LEX_MFA; m_multi_factor_auth->reset(); diff --git a/sql/create_field.h b/sql/create_field.h index 40fe264337f8..d5bfbebe7287 100644 --- a/sql/create_field.h +++ b/sql/create_field.h @@ -201,7 +201,7 @@ class Create_field { Create_field(Field *field, Field *orig_field); /* Used to make a clone of this object for ALTER/CREATE TABLE */ - Create_field *clone(MEM_ROOT *mem_root) const { + Create_field *clone(MEM_ROOT* __restrict mem_root) const { return new (mem_root) Create_field(*this); } bool is_gcol() const { return gcol_info; } diff --git a/sql/dd/impl/sdi_api.cc b/sql/dd/impl/sdi_api.cc index 2de4927c44bb..8183afdc4e2f 100644 --- a/sql/dd/impl/sdi_api.cc +++ b/sql/dd/impl/sdi_api.cc @@ -241,7 +241,8 @@ bool check_privileges(THD *thd, const Import_target &t) { return false; } -MDL_request *mdl_request(const Import_target &t, MEM_ROOT *mem_root) { +MDL_request *mdl_request(const Import_target &t, + MEM_ROOT* __restrict mem_root) { MDL_request *req = new (mem_root) MDL_request; MDL_REQUEST_INIT(req, MDL_key::TABLE, t.can_schema_name()->c_str(), t.can_table_name()->c_str(), MDL_EXCLUSIVE, MDL_TRANSACTION); diff --git a/sql/dd_sql_view.cc b/sql/dd_sql_view.cc index 20975df085c5..d1ed8b1d103e 100644 --- a/sql/dd_sql_view.cc +++ b/sql/dd_sql_view.cc @@ -236,7 +236,8 @@ Uncommitted_tables_guard::~Uncommitted_tables_guard() { template static bool prepare_view_tables_list(THD *thd, const char *db, const char *tbl_or_sf_name, - bool skip_same_db, MEM_ROOT *mem_root, + bool skip_same_db, + MEM_ROOT* __restrict mem_root, std::vector *views) { DBUG_TRACE; std::vector view_ids; @@ -362,7 +363,7 @@ static bool mark_all_views_invalid(THD *thd, const char *db, const char *tbl_or_sf_name, const std::vector *views_list, bool skip_same_db, bool commit_dd_changes, - MEM_ROOT *mem_root) { + MEM_ROOT* __restrict mem_root) { DBUG_TRACE; assert(!views_list->empty()); diff --git a/sql/event_data_objects.cc b/sql/event_data_objects.cc index 466123f119d1..1a01ff22772a 100644 --- a/sql/event_data_objects.cc +++ b/sql/event_data_objects.cc @@ -118,7 +118,7 @@ class Event_creation_ctx : public Stored_program_creation_ctx { Stored_program_creation_ctx **ctx); public: - Stored_program_creation_ctx *clone(MEM_ROOT *mem_root) override { + Stored_program_creation_ctx *clone(MEM_ROOT* __restrict mem_root) override { return new (mem_root) Event_creation_ctx(m_client_cs, m_connection_cl, m_db_cl); } diff --git a/sql/field.cc b/sql/field.cc index c0bc0a2c9b0d..058589b39b8a 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -7561,7 +7561,7 @@ void Field_json::sql_type(String &str) const { } /// Create a shallow clone of this field in the specified MEM_ROOT. -Field_json *Field_json::clone(MEM_ROOT *mem_root) const { +Field_json *Field_json::clone(MEM_ROOT* __restrict mem_root) const { assert(type() == MYSQL_TYPE_JSON); return new (mem_root) Field_json(*this); } @@ -9274,7 +9274,7 @@ size_t calc_pack_length(dd::enum_column_types type, size_t char_length, return pack_length; } -Field *make_field(MEM_ROOT *mem_root, TABLE_SHARE *share, uchar *ptr, +Field *make_field(MEM_ROOT* __restrict mem_root, TABLE_SHARE *share, uchar *ptr, size_t field_length, uchar *null_pos, uchar null_bit, enum_field_types field_type, const CHARSET_INFO *field_charset, @@ -9770,7 +9770,8 @@ uint32 Field_typed_array::key_length() const { 0); } -Field_typed_array *Field_typed_array::clone(MEM_ROOT *mem_root) const { +Field_typed_array *Field_typed_array::clone( + MEM_ROOT* __restrict mem_root) const { assert(is_array()); return new (mem_root) Field_typed_array(*this); } diff --git a/sql/field.h b/sql/field.h index 401076ab4fa7..5bec2e19ffb3 100644 --- a/sql/field.h +++ b/sql/field.h @@ -1901,7 +1901,7 @@ class Create_field_wrapper final : public Field { assert(false); return 0; } - Field *clone(MEM_ROOT *mem_root) const final { + Field *clone(MEM_ROOT* __restrict mem_root) const final { return new (mem_root) Create_field_wrapper(*this); } /* purecov: end */ @@ -2076,7 +2076,7 @@ class Field_decimal final : public Field_real { void overflow(bool negative); bool zero_pack() const final { return false; } void sql_type(String &str) const final; - Field_decimal *clone(MEM_ROOT *mem_root) const final { + Field_decimal *clone(MEM_ROOT* __restrict mem_root) const final { assert(type() == MYSQL_TYPE_DECIMAL); return new (mem_root) Field_decimal(*this); } @@ -2150,7 +2150,7 @@ class Field_new_decimal : public Field_num { bool compatible_field_size(uint field_metadata, Relay_log_info *, uint16, int *order_var) const final; uint is_equal(const Create_field *new_field) const final; - Field_new_decimal *clone(MEM_ROOT *mem_root) const final { + Field_new_decimal *clone(MEM_ROOT* __restrict mem_root) const final { assert(type() == MYSQL_TYPE_NEWDECIMAL); return new (mem_root) Field_new_decimal(*this); } @@ -2190,7 +2190,7 @@ class Field_tiny : public Field_num { uint32 pack_length() const final { return 1; } void sql_type(String &str) const override; uint32 max_display_length() const final { return 4; } - Field_tiny *clone(MEM_ROOT *mem_root) const override { + Field_tiny *clone(MEM_ROOT* __restrict mem_root) const override { assert(type() == MYSQL_TYPE_TINY); return new (mem_root) Field_tiny(*this); } @@ -2242,7 +2242,7 @@ class Field_short final : public Field_num { uint32 pack_length() const final { return 2; } void sql_type(String &str) const final; uint32 max_display_length() const final { return 6; } - Field_short *clone(MEM_ROOT *mem_root) const final { + Field_short *clone(MEM_ROOT* __restrict mem_root) const final { assert(type() == MYSQL_TYPE_SHORT); return new (mem_root) Field_short(*this); } @@ -2290,7 +2290,7 @@ class Field_medium final : public Field_num { uint32 pack_length() const final { return 3; } void sql_type(String &str) const final; uint32 max_display_length() const final { return 8; } - Field_medium *clone(MEM_ROOT *mem_root) const final { + Field_medium *clone(MEM_ROOT* __restrict mem_root) const final { assert(type() == MYSQL_TYPE_INT24); return new (mem_root) Field_medium(*this); } @@ -2333,7 +2333,7 @@ class Field_long : public Field_num { uint32 max_display_length() const final { return MY_INT32_NUM_DECIMAL_DIGITS; } - Field_long *clone(MEM_ROOT *mem_root) const final { + Field_long *clone(MEM_ROOT* __restrict mem_root) const final { assert(type() == MYSQL_TYPE_LONG); return new (mem_root) Field_long(*this); } @@ -2383,7 +2383,7 @@ class Field_longlong : public Field_num { void sql_type(String &str) const final; bool can_be_compared_as_longlong() const final { return true; } uint32 max_display_length() const final { return 20; } - Field_longlong *clone(MEM_ROOT *mem_root) const final { + Field_longlong *clone(MEM_ROOT* __restrict mem_root) const final { assert(type() == MYSQL_TYPE_LONGLONG); return new (mem_root) Field_longlong(*this); } @@ -2427,7 +2427,7 @@ class Field_float final : public Field_real { size_t make_sort_key(uchar *buff, size_t length) const final; uint32 pack_length() const final { return sizeof(float); } void sql_type(String &str) const final; - Field_float *clone(MEM_ROOT *mem_root) const final { + Field_float *clone(MEM_ROOT* __restrict mem_root) const final { assert(type() == MYSQL_TYPE_FLOAT); return new (mem_root) Field_float(*this); } @@ -2482,7 +2482,7 @@ class Field_double final : public Field_real { size_t make_sort_key(uchar *buff, size_t length) const final; uint32 pack_length() const final { return sizeof(double); } void sql_type(String &str) const final; - Field_double *clone(MEM_ROOT *mem_root) const final { + Field_double *clone(MEM_ROOT* __restrict mem_root) const final { assert(type() == MYSQL_TYPE_DOUBLE); return new (mem_root) Field_double(*this); } @@ -2530,7 +2530,7 @@ class Field_null final : public Field_str { uint32 pack_length() const final { return 0; } void sql_type(String &str) const final; uint32 max_display_length() const final { return 4; } - Field_null *clone(MEM_ROOT *mem_root) const final { + Field_null *clone(MEM_ROOT* __restrict mem_root) const final { assert(type() == MYSQL_TYPE_NULL); return new (mem_root) Field_null(*this); } @@ -2941,7 +2941,7 @@ class Field_timestamp : public Field_temporal_with_date_and_time { /* Get TIMESTAMP field value as seconds since begging of Unix Epoch */ bool get_timestamp(my_timeval *tm, int *warnings) const final; bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) const final; - Field_timestamp *clone(MEM_ROOT *mem_root) const final { + Field_timestamp *clone(MEM_ROOT* __restrict mem_root) const final { assert(type() == MYSQL_TYPE_TIMESTAMP); return new (mem_root) Field_timestamp(*this); } @@ -3002,7 +3002,7 @@ class Field_timestampf : public Field_temporal_with_date_and_timef { */ Field_timestampf(bool is_nullable_arg, const char *field_name_arg, uint8 dec_arg); - Field_timestampf *clone(MEM_ROOT *mem_root) const final { + Field_timestampf *clone(MEM_ROOT* __restrict mem_root) const final { assert(type() == MYSQL_TYPE_TIMESTAMP); return new (mem_root) Field_timestampf(*this); } @@ -3063,7 +3063,7 @@ class Field_year final : public Field_tiny { bool send_to_protocol(Protocol *protocol) const final; void sql_type(String &str) const final; bool can_be_compared_as_longlong() const final { return true; } - Field_year *clone(MEM_ROOT *mem_root) const final { + Field_year *clone(MEM_ROOT* __restrict mem_root) const final { assert(type() == MYSQL_TYPE_YEAR); return new (mem_root) Field_year(*this); } @@ -3102,7 +3102,7 @@ class Field_newdate : public Field_temporal_with_date { void sql_type(String &str) const final; bool zero_pack() const final { return true; } bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) const final; - Field_newdate *clone(MEM_ROOT *mem_root) const final { + Field_newdate *clone(MEM_ROOT* __restrict mem_root) const final { assert(type() == MYSQL_TYPE_DATE); assert(real_type() == MYSQL_TYPE_NEWDATE); return new (mem_root) Field_newdate(*this); @@ -3190,7 +3190,7 @@ class Field_time final : public Field_time_common { uint32 pack_length() const final { return 3; } void sql_type(String &str) const final; bool zero_pack() const final { return true; } - Field_time *clone(MEM_ROOT *mem_root) const final { + Field_time *clone(MEM_ROOT* __restrict mem_root) const final { assert(type() == MYSQL_TYPE_TIME); return new (mem_root) Field_time(*this); } @@ -3234,7 +3234,7 @@ class Field_timef final : public Field_time_common { : Field_time_common(nullptr, is_nullable_arg ? &dummy_null_buffer : nullptr, 0, NONE, field_name_arg, dec_arg) {} - Field_timef *clone(MEM_ROOT *mem_root) const final { + Field_timef *clone(MEM_ROOT* __restrict mem_root) const final { assert(type() == MYSQL_TYPE_TIME); return new (mem_root) Field_timef(*this); } @@ -3315,7 +3315,7 @@ class Field_datetime : public Field_temporal_with_date_and_time { void sql_type(String &str) const final; bool zero_pack() const final { return true; } bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) const final; - Field_datetime *clone(MEM_ROOT *mem_root) const final { + Field_datetime *clone(MEM_ROOT* __restrict mem_root) const final { assert(type() == MYSQL_TYPE_DATETIME); return new (mem_root) Field_datetime(*this); } @@ -3366,7 +3366,7 @@ class Field_datetimef : public Field_temporal_with_date_and_timef { : Field_temporal_with_date_and_timef( nullptr, is_nullable_arg ? &dummy_null_buffer : nullptr, 0, NONE, field_name_arg, dec_arg) {} - Field_datetimef *clone(MEM_ROOT *mem_root) const final { + Field_datetimef *clone(MEM_ROOT* __restrict mem_root) const final { assert(type() == MYSQL_TYPE_DATETIME); return new (mem_root) Field_datetimef(*this); } @@ -3450,7 +3450,7 @@ class Field_string : public Field_longstr { bool has_charset() const final { return charset() == &my_charset_bin ? false : true; } - Field_string *clone(MEM_ROOT *mem_root) const final { + Field_string *clone(MEM_ROOT* __restrict mem_root) const final { assert(real_type() == MYSQL_TYPE_STRING); return new (mem_root) Field_string(*this); } @@ -3512,7 +3512,7 @@ class Field_varstring : public Field_longstr { Field *new_field(MEM_ROOT *root, TABLE *new_table) const final; Field *new_key_field(MEM_ROOT *root, TABLE *new_table, uchar *new_ptr, uchar *new_null_ptr, uint new_null_bit) const final; - Field_varstring *clone(MEM_ROOT *mem_root) const final { + Field_varstring *clone(MEM_ROOT* __restrict mem_root) const final { assert(type() == MYSQL_TYPE_VARCHAR); assert(real_type() == MYSQL_TYPE_VARCHAR); return new (mem_root) Field_varstring(*this); @@ -3747,7 +3747,7 @@ class Field_blob : public Field_longstr { void set_key_image(const uchar *buff, size_t length) final; void sql_type(String &str) const override; bool copy(); - Field_blob *clone(MEM_ROOT *mem_root) const override { + Field_blob *clone(MEM_ROOT* __restrict mem_root) const override { assert(type() == MYSQL_TYPE_BLOB); return new (mem_root) Field_blob(*this); } @@ -3917,7 +3917,7 @@ class Field_geom final : public Field_blob { } geometry_type get_geometry_type() const final { return geom_type; } - Field_geom *clone(MEM_ROOT *mem_root) const final { + Field_geom *clone(MEM_ROOT* __restrict mem_root) const final { assert(type() == MYSQL_TYPE_GEOMETRY); return new (mem_root) Field_geom(*this); } @@ -4326,7 +4326,7 @@ class Field_enum : public Field_str { bool has_charset() const override { return true; } /* enum and set are sorted as integers */ const CHARSET_INFO *sort_charset() const final { return &my_charset_bin; } - Field_enum *clone(MEM_ROOT *mem_root) const override { + Field_enum *clone(MEM_ROOT* __restrict mem_root) const override { assert(real_type() == MYSQL_TYPE_ENUM); return new (mem_root) Field_enum(*this); } @@ -4371,7 +4371,7 @@ class Field_set final : public Field_enum { void sql_type(String &str) const final; enum_field_types real_type() const final { return MYSQL_TYPE_SET; } bool has_charset() const final { return true; } - Field_set *clone(MEM_ROOT *mem_root) const final { + Field_set *clone(MEM_ROOT* __restrict mem_root) const final { assert(real_type() == MYSQL_TYPE_SET); return new (mem_root) Field_set(*this); } @@ -4480,7 +4480,7 @@ class Field_bit : public Field { if (bit_ptr != nullptr) bit_ptr += ptr_diff; } void hash(ulong *nr, ulong *nr2) const final; - Field_bit *clone(MEM_ROOT *mem_root) const override { + Field_bit *clone(MEM_ROOT* __restrict mem_root) const override { assert(type() == MYSQL_TYPE_BIT); return new (mem_root) Field_bit(*this); } @@ -4512,7 +4512,7 @@ class Field_bit_as_char final : public Field_bit { // Inherit the store() overloads that have not been overridden. using Field_bit::store; void sql_type(String &str) const final; - Field_bit_as_char *clone(MEM_ROOT *mem_root) const final { + Field_bit_as_char *clone(MEM_ROOT* __restrict mem_root) const final { return new (mem_root) Field_bit_as_char(*this); } }; diff --git a/sql/histograms/equi_height.cc b/sql/histograms/equi_height.cc index e3987a671be6..6fb96d8bc7dc 100644 --- a/sql/histograms/equi_height.cc +++ b/sql/histograms/equi_height.cc @@ -61,7 +61,7 @@ Equi_height::Equi_height(MEM_ROOT *mem_root, const std::string &db_name, // Public factory method template -Equi_height *Equi_height::create(MEM_ROOT *mem_root, +Equi_height *Equi_height::create(MEM_ROOT* __restrict mem_root, const std::string &db_name, const std::string &tbl_name, const std::string &col_name, @@ -673,7 +673,7 @@ bool Equi_height::add_bucket_from_json(const Json_array *json_bucket, } template -Histogram *Equi_height::clone(MEM_ROOT *mem_root) const { +Histogram *Equi_height::clone(MEM_ROOT* __restrict mem_root) const { DBUG_EXECUTE_IF("fail_histogram_clone", return nullptr;); bool error = false; Histogram *equi_height = diff --git a/sql/histograms/singleton.cc b/sql/histograms/singleton.cc index 334416d0483d..173326003ba8 100644 --- a/sql/histograms/singleton.cc +++ b/sql/histograms/singleton.cc @@ -56,7 +56,7 @@ Singleton::Singleton(MEM_ROOT *mem_root, const std::string &db_name, // Public factory method template -Singleton *Singleton::create(MEM_ROOT *mem_root, +Singleton *Singleton::create(MEM_ROOT* __restrict mem_root, const std::string &db_name, const std::string &tbl_name, const std::string &col_name, @@ -394,7 +394,7 @@ bool Singleton::json_to_histogram(const Json_object &json_object, } template -Histogram *Singleton::clone(MEM_ROOT *mem_root) const { +Histogram *Singleton::clone(MEM_ROOT* __restrict mem_root) const { DBUG_EXECUTE_IF("fail_histogram_clone", return nullptr;); bool error = false; Histogram *singleton = new (mem_root) Singleton(mem_root, *this, &error); diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index f2e3fcc2491d..0b62487abb53 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -2692,7 +2692,8 @@ bool Item_func_interval::itemize(Parse_context *pc, Item **res) { return false; } -Item_row *Item_func_interval::alloc_row(const POS &pos, MEM_ROOT *mem_root, +Item_row *Item_func_interval::alloc_row(const POS &pos, + MEM_ROOT* __restrict mem_root, Item *expr1, Item *expr2, PT_item_list *opt_expr_list) { mem_root_deque *list = @@ -4580,7 +4581,7 @@ cmp_item_json::cmp_item_json(unique_ptr_destroy_only wrapper, cmp_item_json::~cmp_item_json() = default; /// Create a cmp_item_json object on a MEM_ROOT. -static cmp_item_json *make_cmp_item_json(MEM_ROOT *mem_root) { +static cmp_item_json *make_cmp_item_json(MEM_ROOT *__restrict mem_root) { auto wrapper = make_unique_destroy_only(mem_root); if (wrapper == nullptr) return nullptr; auto holder = make_unique_destroy_only(mem_root); @@ -7757,7 +7758,7 @@ bool Item_eq_base::append_join_key_for_hash_join( return is_null; } -Item *Item_eq_base::create_cast_if_needed(MEM_ROOT *mem_root, +Item *Item_eq_base::create_cast_if_needed(MEM_ROOT* __restrict mem_root, Item *argument) const { // We wrap the argument in a typecast node in two cases: // a) If the comparison is done in a DECIMAL context. diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 7d02355a68f1..2b75caaedf04 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -1648,7 +1648,8 @@ class in_string final : public in_vector { public: in_string(MEM_ROOT *mem_root, uint elements, const CHARSET_INFO *cs); - Item_basic_constant *create_item(MEM_ROOT *mem_root) const override { + Item_basic_constant *create_item( + MEM_ROOT* __restrict mem_root) const override { return new (mem_root) Item_string(collation); } void value_to_item(uint pos, Item_basic_constant *item) const override { @@ -1676,7 +1677,8 @@ class in_longlong : public in_vector { public: in_longlong(MEM_ROOT *mem_root, uint elements) : in_vector(elements), base(mem_root, elements) {} - Item_basic_constant *create_item(MEM_ROOT *mem_root) const override { + Item_basic_constant *create_item( + MEM_ROOT* __restrict mem_root) const override { /* We've created a signed INT, this may not be correct in the general case (see BUG#19342). @@ -1698,7 +1700,7 @@ class in_longlong : public in_vector { class in_datetime_as_longlong final : public in_longlong { public: - in_datetime_as_longlong(MEM_ROOT *mem_root, uint elements) + in_datetime_as_longlong(MEM_ROOT* __restrict mem_root, uint elements) : in_longlong(mem_root, elements) {} Item_basic_constant *create_item(MEM_ROOT *mem_root) const override { return new (mem_root) Item_temporal(MYSQL_TYPE_DATETIME, 0LL); @@ -1710,7 +1712,7 @@ class in_datetime_as_longlong final : public in_longlong { class in_time_as_longlong final : public in_longlong { public: - in_time_as_longlong(MEM_ROOT *mem_root, uint elements) + in_time_as_longlong(MEM_ROOT* __restrict mem_root, uint elements) : in_longlong(mem_root, elements) {} Item_basic_constant *create_item(MEM_ROOT *mem_root) const override { return new (mem_root) Item_temporal(MYSQL_TYPE_TIME, 0LL); @@ -1731,7 +1733,8 @@ class in_datetime final : public in_longlong { public: in_datetime(MEM_ROOT *mem_root, Item *warn_item_arg, uint elements) : in_longlong(mem_root, elements), warn_item(warn_item_arg) {} - Item_basic_constant *create_item(MEM_ROOT *mem_root) const override { + Item_basic_constant *create_item( + MEM_ROOT* __restrict mem_root) const override { return new (mem_root) Item_temporal(MYSQL_TYPE_DATETIME, 0LL); } @@ -1746,7 +1749,8 @@ class in_double final : public in_vector { public: in_double(MEM_ROOT *mem_root, uint elements) : in_vector(elements), base(mem_root, elements) {} - Item_basic_constant *create_item(MEM_ROOT *mem_root) const override { + Item_basic_constant *create_item( + MEM_ROOT* __restrict mem_root) const override { return new (mem_root) Item_float(0.0, 0); } void value_to_item(uint pos, Item_basic_constant *item) const override { @@ -1766,7 +1770,8 @@ class in_decimal final : public in_vector { public: in_decimal(MEM_ROOT *mem_root, uint elements) : in_vector(elements), base(mem_root, elements) {} - Item_basic_constant *create_item(MEM_ROOT *mem_root) const override { + Item_basic_constant *create_item( + MEM_ROOT* __restrict mem_root) const override { return new (mem_root) Item_decimal(0, false); } void value_to_item(uint pos, Item_basic_constant *item) const override { diff --git a/sql/iterators/timing_iterator.h b/sql/iterators/timing_iterator.h index 7d0837f70c84..798005b63f70 100644 --- a/sql/iterators/timing_iterator.h +++ b/sql/iterators/timing_iterator.h @@ -218,8 +218,9 @@ class TimingIterator final : public RowIterator { // instantiations of iterators should go through this function. template -unique_ptr_destroy_only NewIterator(THD *thd, MEM_ROOT *mem_root, - Args &&... args) { +unique_ptr_destroy_only NewIterator(THD *thd, + MEM_ROOT* __restrict mem_root, + Args &&...args) { if (thd->lex->is_explain_analyze) { return unique_ptr_destroy_only( new (mem_root) diff --git a/sql/key_spec.h b/sql/key_spec.h index a398a454b770..2bf027b3b7b7 100644 --- a/sql/key_spec.h +++ b/sql/key_spec.h @@ -122,7 +122,7 @@ class Key_part_spec { @return If out of memory, 0 is returned and an error is set in THD. */ - Key_part_spec *clone(MEM_ROOT *mem_root) const { + Key_part_spec *clone(MEM_ROOT* __restrict mem_root) const { return new (mem_root) Key_part_spec(*this); } diff --git a/sql/lock.cc b/sql/lock.cc index 21a04d1a6366..7a5e51b0baf3 100644 --- a/sql/lock.cc +++ b/sql/lock.cc @@ -792,7 +792,8 @@ bool lock_schema_name(THD *thd, const char *db) { @return false - On Success. */ bool lock_tablespace_names(THD *thd, Tablespace_hash_set *tablespace_set, - ulong lock_wait_timeout, MEM_ROOT *mem_root) { + ulong lock_wait_timeout, + MEM_ROOT* __restrict mem_root) { // Stop if we have nothing to lock if (tablespace_set->empty()) return false; diff --git a/sql/parse_file.cc b/sql/parse_file.cc index b28e64386139..0269a6a8dd21 100644 --- a/sql/parse_file.cc +++ b/sql/parse_file.cc @@ -58,7 +58,8 @@ File_parser_dummy_hook file_parser_dummy_hook; parser object */ -File_parser *sql_parse_prepare(const LEX_STRING *file_name, MEM_ROOT *mem_root, +File_parser *sql_parse_prepare(const LEX_STRING *file_name, + MEM_ROOT* __restrict mem_root, bool bad_format_errors) { MY_STAT stat_info; size_t len; diff --git a/sql/parse_tree_helpers.h b/sql/parse_tree_helpers.h index 2cd848418036..f3229475d995 100644 --- a/sql/parse_tree_helpers.h +++ b/sql/parse_tree_helpers.h @@ -205,8 +205,8 @@ To *item_cond_cast(Item *const from) { @return resulting parse tree Item */ template -Item *flatten_associative_operator(MEM_ROOT *mem_root, const POS &pos, - Item *left, Item *right) { +Item *flatten_associative_operator(MEM_ROOT* __restrict mem_root, + const POS &pos, Item *left, Item *right) { if (left == nullptr || right == nullptr) return nullptr; Class *left_func = item_cond_cast(left); Class *right_func = item_cond_cast(right); diff --git a/sql/parse_tree_nodes.cc b/sql/parse_tree_nodes.cc index f1504a6333d7..6a8660c1800f 100644 --- a/sql/parse_tree_nodes.cc +++ b/sql/parse_tree_nodes.cc @@ -4632,7 +4632,7 @@ class PT_attribute : public BASE { @return PT_alter_tablespace_option_base* to PT_attribute object. */ PT_alter_tablespace_option_base *make_tablespace_engine_attribute( - MEM_ROOT *mem_root, LEX_CSTRING attr) { + MEM_ROOT* __restrict mem_root, LEX_CSTRING attr) { return new (mem_root) PT_attribute( attr, +[](LEX_CSTRING a, Alter_tablespace_parse_context *pc) { @@ -4652,8 +4652,8 @@ PT_alter_tablespace_option_base *make_tablespace_engine_attribute( @return PT_alter_tablespace_option_base* to PT_attribute object. */ -PT_create_table_option *make_table_engine_attribute(MEM_ROOT *mem_root, - LEX_CSTRING attr) { +PT_create_table_option *make_table_engine_attribute( + MEM_ROOT* __restrict mem_root, LEX_CSTRING attr) { return new (mem_root) PT_attribute( attr, +[](LEX_CSTRING a, Table_ddl_parse_context *pc) { pc->create_info->engine_attribute = a; @@ -4676,7 +4676,7 @@ PT_create_table_option *make_table_engine_attribute(MEM_ROOT *mem_root, */ PT_create_table_option *make_table_secondary_engine_attribute( - MEM_ROOT *mem_root, LEX_CSTRING attr) { + MEM_ROOT* __restrict mem_root, LEX_CSTRING attr) { return new (mem_root) PT_attribute( attr, +[](LEX_CSTRING a, Table_ddl_parse_context *pc) { pc->create_info->secondary_engine_attribute = a; @@ -4698,7 +4698,7 @@ PT_create_table_option *make_table_secondary_engine_attribute( @return PT_create_table_option* to PT_attribute object. */ -PT_column_attr_base *make_column_engine_attribute(MEM_ROOT *mem_root, +PT_column_attr_base *make_column_engine_attribute(MEM_ROOT* __restrict mem_root, LEX_CSTRING attr) { return new (mem_root) PT_attribute( attr, +[](LEX_CSTRING a, Column_parse_context *pc) { @@ -4728,8 +4728,8 @@ PT_column_attr_base *make_column_engine_attribute(MEM_ROOT *mem_root, @return PT_column_attr_base* to PT_attribute object. */ -PT_column_attr_base *make_column_secondary_engine_attribute(MEM_ROOT *mem_root, - LEX_CSTRING attr) { +PT_column_attr_base *make_column_secondary_engine_attribute( + MEM_ROOT* __restrict mem_root, LEX_CSTRING attr) { return new (mem_root) PT_attribute( attr, +[](LEX_CSTRING a, Column_parse_context *pc) { // Note that a std::function is created from the lambda and constructed @@ -4757,7 +4757,7 @@ PT_column_attr_base *make_column_secondary_engine_attribute(MEM_ROOT *mem_root, @return PT_base_index_option* to PT_attribute object. */ -PT_base_index_option *make_index_engine_attribute(MEM_ROOT *mem_root, +PT_base_index_option *make_index_engine_attribute(MEM_ROOT* __restrict mem_root, LEX_CSTRING attr) { return new (mem_root) PT_attribute( attr, +[](LEX_CSTRING a, Table_ddl_parse_context *pc) { @@ -4777,8 +4777,8 @@ PT_base_index_option *make_index_engine_attribute(MEM_ROOT *mem_root, @return PT_base_index_option* to PT_attribute object. */ -PT_base_index_option *make_index_secondary_engine_attribute(MEM_ROOT *mem_root, - LEX_CSTRING attr) { +PT_base_index_option *make_index_secondary_engine_attribute( + MEM_ROOT* __restrict mem_root, LEX_CSTRING attr) { return new (mem_root) PT_attribute( attr, +[](LEX_CSTRING a, Table_ddl_parse_context *pc) { pc->key_create_info->m_secondary_engine_attribute = a; diff --git a/sql/range_optimizer/group_index_skip_scan_plan.cc b/sql/range_optimizer/group_index_skip_scan_plan.cc index c4b4d5943437..8ed1a730262b 100644 --- a/sql/range_optimizer/group_index_skip_scan_plan.cc +++ b/sql/range_optimizer/group_index_skip_scan_plan.cc @@ -1651,7 +1651,7 @@ static void cost_group_min_max(TABLE *table, uint key, uint used_key_parts, (ulong)*records, num_blocks)); } -static bool add_range(MEM_ROOT *return_mem_root, SEL_ARG *sel_range, +static bool add_range(MEM_ROOT* __restrict return_mem_root, SEL_ARG *sel_range, uint key_length, Quick_ranges *range_array) { uint range_flag = sel_range->min_flag | sel_range->max_flag; diff --git a/sql/range_optimizer/index_range_scan_plan.cc b/sql/range_optimizer/index_range_scan_plan.cc index 697a51d664f3..4056f9393c16 100644 --- a/sql/range_optimizer/index_range_scan_plan.cc +++ b/sql/range_optimizer/index_range_scan_plan.cc @@ -1057,11 +1057,12 @@ static inline std::basic_string_view make_string_view(const uchar *start, */ static bool get_ranges_from_tree_given_base( - THD *thd, MEM_ROOT *return_mem_root, const KEY *table_key, KEY_PART *key, - SEL_ROOT *key_tree, uchar *const base_min_key, uchar *min_key, - uint min_key_flag, uchar *const base_max_key, uchar *max_key, - uint max_key_flag, bool first_keypart_is_asc, uint num_key_parts, - uint *used_key_parts, uint *num_exact_key_parts, Quick_ranges *ranges) { + THD *thd, MEM_ROOT* __restrict return_mem_root, const KEY *table_key, + KEY_PART *key, SEL_ROOT *key_tree, uchar *const base_min_key, + uchar *min_key, uint min_key_flag, uchar *const base_max_key, + uchar *max_key, uint max_key_flag, bool first_keypart_is_asc, + uint num_key_parts, uint *used_key_parts, uint *num_exact_key_parts, + Quick_ranges *ranges) { const uint part = key_tree->root->part; const bool asc = key_tree->root->is_ascending; diff --git a/sql/range_optimizer/range_analysis.cc b/sql/range_optimizer/range_analysis.cc index a7a61c75d35d..10d1c2011660 100644 --- a/sql/range_optimizer/range_analysis.cc +++ b/sql/range_optimizer/range_analysis.cc @@ -1161,8 +1161,8 @@ static SEL_TREE *get_mm_parts(THD *thd, RANGE_OPT_PARAM *param, */ static bool save_value_and_handle_conversion( SEL_ROOT **tree, Item *value, const Item_func::Functype comp_op, - Field *field, const char **impossible_cond_cause, MEM_ROOT *memroot, - Query_block *query_block, bool *inexact) { + Field *field, const char **impossible_cond_cause, + MEM_ROOT* __restrict memroot, Query_block *query_block, bool *inexact) { // A SEL_ARG should not have been created for this predicate yet. assert(*tree == nullptr); diff --git a/sql/range_optimizer/rowid_ordered_retrieval_plan.cc b/sql/range_optimizer/rowid_ordered_retrieval_plan.cc index 21d6a1389660..03262e230499 100644 --- a/sql/range_optimizer/rowid_ordered_retrieval_plan.cc +++ b/sql/range_optimizer/rowid_ordered_retrieval_plan.cc @@ -673,7 +673,7 @@ static bool ror_intersect_add(ROR_INTERSECT_INFO *info, static AccessPath *MakeAccessPath(ROR_SCAN_INFO *scan, TABLE *table, KEY_PART *used_key_part, bool reuse_handler, - MEM_ROOT *mem_root) { + MEM_ROOT* __restrict mem_root) { AccessPath *path = new (mem_root) AccessPath; path->type = AccessPath::INDEX_RANGE_SCAN; diff --git a/sql/range_optimizer/tree.cc b/sql/range_optimizer/tree.cc index 1c90535572cc..f0bf2ea08857 100644 --- a/sql/range_optimizer/tree.cc +++ b/sql/range_optimizer/tree.cc @@ -462,7 +462,7 @@ SEL_ROOT::SEL_ROOT(SEL_ARG *root_arg) root(root_arg), elements(count_elements(root_arg)) {} -SEL_ROOT::SEL_ROOT(MEM_ROOT *mem_root, Type type_arg) +SEL_ROOT::SEL_ROOT(MEM_ROOT* __restrict mem_root, Type type_arg) : type(type_arg), root(new (mem_root) SEL_ARG()), elements(1) { assert(type_arg == Type::MAYBE_KEY || type_arg == Type::IMPOSSIBLE); root->make_root(); diff --git a/sql/range_optimizer/tree.h b/sql/range_optimizer/tree.h index ab389fce37e9..436b9e58274b 100644 --- a/sql/range_optimizer/tree.h +++ b/sql/range_optimizer/tree.h @@ -593,7 +593,7 @@ class SEL_ARG { return sel_cmp(field, max_value, arg->min_value, max_flag, arg->min_flag); } SEL_ARG *clone_and(SEL_ARG *arg, - MEM_ROOT *mem_root) { // Get intersection of ranges. + MEM_ROOT* __restrict mem_root) { // Get intersection of ranges. uchar *new_min, *new_max; uint8 flag_min, flag_max; if (cmp_min_to_min(arg) >= 0) { @@ -616,14 +616,14 @@ class SEL_ARG { min_flag & GEOM_FLAG ? rkey_func_flag : HA_READ_INVALID); } SEL_ARG *clone_first(SEL_ARG *arg, - MEM_ROOT *mem_root) { // arg->min <= X < arg->min + MEM_ROOT* __restrict mem_root) { // arg->min <= X < arg->min return new (mem_root) SEL_ARG( field, part, min_value, arg->min_value, min_flag, arg->min_flag & NEAR_MIN ? 0 : NEAR_MAX, maybe_flag || arg->maybe_flag, is_ascending, min_flag & GEOM_FLAG ? rkey_func_flag : HA_READ_INVALID); } SEL_ARG *clone_last(SEL_ARG *arg, - MEM_ROOT *mem_root) { // arg->min <= X <= key_max + MEM_ROOT* __restrict mem_root) { // arg->min <= X <= key_max return new (mem_root) SEL_ARG(field, part, min_value, arg->max_value, min_flag, arg->max_flag, maybe_flag || arg->maybe_flag, is_ascending, diff --git a/sql/sp.cc b/sql/sp.cc index c00749e163a2..049aa2ff45b4 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -239,7 +239,7 @@ Stored_routine_creation_ctx *Stored_routine_creation_ctx::load_from_db( } Stored_program_creation_ctx *Stored_routine_creation_ctx::clone( - MEM_ROOT *mem_root) { + MEM_ROOT* __restrict mem_root) { return new (mem_root) Stored_routine_creation_ctx(m_client_cs, m_connection_cl, m_db_cl); } diff --git a/sql/sql_class.cc b/sql/sql_class.cc index c623145df751..5ce90c28e9cb 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -1973,7 +1973,7 @@ void THD::nocheck_register_item_tree_change(Item **place, Item *new_value) { A list of item tree changes of an average query should be short. */ - void *change_mem = mem_root->Alloc(sizeof(*change)); + void* __restrict change_mem = mem_root->Alloc(sizeof(*change)); if (change_mem == nullptr) { /* OOM, thd->fatal_error() is called by the error handler of the diff --git a/sql/sql_cursor.cc b/sql/sql_cursor.cc index 9edd23de9077..73a48beb8c5a 100644 --- a/sql/sql_cursor.cc +++ b/sql/sql_cursor.cc @@ -135,7 +135,8 @@ class Query_result_materialize final : public Query_result_union { Query_result *m_result; }; -Query_result *new_cursor_result(MEM_ROOT *mem_root, Query_result *result) { +Query_result *new_cursor_result(MEM_ROOT* __restrict mem_root, + Query_result *result) { return new (mem_root) Query_result_materialize(result); } diff --git a/sql/sql_list.h b/sql/sql_list.h index eff03ec73ab8..737b03818f44 100644 --- a/sql/sql_list.h +++ b/sql/sql_list.h @@ -177,7 +177,7 @@ class base_list { } return true; } - inline bool push_back(void *info, MEM_ROOT *mem_root) { + inline bool push_back(void *info, MEM_ROOT* __restrict mem_root) { *last = new (mem_root) list_node(info, &end_of_list); if (*last) { last = &(*last)->next; @@ -196,7 +196,7 @@ class base_list { } return true; } - inline bool push_front(void *info, MEM_ROOT *mem_root) { + inline bool push_front(void *info, MEM_ROOT* __restrict mem_root) { list_node *node = new (mem_root) list_node(info, first); if (node) { if (last == &first) last = &node->next; @@ -323,7 +323,7 @@ class base_list { elements++; if (last == &(node->next)) last = &new_node->next; } - bool after(void *info, list_node *node, MEM_ROOT *mem_root) { + bool after(void *info, list_node *node, MEM_ROOT* __restrict mem_root) { list_node *new_node = new (mem_root) list_node(info, node->next); if (!new_node) return true; // OOM diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 4f9e0a71c96c..4680266fb2eb 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -3517,7 +3517,7 @@ static int test_plugin_options( but tmp->root is not always properly freed, so it will cause leaks in Valgrind (e.g. the main.validate_password_plugin test). */ - MEM_ROOT *mem_root = &plugin_mem_root; + MEM_ROOT *__restrict mem_root = &plugin_mem_root; SYS_VAR **opt; my_option *opts = nullptr; LEX_CSTRING plugin_name; diff --git a/sql/table.cc b/sql/table.cc index ba426244d213..5779c052f14d 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -456,9 +456,10 @@ TABLE_SHARE *alloc_table_share(const char *db, const char *table_name, use key_length= 0 as neither table_cache_key or key_length will be used). */ -void init_tmp_table_share(THD *thd, TABLE_SHARE *share, const char *key, - size_t key_length, const char *table_name, - const char *path, MEM_ROOT *mem_root) { +void init_tmp_table_share(THD *thd, TABLE_SHARE* __restrict share, + const char *key, size_t key_length, + const char *table_name, const char *path, + MEM_ROOT *mem_root) { DBUG_TRACE; DBUG_PRINT("enter", ("table: '%s'.'%s'", key, table_name)); @@ -2865,7 +2866,7 @@ bool create_key_part_field_with_prefix_length(TABLE *table, MEM_ROOT *root) { int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias, uint db_stat, uint prgflag, uint ha_open_flags, - TABLE *outparam, bool is_create_table, + TABLE* __restrict outparam, bool is_create_table, const dd::Table *table_def_param) { int error; uint records, i, bitmap_size; diff --git a/sql/table_trigger_dispatcher.cc b/sql/table_trigger_dispatcher.cc index 70717c09e1b1..fe4f042fc70f 100644 --- a/sql/table_trigger_dispatcher.cc +++ b/sql/table_trigger_dispatcher.cc @@ -388,7 +388,7 @@ bool Table_trigger_dispatcher::check_n_load(THD *thd, const dd::Table &table) { */ Trigger_chain *Table_trigger_dispatcher::create_trigger_chain( - MEM_ROOT *mem_root, enum_trigger_event_type event, + MEM_ROOT* __restrict mem_root, enum_trigger_event_type event, enum_trigger_action_time_type action_time) { assert(event != TRG_EVENT_MAX); assert(action_time != TRG_ACTION_MAX); diff --git a/sql/thr_malloc.cc b/sql/thr_malloc.cc index ab262da7d3d8..938bec7f55a2 100644 --- a/sql/thr_malloc.cc +++ b/sql/thr_malloc.cc @@ -42,7 +42,8 @@ using std::min; extern "C" void sql_alloc_error_handler(void); -void init_sql_alloc(PSI_memory_key key, MEM_ROOT *mem_root, size_t block_size) { +void init_sql_alloc(PSI_memory_key key, MEM_ROOT* __restrict mem_root, + size_t block_size) { ::new ((void *)mem_root) MEM_ROOT(key, block_size); mem_root->set_error_handler(sql_alloc_error_handler); } diff --git a/sql/trigger.cc b/sql/trigger.cc index 7075fe990a13..78c409594cfc 100644 --- a/sql/trigger.cc +++ b/sql/trigger.cc @@ -301,7 +301,7 @@ Trigger *Trigger::create_from_parser(THD *thd, TABLE *subject_table, */ Trigger *Trigger::create_from_dd( - MEM_ROOT *mem_root, const LEX_CSTRING &trigger_name, + MEM_ROOT* __restrict mem_root, const LEX_CSTRING &trigger_name, const LEX_CSTRING &db_name, const LEX_CSTRING &subject_table_name, const LEX_CSTRING &definition, const LEX_CSTRING &definition_utf8, sql_mode_t sql_mode, const LEX_CSTRING &definer_user, diff --git a/sql/trigger_creation_ctx.cc b/sql/trigger_creation_ctx.cc index 28a8e76089dd..d708b8fa19ef 100644 --- a/sql/trigger_creation_ctx.cc +++ b/sql/trigger_creation_ctx.cc @@ -100,7 +100,8 @@ Trigger_creation_ctx *Trigger_creation_ctx::create( Trigger_creation_ctx(client_cs, connection_cl, db_cl); } -Stored_program_creation_ctx *Trigger_creation_ctx::clone(MEM_ROOT *mem_root) { +Stored_program_creation_ctx *Trigger_creation_ctx::clone( + MEM_ROOT* __restrict mem_root) { return new (mem_root) Trigger_creation_ctx(m_client_cs, m_connection_cl, m_db_cl); } diff --git a/sql/xa.cc b/sql/xa.cc index bd625dd0b0d3..9b49a994ee6b 100644 --- a/sql/xa.cc +++ b/sql/xa.cc @@ -207,7 +207,7 @@ MEM_ROOT *Recovered_xa_transactions::get_allocated_memroot() { } static bool xarecover_create_mdl_backup(XA_recover_txn &txn, - MEM_ROOT *mem_root) { + MEM_ROOT* __restrict mem_root) { MDL_request_list mdl_requests; List_iterator table_list_it(*txn.mod_tables); st_handler_tablename *tbl_name; diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc index 7ee635774d24..b1aad4c72d93 100644 --- a/storage/archive/ha_archive.cc +++ b/storage/archive/ha_archive.cc @@ -156,7 +156,7 @@ static handler *archive_create_handler(handlerton *hton, TABLE_SHARE *table, #define ARCHIVE_ROW_HEADER_SIZE 4 static handler *archive_create_handler(handlerton *hton, TABLE_SHARE *table, - bool, MEM_ROOT *mem_root) { + bool, MEM_ROOT* __restrict mem_root) { return new (mem_root) ha_archive(hton, table); } diff --git a/storage/blackhole/ha_blackhole.cc b/storage/blackhole/ha_blackhole.cc index af9ae1cd75a2..edbdaf274564 100644 --- a/storage/blackhole/ha_blackhole.cc +++ b/storage/blackhole/ha_blackhole.cc @@ -49,7 +49,7 @@ static bool is_slave_applier(THD *thd) { /* Static declarations for handlerton */ static handler *blackhole_create_handler(handlerton *hton, TABLE_SHARE *table, - bool, MEM_ROOT *mem_root) { + bool, MEM_ROOT* __restrict mem_root) { return new (mem_root) ha_blackhole(hton, table); } @@ -254,7 +254,7 @@ int ha_blackhole::index_last(uchar *) { } FT_INFO *ha_blackhole::ft_init_ext(uint, uint, String *) { - MEM_ROOT *mem_root = ha_thd()->mem_root; + MEM_ROOT* __restrict mem_root = ha_thd()->mem_root; _ft_vft *vft = new (mem_root) _ft_vft{ /*read_next=*/nullptr, diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc index 8354eb643717..5eda17788122 100644 --- a/storage/csv/ha_tina.cc +++ b/storage/csv/ha_tina.cc @@ -469,7 +469,7 @@ static my_off_t find_eoln_buff(Transparent_file *data_buff, my_off_t begin, } static handler *tina_create_handler(handlerton *hton, TABLE_SHARE *table, bool, - MEM_ROOT *mem_root) { + MEM_ROOT* __restrict mem_root) { return new (mem_root) ha_tina(hton, table); } diff --git a/storage/example/ha_example.cc b/storage/example/ha_example.cc index f082903d1364..5da6a8f2baf6 100644 --- a/storage/example/ha_example.cc +++ b/storage/example/ha_example.cc @@ -150,7 +150,7 @@ Example_share *ha_example::get_share() { } static handler *example_create_handler(handlerton *hton, TABLE_SHARE *table, - bool, MEM_ROOT *mem_root) { + bool, MEM_ROOT* __restrict mem_root) { return new (mem_root) ha_example(hton, table); } diff --git a/storage/federated/ha_federated.cc b/storage/federated/ha_federated.cc index 5639efe8ec94..01405f6be54d 100644 --- a/storage/federated/ha_federated.cc +++ b/storage/federated/ha_federated.cc @@ -436,7 +436,7 @@ static int federated_rollback(handlerton *hton, THD *thd, bool all); /* Federated storage engine handlerton */ static handler *federated_create_handler(handlerton *hton, TABLE_SHARE *table, - bool, MEM_ROOT *mem_root) { + bool, MEM_ROOT* __restrict mem_root) { return new (mem_root) ha_federated(hton, table); } diff --git a/storage/heap/ha_heap.cc b/storage/heap/ha_heap.cc index b04daca13f20..28001bfc04af 100644 --- a/storage/heap/ha_heap.cc +++ b/storage/heap/ha_heap.cc @@ -67,7 +67,7 @@ static int heap_init(void *p) { } static handler *heap_create_handler(handlerton *hton, TABLE_SHARE *table, bool, - MEM_ROOT *mem_root) { + MEM_ROOT* __restrict mem_root) { return new (mem_root) ha_heap(hton, table); } diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 2e86ae437cff..f3cf97667d49 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -2725,7 +2725,7 @@ The caller must take care of relocating bpage->list. @param[in,out] bpage control block being relocated, buf_page_get_state() must be BUF_BLOCK_ZIP_DIRTY or BUF_BLOCK_ZIP_PAGE @param[in,out] dpage destination control block */ -static void buf_relocate(buf_page_t *bpage, buf_page_t *dpage) { +static void buf_relocate(buf_page_t *bpage, buf_page_t* __restrict dpage) { buf_page_t *b; buf_pool_t *buf_pool = buf_pool_from_bpage(bpage); diff --git a/storage/innobase/data/data0data.cc b/storage/innobase/data/data0data.cc index 4e5e132648b9..be10d981eb50 100644 --- a/storage/innobase/data/data0data.cc +++ b/storage/innobase/data/data0data.cc @@ -645,7 +645,7 @@ void dtuple_convert_back_big_rec(dtuple_t *entry, big_rec_t *vector) { } big_rec_t *big_rec_t::alloc(mem_heap_t *heap, ulint n_fld) { - big_rec_t *rec = + big_rec_t* __restrict rec = static_cast(mem_heap_alloc(heap, sizeof(big_rec_t))); new (rec) big_rec_t(n_fld); diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc index 2e36facb6ce0..1a462c1c9b8c 100644 --- a/storage/innobase/fts/fts0fts.cc +++ b/storage/innobase/fts/fts0fts.cc @@ -5427,12 +5427,13 @@ fts_t::~fts_t() { @return instance of fts_t */ fts_t *fts_create(dict_table_t *table) /*!< in/out: table with FTS indexes */ { - fts_t *fts; + mem_heap_t *heap; heap = mem_heap_create(512, UT_LOCATION_HERE); - fts = static_cast(mem_heap_alloc(heap, sizeof(*fts))); + fts_t *__restrict fts = + static_cast(mem_heap_alloc(heap, sizeof(*fts))); new (fts) fts_t(table, heap); diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index c759693471d0..5d2b3ca576b7 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -1757,7 +1757,8 @@ static int innobase_commit_concurrency_validate( @param[in] partitioned Indicates whether table is partitioned @param[in] mem_root memory context */ static handler *innobase_create_handler(handlerton *hton, TABLE_SHARE *table, - bool partitioned, MEM_ROOT *mem_root) { + bool partitioned, + MEM_ROOT* __restrict mem_root) { if (partitioned) { ha_innopart *file = new (mem_root) ha_innopart(hton, table); if (file && file->init_partitioning(mem_root)) { diff --git a/storage/innobase/include/ut0mutex.h b/storage/innobase/include/ut0mutex.h index fc93ccd658b5..6c0a2b9ff2bb 100644 --- a/storage/innobase/include/ut0mutex.h +++ b/storage/innobase/include/ut0mutex.h @@ -232,7 +232,7 @@ Add the mutex instance to the global mutex list. @param[in] file_name Filename from where it was called @param[in] line Line number in filename from where called */ template -void mutex_init(Mutex *mutex, latch_id_t id, const char *file_name, +void mutex_init(Mutex* __restrict mutex, latch_id_t id, const char *file_name, uint32_t line) { new (mutex) Mutex(); diff --git a/storage/innobase/include/ut0new.h b/storage/innobase/include/ut0new.h index c59e42525e53..6c3725e1da91 100644 --- a/storage/innobase/include/ut0new.h +++ b/storage/innobase/include/ut0new.h @@ -748,7 +748,7 @@ inline void free(void *ptr) noexcept { */ template inline T *new_withkey(PSI_memory_key_t key, Args &&... args) { - auto mem = ut::malloc_withkey(key, sizeof(T)); + auto __restrict mem = ut::malloc_withkey(key, sizeof(T)); if (unlikely(!mem)) throw std::bad_alloc(); try { new (mem) T(std::forward(args)...); @@ -1592,7 +1592,7 @@ inline void aligned_free(void *ptr) noexcept { template inline T *aligned_new_withkey(PSI_memory_key_t key, std::size_t alignment, Args &&... args) { - auto mem = aligned_alloc_withkey(key, sizeof(T), alignment); + auto __restrict mem = aligned_alloc_withkey(key, sizeof(T), alignment); if (unlikely(!mem)) throw std::bad_alloc(); try { new (mem) T(std::forward(args)...); @@ -1777,7 +1777,8 @@ inline T *aligned_new_arr_withkey(PSI_memory_key_t key, std::size_t alignment, template inline T *aligned_new_arr_withkey(PSI_memory_key_t key, std::size_t alignment, Count count) { - auto mem = aligned_alloc_withkey(key, sizeof(T) * count(), alignment); + auto __restrict mem = + aligned_alloc_withkey(key, sizeof(T) * count(), alignment); if (unlikely(!mem)) throw std::bad_alloc(); size_t offset = 0; diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc index c890e84c1396..73464db4eb17 100644 --- a/storage/innobase/os/os0file.cc +++ b/storage/innobase/os/os0file.cc @@ -981,9 +981,7 @@ file::Block *os_alloc_block() noexcept { /* After go through the block cache for 3 times, allocate a new temporary block. */ if (retry == MAX_BLOCKS * 3) { - byte *ptr; - - ptr = static_cast(ut::malloc_withkey( + byte* __restrict ptr = static_cast(ut::malloc_withkey( UT_NEW_THIS_FILE_PSI_KEY, sizeof(*block) + BUFFER_BLOCK_SIZE)); block = new (ptr) file::Block(); diff --git a/storage/innobase/row/row0pread.cc b/storage/innobase/row/row0pread.cc index 15d075943fa0..6911806ff339 100644 --- a/storage/innobase/row/row0pread.cc +++ b/storage/innobase/row/row0pread.cc @@ -571,7 +571,7 @@ Parallel_reader::Scan_ctx::create_persistent_cursor( return (iter); } - void *ptr = mem_heap_alloc(iter->m_heap, sizeof(btr_pcur_t)); + void* __restrict ptr = mem_heap_alloc(iter->m_heap, sizeof(btr_pcur_t)); ::new (ptr) btr_pcur_t(); diff --git a/storage/innobase/sync/sync0rw.cc b/storage/innobase/sync/sync0rw.cc index d26c7915bd39..988849acc927 100644 --- a/storage/innobase/sync/sync0rw.cc +++ b/storage/innobase/sync/sync0rw.cc @@ -187,7 +187,7 @@ static rw_lock_debug_t *rw_lock_debug_create(void) { static void rw_lock_debug_free(rw_lock_debug_t *info) { ut::free(info); } #endif /* UNIV_DEBUG */ -void rw_lock_create_func(rw_lock_t *lock, +void rw_lock_create_func(rw_lock_t* __restrict lock, IF_DEBUG(latch_id_t id, ) ut::Location clocation) { #if !defined(UNIV_PFS_RWLOCK) /* It should have been created in pfs_rw_lock_create_func() */ diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc index 9cef6b21cd39..70677cec5a59 100644 --- a/storage/innobase/trx/trx0purge.cc +++ b/storage/innobase/trx/trx0purge.cc @@ -2005,10 +2005,9 @@ struct Purge_groups_t { /* Initialize the grouping vector. */ for (std::size_t grpid = 0; grpid < n_purge_threads; ++grpid) { - void *ptr; purge_node_t::Recs *recs; - ptr = mem_heap_alloc(m_heap, sizeof(purge_node_t::Recs)); + void* __restrict ptr = mem_heap_alloc(m_heap, sizeof(purge_node_t::Recs)); /* Call the destructor explicitly in row_purge_end() */ recs = new (ptr) diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc index 935cc17be73e..a3af98d56b56 100644 --- a/storage/innobase/trx/trx0trx.cc +++ b/storage/innobase/trx/trx0trx.cc @@ -251,7 +251,7 @@ struct TrxFactory { with trx_start_if_not_started() before using it. The default isolation level is TRX_ISO_REPEATABLE_READ. @param trx Transaction instance to initialise */ - static void init(trx_t *trx) { + static void init(trx_t* __restrict trx) { /* Explicitly call the constructor of the already allocated object. trx_t objects are allocated by ut::zalloc_withkey() in Pool::Pool() which would not call @@ -3182,7 +3182,7 @@ static bool get_table_name_info(st_handler_tablename *table, static bool get_info_about_prepared_transaction(XA_recover_txn *txn_list, const trx_t *trx, - MEM_ROOT *mem_root) { + MEM_ROOT* __restrict mem_root) { txn_list->id = *trx->xid; txn_list->mod_tables = new (mem_root) List(); if (!txn_list->mod_tables) return true; diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index ca7bd0c49733..8696a35a628a 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -159,7 +159,7 @@ static void debug_wait_for_kill(const char *info) { *****************************************************************************/ static handler *myisam_create_handler(handlerton *hton, TABLE_SHARE *table, - bool, MEM_ROOT *mem_root) { + bool, MEM_ROOT *__restrict mem_root) { return new (mem_root) ha_myisam(hton, table); } diff --git a/storage/myisammrg/ha_myisammrg.cc b/storage/myisammrg/ha_myisammrg.cc index 724a473d1d8b..73bede918415 100644 --- a/storage/myisammrg/ha_myisammrg.cc +++ b/storage/myisammrg/ha_myisammrg.cc @@ -120,7 +120,8 @@ using std::max; using std::min; static handler *myisammrg_create_handler(handlerton *hton, TABLE_SHARE *table, - bool, MEM_ROOT *mem_root) { + bool, + MEM_ROOT *__restrict mem_root) { return new (mem_root) ha_myisammrg(hton, table); } diff --git a/storage/ndb/plugin/ha_ndbcluster.cc b/storage/ndb/plugin/ha_ndbcluster.cc index 570e2c590795..0f01df496071 100644 --- a/storage/ndb/plugin/ha_ndbcluster.cc +++ b/storage/ndb/plugin/ha_ndbcluster.cc @@ -403,7 +403,7 @@ static void ndbcluster_pre_dd_shutdown(handlerton *); static handler *ndbcluster_create_handler(handlerton *hton, TABLE_SHARE *table, bool /* partitioned */, - MEM_ROOT *mem_root) { + MEM_ROOT *__restrict mem_root) { return new (mem_root) ha_ndbcluster(hton, table); } diff --git a/storage/ndb/plugin/ha_ndbinfo.cc b/storage/ndb/plugin/ha_ndbinfo.cc index 0f29133f8be9..02391c089550 100644 --- a/storage/ndb/plugin/ha_ndbinfo.cc +++ b/storage/ndb/plugin/ha_ndbinfo.cc @@ -157,7 +157,7 @@ static bool ndbcluster_is_disabled(void) { } static handler *create_handler(handlerton *hton, TABLE_SHARE *table, bool, - MEM_ROOT *mem_root) { + MEM_ROOT *__restrict mem_root) { return new (mem_root) ha_ndbinfo(hton, table); } diff --git a/storage/perfschema/ha_perfschema.cc b/storage/perfschema/ha_perfschema.cc index 8125cf15fb42..cba63708ef89 100644 --- a/storage/perfschema/ha_perfschema.cc +++ b/storage/perfschema/ha_perfschema.cc @@ -122,7 +122,7 @@ static void unlock_pfs_external_table_shares() { } static handler *pfs_create_handler(handlerton *hton, TABLE_SHARE *table, bool, - MEM_ROOT *mem_root) { + MEM_ROOT *__restrict mem_root) { return new (mem_root) ha_perfschema(hton, table); } diff --git a/storage/secondary_engine_mock/ha_mock.cc b/storage/secondary_engine_mock/ha_mock.cc index 1fc1150e74fe..056a72ef312c 100644 --- a/storage/secondary_engine_mock/ha_mock.cc +++ b/storage/secondary_engine_mock/ha_mock.cc @@ -349,7 +349,7 @@ static bool ModifyAccessPathCost(THD *thd [[maybe_unused]], } static handler *Create(handlerton *hton, TABLE_SHARE *table_share, bool, - MEM_ROOT *mem_root) { + MEM_ROOT *__restrict mem_root) { return new (mem_root) mock::ha_mock(hton, table_share); } diff --git a/storage/temptable/src/plugin.cc b/storage/temptable/src/plugin.cc index f4aaaf45d741..77e3ac2d83f9 100644 --- a/storage/temptable/src/plugin.cc +++ b/storage/temptable/src/plugin.cc @@ -33,7 +33,7 @@ Glue code for registering the TempTable plugin at MySQL. */ struct MEM_ROOT; static handler *create_handler(handlerton *hton, TABLE_SHARE *table_share, bool, - MEM_ROOT *mem_root) { + MEM_ROOT *__restrict mem_root) { return new (mem_root) temptable::Handler(hton, table_share); } diff --git a/unittest/gunit/get_diagnostics-t.cc b/unittest/gunit/get_diagnostics-t.cc index 379e82e20a10..16a080a34335 100644 --- a/unittest/gunit/get_diagnostics-t.cc +++ b/unittest/gunit/get_diagnostics-t.cc @@ -99,7 +99,7 @@ TEST_F(GetDiagnosticsTest, Cmd) { MockDiagInfo *info; MockDiagInfoItem *diag_info_item; List items; - MEM_ROOT *mem_root = thd()->mem_root; + MEM_ROOT *__restrict mem_root = thd()->mem_root; // set var1 item var = new (mem_root) Item_func_get_user_var(var_name1); @@ -141,7 +141,7 @@ TEST_F(GetDiagnosticsTestDeathTest, DieWhenUnsettableItem) { MockDiagInfo *info; MockDiagInfoItem *diag_info_item; List items; - MEM_ROOT *mem_root = thd()->mem_root; + MEM_ROOT *__restrict mem_root = thd()->mem_root; ::testing::FLAGS_gtest_death_test_style = "threadsafe"; @@ -178,7 +178,7 @@ class MockDiagInfoError : public Diagnostics_information { TEST_F(GetDiagnosticsTest, Error) { Sql_cmd *cmd; MockDiagInfoError *info; - MEM_ROOT *mem_root = thd()->mem_root; + MEM_ROOT *__restrict mem_root = thd()->mem_root; // Pre-existing warning push_warning_printf(thd(), Sql_condition::SL_WARNING, WARN_DATA_TRUNCATED, @@ -213,7 +213,7 @@ TEST_F(GetDiagnosticsTest, Error) { TEST_F(GetDiagnosticsTest, FatalError) { Sql_cmd *cmd; MockDiagInfoError *info; - MEM_ROOT *mem_root = thd()->mem_root; + MEM_ROOT *__restrict mem_root = thd()->mem_root; // Pre-existing warning push_warning_printf(thd(), Sql_condition::SL_WARNING, WARN_DATA_TRUNCATED, @@ -248,7 +248,7 @@ TEST_F(GetDiagnosticsTest, StatementInformation) { Statement_information *info; Statement_information_item *diag_info_item; List items; - MEM_ROOT *mem_root = thd()->mem_root; + MEM_ROOT *__restrict mem_root = thd()->mem_root; // NUMBER = 1 warning thd()->raise_warning(ER_UNKNOWN_ERROR); @@ -294,7 +294,7 @@ TEST_F(GetDiagnosticsTest, ConditionInformation) { Condition_information *info; Condition_information_item *diag_info_item; List items; - MEM_ROOT *mem_root = thd()->mem_root; + MEM_ROOT *__restrict mem_root = thd()->mem_root; // Pre-existing error my_message_sql(ER_UNKNOWN_ERROR, "Unknown error", MYF(0)); @@ -345,7 +345,7 @@ static Item *get_cond_info_item(THD *thd, uint number, Condition_information *info; Condition_information_item *diag_info_item; List items; - MEM_ROOT *mem_root = thd->mem_root; + MEM_ROOT *__restrict mem_root = thd->mem_root; LEX_CSTRING var_name = {STRING_WITH_LEN("get_cond_info_item")}; // Simulate GET DIAGNOSTICS as a new command diff --git a/unittest/gunit/graph_simplification-t.cc b/unittest/gunit/graph_simplification-t.cc index 0f94398bea1a..b0f348866a3b 100644 --- a/unittest/gunit/graph_simplification-t.cc +++ b/unittest/gunit/graph_simplification-t.cc @@ -91,7 +91,7 @@ TEST(OnlineCycleFinderTest, Transitive) { static void AddEdge(THD *thd, RelationalExpression::Type join_type, NodeMap left, NodeMap right, double selectivity, - MEM_ROOT *mem_root, JoinHypergraph *graph) { + MEM_ROOT *__restrict mem_root, JoinHypergraph *graph) { JoinPredicate pred; pred.selectivity = selectivity; pred.expr = new (mem_root) RelationalExpression(thd); @@ -123,7 +123,8 @@ using NodeGuard = Scope_guard; } // namespace -[[nodiscard]] static NodeGuard AddNodes(int num_nodes, MEM_ROOT *mem_root, +[[nodiscard]] static NodeGuard AddNodes(int num_nodes, + MEM_ROOT *__restrict mem_root, JoinHypergraph *g) { for (int i = 0; i < num_nodes; ++i) { TABLE *table = diff --git a/unittest/gunit/walk_access_paths-t.cc b/unittest/gunit/walk_access_paths-t.cc index 65f27d733834..c04dd09156b3 100644 --- a/unittest/gunit/walk_access_paths-t.cc +++ b/unittest/gunit/walk_access_paths-t.cc @@ -69,7 +69,8 @@ AccessPath MakeZeroRows(AccessPath *child) { return path; } -AccessPath MakeAppend(MEM_ROOT *mem_root, AccessPath *c1, AccessPath *c2) { +AccessPath MakeAppend(MEM_ROOT *__restrict mem_root, AccessPath *c1, + AccessPath *c2) { AccessPath path; path.type = AccessPath::APPEND; diff --git a/vio/vio.cc b/vio/vio.cc index 97e450aa0175..1ecb45997233 100644 --- a/vio/vio.cc +++ b/vio/vio.cc @@ -413,7 +413,7 @@ bool vio_reset(Vio *vio, enum enum_vio_type type, my_socket sd, } Vio *internal_vio_create(uint flags) { - void *rawmem = my_malloc(key_memory_vio, sizeof(Vio), MYF(MY_WME)); + void* __restrict rawmem = my_malloc(key_memory_vio, sizeof(Vio), MYF(MY_WME)); if (rawmem == nullptr) return nullptr; return new (rawmem) Vio(flags); }