Skip to content

Commit fb7fb98

Browse files
committed
Merge branch 'PHP-8.6'
* PHP-8.6: opcache: Call orig_post_shutdown_cb() JIT: Discard veneers if generation failed
2 parents 1d90192 + 0c122cc commit fb7fb98

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

‎ext/opcache/ZendAccelerator.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3723,6 +3723,11 @@ static void (*orig_post_shutdown_cb)(void);
37233723

37243724
static void accel_post_shutdown(void)
37253725
{
3726+
/* Call original shutdown prior to detaching SHM, so it can access its memory safely. */
3727+
if (orig_post_shutdown_cb) {
3728+
orig_post_shutdown_cb();
3729+
}
3730+
37263731
zend_shared_alloc_shutdown();
37273732
}
37283733

‎ext/opcache/jit/zend_jit_ir.c‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,15 @@ static void zend_jit_commit_veneers(void)
470470
}
471471
}
472472
}
473+
474+
static void zend_jit_discard_veneers(void)
475+
{
476+
int i, count = sizeof(zend_jit_stubs) / sizeof(zend_jit_stubs[0]);
477+
478+
for (i = 0; i < count; i++) {
479+
zend_jit_stub_handlers[count + i] = NULL;
480+
}
481+
}
473482
#endif
474483

475484
static bool zend_jit_prefer_const_addr_load(zend_jit_ctx *jit, uintptr_t addr)
@@ -2932,7 +2941,11 @@ static void *zend_jit_ir_compile(ir_ctx *ctx, size_t *size, const char *name)
29322941

29332942
#if defined(IR_TARGET_AARCH64)
29342943
if (ctx->flags2 & IR_HAS_VENEERS) {
2935-
zend_jit_commit_veneers();
2944+
if (entry) {
2945+
zend_jit_commit_veneers();
2946+
} else {
2947+
zend_jit_discard_veneers();
2948+
}
29362949
}
29372950
#endif
29382951

0 commit comments

Comments
 (0)