1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Change bitfields in Item to an uint16

The reason for the change is that neither clang or gcc can do efficient
code when several bit fields are change at the same time or when copying
one or more bits between identical bit fields.
Updated bits explicitely with & and | is MUCH more efficient than what
current compilers can do.
This commit is contained in:
Michael Widenius
2020-08-02 12:31:14 +03:00
committed by Sergei Golubchik
parent 451c4ae548
commit 3105c9e7a5
49 changed files with 1240 additions and 1109 deletions

View File

@ -2248,8 +2248,8 @@ Type_handler::make_num_distinct_aggregator_field(MEM_ROOT *mem_root,
{
return new(mem_root)
Field_double(NULL, item->max_length,
(uchar *) (item->maybe_null ? "" : 0),
item->maybe_null ? 1 : 0, Field::NONE,
(uchar *) (item->maybe_null() ? "" : 0),
item->maybe_null() ? 1 : 0, Field::NONE,
&item->name, (uint8) item->decimals,
0, item->unsigned_flag);
}
@ -2262,8 +2262,8 @@ Type_handler_float::make_num_distinct_aggregator_field(MEM_ROOT *mem_root,
{
return new(mem_root)
Field_float(NULL, item->max_length,
(uchar *) (item->maybe_null ? "" : 0),
item->maybe_null ? 1 : 0, Field::NONE,
(uchar *) (item->maybe_null() ? "" : 0),
item->maybe_null() ? 1 : 0, Field::NONE,
&item->name, (uint8) item->decimals,
0, item->unsigned_flag);
}
@ -2278,8 +2278,8 @@ Type_handler_decimal_result::make_num_distinct_aggregator_field(
DBUG_ASSERT(item->decimals <= DECIMAL_MAX_SCALE);
return new (mem_root)
Field_new_decimal(NULL, item->max_length,
(uchar *) (item->maybe_null ? "" : 0),
item->maybe_null ? 1 : 0, Field::NONE,
(uchar *) (item->maybe_null() ? "" : 0),
item->maybe_null() ? 1 : 0, Field::NONE,
&item->name, (uint8) item->decimals,
0, item->unsigned_flag);
}
@ -2296,8 +2296,8 @@ Type_handler_int_result::make_num_distinct_aggregator_field(MEM_ROOT *mem_root,
*/
return new(mem_root)
Field_longlong(NULL, item->max_length,
(uchar *) (item->maybe_null ? "" : 0),
item->maybe_null ? 1 : 0, Field::NONE,
(uchar *) (item->maybe_null() ? "" : 0),
item->maybe_null() ? 1 : 0, Field::NONE,
&item->name, 0, item->unsigned_flag);
}
@ -4761,7 +4761,7 @@ bool Type_handler_temporal_result::
set_if_bigger(func->decimals, deci);
}
if (rc || func->maybe_null)
if (rc || func->maybe_null())
return rc;
/*
LEAST/GREATES(non-temporal, temporal) can return NULL.
@ -4784,7 +4784,7 @@ bool Type_handler_temporal_result::
continue; // No conversion.
if (ha->cmp_type() != TIME_RESULT)
{
func->maybe_null= true; // Conversion from non-temporal is not safe
func->flags|= ITEM_FLAG_MAYBE_NULL; // Conversion from non-temporal is not safe
break;
}
timestamp_type tf= hf->mysql_timestamp_type();
@ -4835,7 +4835,7 @@ bool Type_handler_temporal_result::
DBUG_ASSERT(hf->field_type() == MYSQL_TYPE_DATETIME);
if (!(thd->variables.old_behavior & OLD_MODE_ZERO_DATE_TIME_CAST))
continue;
func->maybe_null= true;
func->flags|= ITEM_FLAG_MAYBE_NULL;
break;
}
return rc;
@ -4847,10 +4847,11 @@ bool Type_handler_date_common::
Item **items, uint nitems) const
{
func->fix_attributes_date();
if (func->maybe_null)
if (func->maybe_null())
return false;
/*
We cannot trust the generic maybe_null value calculated during fix_fields().
We cannot trust the generic maybe_null value calculated during
fix_fields().
If a conversion from non-temoral types to DATE happens,
then the result can be NULL (even if all arguments are not NULL).
*/
@ -4858,7 +4859,7 @@ bool Type_handler_date_common::
{
if (items[i]->type_handler()->cmp_type() != TIME_RESULT)
{
func->maybe_null= true;
func->flags|= ITEM_FLAG_MAYBE_NULL;
break;
}
}
@ -6740,7 +6741,7 @@ bool Type_handler::
item->arguments()[0]->time_precision(current_thd) :
item->decimals;
item->fix_attributes_temporal(MIN_TIME_WIDTH, dec);
item->maybe_null= true;
item->flags|= ITEM_FLAG_MAYBE_NULL;
return false;
}
@ -6749,7 +6750,7 @@ bool Type_handler::
Item_date_typecast_fix_length_and_dec(Item_date_typecast *item) const
{
item->fix_attributes_temporal(MAX_DATE_WIDTH, 0);
item->maybe_null= true;
item->flags|= ITEM_FLAG_MAYBE_NULL;
return false;
}
@ -6762,7 +6763,7 @@ bool Type_handler::
item->arguments()[0]->datetime_precision(current_thd) :
item->decimals;
item->fix_attributes_temporal(MAX_DATETIME_WIDTH, dec);
item->maybe_null= true;
item->flags|= ITEM_FLAG_MAYBE_NULL;
return false;
}