summaryrefslogtreecommitdiff
path: root/ext/opcache/jit/zend_jit_helpers.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2020-10-09 16:54:26 +0300
committerDmitry Stogov <dmitry@zend.com>2020-10-09 16:54:26 +0300
commitfc14dbb7132f03e26b04f7cb7ed7820be68acebb (patch)
tree498a520e7951a3d2ed8211222da9b7cbf9597b0a /ext/opcache/jit/zend_jit_helpers.c
parent38368708d73e8f0940611cddde1d01dca1a1decc (diff)
downloadphp-git-fc14dbb7132f03e26b04f7cb7ed7820be68acebb.tar.gz
Keep the same JIT code for PHP-8.0 and master (workaround against PHP-8.0 ABI freeze)
Diffstat (limited to 'ext/opcache/jit/zend_jit_helpers.c')
-rw-r--r--ext/opcache/jit/zend_jit_helpers.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/ext/opcache/jit/zend_jit_helpers.c b/ext/opcache/jit/zend_jit_helpers.c
index 22904a8e1d..c366e6274a 100644
--- a/ext/opcache/jit/zend_jit_helpers.c
+++ b/ext/opcache/jit/zend_jit_helpers.c
@@ -2609,3 +2609,32 @@ static void ZEND_FASTCALL zend_jit_post_dec_obj_helper(zend_object *zobj, zend_s
zval_ptr_dtor(z);
}
}
+
+#if (PHP_VERSION_ID <= 80000) && (SIZEOF_SIZE_T == 4)
+static zend_result ZEND_FASTCALL zval_jit_update_constant_ex(zval *p, zend_class_entry *scope)
+{
+ if (Z_TYPE_P(p) == IS_CONSTANT_AST) {
+ zend_ast *ast = Z_ASTVAL_P(p);
+
+ if (ast->kind == ZEND_AST_CONSTANT) {
+ zend_string *name = zend_ast_get_constant_name(ast);
+ zval *zv = zend_get_constant_ex(name, scope, ast->attr);
+ if (UNEXPECTED(zv == NULL)) {
+ return FAILURE;
+ }
+
+ zval_ptr_dtor_nogc(p);
+ ZVAL_COPY_OR_DUP(p, zv);
+ } else {
+ zval tmp;
+
+ if (UNEXPECTED(zend_ast_evaluate(&tmp, ast, scope) != SUCCESS)) {
+ return FAILURE;
+ }
+ zval_ptr_dtor_nogc(p);
+ ZVAL_COPY_VALUE(p, &tmp);
+ }
+ }
+ return SUCCESS;
+}
+#endif \ No newline at end of file