mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
JIT support for opcache restart
This commit is contained in:
parent
06da048622
commit
a75cf0c7e1
4 changed files with 36 additions and 1 deletions
|
@ -2506,6 +2506,11 @@ int accel_activate(INIT_FUNC_ARGS)
|
|||
if (ZCSG(preload_script)) {
|
||||
preload_restart();
|
||||
}
|
||||
|
||||
#ifdef HAVE_JIT
|
||||
zend_jit_restart();
|
||||
#endif
|
||||
|
||||
ZCSG(accelerator_enabled) = ZCSG(cache_status_before_restart);
|
||||
if (ZCSG(last_restart_time) < ZCG(request_time)) {
|
||||
ZCSG(last_restart_time) = ZCG(request_time);
|
||||
|
|
|
@ -3798,7 +3798,7 @@ ZEND_EXT_API int zend_jit_startup(void *buf, size_t size, zend_bool reattached)
|
|||
}
|
||||
#endif
|
||||
|
||||
dasm_ptr = dasm_end = (void*)(((char*)dasm_buf) + size - sizeof(*dasm_ptr));
|
||||
dasm_ptr = dasm_end = (void*)(((char*)dasm_buf) + size - sizeof(*dasm_ptr) * 2);
|
||||
if (!reattached) {
|
||||
zend_jit_unprotect();
|
||||
*dasm_ptr = dasm_buf;
|
||||
|
@ -3847,6 +3847,11 @@ ZEND_EXT_API int zend_jit_startup(void *buf, size_t size, zend_bool reattached)
|
|||
return FAILURE;
|
||||
}
|
||||
|
||||
/* save JIT buffer pos */
|
||||
zend_jit_unprotect();
|
||||
dasm_ptr[1] = dasm_ptr[0];
|
||||
zend_jit_protect();
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -3926,4 +3931,18 @@ ZEND_EXT_API void zend_jit_deactivate(void)
|
|||
}
|
||||
}
|
||||
|
||||
ZEND_EXT_API void zend_jit_restart(void)
|
||||
{
|
||||
if (dasm_buf) {
|
||||
zend_jit_unprotect();
|
||||
|
||||
/* restore JIT buffer pos */
|
||||
dasm_ptr[0] = dasm_ptr[1];
|
||||
|
||||
zend_jit_trace_restart();
|
||||
|
||||
zend_jit_protect();
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* HAVE_JIT */
|
||||
|
|
|
@ -140,6 +140,7 @@ ZEND_EXT_API void zend_jit_shutdown(void);
|
|||
ZEND_EXT_API void zend_jit_activate(void);
|
||||
ZEND_EXT_API void zend_jit_deactivate(void);
|
||||
ZEND_EXT_API void zend_jit_status(zval *ret);
|
||||
ZEND_EXT_API void zend_jit_restart(void);
|
||||
|
||||
typedef struct _zend_lifetime_interval zend_lifetime_interval;
|
||||
typedef struct _zend_life_range zend_life_range;
|
||||
|
|
|
@ -5606,3 +5606,13 @@ static void zend_jit_trace_init_caches(void)
|
|||
static void zend_jit_trace_reset_caches(void)
|
||||
{
|
||||
}
|
||||
|
||||
static void zend_jit_trace_restart(void)
|
||||
{
|
||||
ZEND_JIT_TRACE_NUM = 1;
|
||||
ZEND_JIT_COUNTER_NUM = 0;
|
||||
ZEND_JIT_EXIT_NUM = 0;
|
||||
ZEND_JIT_EXIT_COUNTERS = 0;
|
||||
|
||||
zend_jit_trace_init_caches();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue