Change array sorting implementation to avoid two level callbacks system.

Simplify zval comparion API.
This commit is contained in:
Dmitry Stogov 2015-09-10 02:51:23 +03:00
parent 2ea18cd431
commit c174e4cd73
8 changed files with 673 additions and 289 deletions

View file

@ -1662,92 +1662,88 @@ ZEND_API int ZEND_FASTCALL concat_function(zval *result, zval *op1, zval *op2) /
} }
/* }}} */ /* }}} */
ZEND_API int string_compare_function_ex(zval *result, zval *op1, zval *op2, zend_bool case_insensitive) /* {{{ */ ZEND_API int ZEND_FASTCALL string_compare_function_ex(zval *op1, zval *op2, zend_bool case_insensitive) /* {{{ */
{ {
zend_string *str1 = zval_get_string(op1); zend_string *str1 = zval_get_string(op1);
zend_string *str2 = zval_get_string(op2); zend_string *str2 = zval_get_string(op2);
int ret;
if (case_insensitive) { if (case_insensitive) {
ZVAL_LONG(result, zend_binary_strcasecmp_l(ZSTR_VAL(str1), ZSTR_LEN(str1), ZSTR_VAL(str2), ZSTR_LEN(str1))); ret = zend_binary_strcasecmp_l(ZSTR_VAL(str1), ZSTR_LEN(str1), ZSTR_VAL(str2), ZSTR_LEN(str1));
} else { } else {
ZVAL_LONG(result, zend_binary_strcmp(ZSTR_VAL(str1), ZSTR_LEN(str1), ZSTR_VAL(str2), ZSTR_LEN(str2))); ret = zend_binary_strcmp(ZSTR_VAL(str1), ZSTR_LEN(str1), ZSTR_VAL(str2), ZSTR_LEN(str2));
} }
zend_string_release(str1); zend_string_release(str1);
zend_string_release(str2); zend_string_release(str2);
return SUCCESS; return ret;
} }
/* }}} */ /* }}} */
ZEND_API int string_compare_function(zval *result, zval *op1, zval *op2) /* {{{ */ ZEND_API int ZEND_FASTCALL string_compare_function(zval *op1, zval *op2) /* {{{ */
{ {
if (EXPECTED(Z_TYPE_P(op1) == IS_STRING) && if (EXPECTED(Z_TYPE_P(op1) == IS_STRING) &&
EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { EXPECTED(Z_TYPE_P(op2) == IS_STRING)) {
if (Z_STR_P(op1) == Z_STR_P(op2)) { if (Z_STR_P(op1) == Z_STR_P(op2)) {
ZVAL_LONG(result, 0); return 0;
} else { } else {
ZVAL_LONG(result, zend_binary_strcmp(Z_STRVAL_P(op1), Z_STRLEN_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op2))); return zend_binary_strcmp(Z_STRVAL_P(op1), Z_STRLEN_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op2));
} }
} else { } else {
zend_string *str1 = zval_get_string(op1); zend_string *str1 = zval_get_string(op1);
zend_string *str2 = zval_get_string(op2); zend_string *str2 = zval_get_string(op2);
int ret = zend_binary_strcmp(ZSTR_VAL(str1), ZSTR_LEN(str1), ZSTR_VAL(str2), ZSTR_LEN(str2));
ZVAL_LONG(result, zend_binary_strcmp(ZSTR_VAL(str1), ZSTR_LEN(str1), ZSTR_VAL(str2), ZSTR_LEN(str2)));
zend_string_release(str1); zend_string_release(str1);
zend_string_release(str2); zend_string_release(str2);
return ret;
} }
return SUCCESS;
} }
/* }}} */ /* }}} */
ZEND_API int string_case_compare_function(zval *result, zval *op1, zval *op2) /* {{{ */ ZEND_API int ZEND_FASTCALL string_case_compare_function(zval *op1, zval *op2) /* {{{ */
{ {
if (EXPECTED(Z_TYPE_P(op1) == IS_STRING) && if (EXPECTED(Z_TYPE_P(op1) == IS_STRING) &&
EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { EXPECTED(Z_TYPE_P(op2) == IS_STRING)) {
if (Z_STR_P(op1) == Z_STR_P(op2)) { if (Z_STR_P(op1) == Z_STR_P(op2)) {
ZVAL_LONG(result, 0); return 0;
} else { } else {
ZVAL_LONG(result, zend_binary_strcasecmp_l(Z_STRVAL_P(op1), Z_STRLEN_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op2))); return zend_binary_strcasecmp_l(Z_STRVAL_P(op1), Z_STRLEN_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op2));
} }
} else { } else {
zend_string *str1 = zval_get_string(op1); zend_string *str1 = zval_get_string(op1);
zend_string *str2 = zval_get_string(op2); zend_string *str2 = zval_get_string(op2);
int ret = zend_binary_strcasecmp_l(ZSTR_VAL(str1), ZSTR_LEN(str1), ZSTR_VAL(str2), ZSTR_LEN(str1));
ZVAL_LONG(result, zend_binary_strcasecmp_l(ZSTR_VAL(str1), ZSTR_LEN(str1), ZSTR_VAL(str2), ZSTR_LEN(str1)));
zend_string_release(str1); zend_string_release(str1);
zend_string_release(str2); zend_string_release(str2);
return ret;
} }
return SUCCESS;
} }
/* }}} */ /* }}} */
#if HAVE_STRCOLL #if HAVE_STRCOLL
ZEND_API int string_locale_compare_function(zval *result, zval *op1, zval *op2) /* {{{ */ ZEND_API int ZEND_FASTCALL string_locale_compare_function(zval *op1, zval *op2) /* {{{ */
{ {
zend_string *str1 = zval_get_string(op1); zend_string *str1 = zval_get_string(op1);
zend_string *str2 = zval_get_string(op2); zend_string *str2 = zval_get_string(op2);
int ret = strcoll(ZSTR_VAL(str1), ZSTR_VAL(str2));
ZVAL_LONG(result, strcoll(ZSTR_VAL(str1), ZSTR_VAL(str2)));
zend_string_release(str1); zend_string_release(str1);
zend_string_release(str2); zend_string_release(str2);
return SUCCESS; return ret;
} }
/* }}} */ /* }}} */
#endif #endif
ZEND_API int numeric_compare_function(zval *result, zval *op1, zval *op2) /* {{{ */ ZEND_API int ZEND_FASTCALL numeric_compare_function(zval *op1, zval *op2) /* {{{ */
{ {
double d1, d2; double d1, d2;
d1 = zval_get_double(op1); d1 = zval_get_double(op1);
d2 = zval_get_double(op2); d2 = zval_get_double(op2);
ZVAL_LONG(result, ZEND_NORMALIZE_BOOL(d1 - d2)); return ZEND_NORMALIZE_BOOL(d1 - d2);
return SUCCESS;
} }
/* }}} */ /* }}} */
@ -1763,7 +1759,7 @@ static inline void zend_free_obj_get_result(zval *op) /* {{{ */
} }
/* }}} */ /* }}} */
static int ZEND_FASTCALL convert_compare_result_to_long(zval *result) static void ZEND_FASTCALL convert_compare_result_to_long(zval *result)
{ {
if (Z_TYPE_P(result) == IS_DOUBLE) { if (Z_TYPE_P(result) == IS_DOUBLE) {
ZVAL_LONG(result, ZEND_NORMALIZE_BOOL(Z_DVAL_P(result))); ZVAL_LONG(result, ZEND_NORMALIZE_BOOL(Z_DVAL_P(result)));
@ -1829,7 +1825,7 @@ ZEND_API int ZEND_FASTCALL compare_function(zval *result, zval *op1, zval *op2)
ZVAL_LONG(result, 0); ZVAL_LONG(result, 0);
return SUCCESS; return SUCCESS;
} }
ZVAL_LONG(result, zendi_smart_strcmp(op1, op2)); ZVAL_LONG(result, zendi_smart_strcmp(Z_STR_P(op1), Z_STR_P(op2)));
return SUCCESS; return SUCCESS;
case TYPE_PAIR(IS_NULL, IS_STRING): case TYPE_PAIR(IS_NULL, IS_STRING):
@ -1962,15 +1958,6 @@ ZEND_API int ZEND_FASTCALL compare_function(zval *result, zval *op1, zval *op2)
} }
/* }}} */ /* }}} */
ZEND_API int zval_compare_function(zval *result, zval *op1, zval *op2) /* {{{ */
{
int ret = compare_function(result, op1, op2);
ZEND_ASSERT(Z_TYPE_P(result) == IS_LONG);
return ret;
}
/* }}} */
static int hash_zval_identical_function(zval *z1, zval *z2) /* {{{ */ static int hash_zval_identical_function(zval *z1, zval *z2) /* {{{ */
{ {
zval result; zval result;
@ -2644,15 +2631,15 @@ ZEND_API int ZEND_FASTCALL zend_binary_zval_strncasecmp(zval *s1, zval *s2, zval
} }
/* }}} */ /* }}} */
ZEND_API zend_long ZEND_FASTCALL zendi_smart_strcmp(zval *s1, zval *s2) /* {{{ */ ZEND_API zend_long ZEND_FASTCALL zendi_smart_strcmp(zend_string *s1, zend_string *s2) /* {{{ */
{ {
int ret1, ret2; int ret1, ret2;
int oflow1, oflow2; int oflow1, oflow2;
zend_long lval1 = 0, lval2 = 0; zend_long lval1 = 0, lval2 = 0;
double dval1 = 0.0, dval2 = 0.0; double dval1 = 0.0, dval2 = 0.0;
if ((ret1 = is_numeric_string_ex(Z_STRVAL_P(s1), Z_STRLEN_P(s1), &lval1, &dval1, 0, &oflow1)) && if ((ret1 = is_numeric_string_ex(s1->val, s1->len, &lval1, &dval1, 0, &oflow1)) &&
(ret2 = is_numeric_string_ex(Z_STRVAL_P(s2), Z_STRLEN_P(s2), &lval2, &dval2, 0, &oflow2))) { (ret2 = is_numeric_string_ex(s2->val, s2->len, &lval2, &dval2, 0, &oflow2))) {
#if ZEND_ULONG_MAX == 0xFFFFFFFF #if ZEND_ULONG_MAX == 0xFFFFFFFF
if (oflow1 != 0 && oflow1 == oflow2 && dval1 - dval2 == 0. && if (oflow1 != 0 && oflow1 == oflow2 && dval1 - dval2 == 0. &&
((oflow1 == 1 && dval1 > 9007199254740991. /*0x1FFFFFFFFFFFFF*/) ((oflow1 == 1 && dval1 > 9007199254740991. /*0x1FFFFFFFFFFFFF*/)
@ -2689,7 +2676,7 @@ ZEND_API zend_long ZEND_FASTCALL zendi_smart_strcmp(zval *s1, zval *s2) /* {{{ *
} else { } else {
int strcmp_ret; int strcmp_ret;
string_cmp: string_cmp:
strcmp_ret = zend_binary_strcmp(Z_STRVAL_P(s1), Z_STRLEN_P(s1), Z_STRVAL_P(s2), Z_STRLEN_P(s2)); strcmp_ret = zend_binary_strcmp(s1->val, s1->len, s2->val, s2->len);
return ZEND_NORMALIZE_BOOL(strcmp_ret); return ZEND_NORMALIZE_BOOL(strcmp_ret);
} }
} }

View file

@ -329,13 +329,13 @@ again:
} }
ZEND_API int ZEND_FASTCALL compare_function(zval *result, zval *op1, zval *op2); ZEND_API int ZEND_FASTCALL compare_function(zval *result, zval *op1, zval *op2);
ZEND_API int zval_compare_function(zval *result, zval *op1, zval *op2);
ZEND_API int numeric_compare_function(zval *result, zval *op1, zval *op2); ZEND_API int ZEND_FASTCALL numeric_compare_function(zval *op1, zval *op2);
ZEND_API int string_compare_function_ex(zval *result, zval *op1, zval *op2, zend_bool case_insensitive); ZEND_API int ZEND_FASTCALL string_compare_function_ex(zval *op1, zval *op2, zend_bool case_insensitive);
ZEND_API int string_compare_function(zval *result, zval *op1, zval *op2); ZEND_API int ZEND_FASTCALL string_compare_function(zval *op1, zval *op2);
ZEND_API int string_case_compare_function(zval *result, zval *op1, zval *op2); ZEND_API int ZEND_FASTCALL string_case_compare_function(zval *op1, zval *op2);
#if HAVE_STRCOLL #if HAVE_STRCOLL
ZEND_API int string_locale_compare_function(zval *result, zval *op1, zval *op2); ZEND_API int ZEND_FASTCALL string_locale_compare_function(zval *op1, zval *op2);
#endif #endif
ZEND_API void ZEND_FASTCALL zend_str_tolower(char *str, size_t length); ZEND_API void ZEND_FASTCALL zend_str_tolower(char *str, size_t length);
@ -355,7 +355,7 @@ ZEND_API int ZEND_FASTCALL zend_binary_strncasecmp(const char *s1, size_t len1,
ZEND_API int ZEND_FASTCALL zend_binary_strcasecmp_l(const char *s1, size_t len1, const char *s2, size_t len2); ZEND_API int ZEND_FASTCALL zend_binary_strcasecmp_l(const char *s1, size_t len1, const char *s2, size_t len2);
ZEND_API int ZEND_FASTCALL zend_binary_strncasecmp_l(const char *s1, size_t len1, const char *s2, size_t len2, size_t length); ZEND_API int ZEND_FASTCALL zend_binary_strncasecmp_l(const char *s1, size_t len1, const char *s2, size_t len2, size_t length);
ZEND_API zend_long ZEND_FASTCALL zendi_smart_strcmp(zval *s1, zval *s2); ZEND_API zend_long ZEND_FASTCALL zendi_smart_strcmp(zend_string *s1, zend_string *s2);
ZEND_API int ZEND_FASTCALL zend_compare_symbol_tables(HashTable *ht1, HashTable *ht2); ZEND_API int ZEND_FASTCALL zend_compare_symbol_tables(HashTable *ht1, HashTable *ht2);
ZEND_API int ZEND_FASTCALL zend_compare_arrays(zval *a1, zval *a2); ZEND_API int ZEND_FASTCALL zend_compare_arrays(zval *a1, zval *a2);
ZEND_API int ZEND_FASTCALL zend_compare_objects(zval *o1, zval *o2); ZEND_API int ZEND_FASTCALL zend_compare_objects(zval *o1, zval *o2);
@ -692,7 +692,7 @@ static zend_always_inline int fast_equal_check_function(zval *op1, zval *op2)
return memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0; return memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0;
} }
} else { } else {
return zendi_smart_strcmp(op1, op2) == 0; return zendi_smart_strcmp(Z_STR_P(op1), Z_STR_P(op2)) == 0;
} }
} }
} }
@ -723,7 +723,7 @@ static zend_always_inline int fast_equal_check_string(zval *op1, zval *op2)
return memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0; return memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0;
} }
} else { } else {
return zendi_smart_strcmp(op1, op2) == 0; return zendi_smart_strcmp(Z_STR_P(op1), Z_STR_P(op2)) == 0;
} }
} }
compare_function(&result, op1, op2); compare_function(&result, op1, op2);

View file

@ -380,7 +380,7 @@ ZEND_VM_HANDLER(17, ZEND_IS_EQUAL, CONST|TMPVAR|CV, CONST|TMPVAR|CV)
result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0); result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0);
} }
} else { } else {
result = (zendi_smart_strcmp(op1, op2) == 0); result = (zendi_smart_strcmp(Z_STR_P(op1), Z_STR_P(op2)) == 0);
} }
FREE_OP1(); FREE_OP1();
FREE_OP2(); FREE_OP2();
@ -448,7 +448,7 @@ ZEND_VM_HANDLER(18, ZEND_IS_NOT_EQUAL, CONST|TMPVAR|CV, CONST|TMPVAR|CV)
result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) != 0); result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) != 0);
} }
} else { } else {
result = (zendi_smart_strcmp(op1, op2) != 0); result = (zendi_smart_strcmp(Z_STR_P(op1), Z_STR_P(op2)) != 0);
} }
FREE_OP1(); FREE_OP1();
FREE_OP2(); FREE_OP2();
@ -4832,7 +4832,7 @@ ZEND_VM_HANDLER(48, ZEND_CASE, CONST|TMPVAR|CV, CONST|TMPVAR|CV)
result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0); result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0);
} }
} else { } else {
result = (zendi_smart_strcmp(op1, op2) == 0); result = (zendi_smart_strcmp(Z_STR_P(op1), Z_STR_P(op2)) == 0);
} }
FREE_OP2(); FREE_OP2();
} else { } else {

View file

@ -4635,7 +4635,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CONST_CONST_HAND
result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0); result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0);
} }
} else { } else {
result = (zendi_smart_strcmp(op1, op2) == 0); result = (zendi_smart_strcmp(Z_STR_P(op1), Z_STR_P(op2)) == 0);
} }
@ -4703,7 +4703,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CONST_CONST_
result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) != 0); result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) != 0);
} }
} else { } else {
result = (zendi_smart_strcmp(op1, op2) != 0); result = (zendi_smart_strcmp(Z_STR_P(op1), Z_STR_P(op2)) != 0);
} }
@ -5805,7 +5805,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CASE_SPEC_CONST_CONST_HANDLER(
result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0); result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0);
} }
} else { } else {
result = (zendi_smart_strcmp(op1, op2) == 0); result = (zendi_smart_strcmp(Z_STR_P(op1), Z_STR_P(op2)) == 0);
} }
} else { } else {
@ -8572,7 +8572,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CONST_CV_HANDLER
result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0); result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0);
} }
} else { } else {
result = (zendi_smart_strcmp(op1, op2) == 0); result = (zendi_smart_strcmp(Z_STR_P(op1), Z_STR_P(op2)) == 0);
} }
@ -8640,7 +8640,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CONST_CV_HAN
result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) != 0); result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) != 0);
} }
} else { } else {
result = (zendi_smart_strcmp(op1, op2) != 0); result = (zendi_smart_strcmp(Z_STR_P(op1), Z_STR_P(op2)) != 0);
} }
@ -9567,7 +9567,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CASE_SPEC_CONST_CV_HANDLER(ZEN
result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0); result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0);
} }
} else { } else {
result = (zendi_smart_strcmp(op1, op2) == 0); result = (zendi_smart_strcmp(Z_STR_P(op1), Z_STR_P(op2)) == 0);
} }
} else { } else {
@ -10377,7 +10377,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CONST_TMPVAR_HAN
result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0); result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0);
} }
} else { } else {
result = (zendi_smart_strcmp(op1, op2) == 0); result = (zendi_smart_strcmp(Z_STR_P(op1), Z_STR_P(op2)) == 0);
} }
zval_ptr_dtor_nogc(free_op2); zval_ptr_dtor_nogc(free_op2);
@ -10445,7 +10445,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CONST_TMPVAR
result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) != 0); result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) != 0);
} }
} else { } else {
result = (zendi_smart_strcmp(op1, op2) != 0); result = (zendi_smart_strcmp(Z_STR_P(op1), Z_STR_P(op2)) != 0);
} }
zval_ptr_dtor_nogc(free_op2); zval_ptr_dtor_nogc(free_op2);
@ -11326,7 +11326,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CASE_SPEC_CONST_TMPVAR_HANDLER
result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0); result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0);
} }
} else { } else {
result = (zendi_smart_strcmp(op1, op2) == 0); result = (zendi_smart_strcmp(Z_STR_P(op1), Z_STR_P(op2)) == 0);
} }
zval_ptr_dtor_nogc(free_op2); zval_ptr_dtor_nogc(free_op2);
} else { } else {
@ -29972,7 +29972,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_CONST_HANDLER
result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0); result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0);
} }
} else { } else {
result = (zendi_smart_strcmp(op1, op2) == 0); result = (zendi_smart_strcmp(Z_STR_P(op1), Z_STR_P(op2)) == 0);
} }
@ -30040,7 +30040,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_CONST_HAN
result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) != 0); result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) != 0);
} }
} else { } else {
result = (zendi_smart_strcmp(op1, op2) != 0); result = (zendi_smart_strcmp(Z_STR_P(op1), Z_STR_P(op2)) != 0);
} }
@ -31820,7 +31820,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CASE_SPEC_CV_CONST_HANDLER(ZEN
result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0); result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0);
} }
} else { } else {
result = (zendi_smart_strcmp(op1, op2) == 0); result = (zendi_smart_strcmp(Z_STR_P(op1), Z_STR_P(op2)) == 0);
} }
} else { } else {
@ -35168,7 +35168,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_CV_HANDLER(ZE
result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0); result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0);
} }
} else { } else {
result = (zendi_smart_strcmp(op1, op2) == 0); result = (zendi_smart_strcmp(Z_STR_P(op1), Z_STR_P(op2)) == 0);
} }
@ -35236,7 +35236,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_CV_HANDLE
result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) != 0); result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) != 0);
} }
} else { } else {
result = (zendi_smart_strcmp(op1, op2) != 0); result = (zendi_smart_strcmp(Z_STR_P(op1), Z_STR_P(op2)) != 0);
} }
@ -36849,7 +36849,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CASE_SPEC_CV_CV_HANDLER(ZEND_O
result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0); result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0);
} }
} else { } else {
result = (zendi_smart_strcmp(op1, op2) == 0); result = (zendi_smart_strcmp(Z_STR_P(op1), Z_STR_P(op2)) == 0);
} }
} else { } else {
@ -37805,7 +37805,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_TMPVAR_HANDLE
result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0); result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0);
} }
} else { } else {
result = (zendi_smart_strcmp(op1, op2) == 0); result = (zendi_smart_strcmp(Z_STR_P(op1), Z_STR_P(op2)) == 0);
} }
zval_ptr_dtor_nogc(free_op2); zval_ptr_dtor_nogc(free_op2);
@ -37873,7 +37873,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_TMPVAR_HA
result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) != 0); result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) != 0);
} }
} else { } else {
result = (zendi_smart_strcmp(op1, op2) != 0); result = (zendi_smart_strcmp(Z_STR_P(op1), Z_STR_P(op2)) != 0);
} }
zval_ptr_dtor_nogc(free_op2); zval_ptr_dtor_nogc(free_op2);
@ -39407,7 +39407,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CASE_SPEC_CV_TMPVAR_HANDLER(ZE
result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0); result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0);
} }
} else { } else {
result = (zendi_smart_strcmp(op1, op2) == 0); result = (zendi_smart_strcmp(Z_STR_P(op1), Z_STR_P(op2)) == 0);
} }
zval_ptr_dtor_nogc(free_op2); zval_ptr_dtor_nogc(free_op2);
} else { } else {
@ -40811,7 +40811,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_TMPVAR_CONST_HAN
result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0); result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0);
} }
} else { } else {
result = (zendi_smart_strcmp(op1, op2) == 0); result = (zendi_smart_strcmp(Z_STR_P(op1), Z_STR_P(op2)) == 0);
} }
zval_ptr_dtor_nogc(free_op1); zval_ptr_dtor_nogc(free_op1);
@ -40879,7 +40879,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_TMPVAR_CONST
result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) != 0); result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) != 0);
} }
} else { } else {
result = (zendi_smart_strcmp(op1, op2) != 0); result = (zendi_smart_strcmp(Z_STR_P(op1), Z_STR_P(op2)) != 0);
} }
zval_ptr_dtor_nogc(free_op1); zval_ptr_dtor_nogc(free_op1);
@ -41635,7 +41635,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CASE_SPEC_TMPVAR_CONST_HANDLER
result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0); result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0);
} }
} else { } else {
result = (zendi_smart_strcmp(op1, op2) == 0); result = (zendi_smart_strcmp(Z_STR_P(op1), Z_STR_P(op2)) == 0);
} }
} else { } else {
@ -43151,7 +43151,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_TMPVAR_CV_HANDLE
result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0); result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0);
} }
} else { } else {
result = (zendi_smart_strcmp(op1, op2) == 0); result = (zendi_smart_strcmp(Z_STR_P(op1), Z_STR_P(op2)) == 0);
} }
zval_ptr_dtor_nogc(free_op1); zval_ptr_dtor_nogc(free_op1);
@ -43219,7 +43219,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_TMPVAR_CV_HA
result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) != 0); result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) != 0);
} }
} else { } else {
result = (zendi_smart_strcmp(op1, op2) != 0); result = (zendi_smart_strcmp(Z_STR_P(op1), Z_STR_P(op2)) != 0);
} }
zval_ptr_dtor_nogc(free_op1); zval_ptr_dtor_nogc(free_op1);
@ -43749,7 +43749,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CASE_SPEC_TMPVAR_CV_HANDLER(ZE
result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0); result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0);
} }
} else { } else {
result = (zendi_smart_strcmp(op1, op2) == 0); result = (zendi_smart_strcmp(Z_STR_P(op1), Z_STR_P(op2)) == 0);
} }
} else { } else {
@ -44288,7 +44288,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_TMPVAR_TMPVAR_HA
result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0); result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0);
} }
} else { } else {
result = (zendi_smart_strcmp(op1, op2) == 0); result = (zendi_smart_strcmp(Z_STR_P(op1), Z_STR_P(op2)) == 0);
} }
zval_ptr_dtor_nogc(free_op1); zval_ptr_dtor_nogc(free_op1);
zval_ptr_dtor_nogc(free_op2); zval_ptr_dtor_nogc(free_op2);
@ -44356,7 +44356,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_TMPVAR_TMPVA
result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) != 0); result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) != 0);
} }
} else { } else {
result = (zendi_smart_strcmp(op1, op2) != 0); result = (zendi_smart_strcmp(Z_STR_P(op1), Z_STR_P(op2)) != 0);
} }
zval_ptr_dtor_nogc(free_op1); zval_ptr_dtor_nogc(free_op1);
zval_ptr_dtor_nogc(free_op2); zval_ptr_dtor_nogc(free_op2);
@ -44888,7 +44888,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CASE_SPEC_TMPVAR_TMPVAR_HANDLE
result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0); result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0);
} }
} else { } else {
result = (zendi_smart_strcmp(op1, op2) == 0); result = (zendi_smart_strcmp(Z_STR_P(op1), Z_STR_P(op2)) == 0);
} }
zval_ptr_dtor_nogc(free_op2); zval_ptr_dtor_nogc(free_op2);
} else { } else {

View file

@ -144,7 +144,6 @@ static int collator_regular_compare_function(zval *result, zval *op1, zval *op2)
*/ */
static int collator_numeric_compare_function(zval *result, zval *op1, zval *op2) static int collator_numeric_compare_function(zval *result, zval *op1, zval *op2)
{ {
int rc = SUCCESS;
zval num1, num2; zval num1, num2;
zval *num1_p = NULL; zval *num1_p = NULL;
zval *num2_p = NULL; zval *num2_p = NULL;
@ -161,14 +160,14 @@ static int collator_numeric_compare_function(zval *result, zval *op1, zval *op2)
op2 = num2_p; op2 = num2_p;
} }
rc = numeric_compare_function( result, op1, op2); ZVAL_LONG(result, numeric_compare_function(op1, op2));
if( num1_p ) if( num1_p )
zval_ptr_dtor( num1_p ); zval_ptr_dtor( num1_p );
if( num2_p ) if( num2_p )
zval_ptr_dtor( num2_p ); zval_ptr_dtor( num2_p );
return rc; return SUCCESS;
} }
/* }}} */ /* }}} */

File diff suppressed because it is too large Load diff

View file

@ -125,8 +125,7 @@ PHPAPI zend_long php_count_recursive(zval *array, zend_long mode);
#define ARRAY_FILTER_USE_KEY 2 #define ARRAY_FILTER_USE_KEY 2
ZEND_BEGIN_MODULE_GLOBALS(array) ZEND_BEGIN_MODULE_GLOBALS(array)
int *multisort_flags[2]; compare_func_t *multisort_func;
int (*compare_func)(zval *result, zval *op1, zval *op2);
ZEND_END_MODULE_GLOBALS(array) ZEND_END_MODULE_GLOBALS(array)
#define ARRAYG(v) ZEND_MODULE_GLOBALS_ACCESSOR(array, v) #define ARRAYG(v) ZEND_MODULE_GLOBALS_ACCESSOR(array, v)

View file

@ -50,7 +50,7 @@ typedef struct {
static int phpdbg_array_data_compare(const void *a, const void *b) { static int phpdbg_array_data_compare(const void *a, const void *b) {
Bucket *f, *s; Bucket *f, *s;
zval result; int result;
zval *first, *second; zval *first, *second;
f = *((Bucket **) a); f = *((Bucket **) a);
@ -59,13 +59,11 @@ static int phpdbg_array_data_compare(const void *a, const void *b) {
first = &f->val; first = &f->val;
second = &s->val; second = &s->val;
if (string_compare_function(&result, first, second) == FAILURE) { result = string_compare_function(first, second);
return 0;
}
if (Z_LVAL(result) < 0) { if (result < 0) {
return -1; return -1;
} else if (Z_LVAL(result) > 0) { } else if (result > 0) {
return 1; return 1;
} }