summaryrefslogtreecommitdiff
path: root/ext/opcache/jit/zend_jit.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/opcache/jit/zend_jit.c')
-rw-r--r--ext/opcache/jit/zend_jit.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/ext/opcache/jit/zend_jit.c b/ext/opcache/jit/zend_jit.c
index debf4df866..478244b6d7 100644
--- a/ext/opcache/jit/zend_jit.c
+++ b/ext/opcache/jit/zend_jit.c
@@ -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 */