VirtualBox

Changeset 527 in kBuild for trunk/src


Ignore:
Timestamp:
Sep 17, 2006 4:04:14 AM (19 years ago)
Author:
bird
Message:

CONFIG_WITH_OPTIMIZATION_HACKS

Location:
trunk/src/gmake
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gmake/Makefile.kmk

    r523 r527  
    2222        CONFIG_WITH_EXTENDED_NOTPARALLEL \
    2323        CONFIG_WITH_TOUPPER_TOLOWER \
     24    CONFIG_WITH_INCLUDEDEP \
    2425        KMK \
    25         VARIABLE_HASH
     26        CONFIG_WITH_OPTIMIZATION_HACKS \
     27        VARIABLE_HASH
    2628       
    2729kmk_SOURCES = \
  • trunk/src/gmake/expand.c

    r526 r527  
    440440    return allocated_variable_expand ((char *)str);
    441441
    442   tmp = (char *) alloca (end - str + 1);
    443   bcopy (str, tmp, end - str);
    444   tmp[end - str] = '\0';
    445 
    446   return allocated_variable_expand (tmp);
     442#ifdef CONFIG_WITH_OPTIMIZATION_HACKS
     443    {
     444      const char saved_char = *end;
     445      *(char *)end = '\0';
     446      tmp = allocated_variable_expand ((char *)str);
     447      *(char *)end = saved_char;
     448      return tmp;
     449    }
     450#else
     451    {
     452      tmp = (char *) alloca (end - str + 1);
     453      bcopy (str, tmp, end - str);
     454      tmp[end - str] = '\0';
     455 
     456      return allocated_variable_expand (tmp);
     457    }
     458#endif
    447459}
    448460
  • trunk/src/gmake/function.c

    r526 r527  
    261261
    262262
    263 
     263#ifdef CONFIG_WITH_OPTIMIZATION_HACKS
    264264/* The maximum length of a function, once reached there is
    265265   it can't be function and we can skip the hash lookup drop out. */
     
    268268
    269269/* Look up a function by name.  */
    270 #if defined(__GNUC__) || defined(_MSC_VER)
    271270__inline
    272 #endif
     271#endif /* CONFIG_WITH_OPTIMIZATION_HACKS */
    273272static const struct function_table_entry *
    274273lookup_function (const char *s)
    275274{
    276275  const char *e = s;
    277 #ifdef MAX_FUNCTION_LENGTH
     276#ifdef CONFIG_WITH_OPTIMIZATION_HACKS
    278277  int left = MAX_FUNCTION_LENGTH;
    279278  int ch;
     
    24372436  hash_load (&function_table, function_table_init,
    24382437             FUNCTION_TABLE_ENTRIES, sizeof (struct function_table_entry));
    2439 #ifdef MAX_FUNCTION_LENGTH /* bird */
     2438#ifdef CONFIG_WITH_OPTIMIZATION_HACKS
    24402439  {
    24412440    unsigned i;
  • trunk/src/gmake/hash.h

    r503 r527  
    8383/* hash and comparison macros for case-sensitive string keys. */
    8484
    85 #if 0
     85#ifndef CONFIG_WITH_OPTIMIZATION_HACKS
    8686#define STRING_HASH_1(KEY, RESULT) do { \
    8787  unsigned char const *_key_ = (unsigned char const *) (KEY) - 1; \
     
    8989    (RESULT) += (*_key_ << (_key_[1] & 0xf)); \
    9090} while (0)
    91 #else
    92 #define STRING_HASH_1(KEY, RESULT) do { \
     91#else /* CONFIG_WITH_OPTIMIZATION_HACKS */
     92# define STRING_HASH_1(KEY, RESULT) do { \
    9393  unsigned char const *_key_ = (unsigned char const *) (KEY); \
    9494  unsigned int _ch_ = *_key_; \
     
    100100    } \
    101101} while (0)
    102 #endif
     102#endif /* CONFIG_WITH_OPTIMIZATION_HACKS */
    103103#define return_STRING_HASH_1(KEY) do { \
    104104  unsigned long _result_ = 0; \
     
    107107} while (0)
    108108
    109 #if 0
     109#ifndef CONFIG_WITH_OPTIMIZATION_HACKS
    110110#define STRING_HASH_2(KEY, RESULT) do { \
    111111  unsigned char const *_key_ = (unsigned char const *) (KEY) - 1; \
     
    113113    (RESULT) += (*_key_ << (_key_[1] & 0x7)); \
    114114} while (0)
    115 #else
    116 #define STRING_HASH_2(KEY, RESULT) do { \
     115#else /* CONFIG_WITH_OPTIMIZATION_HACKS */
     116# define STRING_HASH_2(KEY, RESULT) do { \
    117117  unsigned char const *_key_ = (unsigned char const *) (KEY); \
    118118  unsigned int _ch_ = *_key_; \
     
    124124    } \
    125125} while (0)
    126 #endif
     126#endif /* CONFIG_WITH_OPTIMIZATION_HACKS */
    127127#define return_STRING_HASH_2(KEY) do { \
    128128  unsigned long _result_ = 0; \
     
    138138} while (0)
    139139
    140 #if 0
    141 #define _STRING_N_HASH_1(KEY, N, RESULT) do { \
     140#ifndef CONFIG_WITH_OPTIMIZATION_HACKS
     141#define STRING_N_HASH_1(KEY, N, RESULT) do { \
    142142  unsigned char const *_key_ = (unsigned char const *) (KEY) - 1; \
    143143  int _n_ = (N); \
     
    147147  (RESULT) += *++_key_; \
    148148} while (0)
    149 #else
    150 #define STRING_N_HASH_1(KEY, N, RESULT) do { \
     149#else /* CONFIG_WITH_OPTIMIZATION_HACKS */
     150# define STRING_N_HASH_1(KEY, N, RESULT) do { \
    151151  unsigned char const *_key_ = (unsigned char const *) (KEY); \
    152152  unsigned int _ch_ = *_key_; \
     
    171171    (RESULT) += _ch_; \
    172172} while (0)
    173 #endif
     173#endif /* CONFIG_WITH_OPTIMIZATION_HACKS */
    174174#define return_STRING_N_HASH_1(KEY, N) do { \
    175175  unsigned long _result_ = 0; \
     
    178178} while (0)
    179179
    180 #if 0
     180#ifndef CONFIG_WITH_OPTIMIZATION_HACKS
    181181#define STRING_N_HASH_2(KEY, N, RESULT) do { \
    182182  unsigned char const *_key_ = (unsigned char const *) (KEY) - 1; \
     
    187187  (RESULT) += *++_key_; \
    188188} while (0)
    189 #else
    190 #define STRING_N_HASH_2(KEY, N, RESULT) do { \
     189#else /* CONFIG_WITH_OPTIMIZATION_HACKS */
     190# define STRING_N_HASH_2(KEY, N, RESULT) do { \
    191191  unsigned char const *_key_ = (unsigned char const *) (KEY); \
    192192  unsigned int _ch_ = *_key_; \
     
    211211    (RESULT) += _ch_; \
    212212} while (0)
    213 #endif
     213#endif /* CONFIG_WITH_OPTIMIZATION_HACKS */
    214214#define return_STRING_N_HASH_2(KEY, N) do { \
    215215  unsigned long _result_ = 0; \
     
    229229/* hash and comparison macros for case-insensitive string _key_s. */
    230230
    231 #if 1 /* testme */
     231#if 1 /*ndef CONFIG_WITH_OPTIMIZATION_HACKS - testme */
    232232#define ISTRING_HASH_1(KEY, RESULT) do { \
    233233  unsigned char const *_key_ = (unsigned char const *) (KEY) - 1; \
     
    235235    (RESULT) += ((isupper (*_key_) ? tolower (*_key_) : *_key_) << (_key_[1] & 0xf)); \
    236236} while (0)
    237 #else
     237#else /* CONFIG_WITH_OPTIMIZATION_HACKS */
    238238#define ISTRING_HASH_1(KEY, RESULT) do { \
    239239  unsigned char const *_key_ = (unsigned char const *) (KEY); \
     
    246246    } \
    247247} while (0)
    248 #endif
     248#endif /* CONFIG_WITH_OPTIMIZATION_HACKS */
    249249#define return_ISTRING_HASH_1(KEY) do { \
    250250  unsigned long _result_ = 0; \
     
    253253} while (0)
    254254
    255 #if 1 /* testme */
     255#if 1 /* ndef CONFIG_WITH_OPTIMIZATION_HACKS - testme */
    256256#define ISTRING_HASH_2(KEY, RESULT) do { \
    257257  unsigned char const *_key_ = (unsigned char const *) (KEY) - 1; \
     
    259259    (RESULT) += ((isupper (*_key_) ? tolower (*_key_) : *_key_) << (_key_[1] & 0x7)); \
    260260} while (0)
    261 #else
     261#else /* CONFIG_WITH_OPTIMIZATION_HACKS */
    262262#define ISTRING_HASH_2(KEY, RESULT) do { \
    263263  unsigned char const *_key_ = (unsigned char const *) (KEY); \
     
    270270    } \
    271271} while (0)
    272 #endif
     272#endif /* CONFIG_WITH_OPTIMIZATION_HACKS */
    273273#define return_ISTRING_HASH_2(KEY) do { \
    274274  unsigned long _result_ = 0; \
  • trunk/src/gmake/make.h

    r520 r527  
    425425extern char *end_of_token PARAMS ((const char *));
    426426extern void collapse_continuations PARAMS ((char *));
    427 #if 1 /* memchr is usually compiler intrinsic, thus faster. */
     427#ifdef CONFIG_WITH_OPTIMIZATION_HACKS /* memchr is usually compiler intrinsic, thus faster. */
    428428#define lindex(s, limit, c) ((char *)memchr((s), (c), (limit) - (s)))
    429429#else
     
    615615                               while (((_v)=_c)==0 && errno==EINTR); }while(0)
    616616
    617 #ifdef __EMX__ /* bird: saves 40-100ms on libc. */
     617#if defined(__EMX__) && defined(CONFIG_WITH_OPTIMIZATION_HACKS) /* bird: saves 40-100ms on libc. */
    618618#undef strchr
    619619#define strchr(s, c) \
  • trunk/src/gmake/misc.c

    r520 r527  
    2121#include "debug.h"
    2222
    23 #ifdef __EMX__ /* bird: saves 5-10ms on libc */
     23#if defined(__EMX__) && defined(CONFIG_WITH_OPTIMIZATION_HACKS) /* bird: saves 5-10ms on libc */
    2424# define bcopy(src, dst, size)   __builtin_memcpy((dst), (src), (size))
    2525#endif
     
    406406
    407407
    408 #if 0 /* This is really a reimplemntation of memchr, only slower.
    409          It's been replaced by a macro in the header file. */
     408#ifndef CONFIG_WITH_OPTIMIZATION_HACKS /* This is really a reimplemntation of
     409   memchr, only slower. It's been replaced by a macro in the header file. */
     410
    410411/* Limited INDEX:
    411412   Search through the string STRING, which ends at LIMIT, for the character C.
     
    423424  return 0;
    424425}
    425 #endif
     426#endif /* CONFIG_WITH_OPTIMIZATION_HACKS */
    426427
    427428
  • trunk/src/gmake/variable.c

    r526 r527  
    104104/* Hash table of all global variable definitions.  */
    105105
    106 #ifdef KMK
     106#ifdef CONFIG_WITH_OPTIMIZATION_HACKS
    107107# ifdef _MSC_VER
    108108#  define inline _inline
     
    156156    }
    157157}
    158 #endif /* KMK */
     158#endif /* CONFIG_WITH_OPTIMIZATION_HACKS */
    159159
    160160static unsigned long
     
    171171  return key->hash1;
    172172#else
    173 # ifdef KMK
     173# ifdef CONFIG_WITH_OPTIMIZATION_HACKS
    174174  return variable_hash_1i (key->name, key->length);
    175175# else
     
    189189#else
    190190  struct variable const *key = (struct variable const *) keyv;
    191 # ifdef KMK
     191# ifdef CONFIG_WITH_OPTIMIZATION_HACKS
    192192  return variable_hash_2i (key->name, key->length);
    193193# else
     
    221221    return result;
    222222#endif
    223 #ifdef KMK /* bird: speed */
     223#ifdef CONFIG_WITH_OPTIMIZATION_HACKS /* bird: speed */
    224224  {
    225225    const char *xs = x->name;
     
    259259      }
    260260  }
    261 #endif /* KMK */
     261#endif /* CONFIG_WITH_OPTIMIZATION_HACKS */
    262262#ifdef VARIABLE_HASH
    263263  /* hash 2 */
     
    270270    return result;
    271271#endif
    272 #ifdef KMK
     272#ifdef CONFIG_WITH_OPTIMIZATION_HACKS
    273273  return memcmp (x->name, y->name, x->length);
    274274#else
     
    299299{
    300300  hash_init (&global_variable_set.table,
    301 #ifdef KMK
     301#ifdef KMK /* FIMXE: just redefine the bucket size! */
    302302             16384,
    303303#else
  • trunk/src/gmake/vpath.c

    r503 r527  
    6262  register struct vpath *old, *nexto;
    6363  register char *p;
     64#ifdef CONFIG_WITH_OPTIMIZATION_HACKS
     65  char expr[64];
     66#endif
    6467
    6568  /* Reverse the chain.  */
     
    8184    int save = warn_undefined_variables_flag;
    8285    warn_undefined_variables_flag = 0;
    83 
     86#ifdef CONFIG_WITH_OPTIMIZATION_HACKS
     87    p = variable_expand (strcpy (expr, "$(strip $(VPATH))"));
     88#else
    8489    p = variable_expand ("$(strip $(VPATH))");
     90#endif
    8591
    8692    warn_undefined_variables_flag = save;
     
    114120    warn_undefined_variables_flag = 0;
    115121
     122#ifdef CONFIG_WITH_OPTIMIZATION_HACKS
     123    p = variable_expand (strcpy (expr, "$(strip $(GPATH))"));
     124#else
    116125    p = variable_expand ("$(strip $(GPATH))");
     126#endif
    117127
    118128    warn_undefined_variables_flag = save;
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette