diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2019-06-20 16:24:31 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-06-20 16:24:31 +0200 |
commit | 6aaab9adf7619c121c19701022aeb8d88f9c3bab (patch) | |
tree | 531c292fdae6364f73f141759788a626888238d8 /Zend | |
parent | 50978128f50eb5fa5920aea8a19a5855059a87c7 (diff) | |
parent | 6165c23475d5020cda3794cb684693a7fab9918d (diff) | |
download | php-git-6aaab9adf7619c121c19701022aeb8d88f9c3bab.tar.gz |
Merge branch 'PHP-7.4'
Diffstat (limited to 'Zend')
-rw-r--r-- | Zend/zend_execute.c | 2 | ||||
-rw-r--r-- | Zend/zend_execute_API.c | 13 | ||||
-rw-r--r-- | Zend/zend_globals.h | 2 | ||||
-rw-r--r-- | Zend/zend_operators.c | 3 | ||||
-rw-r--r-- | Zend/zend_operators.h | 10 |
5 files changed, 18 insertions, 12 deletions
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index cc2c1a0c20..d25694be18 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -3347,7 +3347,7 @@ ZEND_API void zend_clean_and_cache_symbol_table(zend_array *symbol_table) /* {{{ /* clean before putting into the cache, since clean could call dtors, which could use cached hash */ zend_symtable_clean(symbol_table); - *(++EG(symtable_cache_ptr)) = symbol_table; + *(EG(symtable_cache_ptr)++) = symbol_table; } } /* }}} */ diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index a60883fb74..b5460dc51a 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -132,8 +132,8 @@ void init_executor(void) /* {{{ */ original_sigsegv_handler = signal(SIGSEGV, zend_handle_sigsegv); #endif - EG(symtable_cache_ptr) = EG(symtable_cache) - 1; - EG(symtable_cache_limit) = EG(symtable_cache) + SYMTABLE_CACHE_SIZE - 1; + EG(symtable_cache_ptr) = EG(symtable_cache); + EG(symtable_cache_limit) = EG(symtable_cache) + SYMTABLE_CACHE_SIZE; EG(no_extensions) = 0; EG(function_table) = CG(function_table); @@ -398,10 +398,10 @@ void shutdown_executor(void) /* {{{ */ zend_cleanup_internal_classes(); - while (EG(symtable_cache_ptr)>=EG(symtable_cache)) { + while (EG(symtable_cache_ptr) > EG(symtable_cache)) { + EG(symtable_cache_ptr)--; zend_hash_destroy(*EG(symtable_cache_ptr)); FREE_HASHTABLE(*EG(symtable_cache_ptr)); - EG(symtable_cache_ptr)--; } zend_hash_destroy(&EG(included_files)); @@ -1416,9 +1416,8 @@ ZEND_API zend_array *zend_rebuild_symbol_table(void) /* {{{ */ } ZEND_ADD_CALL_FLAG(ex, ZEND_CALL_HAS_SYMBOL_TABLE); - if (EG(symtable_cache_ptr) >= EG(symtable_cache)) { - /*printf("Cache hit! Reusing %x\n", symtable_cache[symtable_cache_ptr]);*/ - symbol_table = ex->symbol_table = *(EG(symtable_cache_ptr)--); + if (EG(symtable_cache_ptr) > EG(symtable_cache)) { + symbol_table = ex->symbol_table = *(--EG(symtable_cache_ptr)); if (!ex->func->op_array.last_var) { return symbol_table; } diff --git a/Zend/zend_globals.h b/Zend/zend_globals.h index 27ea9d4a8e..281450f3fe 100644 --- a/Zend/zend_globals.h +++ b/Zend/zend_globals.h @@ -136,7 +136,9 @@ struct _zend_executor_globals { /* symbol table cache */ zend_array *symtable_cache[SYMTABLE_CACHE_SIZE]; + /* Pointer to one past the end of the symtable_cache */ zend_array **symtable_cache_limit; + /* Pointer to first unused symtable_cache slot */ zend_array **symtable_cache_ptr; zend_array symbol_table; /* main symbol table */ diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index 6b7d5d16ac..17e7434215 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -1238,6 +1238,9 @@ ZEND_API int ZEND_FASTCALL pow_function(zval *result, zval *op1, zval *op2) /* { } /* }}} */ +#ifdef __clang__ +__attribute__((no_sanitize("float-divide-by-zero"))) +#endif ZEND_API int ZEND_FASTCALL div_function(zval *result, zval *op1, zval *op2) /* {{{ */ { zval op1_copy, op2_copy; diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index 5fe7ed6608..59693e00bc 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -225,10 +225,12 @@ zend_memnrstr(const char *haystack, const char *needle, size_t needle_len, const p -= needle_len; do { - if ((p = (const char *)zend_memrchr(haystack, *needle, (p - haystack) + 1)) && ne == p[needle_len-1]) { - if (!memcmp(needle + 1, p + 1, needle_len - 2)) { - return p; - } + p = (const char *)zend_memrchr(haystack, *needle, (p - haystack) + 1); + if (!p) { + return NULL; + } + if (ne == p[needle_len-1] && !memcmp(needle + 1, p + 1, needle_len - 2)) { + return p; } } while (p-- >= haystack); |