Skip to content

Commit cc9af52

Browse files
author
Steinar H. Gunderson
committed
Bug #26927386: REDUCE COMPILATION TIME [noclose]
Re-push with OpenSSL fixes. Change-Id: I2471b9ab906329ae9c3d8654da79109ddbe49cb2
1 parent a5f6939 commit cc9af52

File tree

92 files changed

+203
-186
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+203
-186
lines changed

client/base/abstract_program.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "client/base/help_options.h"
2626
#include "client/base/i_options_provider.h"
2727
#include "client/base/message_data.h"
28+
#include "my_alloc.h"
2829
#include "my_compiler.h"
2930
#include "my_inttypes.h"
3031

client/completion_hash.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "client/completion_hash.h"
2424

2525
#include "m_string.h"
26+
#include "my_alloc.h"
2627
#include "my_inttypes.h"
2728
#include "my_sys.h"
2829
#include "mysql/service_mysql_alloc.h"

client/completion_hash.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
#include <sys/types.h>
2525

26+
#include "my_alloc.h"
2627
#include "my_sys.h"
2728

2829
typedef struct _entry {

client/mysql.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
#endif
7373

7474
#if defined(HAVE_TERM_H)
75+
#define NOMACROS // move() macro interferes with std::move.
7576
#include <curses.h>
7677
#include <term.h>
7778
#endif

client/mysql_secure_installation.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <sys/types.h>
2121

2222
#include "client/client_priv.h"
23+
#include "my_alloc.h"
2324
#include "my_compiler.h"
2425
#include "my_dbug.h"
2526
#include "my_default.h"

client/mysql_ssl_rsa_setup.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131

3232
#include "client/logger.h"
3333
#include "client/path.h"
34+
#include "my_alloc.h"
3435
#include "my_compiler.h"
3536
#include "my_dbug.h"
3637
#include "my_default.h"

client/mysqladmin.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include <string>
2929

3030
#include "client/client_priv.h"
31+
#include "my_alloc.h"
3132
#include "my_compiler.h"
3233
#include "my_dbug.h"
3334
#include "my_default.h"

client/mysqlimport.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <time.h>
2727

2828
#include "client/client_priv.h"
29+
#include "my_alloc.h"
2930
#include "my_dbug.h"
3031
#include "my_default.h"
3132
#include "my_inttypes.h"

client/mysqlshow.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "caching_sha2_passwordopt-vars.h"
2929
#include "client/client_priv.h"
3030
#include "m_string.h"
31+
#include "my_alloc.h"
3132
#include "my_dbug.h"
3233
#include "my_default.h"
3334
#include "my_inttypes.h"

client/mysqlslap.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@
101101
#include <time.h>
102102

103103
#include "client/client_priv.h"
104+
#include "my_alloc.h"
104105
#include "my_dbug.h"
105106
#include "my_default.h"
106107
#include "my_inttypes.h"

components/logging/log_sink_syseventlog.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
1818
#include "log_service_imp.h"
1919
#include "m_string.h" // native_strncasecmp()/native_strcasecmp()
2020
#include "my_compiler.h"
21+
#include "my_io.h"
2122
#include "my_sys.h"
2223
#include "mysqld_error.h" // so we can throw ER_LOG_SYSLOG_*
2324
#ifndef _WIN32

extra/regex/utils.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#include <limits.h>
2+
13
/* utility definitions */
24
#ifdef _POSIX2_RE_DUP_MAX
35
#define DUPMAX _POSIX2_RE_DUP_MAX /* xxx is this right? */

include/m_string.h

Lines changed: 8 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,15 @@
2222
*/
2323

2424
#include <float.h>
25-
#include <mysql/mysql_lex_string.h>
26-
#include <stdlib.h>
2725
#include <string.h>
26+
#include <stdbool.h> // IWYU pragma: keep
27+
#include <stdint.h>
28+
#include <stdlib.h>
2829

2930
#include "lex_string.h"
30-
#include "my_byteorder.h" /* uint8korr */
3131
#include "my_config.h"
32-
#include "my_dbug.h"
3332
#include "my_inttypes.h"
3433
#include "my_macros.h"
35-
#include "mysql_com.h"
36-
37-
#define bfill please_use_memset_rather_than_bfill
38-
#define bzero please_use_memset_rather_than_bzero
39-
#define bmove please_use_memmove_rather_than_bmove
40-
#define strmov please_use_my_stpcpy_or_my_stpmov_rather_than_strmov
41-
#define strnmov please_use_my_stpncpy_or_my_stpnmov_rather_than_strnmov
4234

4335
/**
4436
Definition of the null string (a null pointer of type char *),
@@ -342,90 +334,25 @@ static inline char *ullstr(longlong value, char *buff)
342334
#define C_STRING_WITH_LEN(X) ((char *) (X)), ((sizeof(X) - 1))
343335

344336
/**
345-
Skip trailing space.
346-
347-
On most systems reading memory in larger chunks (ideally equal to the size of
348-
the chinks that the machine physically reads from memory) causes fewer memory
349-
access loops and hence increased performance.
350-
This is why the 'int' type is used : it's closest to that (according to how
351-
it's defined in C).
352-
So when we determine the amount of whitespace at the end of a string we do
353-
the following :
354-
1. We divide the string into 3 zones :
355-
a) from the start of the string (__start) to the first multiple
356-
of sizeof(int) (__start_words)
357-
b) from the end of the string (__end) to the last multiple of sizeof(int)
358-
(__end_words)
359-
c) a zone that is aligned to sizeof(int) and can be safely accessed
360-
through an int *
361-
2. We start comparing backwards from (c) char-by-char. If all we find is
362-
space then we continue
363-
3. If there are elements in zone (b) we compare them as unsigned ints to a
364-
int mask (SPACE_INT) consisting of all spaces
365-
4. Finally we compare the remaining part (a) of the string char by char.
366-
This covers for the last non-space unsigned int from 3. (if any)
367-
368-
This algorithm works well for relatively larger strings, but it will slow
369-
the things down for smaller strings (because of the additional calculations
370-
and checks compared to the naive method). Thus the barrier of length 20
371-
is added.
372-
373-
@param ptr pointer to the input string
374-
@param len the length of the string
375-
@return the last non-space character
376-
*/
377-
#if defined(__sparc) || defined(__sparcv9)
378-
static inline const uchar *skip_trailing_space(const uchar *ptr,size_t len)
379-
{
380-
/* SPACE_INT is a word that contains only spaces */
381-
#if SIZEOF_INT == 4
382-
const unsigned SPACE_INT= 0x20202020U;
383-
#elif SIZEOF_INT == 8
384-
const unsigned SPACE_INT= 0x2020202020202020ULL;
385-
#else
386-
#error define the appropriate constant for a word full of spaces
387-
#endif
388-
389-
const uchar *end= ptr + len;
337+
Skip trailing space (ASCII spaces only).
390338
391-
if (len > 20)
392-
{
393-
const uchar *end_words= (const uchar *)(intptr)
394-
(((ulonglong)(intptr)end) / SIZEOF_INT * SIZEOF_INT);
395-
const uchar *start_words= (const uchar *)(intptr)
396-
((((ulonglong)(intptr)ptr) + SIZEOF_INT - 1) / SIZEOF_INT * SIZEOF_INT);
397-
398-
DBUG_ASSERT(end_words > ptr);
399-
while (end > end_words && end[-1] == 0x20)
400-
end--;
401-
if (end[-1] == 0x20 && start_words < end_words)
402-
while (end > start_words && ((unsigned *)end)[-1] == SPACE_INT)
403-
end -= SIZEOF_INT;
404-
}
405-
while (end > ptr && end[-1] == 0x20)
406-
end--;
407-
return (end);
408-
}
409-
#else
410-
/*
411-
Reads 8 bytes at a time, ignoring alignment.
412-
We use uint8korr, which is fast (it simply reads a *ulonglong)
413-
on all platforms, except sparc.
339+
@return New end of the string.
414340
*/
415341
static inline const uchar *skip_trailing_space(const uchar *ptr, size_t len)
416342
{
417343
const uchar *end= ptr + len;
418344
while (end - ptr >= 8)
419345
{
420-
if (uint8korr(end-8) != 0x2020202020202020ULL)
346+
uint64_t chunk;
347+
memcpy(&chunk, end - 8, sizeof(chunk));
348+
if (chunk != 0x2020202020202020ULL)
421349
break;
422350
end-= 8;
423351
}
424352
while (end > ptr && end[-1] == 0x20)
425353
end--;
426354
return (end);
427355
}
428-
#endif
429356

430357
static inline void lex_string_set(LEX_STRING *lex_str, const char *c_str)
431358
{

include/my_getopt.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <sys/types.h>
2626

2727
#include "my_config.h"
28+
#include "my_io.h"
2829
#include "my_inttypes.h"
2930
#include "my_macros.h"
3031
#include "my_sys.h" /* loglevel */

include/my_sys.h

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,10 @@
2222

2323
#include "my_config.h"
2424

25-
#include "m_ctype.h" /* CHARSET_INFO */
26-
#include "m_string.h" /* STRING_WITH_LEN */
27-
#include "my_alloc.h" /* USED_MEM */
28-
#include "my_compiler.h"
29-
#include "my_inttypes.h"
30-
#include "my_io.h"
31-
#include "my_macros.h"
32-
#include "my_psi_config.h" /* IWYU pragma: keep */
33-
#include "my_sharedlib.h"
34-
3525
#ifdef HAVE_ALLOCA_H
3626
#include <alloca.h>
3727
#endif
28+
#include <limits.h>
3829
#ifdef _WIN32
3930
#include <malloc.h>
4031
#endif
@@ -43,26 +34,41 @@
4334
#endif
4435
#include <stdarg.h>
4536
#include <stdio.h>
46-
#include <string.h>
47-
#include <sys/stat.h>
37+
#ifdef HAVE_SYS_SELECT_H
38+
#include <sys/select.h>
39+
#endif
4840
#include <sys/types.h>
4941
#include <time.h>
5042

43+
#include "m_ctype.h" /* CHARSET_INFO */
44+
#include "m_string.h" /* IWYU pragma: keep */
45+
#include "my_compiler.h"
46+
#include "my_inttypes.h"
47+
#include "my_loglevel.h"
48+
#include "my_macros.h"
49+
#include "my_psi_config.h" /* IWYU pragma: keep */
50+
#include "my_sharedlib.h"
5151
#include "mysql/psi/mysql_cond.h" /* mysql_cond_t */
5252
#include "mysql/psi/mysql_mutex.h" /* mysql_mutex_t */
53-
#include "mysql/psi/mysql_rwlock.h" /* mysql_rwlock_t */
54-
#include "mysql/psi/mysql_thread.h" /* mysql_thread_t */
55-
#include "mysql/psi/psi_data_lock.h" /* PSI_data_lock_service_t */
56-
#include "mysql/psi/psi_error.h" /* PSI_error_service_t */
5753
#include "mysql/psi/psi_file.h" /* PSI_file_service_t */
58-
#include "mysql/psi/psi_idle.h" /* PSI_idle_service_t */
59-
#include "mysql/psi/psi_mdl.h" /* PSI_mdl_service_t */
60-
#include "mysql/psi/psi_memory.h" /* PSI_memory_service_t */
61-
#include "mysql/psi/psi_socket.h" /* PSI_socket_service_t */
62-
#include "mysql/psi/psi_stage.h" /* PSI_stage_info */
63-
#include "mysql/psi/psi_statement.h" /* PSI_statement_service_t */
64-
#include "mysql/psi/psi_table.h" /* PSI_table_service_t */
65-
#include "mysql/psi/psi_transaction.h" /* PSI_transaction_service_t */
54+
#include "mysql/psi/psi_stage.h"
55+
56+
struct PSI_cond_bootstrap;
57+
struct PSI_data_lock_bootstrap;
58+
struct PSI_error_bootstrap;
59+
struct PSI_file_bootstrap;
60+
struct PSI_idle_bootstrap;
61+
struct PSI_mdl_bootstrap;
62+
struct PSI_memory_bootstrap;
63+
struct PSI_mutex_bootstrap;
64+
struct PSI_rwlock_bootstrap;
65+
struct PSI_socket_bootstrap;
66+
struct PSI_stage_bootstrap;
67+
struct PSI_statement_bootstrap;
68+
struct PSI_table_bootstrap;
69+
struct PSI_thread_bootstrap;
70+
struct PSI_transaction_bootstrap;
71+
struct MEM_ROOT;
6672

6773
C_MODE_START
6874

include/mysql/psi/mysql_socket.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
2929

3030
/* For MY_STAT */
3131
#include "my_dir.h"
32+
#include "my_io.h"
3233
/* For my_chsize */
3334
#include "my_sys.h"
3435
#include "mysql/psi/psi_socket.h"

include/mysql/psi/psi_abi_cond_v1.h.pp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@
8181
{
8282
void *(*get_interface)(int version);
8383
};
84-
typedef struct PSI_cond_bootstrap PSI_cond_bootstrap;
8584
struct PSI_cond_service_v1
8685
{
8786
register_cond_v1_t register_cond;

include/mysql/psi/psi_abi_file_v1.h.pp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@
104104
{
105105
void *(*get_interface)(int version);
106106
};
107-
typedef struct PSI_file_bootstrap PSI_file_bootstrap;
108107
struct PSI_file_service_v1
109108
{
110109
register_file_v1_t register_file;

include/mysql/psi/psi_abi_mutex_v1.h.pp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@
7272
{
7373
void *(*get_interface)(int version);
7474
};
75-
typedef struct PSI_mutex_bootstrap PSI_mutex_bootstrap;
7675
struct PSI_mutex_service_v1
7776
{
7877
register_mutex_v1_t register_mutex;

include/mysql/psi/psi_abi_stage_v1.h.pp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
{
5757
void *(*get_interface)(int version);
5858
};
59-
typedef struct PSI_stage_bootstrap PSI_stage_bootstrap;
6059
struct PSI_stage_service_v1
6160
{
6261
register_stage_v1_t register_stage;

include/mysql/psi/psi_cond.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ struct PSI_cond_bootstrap
4747
*/
4848
void *(*get_interface)(int version);
4949
};
50-
typedef struct PSI_cond_bootstrap PSI_cond_bootstrap;
5150

5251
#ifdef HAVE_PSI_COND_INTERFACE
5352

include/mysql/psi/psi_file.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ struct PSI_file_bootstrap
5959
*/
6060
void *(*get_interface)(int version);
6161
};
62-
typedef struct PSI_file_bootstrap PSI_file_bootstrap;
6362

6463
#ifdef HAVE_PSI_FILE_INTERFACE
6564

include/mysql/psi/psi_mutex.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ struct PSI_mutex_bootstrap
4646
*/
4747
void *(*get_interface)(int version);
4848
};
49-
typedef struct PSI_mutex_bootstrap PSI_mutex_bootstrap;
5049

5150
#ifdef HAVE_PSI_MUTEX_INTERFACE
5251

include/mysql/psi/psi_stage.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ struct PSI_stage_bootstrap
4747
*/
4848
void *(*get_interface)(int version);
4949
};
50-
typedef struct PSI_stage_bootstrap PSI_stage_bootstrap;
5150

5251
#ifdef HAVE_PSI_STAGE_INTERFACE
5352

include/mysql/service_srv_session_info.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#ifndef MYSQL_SERVICE_SRV_SESSION_INFO_INCLUDED
22
#define MYSQL_SERVICE_SRV_SESSION_INFO_INCLUDED
3-
/* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
3+
/* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
44
55
This program is free software; you can redistribute it and/or
66
modify it under the terms of the GNU General Public License as
@@ -25,6 +25,7 @@
2525
#include "mysql/service_srv_session.h"
2626
#ifndef MYSQL_ABI_CHECK
2727
#include "my_thread.h" /* my_thread_id */
28+
#include "my_thread_local.h"
2829
#include "m_string.h" /* LEX_CSTRING */
2930
#include "plugin.h" /* MYSQL_THD */
3031
#include "mysql_com.h" /* Vio for violite.h */

include/sql_string.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "lex_string.h"
3131
#include "m_ctype.h" // my_convert
3232
#include "m_string.h" // LEX_CSTRING
33+
#include "my_alloc.h"
3334
#include "my_byteorder.h"
3435
#include "my_compiler.h"
3536
#include "my_dbug.h"

0 commit comments

Comments
 (0)