Skip to content

Commit d09a3f2

Browse files
committed
_tsrm_ls_cache resolution
1 parent 27e485d commit d09a3f2

File tree

22 files changed

+2342
-168
lines changed

22 files changed

+2342
-168
lines changed

.github/actions/freebsd/action.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ runs:
3737
webp \
3838
libavif \
3939
`#sqlite3` \
40-
curl
40+
curl \
41+
gcc
4142

4243
./buildconf -f
4344
./configure \
@@ -102,3 +103,6 @@ runs:
102103
--show-slow 1000 \
103104
--set-timeout 120 \
104105
-d zend_extension=opcache.so
106+
107+
export TLSC=$(pwd)/ext/opcache/jit/tls/zend_jit_tls_x86_64.c
108+
./ext/opcache/jit/tls/testing/test.sh
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: Test TLS
2+
runs:
3+
using: composite
4+
steps:
5+
- shell: bash
6+
run: |
7+
set -x
8+
apk add clang gcc binutils-gold lld
9+
export TLSC=$(pwd)/ext/opcache/jit/tls/zend_jit_tls_x86_64.c
10+
./ext/opcache/jit/tls/testing/test.sh
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: Test TLS
2+
runs:
3+
using: composite
4+
steps:
5+
- shell: bash
6+
run: |
7+
set -x
8+
export TLSC=$(pwd)/ext/opcache/jit/tls/zend_jit_tls_darwin.c
9+
./ext/opcache/jit/tls/testing/test.sh
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Test TLS
2+
runs:
3+
using: composite
4+
steps:
5+
- shell: bash
6+
run: |
7+
set -x
8+
export DEBIAN_FRONTEND=noninteractive
9+
apt-get install -y gcc clang lld
10+
export TLSC=$(pwd)/ext/opcache/jit/tls/zend_jit_tls_x86.c
11+
export MACHINE=-m32
12+
./ext/opcache/jit/tls/testing/test.sh
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: Test TLS
2+
runs:
3+
using: composite
4+
steps:
5+
- shell: bash
6+
run: |
7+
set -x
8+
export DEBIAN_FRONTEND=noninteractive
9+
sudo apt-get install -y gcc clang lld
10+
export TLSC=$(pwd)/ext/opcache/jit/tls/zend_jit_tls_x86_64.c
11+
./ext/opcache/jit/tls/testing/test.sh

.github/workflows/nightly.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ jobs:
128128
--asan -x
129129
-d zend_extension=opcache.so
130130
-d opcache.enable_cli=1
131+
- name: Test TLS resolution
132+
uses: ./.github/actions/test-tls-alpine
131133
- name: Notify Slack
132134
if: failure()
133135
uses: ./.github/actions/notify-slack
@@ -260,6 +262,9 @@ jobs:
260262
${{ matrix.run_tests_parameters }}
261263
-d zend_extension=opcache.so
262264
-d opcache.enable_cli=1
265+
- name: Test TLS resolution
266+
if: matrix.debug && matrix.zts && !matrix.asan
267+
uses: ./.github/actions/test-tls-x64
263268
- name: Verify generated files are up to date
264269
uses: ./.github/actions/verify-generated-files
265270
- name: Notify Slack
@@ -349,6 +354,9 @@ jobs:
349354
${{ matrix.run_tests_parameters }}
350355
-d zend_extension=opcache.so
351356
-d opcache.enable_cli=1
357+
- name: Test TLS resolution
358+
if: matrix.debug && matrix.zts
359+
uses: ./.github/actions/test-tls-x32
352360
- name: Notify Slack
353361
if: failure()
354362
uses: ./.github/actions/notify-slack
@@ -408,6 +416,10 @@ jobs:
408416
runTestsParameters: >-
409417
-d zend_extension=opcache.so
410418
-d opcache.enable_cli=1
419+
- name: Test TLS resolution
420+
# JIT+ZTS not supported yet on ARM64
421+
if: matrix.os != '14' && matrix.debug && matrix.zts
422+
uses: ./.github/actions/test-tls-macos
411423
- name: Verify generated files are up to date
412424
uses: ./.github/actions/verify-generated-files
413425
- name: Notify Slack

ext/opcache/config.m4

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,19 +73,23 @@ if test "$PHP_OPCACHE" != "no"; then
7373
IR_TARGET=IR_TARGET_X64
7474
DASM_FLAGS="-D X64APPLE=1 -D X64=1"
7575
DASM_ARCH="x86"
76+
TLS_TARGET="darwin"
7677
],
7778
[*x86_64*|amd64-*-freebsd*], [
7879
IR_TARGET=IR_TARGET_X64
7980
DASM_FLAGS="-D X64=1"
8081
DASM_ARCH="x86"
82+
TLS_TARGET="x86_64"
8183
],
8284
[[i[34567]86*|x86*]], [
8385
IR_TARGET=IR_TARGET_X86
8486
DASM_ARCH="x86"
87+
TLS_TARGET="x86"
8588
],
8689
[aarch64*], [
8790
IR_TARGET=IR_TARGET_AARCH64
8891
DASM_ARCH="aarch64"
92+
TLS_TARGET="aarch64"
8993
])
9094

9195
AS_VAR_IF([PHP_CAPSTONE], [yes],
@@ -102,6 +106,10 @@ if test "$PHP_OPCACHE" != "no"; then
102106

103107
JIT_CFLAGS="-I@ext_builddir@/jit/ir -D$IR_TARGET -DIR_PHP"
104108
AS_VAR_IF([ZEND_DEBUG], [yes], [JIT_CFLAGS="$JIT_CFLAGS -DIR_DEBUG"])
109+
110+
AS_VAR_IF([PHP_THREAD_SAFETY], [yes], [
111+
ZEND_JIT_SRC="$ZEND_JIT_SRC jit/tls/zend_jit_tls_$TLS_TARGET.c"
112+
])
105113
])
106114

107115
AC_CHECK_FUNCS([mprotect shm_create_largepage])

ext/opcache/config.w32

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ if (PHP_OPCACHE != "no") {
3333
DEFINE("IR_TARGET", ir_target);
3434
DEFINE("DASM_FLAGS", dasm_flags);
3535
DEFINE("DASM_ARCH", "x86");
36+
DEFINE("TLS_TARGET", "win");
3637

3738
AC_DEFINE('HAVE_JIT', 1, 'Define to 1 to enable JIT.');
3839

@@ -52,6 +53,11 @@ if (PHP_OPCACHE != "no") {
5253
ADD_SOURCES(configure_module_dirname + "\\jit",
5354
"zend_jit.c zend_jit_vm_helpers.c",
5455
"opcache", "ext\\opcache\\jit");
56+
if (PHP_ZTS == "yes") {
57+
ADD_SOURCES(configure_module_dirname + "\\jit\\tls",
58+
"zend_jit_tls_win.c",
59+
"opcache", "ext\\opcache\\jit\\tls");
60+
}
5561
ADD_SOURCES(configure_module_dirname + "\\jit\\ir",
5662
"ir.c", "opcache", "ext\\opcache\\jit\\ir");
5763
ADD_SOURCES(configure_module_dirname + "\\jit\\ir",
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*.so
2+
*.o
3+
main
4+
main.dSYM

0 commit comments

Comments
 (0)