1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Use fastcall calling convention

This commit is contained in:
Dmitry Stogov
2018-01-16 10:33:41 +03:00
parent d688129360
commit 267b78550e
6 changed files with 27 additions and 27 deletions

View File

@@ -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()

View File

@@ -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;

View File

@@ -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;

View File

@@ -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");

View File

@@ -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];
}

View File

@@ -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()