com php-src: Use inlined HYBRID VM handlers for DO_FCALL* a nd ZEND_RETRUN: ext/opcache/jit/zend_jit_disasm_x 86.c ext/opcache/jit/zend_jit_x86.dasc
| From: | Dmitry Stogov | Date: | Wed, 03 Apr 2019 12:02:04 +0000 |
| Subject: | com php-src: Use inlined HYBRID VM handlers for DO_FCALL* a nd ZEND_RETRUN: ext/opcache/jit/zend_jit_disasm_x 86.c ext/opcache/jit/zend_jit_x86.dasc | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-105511@lists.php.net to get a copy of this message | ||
Commit: 22b3b6d5eaf4e5be05fa26f70f9a718daa82f769
Author: Dmitry Stogov <dmitry@zend.com> Wed, 3 Apr 2019 15:02:04 +0300
Parents: 3df8e27731dce8ed141a91f02832798e67c2b4ea
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=22b3b6d5eaf4e5be05fa26f70f9a718daa82f769
Log:
Use inlined HYBRID VM handlers for DO_FCALL* and ZEND_RETRUN
Changed paths:
M ext/opcache/jit/zend_jit_disasm_x86.c
M ext/opcache/jit/zend_jit_x86.dasc
Diff:
diff --git a/ext/opcache/jit/zend_jit_disasm_x86.c b/ext/opcache/jit/zend_jit_disasm_x86.c
index 10c7d19..2007553 100644
--- a/ext/opcache/jit/zend_jit_disasm_x86.c
+++ b/ext/opcache/jit/zend_jit_disasm_x86.c
@@ -450,6 +450,62 @@ static int zend_jit_disasm_init(void)
zend_elf_load_symbols();
#endif
+ if (zend_vm_kind() == ZEND_VM_KIND_HYBRID) {
+ zend_op opline;
+
+ memset(&opline, 0, sizeof(opline));
+
+ opline.opcode = ZEND_DO_UCALL;
+ opline.result_type = IS_UNUSED;
+ zend_vm_set_opcode_handler(&opline);
+ zend_jit_disasm_add_symbol("ZEND_DO_UCALL_SPEC_RETVAL_UNUSED_LABEL",
(uint64_t)(uintptr_t)opline.handler, sizeof(void*));
+
+ opline.opcode = ZEND_DO_UCALL;
+ opline.result_type = IS_VAR;
+ zend_vm_set_opcode_handler(&opline);
+ zend_jit_disasm_add_symbol("ZEND_DO_UCALL_SPEC_RETVAL_USED_LABEL",
(uint64_t)(uintptr_t)opline.handler, sizeof(void*));
+
+ opline.opcode = ZEND_DO_FCALL_BY_NAME;
+ opline.result_type = IS_UNUSED;
+ zend_vm_set_opcode_handler(&opline);
+ zend_jit_disasm_add_symbol("ZEND_DO_FCALL_BY_NAME_SPEC_RETVAL_UNUSED_LABEL",
(uint64_t)(uintptr_t)opline.handler, sizeof(void*));
+
+ opline.opcode = ZEND_DO_FCALL_BY_NAME;
+ opline.result_type = IS_VAR;
+ zend_vm_set_opcode_handler(&opline);
+ zend_jit_disasm_add_symbol("ZEND_DO_FCALL_BY_NAME_SPEC_RETVAL_USED_LABEL",
(uint64_t)(uintptr_t)opline.handler, sizeof(void*));
+
+ opline.opcode = ZEND_DO_FCALL;
+ opline.result_type = IS_UNUSED;
+ zend_vm_set_opcode_handler(&opline);
+ zend_jit_disasm_add_symbol("ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_LABEL",
(uint64_t)(uintptr_t)opline.handler, sizeof(void*));
+
+ opline.opcode = ZEND_DO_FCALL;
+ opline.result_type = IS_VAR;
+ zend_vm_set_opcode_handler(&opline);
+ zend_jit_disasm_add_symbol("ZEND_DO_FCALL_SPEC_RETVAL_USED_LABEL",
(uint64_t)(uintptr_t)opline.handler, sizeof(void*));
+
+ opline.opcode = ZEND_RETURN;
+ opline.op1_type = IS_CONST;
+ zend_vm_set_opcode_handler(&opline);
+ zend_jit_disasm_add_symbol("ZEND_RETURN_SPEC_CONST_LABEL",
(uint64_t)(uintptr_t)opline.handler, sizeof(void*));
+
+ opline.opcode = ZEND_RETURN;
+ opline.op1_type = IS_TMP_VAR;
+ zend_vm_set_opcode_handler(&opline);
+ zend_jit_disasm_add_symbol("ZEND_RETURN_SPEC_TMP_LABEL",
(uint64_t)(uintptr_t)opline.handler, sizeof(void*));
+
+ opline.opcode = ZEND_RETURN;
+ opline.op1_type = IS_VAR;
+ zend_vm_set_opcode_handler(&opline);
+ zend_jit_disasm_add_symbol("ZEND_RETURN_SPEC_VAR_LABEL",
(uint64_t)(uintptr_t)opline.handler, sizeof(void*));
+
+ opline.opcode = ZEND_RETURN;
+ opline.op1_type = IS_CV;
+ zend_vm_set_opcode_handler(&opline);
+ zend_jit_disasm_add_symbol("ZEND_RETURN_SPEC_CV_LABEL",
(uint64_t)(uintptr_t)opline.handler, sizeof(void*));
+ }
+
return 1;
}
diff --git a/ext/opcache/jit/zend_jit_x86.dasc b/ext/opcache/jit/zend_jit_x86.dasc
index 103fc39..3b2da99 100644
--- a/ext/opcache/jit/zend_jit_x86.dasc
+++ b/ext/opcache/jit/zend_jit_x86.dasc
@@ -2751,19 +2751,23 @@ static int zend_jit_tail_handler(dasm_State **Dst, const zend_op *opline)
return 0;
}
if (zend_jit_vm_kind == ZEND_VM_KIND_HYBRID) {
-#if 0
- /* TODO: Use tail call to HYBRID VM handler (works, but need disassembler support ???) */
- const void *handler = opline->handler;
+ if (opline->opcode == ZEND_DO_UCALL ||
+ opline->opcode == ZEND_DO_FCALL_BY_NAME ||
+ opline->opcode == ZEND_DO_FCALL ||
+ opline->opcode == ZEND_RETURN) {
- | add r4, HYBRID_SPAD
- | EXT_JMP handler, r0
-#else
- const void *handler = zend_get_opcode_handler_func(opline);
+ /* Use inlined HYBRID VM handler */
+ const void *handler = opline->handler;
- | EXT_CALL handler, r0
- | add r4, HYBRID_SPAD
- | JMP_IP
-#endif
+ | add r4, HYBRID_SPAD
+ | EXT_JMP handler, r0
+ } else {
+ const void *handler = zend_get_opcode_handler_func(opline);
+
+ | EXT_CALL handler, r0
+ | add r4, HYBRID_SPAD
+ | JMP_IP
+ }
} else {
const void *handler = opline->handler;