From 267b78550e14ffa47206645fbd74471c6dbaeaac Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Tue, 16 Jan 2018 10:33:41 +0300 Subject: [PATCH] Use fastcall calling convention --- Zend/zend_vm.h | 12 ++++++------ Zend/zend_vm_execute.h | 12 ++++++------ Zend/zend_vm_execute.skl | 6 +++--- Zend/zend_vm_gen.php | 16 ++++++++-------- Zend/zend_vm_opcodes.c | 4 ++-- Zend/zend_vm_opcodes.h | 4 ++-- 6 files changed, 27 insertions(+), 27 deletions(-) diff --git a/Zend/zend_vm.h b/Zend/zend_vm.h index eed06a653c..ce0304e910 100644 --- a/Zend/zend_vm.h +++ b/Zend/zend_vm.h @@ -24,13 +24,13 @@ BEGIN_EXTERN_C() ZEND_API void zend_vm_use_old_executor(void); -ZEND_API void zend_vm_set_opcode_handler(zend_op* opcode); -ZEND_API void zend_vm_set_opcode_handler_ex(zend_op* opcode, uint32_t op1_info, uint32_t op2_info, uint32_t res_info); -ZEND_API void zend_serialize_opcode_handler(zend_op *op); -ZEND_API void zend_deserialize_opcode_handler(zend_op *op); -ZEND_API const void *zend_get_opcode_handler_func(const zend_op *op); +ZEND_API void ZEND_FASTCALL zend_vm_set_opcode_handler(zend_op* opcode); +ZEND_API void ZEND_FASTCALL zend_vm_set_opcode_handler_ex(zend_op* opcode, uint32_t op1_info, uint32_t op2_info, uint32_t res_info); +ZEND_API void ZEND_FASTCALL zend_serialize_opcode_handler(zend_op *op); +ZEND_API void ZEND_FASTCALL zend_deserialize_opcode_handler(zend_op *op); +ZEND_API const void* ZEND_FASTCALL zend_get_opcode_handler_func(const zend_op *op); ZEND_API const zend_op *zend_get_halt_op(void); -ZEND_API int zend_vm_call_opcode_handler(zend_execute_data *ex); +ZEND_API int ZEND_FASTCALL zend_vm_call_opcode_handler(zend_execute_data *ex); ZEND_API int zend_vm_kind(void); END_EXTERN_C() diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 3845f454da..18d10b0abf 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -66930,7 +66930,7 @@ static void init_opcode_serialiser(void) } } -ZEND_API void zend_serialize_opcode_handler(zend_op *op) +ZEND_API void ZEND_FASTCALL zend_serialize_opcode_handler(zend_op *op) { zval *zv; @@ -66942,12 +66942,12 @@ ZEND_API void zend_serialize_opcode_handler(zend_op *op) op->handler = (const void *)(zend_uintptr_t)Z_LVAL_P(zv); } -ZEND_API void zend_deserialize_opcode_handler(zend_op *op) +ZEND_API void ZEND_FASTCALL zend_deserialize_opcode_handler(zend_op *op) { op->handler = zend_opcode_handlers[(zend_uintptr_t)op->handler]; } -ZEND_API const void *zend_get_opcode_handler_func(const zend_op *op) +ZEND_API const void* ZEND_FASTCALL zend_get_opcode_handler_func(const zend_op *op) { #if ZEND_VM_KIND == ZEND_VM_KIND_CALL return op->handler; @@ -67082,7 +67082,7 @@ static const void *zend_vm_get_opcode_handler_func(zend_uchar opcode, const zend #endif -ZEND_API void zend_vm_set_opcode_handler(zend_op* op) +ZEND_API void ZEND_FASTCALL zend_vm_set_opcode_handler(zend_op* op) { uint32_t spec = zend_spec_handlers[op->opcode]; @@ -67094,7 +67094,7 @@ ZEND_API void zend_vm_set_opcode_handler(zend_op* op) op->handler = zend_vm_get_opcode_handler_ex(spec, op); } -ZEND_API void zend_vm_set_opcode_handler_ex(zend_op* op, uint32_t op1_info, uint32_t op2_info, uint32_t res_info) +ZEND_API void ZEND_FASTCALL zend_vm_set_opcode_handler_ex(zend_op* op, uint32_t op1_info, uint32_t op2_info, uint32_t res_info) { zend_uchar opcode = zend_user_opcodes[op->opcode]; uint32_t spec = zend_spec_handlers[opcode]; @@ -67302,7 +67302,7 @@ ZEND_API void zend_vm_set_opcode_handler_ex(zend_op* op, uint32_t op1_info, uint op->handler = zend_vm_get_opcode_handler_ex(spec, op); } -ZEND_API int zend_vm_call_opcode_handler(zend_execute_data* ex) +ZEND_API int ZEND_FASTCALL zend_vm_call_opcode_handler(zend_execute_data* ex) { #if (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID) opcode_handler_t handler; diff --git a/Zend/zend_vm_execute.skl b/Zend/zend_vm_execute.skl index 8eda5a48b0..25809a90b3 100644 --- a/Zend/zend_vm_execute.skl +++ b/Zend/zend_vm_execute.skl @@ -66,7 +66,7 @@ static void init_opcode_serialiser(void) } } -ZEND_API void zend_serialize_opcode_handler(zend_op *op) +ZEND_API void ZEND_FASTCALL zend_serialize_opcode_handler(zend_op *op) { zval *zv; @@ -78,12 +78,12 @@ ZEND_API void zend_serialize_opcode_handler(zend_op *op) op->handler = (const void *)(zend_uintptr_t)Z_LVAL_P(zv); } -ZEND_API void zend_deserialize_opcode_handler(zend_op *op) +ZEND_API void ZEND_FASTCALL zend_deserialize_opcode_handler(zend_op *op) { op->handler = zend_opcode_handlers[(zend_uintptr_t)op->handler]; } -ZEND_API const void *zend_get_opcode_handler_func(const zend_op *op) +ZEND_API const void* ZEND_FASTCALL zend_get_opcode_handler_func(const zend_op *op) { #if ZEND_VM_KIND == ZEND_VM_KIND_CALL return op->handler; diff --git a/Zend/zend_vm_gen.php b/Zend/zend_vm_gen.php index a5eb616ea4..5d5f734a23 100644 --- a/Zend/zend_vm_gen.php +++ b/Zend/zend_vm_gen.php @@ -2348,8 +2348,8 @@ function gen_vm($def, $skel) { fputs($f, "#define ZEND_VM_OP2_FLAGS(flags) ((flags >> 8) & 0xff)\n"); fputs($f, "\n"); fputs($f, "BEGIN_EXTERN_C()\n\n"); - fputs($f, "ZEND_API const char *zend_get_opcode_name(zend_uchar opcode);\n"); - fputs($f, "ZEND_API uint32_t zend_get_opcode_flags(zend_uchar opcode);\n\n"); + fputs($f, "ZEND_API const char* ZEND_FASTCALL zend_get_opcode_name(zend_uchar opcode);\n"); + fputs($f, "ZEND_API uint32_t ZEND_FASTCALL zend_get_opcode_flags(zend_uchar opcode);\n\n"); fputs($f, "END_EXTERN_C()\n\n"); foreach ($opcodes as $code => $dsc) { @@ -2388,11 +2388,11 @@ function gen_vm($def, $skel) { } fputs($f, "};\n\n"); - fputs($f, "ZEND_API const char* zend_get_opcode_name(zend_uchar opcode) {\n"); + fputs($f, "ZEND_API const char* ZEND_FASTCALL zend_get_opcode_name(zend_uchar opcode) {\n"); fputs($f, "\treturn zend_vm_opcodes_names[opcode];\n"); fputs($f, "}\n"); - fputs($f, "ZEND_API uint32_t zend_get_opcode_flags(zend_uchar opcode) {\n"); + fputs($f, "ZEND_API uint32_t ZEND_FASTCALL zend_get_opcode_flags(zend_uchar opcode) {\n"); fputs($f, "\treturn zend_vm_opcodes_flags[opcode];\n"); fputs($f, "}\n"); @@ -2582,7 +2582,7 @@ function gen_vm($def, $skel) { } // Generate zend_vm_get_opcode_handler() function - out($f, "ZEND_API void zend_vm_set_opcode_handler(zend_op* op)\n"); + out($f, "ZEND_API void ZEND_FASTCALL zend_vm_set_opcode_handler(zend_op* op)\n"); out($f, "{\n"); if (!ZEND_VM_SPEC) { out($f, "\top->handler = zend_vm_get_opcode_handler(op->opcode, op);\n"); @@ -2598,7 +2598,7 @@ function gen_vm($def, $skel) { out($f, "}\n\n"); // Generate zend_vm_set_opcode_handler_ex() function - out($f, "ZEND_API void zend_vm_set_opcode_handler_ex(zend_op* op, uint32_t op1_info, uint32_t op2_info, uint32_t res_info)\n"); + out($f, "ZEND_API void ZEND_FASTCALL zend_vm_set_opcode_handler_ex(zend_op* op, uint32_t op1_info, uint32_t op2_info, uint32_t res_info)\n"); out($f, "{\n"); out($f, "\tzend_uchar opcode = zend_user_opcodes[op->opcode];\n"); if (!ZEND_VM_SPEC) { @@ -2670,7 +2670,7 @@ function gen_vm($def, $skel) { // Generate zend_vm_call_opcode_handler() function if (ZEND_VM_KIND == ZEND_VM_KIND_CALL || ZEND_VM_KIND == ZEND_VM_KIND_HYBRID) { - out($f, "ZEND_API int zend_vm_call_opcode_handler(zend_execute_data* ex)\n"); + out($f, "ZEND_API int ZEND_FASTCALL zend_vm_call_opcode_handler(zend_execute_data* ex)\n"); out($f, "{\n"); if (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID) { out($f,"#if (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID)\n"); @@ -2722,7 +2722,7 @@ function gen_vm($def, $skel) { out($f, "\treturn ret;\n"); out($f, "}\n\n"); } else { - out($f, "ZEND_API int zend_vm_call_opcode_handler(zend_execute_data* ex)\n"); + out($f, "ZEND_API int ZEND_FASTCALL zend_vm_call_opcode_handler(zend_execute_data* ex)\n"); out($f, "{\n"); out($f, "\tzend_error_noreturn(E_CORE_ERROR, \"zend_vm_call_opcode_handler() is not supported\");\n"); out($f, "\treturn 0;\n"); diff --git a/Zend/zend_vm_opcodes.c b/Zend/zend_vm_opcodes.c index 513792fd22..2464cc4eb8 100644 --- a/Zend/zend_vm_opcodes.c +++ b/Zend/zend_vm_opcodes.c @@ -425,9 +425,9 @@ static uint32_t zend_vm_opcodes_flags[199] = { 0x00000701, }; -ZEND_API const char* zend_get_opcode_name(zend_uchar opcode) { +ZEND_API const char* ZEND_FASTCALL zend_get_opcode_name(zend_uchar opcode) { return zend_vm_opcodes_names[opcode]; } -ZEND_API uint32_t zend_get_opcode_flags(zend_uchar opcode) { +ZEND_API uint32_t ZEND_FASTCALL zend_get_opcode_flags(zend_uchar opcode) { return zend_vm_opcodes_flags[opcode]; } diff --git a/Zend/zend_vm_opcodes.h b/Zend/zend_vm_opcodes.h index 2cf08ab3ea..f9603dfcb7 100644 --- a/Zend/zend_vm_opcodes.h +++ b/Zend/zend_vm_opcodes.h @@ -69,8 +69,8 @@ BEGIN_EXTERN_C() -ZEND_API const char *zend_get_opcode_name(zend_uchar opcode); -ZEND_API uint32_t zend_get_opcode_flags(zend_uchar opcode); +ZEND_API const char* ZEND_FASTCALL zend_get_opcode_name(zend_uchar opcode); +ZEND_API uint32_t ZEND_FASTCALL zend_get_opcode_flags(zend_uchar opcode); END_EXTERN_C() -- 2.40.0