diff --git a/ext/opcache/jit/tls/zend_jit_tls_aarch64.c b/ext/opcache/jit/tls/zend_jit_tls_aarch64.c index 3258a3123ebb..80d19090312f 100644 --- a/ext/opcache/jit/tls/zend_jit_tls_aarch64.c +++ b/ext/opcache/jit/tls/zend_jit_tls_aarch64.c @@ -124,7 +124,9 @@ zend_result zend_jit_resolve_tsrm_ls_cache_offsets( "add %2, x8, x0\n" : "=r" (thread_pointer), "=r" (insn), "=r" (addr) : - : "x0", "x1", "x8"); + /* Resolver call clobbers only a few registers: https://github.com/ARM-software/abi-aa/blob/ee4b3c12d57c8424ff60c2ae56e10690d0604ab6/sysvabi64/sysvabi64.rst#calling-convention. + * We also clobber x8. */ + : "x0", "x1", "x8", "x30", "cc", "memory"); ZEND_ASSERT(addr == &_tsrm_ls_cache); diff --git a/ext/opcache/jit/tls/zend_jit_tls_x86.c b/ext/opcache/jit/tls/zend_jit_tls_x86.c index 362dffb47785..dae644ab7b7d 100644 --- a/ext/opcache/jit/tls/zend_jit_tls_x86.c +++ b/ext/opcache/jit/tls/zend_jit_tls_x86.c @@ -108,6 +108,12 @@ zend_result zend_jit_resolve_tsrm_ls_cache_offsets( /* Load thread pointer address */ "movl %%gs:0, %%ebx\n" : "=a" (t_addr), "=S" (code), "=b" (thread_pointer) + : + /* call may clobber volatile registers */ + : "ecx", "edx", + "st", "st(1)", "st(2)", "st(3)", "st(4)", "st(5)", "st(6)", "st(7)", + "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7", + "cc", "memory" ); ZEND_ASSERT(t_addr == &_tsrm_ls_cache); diff --git a/ext/opcache/jit/tls/zend_jit_tls_x86_64.c b/ext/opcache/jit/tls/zend_jit_tls_x86_64.c index 6c58dbc1c43d..f3495505c524 100644 --- a/ext/opcache/jit/tls/zend_jit_tls_x86_64.c +++ b/ext/opcache/jit/tls/zend_jit_tls_x86_64.c @@ -104,6 +104,14 @@ zend_result zend_jit_resolve_tsrm_ls_cache_offsets( /* Load thread pointer address */ "movq %%fs:0, %%rsi\n" : "=a" (addr), "=b" (code), "=S" (thread_pointer) + : + /* call may clobber volatile registers */ + : "rcx", "rdx", "rdi", + "r8", "r9", "r10", "r11", + "st", "st(1)", "st(2)", "st(3)", "st(4)", "st(5)", "st(6)", "st(7)", + "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7", + "xmm8", "xmm9", "xmm10", "xmm11", "xmm12", "xmm13", "xmm14", "xmm15", + "cc", "memory" ); ZEND_ASSERT(addr == &_tsrm_ls_cache); diff --git a/ext/standard/tests/array/array_map_foreach_optimization_006.phpt b/ext/standard/tests/array/array_map_foreach_optimization_006.phpt index e21e3e0a9a8b..4d37697a616c 100644 --- a/ext/standard/tests/array/array_map_foreach_optimization_006.phpt +++ b/ext/standard/tests/array/array_map_foreach_optimization_006.phpt @@ -53,7 +53,7 @@ LIVE RANGES: 5: 0009 - 0013 (tmp/var) plusn: - ; (lines=4, args=2, vars=2, tmps=1) + ; (lines=4, args=2, vars=2, tmps=%d) ; (after optimizer) ; %s 0000 CV0($x) = RECV 1 diff --git a/ext/standard/tests/array/array_map_foreach_optimization_007.phpt b/ext/standard/tests/array/array_map_foreach_optimization_007.phpt index 67654b9e7640..8a406ef11ca6 100644 --- a/ext/standard/tests/array/array_map_foreach_optimization_007.phpt +++ b/ext/standard/tests/array/array_map_foreach_optimization_007.phpt @@ -44,7 +44,7 @@ $_main: 0016 RETURN int(1) plusn: - ; (lines=4, args=2, vars=2, tmps=1) + ; (lines=4, args=2, vars=2, tmps=%d) ; (after optimizer) ; %s 0000 CV0($x) = RECV 1 @@ -53,7 +53,7 @@ plusn: 0003 RETURN T2 $_main: - ; (lines=4, args=0, vars=1, tmps=1) + ; (lines=4, args=0, vars=1, tmps=%d) ; (after optimizer) ; %s:1-9 0000 T1 = DECLARE_LAMBDA_FUNCTION 0 @@ -64,7 +64,7 @@ LIVE RANGES: 1: 0001 - 0002 (tmp/var) {closure:pfa:%s:9}: - ; (lines=18, args=1, vars=2, tmps=2) + ; (lines=18, args=1, vars=2, tmps=%d) ; (after optimizer) ; %s:9-9 0000 CV0($x) = RECV 1