Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions Zend/Zend.m4
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ AX_CHECK_COMPILE_FLAG([-fno-common],
[CFLAGS="-fno-common $CFLAGS"])

ZEND_CHECK_ALIGNMENT
ZEND_CHECK_INT64
ZEND_CHECK_SIGNALS
ZEND_CHECK_MAX_EXECUTION_TIMERS
])
Expand Down Expand Up @@ -414,6 +415,43 @@ AS_VAR_IF([php_cv_align_mm], [failed],
])
])

dnl
dnl ZEND_CHECK_INT64
dnl
dnl Check whether to enable 64 bit integer if supported by the system.
dnl
AC_DEFUN([ZEND_CHECK_INT64], [dnl
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[]],
[[
#if !(defined(__x86_64__) || defined(__LP64__) || defined(_LP64) || defined(_WIN64))
#error "Not a 64-bit platform"
#endif
]]
)],
[ZEND_INT64=yes],
[ZEND_INT64=no])

AC_ARG_ENABLE([zend-int64],
[AS_HELP_STRING([--enable-zend-int64], [Enable 64bit integer support (enabled by default on 64bit arch)])],
[ZEND_INT64=$enableval],
[ZEND_INT64=$ZEND_INT64])

AS_VAR_IF([ZEND_INT64], [yes],
AC_CHECK_TYPE([int64_t],,
[AC_MSG_ERROR([int64_t not found])],
[#include <stdint.h>]))

AS_VAR_IF([ZEND_INT64], [yes],
[AC_DEFINE([ZEND_INT64], [1],
[Define to 1 if zend_long as int64 is supported and enabled.])
AS_VAR_APPEND([CFLAGS], [" -DZEND_INT64"])])

AC_MSG_CHECKING([whether to enable 64 bit integer support])
AC_MSG_RESULT([$ZEND_INT64])
])

dnl
dnl ZEND_CHECK_SIGNALS
dnl
Expand Down
30 changes: 15 additions & 15 deletions Zend/zend_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ static size_t _real_page_size = ZEND_MM_PAGE_SIZE;
#endif

typedef uint32_t zend_mm_page_info; /* 4-byte integer */
typedef zend_ulong zend_mm_bitset; /* 4-byte or 8-byte integer */
typedef size_t zend_mm_bitset; /* 4-byte or 8-byte integer */

#define ZEND_MM_ALIGNED_OFFSET(size, alignment) \
(((size_t)(size)) & ((alignment) - 1))
Expand Down Expand Up @@ -571,7 +571,7 @@ static void *zend_mm_mmap(size_t size)
/* number of trailing set (1) bits */
ZEND_ATTRIBUTE_CONST static zend_always_inline int zend_mm_bitset_nts(zend_mm_bitset bitset)
{
#if (defined(__GNUC__) || __has_builtin(__builtin_ctzl)) && SIZEOF_ZEND_LONG == SIZEOF_LONG && defined(PHP_HAVE_BUILTIN_CTZL)
#if (defined(__GNUC__) || __has_builtin(__builtin_ctzl)) && SIZEOF_SIZE_T == SIZEOF_LONG && defined(PHP_HAVE_BUILTIN_CTZL)
return __builtin_ctzl(~bitset);
#elif (defined(__GNUC__) || __has_builtin(__builtin_ctzll)) && defined(PHP_HAVE_BUILTIN_CTZLL)
return __builtin_ctzll(~bitset);
Expand All @@ -594,7 +594,7 @@ ZEND_ATTRIBUTE_CONST static zend_always_inline int zend_mm_bitset_nts(zend_mm_bi
if (bitset == (zend_mm_bitset)-1) return ZEND_MM_BITSET_LEN;

n = 0;
#if SIZEOF_ZEND_LONG == 8
#if SIZEOF_SIZE_T == 8
if (sizeof(zend_mm_bitset) == 8) {
if ((bitset & 0xffffffff) == 0xffffffff) {n += 32; bitset = bitset >> Z_UL(32);}
}
Expand All @@ -614,12 +614,12 @@ static zend_always_inline int zend_mm_bitset_is_set(zend_mm_bitset *bitset, int

static zend_always_inline void zend_mm_bitset_set_bit(zend_mm_bitset *bitset, int bit)
{
bitset[bit / ZEND_MM_BITSET_LEN] |= (Z_UL(1) << (bit & (ZEND_MM_BITSET_LEN-1)));
bitset[bit / ZEND_MM_BITSET_LEN] |= ((zend_mm_bitset)1 << (bit & (ZEND_MM_BITSET_LEN-1)));
}

static zend_always_inline void zend_mm_bitset_reset_bit(zend_mm_bitset *bitset, int bit)
{
bitset[bit / ZEND_MM_BITSET_LEN] &= ~(Z_UL(1) << (bit & (ZEND_MM_BITSET_LEN-1)));
bitset[bit / ZEND_MM_BITSET_LEN] &= ~((zend_mm_bitset)1 << (bit & (ZEND_MM_BITSET_LEN-1)));
}

static zend_always_inline void zend_mm_bitset_set_range(zend_mm_bitset *bitset, int start, int len)
Expand Down Expand Up @@ -2082,7 +2082,7 @@ static zend_mm_heap *zend_mm_init(void)
#endif
zend_mm_init_key(heap);
#if ZEND_MM_LIMIT
heap->limit = (size_t)Z_L(-1) >> 1;
heap->limit = (size_t)-1 >> 1;
heap->overflow = 0;
#endif
#if ZEND_MM_CUSTOM
Expand Down Expand Up @@ -2334,7 +2334,7 @@ static void zend_mm_check_leaks(zend_mm_heap *heap)
repeated = zend_mm_find_leaks_huge(heap, list);
total += 1 + repeated;
if (repeated) {
zend_message_dispatcher(ZMSG_MEMORY_LEAK_REPEATED, (void *)(uintptr_t)repeated);
zend_message_dispatcher(ZMSG_MEMORY_LEAK_REPEATED, ZEND_ULONG2PTR(repeated));
}

heap->huge_list = list = list->next;
Expand Down Expand Up @@ -2373,7 +2373,7 @@ static void zend_mm_check_leaks(zend_mm_heap *heap)
zend_mm_find_leaks(heap, p, i + bin_pages[bin_num], &leak);
total += 1 + repeated;
if (repeated) {
zend_message_dispatcher(ZMSG_MEMORY_LEAK_REPEATED, (void *)(uintptr_t)repeated);
zend_message_dispatcher(ZMSG_MEMORY_LEAK_REPEATED, ZEND_ULONG2PTR(repeated));
}
}
dbg = (zend_mm_debug_info*)((char*)dbg + bin_data_size[bin_num]);
Expand All @@ -2399,7 +2399,7 @@ static void zend_mm_check_leaks(zend_mm_heap *heap)
repeated = zend_mm_find_leaks(heap, p, i + pages_count, &leak);
total += 1 + repeated;
if (repeated) {
zend_message_dispatcher(ZMSG_MEMORY_LEAK_REPEATED, (void *)(uintptr_t)repeated);
zend_message_dispatcher(ZMSG_MEMORY_LEAK_REPEATED, ZEND_ULONG2PTR(repeated));
}
i += pages_count;
}
Expand Down Expand Up @@ -2981,14 +2981,14 @@ static ZEND_COLD ZEND_NORETURN void zend_out_of_memory(void)
#if ZEND_MM_CUSTOM
static zend_always_inline void tracked_add(zend_mm_heap *heap, void *ptr, size_t size) {
zval size_zv;
zend_ulong h = ((uintptr_t) ptr) >> ZEND_MM_ALIGNMENT_LOG2;
ZEND_ASSERT((void *) (uintptr_t) (h << ZEND_MM_ALIGNMENT_LOG2) == ptr);
zend_ulong h = ZEND_PTR2ULONG(ptr) >> ZEND_MM_ALIGNMENT_LOG2;
ZEND_ASSERT(ZEND_ULONG2PTR(h << ZEND_MM_ALIGNMENT_LOG2) == ptr);
ZVAL_LONG(&size_zv, size);
zend_hash_index_add_new(heap->tracked_allocs, h, &size_zv);
}

static zend_always_inline zval *tracked_get_size_zv(zend_mm_heap *heap, void *ptr) {
zend_ulong h = ((uintptr_t) ptr) >> ZEND_MM_ALIGNMENT_LOG2;
zend_ulong h = ZEND_PTR2ULONG(ptr) >> ZEND_MM_ALIGNMENT_LOG2;
zval *size_zv = zend_hash_index_find(heap->tracked_allocs, h);
ZEND_ASSERT(size_zv && "Trying to free pointer not allocated through ZendMM");
return size_zv;
Expand Down Expand Up @@ -3074,7 +3074,7 @@ static void tracked_free_all(zend_mm_heap *heap) {
HashTable *tracked_allocs = heap->tracked_allocs;
zend_ulong h;
ZEND_HASH_FOREACH_NUM_KEY(tracked_allocs, h) {
void *ptr = (void *) (uintptr_t) (h << ZEND_MM_ALIGNMENT_LOG2);
void *ptr = ZEND_ULONG2PTR(h << ZEND_MM_ALIGNMENT_LOG2);
free(ptr);
} ZEND_HASH_FOREACH_END();
}
Expand Down Expand Up @@ -3285,7 +3285,7 @@ static void alloc_globals_ctor(zend_alloc_globals *alloc_globals)
zend_mm_heap *mm_heap = alloc_globals->mm_heap = malloc(sizeof(zend_mm_heap));
memset(mm_heap, 0, sizeof(zend_mm_heap));
mm_heap->use_custom_heap = ZEND_MM_CUSTOM_HEAP_STD;
mm_heap->limit = (size_t)Z_L(-1) >> 1;
mm_heap->limit = (size_t)-1 >> 1;
mm_heap->overflow = 0;

if (!tracked) {
Expand Down Expand Up @@ -3506,7 +3506,7 @@ ZEND_API zend_mm_heap *zend_mm_startup_ex(const zend_mm_handlers *handlers, void
#endif
zend_mm_init_key(heap);
#if ZEND_MM_LIMIT
heap->limit = (size_t)Z_L(-1) >> 1;
heap->limit = (size_t)-1 >> 1;
heap->overflow = 0;
#endif
#if ZEND_MM_CUSTOM
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -12360,7 +12360,7 @@ static void zend_eval_const_expr(zend_ast **ast_ptr) /* {{{ */
} else if (Z_TYPE_P(dim) != IS_STRING || is_numeric_string(Z_STRVAL_P(dim), Z_STRLEN_P(dim), &offset, NULL, 1) != IS_LONG) {
return;
}
if (offset < 0 || (size_t)offset >= Z_STRLEN_P(container)) {
if (offset < 0 || ZEND_SIZE_T_LTE_ZEND_LONG(Z_STRLEN_P(container), offset)) {
return;
}
c = (uint8_t) Z_STRVAL_P(container)[offset];
Expand Down
12 changes: 6 additions & 6 deletions Zend/zend_execute.c
Original file line number Diff line number Diff line change
Expand Up @@ -2157,11 +2157,11 @@ static zend_never_inline void zend_assign_to_string_offset(zval *str, zval *dim,
}
}

if ((size_t)offset >= ZSTR_LEN(s)) {
if (ZEND_SIZE_T_LTE_ZEND_LONG(ZSTR_LEN(s), offset)) {
/* Extend string if needed */
zend_long old_len = ZSTR_LEN(s);
size_t old_len = ZSTR_LEN(s);
ZVAL_NEW_STR(str, zend_string_extend(s, (size_t)offset + 1, 0));
memset(Z_STRVAL_P(str) + old_len, ' ', offset - old_len);
memset(Z_STRVAL_P(str) + old_len, ' ', (size_t)offset - old_len);
Z_STRVAL_P(str)[offset+1] = 0;
} else {
zend_string_forget_hash_val(Z_STR_P(str));
Expand Down Expand Up @@ -3148,7 +3148,7 @@ static zend_always_inline void zend_fetch_dimension_address_read(zval *result, z
}
out:

if (UNEXPECTED(ZSTR_LEN(str) < ((offset < 0) ? -(size_t)offset : ((size_t)offset + 1)))) {
if (UNEXPECTED(ZEND_SIZE_T_LT_ZEND_ULONG(ZSTR_LEN(str), ((offset < 0) ? -(zend_ulong)offset : ((zend_ulong)offset + 1))))) {
if (type != BP_VAR_IS) {
zend_error(E_WARNING, "Uninitialized string offset " ZEND_LONG_FMT, offset);
ZVAL_EMPTY_STRING(result);
Expand Down Expand Up @@ -3309,7 +3309,7 @@ static zend_never_inline bool ZEND_FASTCALL zend_isset_dim_slow(zval *container,
if (UNEXPECTED(lval < 0)) { /* Handle negative offset */
lval += (zend_long)Z_STRLEN_P(container);
}
if (EXPECTED(lval >= 0) && (size_t)lval < Z_STRLEN_P(container)) {
if (EXPECTED(lval >= 0) && ZEND_SIZE_T_GT_ZEND_LONG(Z_STRLEN_P(container), lval)) {
return 1;
} else {
return 0;
Expand Down Expand Up @@ -3348,7 +3348,7 @@ static zend_never_inline bool ZEND_FASTCALL zend_isempty_dim_slow(zval *containe
if (UNEXPECTED(lval < 0)) { /* Handle negative offset */
lval += (zend_long)Z_STRLEN_P(container);
}
if (EXPECTED(lval >= 0) && (size_t)lval < Z_STRLEN_P(container)) {
if (EXPECTED(lval >= 0) && ZEND_SIZE_T_GT_ZEND_LONG(Z_STRLEN_P(container), lval)) {
return (Z_STRVAL_P(container)[lval] == '0');
} else {
return 1;
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_execute_API.c
Original file line number Diff line number Diff line change
Expand Up @@ -1215,7 +1215,7 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, zend_string *
ALLOC_HASHTABLE(CG(unlinked_uses));
zend_hash_init(CG(unlinked_uses), 0, NULL, NULL, 0);
}
zend_hash_index_add_empty_element(CG(unlinked_uses), (zend_long)(uintptr_t)ce);
zend_hash_index_add_empty_element(CG(unlinked_uses), ZEND_PTR2ULONG(ce));
return ce;
}
return NULL;
Expand Down
6 changes: 3 additions & 3 deletions Zend/zend_generators.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ static void zend_generator_remove_child(zend_generator_node *node, zend_generato
node->child.single = NULL;
} else {
HashTable *ht = node->child.ht;
zend_hash_index_del(ht, (zend_ulong) child);
zend_hash_index_del(ht, ZEND_PTR2ULONG(child));
if (node->children == 2) {
zend_generator *other_child;
ZEND_HASH_FOREACH_PTR(ht, other_child) {
Expand Down Expand Up @@ -552,11 +552,11 @@ static void zend_generator_add_child(zend_generator *generator, zend_generator *
HashTable *ht = emalloc(sizeof(HashTable));
zend_hash_init(ht, 0, NULL, NULL, 0);
zend_hash_index_add_new_ptr(ht,
(zend_ulong) node->child.single, node->child.single);
ZEND_PTR2ULONG(node->child.single), node->child.single);
node->child.ht = ht;
}

zend_hash_index_add_new_ptr(node->child.ht, (zend_ulong) child, child);
zend_hash_index_add_new_ptr(node->child.ht, ZEND_PTR2ULONG(child), child);
}

++node->children;
Expand Down
4 changes: 2 additions & 2 deletions Zend/zend_inheritance.c
Original file line number Diff line number Diff line change
Expand Up @@ -3316,7 +3316,7 @@ static void check_unrecoverable_load_failure(const zend_class_entry *ce) {
* a dependence on the inheritance hierarchy of this specific class. Instead we fall back to
* a fatal error, as would happen if we did not allow exceptions in the first place. */
if (CG(unlinked_uses)
&& zend_hash_index_del(CG(unlinked_uses), (zend_long)(uintptr_t)ce) == SUCCESS) {
&& zend_hash_index_del(CG(unlinked_uses), ZEND_PTR2ULONG(ce)) == SUCCESS) {
zend_exception_uncaught_error(
"During inheritance of %s with variance dependencies", ZSTR_VAL(ce->name));
}
Expand Down Expand Up @@ -3611,7 +3611,7 @@ ZEND_API zend_class_entry *zend_do_link_class(zend_class_entry *ce, zend_string
}

if (CG(unlinked_uses)) {
zend_hash_index_del(CG(unlinked_uses), (zend_long)(uintptr_t) ce);
zend_hash_index_del(CG(unlinked_uses), ZEND_PTR2ULONG(ce));
}

orig_linking_class = CG(current_linking_class);
Expand Down
10 changes: 9 additions & 1 deletion Zend/zend_long.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <stdint.h>

/* This is the heart of the whole int64 enablement in zval. */
#if defined(__x86_64__) || defined(__LP64__) || defined(_LP64) || defined(_WIN64)
#ifdef ZEND_INT64
# define ZEND_ENABLE_ZVAL_LONG64 1
#endif

Expand All @@ -38,6 +38,12 @@ typedef int64_t zend_off_t;
# define Z_L(i) INT64_C(i)
# define Z_UL(i) UINT64_C(i)
# define SIZEOF_ZEND_LONG 8
# define ZEND_PTR2ULONG(ptr) ((zend_ulong)(uintptr_t)(ptr))
# define ZEND_ULONG2PTR(i) \
( (UNEXPECTED((i) > (zend_ulong)UINTPTR_MAX)) \
? (assert(!"zend_ulong out of pointer range"), NULL) \
: (void *)(uintptr_t)(i) \
)
#else
typedef int32_t zend_long;
typedef uint32_t zend_ulong;
Expand All @@ -48,6 +54,8 @@ typedef int32_t zend_off_t;
# define Z_L(i) INT32_C(i)
# define Z_UL(i) UINT32_C(i)
# define SIZEOF_ZEND_LONG 4
# define ZEND_PTR2ULONG(ptr) ((zend_ulong)(uintptr_t)(ptr))
# define ZEND_ULONG2PTR(i) ((void *)(uintptr_t)(i))
#endif


Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_object_handlers.c
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ static zend_always_inline uintptr_t zend_get_property_offset(zend_class_entry *c
*info_ptr = property_info;
}
if (cache_slot) {
CACHE_POLYMORPHIC_PTR_EX(cache_slot, ce, (void*)(uintptr_t)offset);
CACHE_POLYMORPHIC_PTR_EX(cache_slot, ce, (void*) offset);
CACHE_PTR_EX(cache_slot + 2, property_info);
}
return offset;
Expand Down
8 changes: 4 additions & 4 deletions Zend/zend_operators.h
Original file line number Diff line number Diff line change
Expand Up @@ -528,11 +528,11 @@ ZEND_API void zend_reset_lc_ctype_locale(void);
#define ZVAL_OFFSETOF_TYPE \
(offsetof(zval, u1.type_info) - offsetof(zval, value))

#if defined(HAVE_ASM_GOTO) && !__has_feature(memory_sanitizer)
# define ZEND_USE_ASM_ARITHMETIC 1
#else
//#if defined(HAVE_ASM_GOTO) && !__has_feature(memory_sanitizer)
//# define ZEND_USE_ASM_ARITHMETIC 1
//#else
# define ZEND_USE_ASM_ARITHMETIC 0
#endif
//#endif

static zend_always_inline void fast_long_increment_function(zval *op1)
{
Expand Down
23 changes: 19 additions & 4 deletions Zend/zend_range_check.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,24 @@
#endif

/* Comparison zend_long vs size_t */
#define ZEND_SIZE_T_GT_ZEND_LONG(size, zlong) ((zlong) < 0 || (size) > (size_t)(zlong))
#define ZEND_SIZE_T_GTE_ZEND_LONG(size, zlong) ((zlong) < 0 || (size) >= (size_t)(zlong))
#define ZEND_SIZE_T_LT_ZEND_LONG(size, zlong) ((zlong) >= 0 && (size) < (size_t)(zlong))
#define ZEND_SIZE_T_LTE_ZEND_LONG(size, zlong) ((zlong) >= 0 && (size) <= (size_t)(zlong))
#if SIZEOF_SIZE_T < SIZEOF_ZEND_LONG
# define ZEND_SIZE_T_GT_ZEND_LONG(size, zlong) ((zlong) < 0 || ((zlong) < SIZE_MAX && (size) > (size_t)(zlong)))
# define ZEND_SIZE_T_GT_ZEND_ULONG(size, zulong) (zulong < SIZE_MAX && (size) > (size_t)(zulong))
# define ZEND_SIZE_T_GTE_ZEND_LONG(size, zlong) ((zlong) < 0 || ((zlong) <= SIZE_MAX && (size) >= (size_t)(zlong)))
# define ZEND_SIZE_T_GTE_ZEND_ULONG(size, zulong) ((zulong) <= SIZE_MAX && (size) >= (size_t)(zulong))
# define ZEND_SIZE_T_LT_ZEND_LONG(size, zlong) ((zlong) >= SIZE_MAX || ((zlong) > 0 && (size) < (size_t)(zlong)))
# define ZEND_SIZE_T_LT_ZEND_ULONG(size, zulong) ((zulong) >= SIZE_MAX || (size) < (size_t)(zulong))
# define ZEND_SIZE_T_LTE_ZEND_LONG(size, zlong) ((zlong) > SIZE_MAX || ((zlong) >= 0 && (size) <= (size_t)(zlong)))
# define ZEND_SIZE_T_LTE_ZEND_ULONG(size, zulong) ((zulong) > SIZE_MAX || (size) <= (size_t)(zlong))
#else
# define ZEND_SIZE_T_GT_ZEND_LONG(size, zlong) ((zlong) < 0 || (size) > (size_t)(zlong))
# define ZEND_SIZE_T_GT_ZEND_ULONG(size, zulong) ((size) > (size_t)(zulong))
# define ZEND_SIZE_T_GTE_ZEND_LONG(size, zlong) ((zlong) < 0 || (size) >= (size_t)(zlong))
# define ZEND_SIZE_T_GTE_ZEND_ULONG(size, zulong) ((size) >= (size_t)(zulong))
# define ZEND_SIZE_T_LT_ZEND_LONG(size, zlong) ((zlong) > 0 && (size) < (size_t)(zlong))
# define ZEND_SIZE_T_LT_ZEND_ULONG(size, zulong) ((size) < (size_t)(zulong))
# define ZEND_SIZE_T_LTE_ZEND_LONG(size, zlong) ((zlong) >= 0 && (size) <= (size_t)(zlong))
# define ZEND_SIZE_T_LTE_ZEND_ULONG(size, zulong) ((size) <= (size_t)(zulong))
#endif

#endif /* ZEND_RANGE_CHECK_H */
5 changes: 2 additions & 3 deletions Zend/zend_string.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ ZEND_API bool ZEND_FASTCALL I_REPLACE_SONAME_FNNAME_ZU(NONE,zend_string_equal_va
}
#endif

#if defined(__GNUC__) && defined(__i386__)
#if SIZEOF_SIZE_T == SIZEOF_ZEND_LONG && defined(__GNUC__) && defined(__i386__)
ZEND_API zend_never_inline NOIPA bool ZEND_FASTCALL zend_string_equal_val(const zend_string *s1, const zend_string *s2)
{
const char *ptr = ZSTR_VAL(s1);
Expand Down Expand Up @@ -430,8 +430,7 @@ ZEND_API zend_never_inline NOIPA bool ZEND_FASTCALL zend_string_equal_val(const
: "cc");
return ret;
}

#elif defined(__GNUC__) && defined(__x86_64__) && !defined(__ILP32__)
#elif SIZEOF_SIZE_T == SIZEOF_ZEND_LONG && defined(__GNUC__) && defined(__x86_64__) && !defined(__ILP32__)
ZEND_API zend_never_inline NOIPA bool ZEND_FASTCALL zend_string_equal_val(const zend_string *s1, const zend_string *s2)
{
const char *ptr = ZSTR_VAL(s1);
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_string.h
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ static zend_always_inline bool zend_string_equals_cstr(const zend_string *s1, co
return ZSTR_LEN(s1) == s2_length && !memcmp(ZSTR_VAL(s1), s2, s2_length);
}

#if defined(__GNUC__) && (defined(__i386__) || (defined(__x86_64__) && !defined(__ILP32__)))
#if SIZEOF_SIZE_T == SIZEOF_ZEND_LONG && defined(__GNUC__) && (defined(__i386__) || (defined(__x86_64__) && !defined(__ILP32__)))
BEGIN_EXTERN_C()
ZEND_API bool ZEND_FASTCALL zend_string_equal_val(const zend_string *s1, const zend_string *s2);
END_EXTERN_C()
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_vm_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -9736,7 +9736,7 @@ ZEND_VM_HANDLER(202, ZEND_CALLABLE_CONVERT, UNUSED, UNUSED, NUM|CACHE_SLOT)
} else {
/* Rotate the key for better hash distribution. */
const int shift = sizeof(size_t) == 4 ? 6 : 7;
zend_ulong key = (zend_ulong)(uintptr_t)call->func;
zend_ulong key = ZEND_PTR2ULONG(call->func);
key = (key >> shift) | (key << ((sizeof(key) * 8) - shift));
zval *closure_zv = zend_hash_index_lookup(&EG(callable_convert_cache), key);
if (Z_TYPE_P(closure_zv) == IS_NULL) {
Expand Down
Loading
Loading