Skip to content

Commit bd6e462

Browse files
committed
test with indirect function ptr
1 parent dfb690d commit bd6e462

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

ext/json/json_encoder.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ typedef enum php_json_simd_result {
539539
PHP_JSON_SLOW,
540540
PHP_JSON_NON_ASCII,
541541
} php_json_simd_result;
542-
542+
php_json_compute_escape_intersection_t foo = php_json_sse42_compute_escape_intersection_real;
543543
#ifdef JSON_USE_SIMD
544544
static zend_always_inline php_json_simd_result php_json_process_simd_block(
545545
smart_str *buf,
@@ -550,6 +550,7 @@ static zend_always_inline php_json_simd_result php_json_process_simd_block(
550550
int options
551551
)
552552
{
553+
const php_json_compute_escape_intersection_t dontchangeme = foo;
553554
while (*len >= sizeof(__m128i)) {
554555
const __m128i input = _mm_loadu_si128((const __m128i *) (*s + *pos));
555556
/* signed compare, so checks for unsigned bytes >= 0x80 as well */
@@ -566,13 +567,14 @@ static zend_always_inline php_json_simd_result php_json_process_simd_block(
566567
max_shift = zend_ulong_ntz(input_range_mask);
567568
}
568569

569-
#ifdef ZEND_INTRIN_SSE4_2_NATIVE
570-
int mask = php_json_sse42_compute_escape_intersection_real(sse_escape_mask, input);
571-
#elif defined(ZEND_INTRIN_SSE4_2_FUNC_PROTO)
572-
int mask = php_json_sse42_compute_escape_intersection(sse_escape_mask, input);
573-
#else
574-
int mask = php_json_sse2_compute_escape_intersection(_mm_setzero_si128(), input);
575-
#endif
570+
// #ifdef ZEND_INTRIN_SSE4_2_NATIVE
571+
// int mask = php_json_sse42_compute_escape_intersection_real(sse_escape_mask, input);
572+
// #elif defined(ZEND_INTRIN_SSE4_2_FUNC_PROTO)
573+
// int mask = php_json_sse42_compute_escape_intersection(sse_escape_mask, input);
574+
// #else
575+
// int mask = php_json_sse2_compute_escape_intersection(_mm_setzero_si128(), input);
576+
// #endif
577+
int mask = dontchangeme(sse_escape_mask, input);
576578
if (mask != 0) {
577579
if (UNEXPECTED(max_shift < sizeof(__m128i))) {
578580
int shift = zend_ulong_ntz(mask); /* first offending character */

0 commit comments

Comments
 (0)