Skip to content

Commit 2207da9

Browse files
committed
Fixed JIT startup failure not being respected by new threads in ZTS
1 parent cae2582 commit 2207da9

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

ext/opcache/ZendAccelerator.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3278,6 +3278,7 @@ static zend_result accel_post_startup(void)
32783278
|| zend_jit_startup(ZSMMG(reserved), jit_size, reattached) != SUCCESS) {
32793279
JIT_G(enabled) = false;
32803280
JIT_G(on) = false;
3281+
zend_jit_startup_failed = true;
32813282
/* The JIT is implicitly disabled with opcache.jit_buffer_size=0, so we don't want to
32823283
* emit a warning here. */
32833284
if (JIT_G(buffer_size) != 0) {

ext/opcache/jit/zend_jit.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ typedef struct _zend_jit_stub {
103103
#define JIT_STUB(name, offset, adjustment) \
104104
{JIT_STUB_PREFIX #name, zend_jit_ ## name ## _stub, offset, adjustment}
105105

106+
bool zend_jit_startup_failed = false;
107+
106108
zend_ulong zend_jit_profile_counter = 0;
107109
int zend_jit_profile_counter_rid = -1;
108110

@@ -4796,7 +4798,7 @@ ZEND_EXT_API int zend_jit_config(zend_string *jit, int stage)
47964798
return FAILURE;
47974799
}
47984800

4799-
if (zend_string_equals_literal_ci(jit, "disable")) {
4801+
if (zend_jit_startup_failed || zend_string_equals_literal_ci(jit, "disable")) {
48004802
JIT_G(enabled) = 0;
48014803
JIT_G(on) = 0;
48024804
return SUCCESS;

ext/opcache/jit/zend_jit.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ typedef struct _zend_jit_trace_rec zend_jit_trace_rec;
9191
typedef struct _zend_jit_trace_stack_frame zend_jit_trace_stack_frame;
9292
typedef struct _sym_node zend_sym_node;
9393

94+
extern bool zend_jit_startup_failed;
95+
9496
typedef struct _zend_jit_globals {
9597
bool enabled;
9698
bool on;

0 commit comments

Comments
 (0)