- Timestamp:
- Sep 17, 2006 4:04:14 AM (19 years ago)
- Location:
- trunk/src/gmake
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gmake/Makefile.kmk
r523 r527 22 22 CONFIG_WITH_EXTENDED_NOTPARALLEL \ 23 23 CONFIG_WITH_TOUPPER_TOLOWER \ 24 CONFIG_WITH_INCLUDEDEP \ 24 25 KMK \ 25 VARIABLE_HASH 26 CONFIG_WITH_OPTIMIZATION_HACKS \ 27 VARIABLE_HASH 26 28 27 29 kmk_SOURCES = \ -
trunk/src/gmake/expand.c
r526 r527 440 440 return allocated_variable_expand ((char *)str); 441 441 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 447 459 } 448 460 -
trunk/src/gmake/function.c
r526 r527 261 261 262 262 263 263 #ifdef CONFIG_WITH_OPTIMIZATION_HACKS 264 264 /* The maximum length of a function, once reached there is 265 265 it can't be function and we can skip the hash lookup drop out. */ … … 268 268 269 269 /* Look up a function by name. */ 270 #if defined(__GNUC__) || defined(_MSC_VER)271 270 __inline 272 #endif 271 #endif /* CONFIG_WITH_OPTIMIZATION_HACKS */ 273 272 static const struct function_table_entry * 274 273 lookup_function (const char *s) 275 274 { 276 275 const char *e = s; 277 #ifdef MAX_FUNCTION_LENGTH276 #ifdef CONFIG_WITH_OPTIMIZATION_HACKS 278 277 int left = MAX_FUNCTION_LENGTH; 279 278 int ch; … … 2437 2436 hash_load (&function_table, function_table_init, 2438 2437 FUNCTION_TABLE_ENTRIES, sizeof (struct function_table_entry)); 2439 #ifdef MAX_FUNCTION_LENGTH /* bird */2438 #ifdef CONFIG_WITH_OPTIMIZATION_HACKS 2440 2439 { 2441 2440 unsigned i; -
trunk/src/gmake/hash.h
r503 r527 83 83 /* hash and comparison macros for case-sensitive string keys. */ 84 84 85 #if 085 #ifndef CONFIG_WITH_OPTIMIZATION_HACKS 86 86 #define STRING_HASH_1(KEY, RESULT) do { \ 87 87 unsigned char const *_key_ = (unsigned char const *) (KEY) - 1; \ … … 89 89 (RESULT) += (*_key_ << (_key_[1] & 0xf)); \ 90 90 } 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 { \ 93 93 unsigned char const *_key_ = (unsigned char const *) (KEY); \ 94 94 unsigned int _ch_ = *_key_; \ … … 100 100 } \ 101 101 } while (0) 102 #endif 102 #endif /* CONFIG_WITH_OPTIMIZATION_HACKS */ 103 103 #define return_STRING_HASH_1(KEY) do { \ 104 104 unsigned long _result_ = 0; \ … … 107 107 } while (0) 108 108 109 #if 0109 #ifndef CONFIG_WITH_OPTIMIZATION_HACKS 110 110 #define STRING_HASH_2(KEY, RESULT) do { \ 111 111 unsigned char const *_key_ = (unsigned char const *) (KEY) - 1; \ … … 113 113 (RESULT) += (*_key_ << (_key_[1] & 0x7)); \ 114 114 } 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 { \ 117 117 unsigned char const *_key_ = (unsigned char const *) (KEY); \ 118 118 unsigned int _ch_ = *_key_; \ … … 124 124 } \ 125 125 } while (0) 126 #endif 126 #endif /* CONFIG_WITH_OPTIMIZATION_HACKS */ 127 127 #define return_STRING_HASH_2(KEY) do { \ 128 128 unsigned long _result_ = 0; \ … … 138 138 } while (0) 139 139 140 #if 0141 #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 { \ 142 142 unsigned char const *_key_ = (unsigned char const *) (KEY) - 1; \ 143 143 int _n_ = (N); \ … … 147 147 (RESULT) += *++_key_; \ 148 148 } 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 { \ 151 151 unsigned char const *_key_ = (unsigned char const *) (KEY); \ 152 152 unsigned int _ch_ = *_key_; \ … … 171 171 (RESULT) += _ch_; \ 172 172 } while (0) 173 #endif 173 #endif /* CONFIG_WITH_OPTIMIZATION_HACKS */ 174 174 #define return_STRING_N_HASH_1(KEY, N) do { \ 175 175 unsigned long _result_ = 0; \ … … 178 178 } while (0) 179 179 180 #if 0180 #ifndef CONFIG_WITH_OPTIMIZATION_HACKS 181 181 #define STRING_N_HASH_2(KEY, N, RESULT) do { \ 182 182 unsigned char const *_key_ = (unsigned char const *) (KEY) - 1; \ … … 187 187 (RESULT) += *++_key_; \ 188 188 } 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 { \ 191 191 unsigned char const *_key_ = (unsigned char const *) (KEY); \ 192 192 unsigned int _ch_ = *_key_; \ … … 211 211 (RESULT) += _ch_; \ 212 212 } while (0) 213 #endif 213 #endif /* CONFIG_WITH_OPTIMIZATION_HACKS */ 214 214 #define return_STRING_N_HASH_2(KEY, N) do { \ 215 215 unsigned long _result_ = 0; \ … … 229 229 /* hash and comparison macros for case-insensitive string _key_s. */ 230 230 231 #if 1 /* testme */231 #if 1 /*ndef CONFIG_WITH_OPTIMIZATION_HACKS - testme */ 232 232 #define ISTRING_HASH_1(KEY, RESULT) do { \ 233 233 unsigned char const *_key_ = (unsigned char const *) (KEY) - 1; \ … … 235 235 (RESULT) += ((isupper (*_key_) ? tolower (*_key_) : *_key_) << (_key_[1] & 0xf)); \ 236 236 } while (0) 237 #else 237 #else /* CONFIG_WITH_OPTIMIZATION_HACKS */ 238 238 #define ISTRING_HASH_1(KEY, RESULT) do { \ 239 239 unsigned char const *_key_ = (unsigned char const *) (KEY); \ … … 246 246 } \ 247 247 } while (0) 248 #endif 248 #endif /* CONFIG_WITH_OPTIMIZATION_HACKS */ 249 249 #define return_ISTRING_HASH_1(KEY) do { \ 250 250 unsigned long _result_ = 0; \ … … 253 253 } while (0) 254 254 255 #if 1 /* testme */255 #if 1 /* ndef CONFIG_WITH_OPTIMIZATION_HACKS - testme */ 256 256 #define ISTRING_HASH_2(KEY, RESULT) do { \ 257 257 unsigned char const *_key_ = (unsigned char const *) (KEY) - 1; \ … … 259 259 (RESULT) += ((isupper (*_key_) ? tolower (*_key_) : *_key_) << (_key_[1] & 0x7)); \ 260 260 } while (0) 261 #else 261 #else /* CONFIG_WITH_OPTIMIZATION_HACKS */ 262 262 #define ISTRING_HASH_2(KEY, RESULT) do { \ 263 263 unsigned char const *_key_ = (unsigned char const *) (KEY); \ … … 270 270 } \ 271 271 } while (0) 272 #endif 272 #endif /* CONFIG_WITH_OPTIMIZATION_HACKS */ 273 273 #define return_ISTRING_HASH_2(KEY) do { \ 274 274 unsigned long _result_ = 0; \ -
trunk/src/gmake/make.h
r520 r527 425 425 extern char *end_of_token PARAMS ((const char *)); 426 426 extern 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. */ 428 428 #define lindex(s, limit, c) ((char *)memchr((s), (c), (limit) - (s))) 429 429 #else … … 615 615 while (((_v)=_c)==0 && errno==EINTR); }while(0) 616 616 617 #if def __EMX__/* bird: saves 40-100ms on libc. */617 #if defined(__EMX__) && defined(CONFIG_WITH_OPTIMIZATION_HACKS) /* bird: saves 40-100ms on libc. */ 618 618 #undef strchr 619 619 #define strchr(s, c) \ -
trunk/src/gmake/misc.c
r520 r527 21 21 #include "debug.h" 22 22 23 #if def __EMX__/* bird: saves 5-10ms on libc */23 #if defined(__EMX__) && defined(CONFIG_WITH_OPTIMIZATION_HACKS) /* bird: saves 5-10ms on libc */ 24 24 # define bcopy(src, dst, size) __builtin_memcpy((dst), (src), (size)) 25 25 #endif … … 406 406 407 407 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 410 411 /* Limited INDEX: 411 412 Search through the string STRING, which ends at LIMIT, for the character C. … … 423 424 return 0; 424 425 } 425 #endif 426 #endif /* CONFIG_WITH_OPTIMIZATION_HACKS */ 426 427 427 428 -
trunk/src/gmake/variable.c
r526 r527 104 104 /* Hash table of all global variable definitions. */ 105 105 106 #ifdef KMK106 #ifdef CONFIG_WITH_OPTIMIZATION_HACKS 107 107 # ifdef _MSC_VER 108 108 # define inline _inline … … 156 156 } 157 157 } 158 #endif /* KMK*/158 #endif /* CONFIG_WITH_OPTIMIZATION_HACKS */ 159 159 160 160 static unsigned long … … 171 171 return key->hash1; 172 172 #else 173 # ifdef KMK173 # ifdef CONFIG_WITH_OPTIMIZATION_HACKS 174 174 return variable_hash_1i (key->name, key->length); 175 175 # else … … 189 189 #else 190 190 struct variable const *key = (struct variable const *) keyv; 191 # ifdef KMK191 # ifdef CONFIG_WITH_OPTIMIZATION_HACKS 192 192 return variable_hash_2i (key->name, key->length); 193 193 # else … … 221 221 return result; 222 222 #endif 223 #ifdef KMK/* bird: speed */223 #ifdef CONFIG_WITH_OPTIMIZATION_HACKS /* bird: speed */ 224 224 { 225 225 const char *xs = x->name; … … 259 259 } 260 260 } 261 #endif /* KMK*/261 #endif /* CONFIG_WITH_OPTIMIZATION_HACKS */ 262 262 #ifdef VARIABLE_HASH 263 263 /* hash 2 */ … … 270 270 return result; 271 271 #endif 272 #ifdef KMK272 #ifdef CONFIG_WITH_OPTIMIZATION_HACKS 273 273 return memcmp (x->name, y->name, x->length); 274 274 #else … … 299 299 { 300 300 hash_init (&global_variable_set.table, 301 #ifdef KMK 301 #ifdef KMK /* FIMXE: just redefine the bucket size! */ 302 302 16384, 303 303 #else -
trunk/src/gmake/vpath.c
r503 r527 62 62 register struct vpath *old, *nexto; 63 63 register char *p; 64 #ifdef CONFIG_WITH_OPTIMIZATION_HACKS 65 char expr[64]; 66 #endif 64 67 65 68 /* Reverse the chain. */ … … 81 84 int save = warn_undefined_variables_flag; 82 85 warn_undefined_variables_flag = 0; 83 86 #ifdef CONFIG_WITH_OPTIMIZATION_HACKS 87 p = variable_expand (strcpy (expr, "$(strip $(VPATH))")); 88 #else 84 89 p = variable_expand ("$(strip $(VPATH))"); 90 #endif 85 91 86 92 warn_undefined_variables_flag = save; … … 114 120 warn_undefined_variables_flag = 0; 115 121 122 #ifdef CONFIG_WITH_OPTIMIZATION_HACKS 123 p = variable_expand (strcpy (expr, "$(strip $(GPATH))")); 124 #else 116 125 p = variable_expand ("$(strip $(GPATH))"); 126 #endif 117 127 118 128 warn_undefined_variables_flag = save;
Note:
See TracChangeset
for help on using the changeset viewer.