Lines Matching refs:type

63 	zend_ffi_type         *type;  member
107 zend_ffi_type *type; member
111 zend_ffi_type *type; member
131 zend_ffi_type *type; member
144 zend_ffi_type *type; member
180 zend_ffi_type *type; member
188 zend_ffi_type *type; member
208 static void _zend_ffi_type_dtor(zend_ffi_type *type);
211 static zend_ffi_type *zend_ffi_remember_type(zend_ffi_type *type);
214 static ZEND_COLD void zend_ffi_return_unsupported(zend_ffi_type *type);
215 static ZEND_COLD void zend_ffi_pass_unsupported(zend_ffi_type *type);
216 static ZEND_COLD void zend_ffi_assign_incompatible(zval *arg, zend_ffi_type *type);
219 static void *zend_ffi_create_callback(zend_ffi_type *type, zval *value);
222 static zend_always_inline void zend_ffi_type_dtor(zend_ffi_type *type) /* {{{ */ in zend_ffi_type_dtor() argument
224 if (UNEXPECTED(ZEND_FFI_TYPE_IS_OWNED(type))) { in zend_ffi_type_dtor()
225 _zend_ffi_type_dtor(type); in zend_ffi_type_dtor()
250 cdata->type = NULL; in zend_ffi_cdata_new()
267 dst_type = ZEND_FFI_TYPE(dst_type->pointer.type); in zend_ffi_is_compatible_type()
268 src_type = ZEND_FFI_TYPE(src_type->pointer.type); in zend_ffi_is_compatible_type()
276 dst_type = ZEND_FFI_TYPE(dst_type->array.type); in zend_ffi_is_compatible_type()
277 src_type = ZEND_FFI_TYPE(src_type->array.type); in zend_ffi_is_compatible_type()
283 dst_type = ZEND_FFI_TYPE(dst_type->pointer.type); in zend_ffi_is_compatible_type()
284 src_type = ZEND_FFI_TYPE(src_type->array.type); in zend_ffi_is_compatible_type()
296 static ffi_type* zend_ffi_face_struct_add_fields(ffi_type* t, zend_ffi_type *type, int *i, size_t s… in zend_ffi_face_struct_add_fields() argument
300 ZEND_HASH_FOREACH_PTR(&type->record.fields, field) { in zend_ffi_face_struct_add_fields()
301 switch (ZEND_FFI_TYPE(field->type)->kind) { in zend_ffi_face_struct_add_fields()
335 zend_ffi_type *field_type = ZEND_FFI_TYPE(field->type); in zend_ffi_face_struct_add_fields()
352 if (type->attr & ZEND_FFI_ATTR_UNION) { in zend_ffi_face_struct_add_fields()
360 static ffi_type *zend_ffi_make_fake_struct_type(zend_ffi_type *type) /* {{{ */ in zend_ffi_make_fake_struct_type() argument
363 int num_fields = !(type->attr & ZEND_FFI_ATTR_UNION) ? in zend_ffi_make_fake_struct_type()
364 zend_hash_num_elements(&type->record.fields) : 1; in zend_ffi_make_fake_struct_type()
369 t->size = type->size; in zend_ffi_make_fake_struct_type()
370 t->alignment = type->align; in zend_ffi_make_fake_struct_type()
371 t->type = FFI_TYPE_STRUCT; in zend_ffi_make_fake_struct_type()
374 t = zend_ffi_face_struct_add_fields(t, type, &i, size); in zend_ffi_make_fake_struct_type()
380 static ffi_type *zend_ffi_get_type(zend_ffi_type *type) /* {{{ */ in zend_ffi_get_type() argument
382 zend_ffi_type_kind kind = type->kind; in zend_ffi_get_type()
419 kind = type->enumeration.kind; in zend_ffi_get_type()
422 return zend_ffi_make_fake_struct_type(type); in zend_ffi_get_type()
430 static zend_never_inline zend_ffi_cdata *zend_ffi_cdata_to_zval_slow(void *ptr, zend_ffi_type *type in zend_ffi_cdata_to_zval_slow() argument
436 (type->kind < ZEND_FFI_TYPE_POINTER) ? in zend_ffi_cdata_to_zval_slow()
439 cdata->type = type; in zend_ffi_cdata_to_zval_slow()
446 …zend_ffi_cdata *zend_ffi_cdata_to_zval_slow_ptr(void *ptr, zend_ffi_type *type, zend_ffi_flags fla… in zend_ffi_cdata_to_zval_slow_ptr() argument
452 cdata->type = type; in zend_ffi_cdata_to_zval_slow_ptr()
460 …zend_ffi_cdata *zend_ffi_cdata_to_zval_slow_ret(void *ptr, zend_ffi_type *type, zend_ffi_flags fla… in zend_ffi_cdata_to_zval_slow_ret() argument
466 (type->kind < ZEND_FFI_TYPE_POINTER) ? in zend_ffi_cdata_to_zval_slow_ret()
469 cdata->type = type; in zend_ffi_cdata_to_zval_slow_ret()
471 if (type->kind == ZEND_FFI_TYPE_POINTER) { in zend_ffi_cdata_to_zval_slow_ret()
474 } else if (type->kind == ZEND_FFI_TYPE_STRUCT) { in zend_ffi_cdata_to_zval_slow_ret()
475 cdata->ptr = emalloc(type->size); in zend_ffi_cdata_to_zval_slow_ret()
477 memcpy(cdata->ptr, ptr, type->size); in zend_ffi_cdata_to_zval_slow_ret()
485 …d zend_ffi_cdata_to_zval(zend_ffi_cdata *cdata, void *ptr, zend_ffi_type *type, int read_type, zva… in zend_ffi_cdata_to_zval() argument
488 zend_ffi_type_kind kind = type->kind; in zend_ffi_cdata_to_zval()
534 kind = type->enumeration.kind; in zend_ffi_cdata_to_zval()
543 …} else if ((type->attr & ZEND_FFI_ATTR_CONST) && ZEND_FFI_TYPE(type->pointer.type)->kind == ZEND_F… in zend_ffi_cdata_to_zval()
549 cdata = zend_ffi_cdata_to_zval_slow_ret(ptr, type, flags); in zend_ffi_cdata_to_zval()
551 cdata = zend_ffi_cdata_to_zval_slow_ptr(ptr, type, flags); in zend_ffi_cdata_to_zval()
565 cdata = zend_ffi_cdata_to_zval_slow_ret(ptr, type, flags); in zend_ffi_cdata_to_zval()
567 cdata = zend_ffi_cdata_to_zval_slow(ptr, type, flags); in zend_ffi_cdata_to_zval()
621 if (ZEND_FFI_TYPE(field->type)->kind == ZEND_FFI_TYPE_CHAR in zend_ffi_bit_field_to_zval()
622 || ZEND_FFI_TYPE(field->type)->kind == ZEND_FFI_TYPE_SINT8 in zend_ffi_bit_field_to_zval()
623 || ZEND_FFI_TYPE(field->type)->kind == ZEND_FFI_TYPE_SINT16 in zend_ffi_bit_field_to_zval()
624 || ZEND_FFI_TYPE(field->type)->kind == ZEND_FFI_TYPE_SINT32 in zend_ffi_bit_field_to_zval()
625 || ZEND_FFI_TYPE(field->type)->kind == ZEND_FFI_TYPE_SINT64) { in zend_ffi_bit_field_to_zval()
679 static zend_always_inline int zend_ffi_zval_to_cdata(void *ptr, zend_ffi_type *type, zval *value) /… in zend_ffi_zval_to_cdata() argument
685 zend_ffi_type_kind kind = type->kind; in zend_ffi_zval_to_cdata()
743 zend_ffi_assign_incompatible(value, type); in zend_ffi_zval_to_cdata()
749 kind = type->enumeration.kind; in zend_ffi_zval_to_cdata()
758 if (zend_ffi_is_compatible_type(type, ZEND_FFI_TYPE(cdata->type))) { in zend_ffi_zval_to_cdata()
759 if (ZEND_FFI_TYPE(cdata->type)->kind == ZEND_FFI_TYPE_POINTER) { in zend_ffi_zval_to_cdata()
770 } else if (ZEND_FFI_TYPE(cdata->type)->kind != ZEND_FFI_TYPE_POINTER in zend_ffi_zval_to_cdata()
771 … && zend_ffi_is_compatible_type(ZEND_FFI_TYPE(type->pointer.type), ZEND_FFI_TYPE(cdata->type))) { in zend_ffi_zval_to_cdata()
780 } else if (ZEND_FFI_TYPE(type->pointer.type)->kind == ZEND_FFI_TYPE_FUNC) { in zend_ffi_zval_to_cdata()
781 void *callback = zend_ffi_create_callback(ZEND_FFI_TYPE(type->pointer.type), value); in zend_ffi_zval_to_cdata()
791 zend_ffi_assign_incompatible(value, type); in zend_ffi_zval_to_cdata()
798 if (zend_ffi_is_compatible_type(type, ZEND_FFI_TYPE(cdata->type)) && in zend_ffi_zval_to_cdata()
799 type->size == ZEND_FFI_TYPE(cdata->type)->size) { in zend_ffi_zval_to_cdata()
800 memcpy(ptr, cdata->ptr, type->size); in zend_ffi_zval_to_cdata()
804 zend_ffi_assign_incompatible(value, type); in zend_ffi_zval_to_cdata()
812 static size_t zend_ffi_arg_size(zend_ffi_type *type) /* {{{ */ in zend_ffi_arg_size() argument
817 ZEND_HASH_FOREACH_PTR(type->func.args, arg_type) { in zend_ffi_arg_size()
825 …ys_inline zend_string *zend_ffi_mangled_func_name(zend_string *name, zend_ffi_type *type) /* {{{ */ in zend_ffi_mangled_func_name() argument
828 switch (type->func.abi) { in zend_ffi_mangled_func_name()
831 return strpprintf(0, "@%s@%zu", ZSTR_VAL(name), zend_ffi_arg_size(type)); in zend_ffi_mangled_func_name()
835 return strpprintf(0, "_%s@%zu", ZSTR_VAL(name), zend_ffi_arg_size(type)); in zend_ffi_mangled_func_name()
839 return strpprintf(0, "%s@@%zu", ZSTR_VAL(name), zend_ffi_arg_size(type)); in zend_ffi_mangled_func_name()
850 zend_ffi_type *type; member
868 if (callback_data->arg_types[i]->type == FFI_TYPE_STRUCT) { in zend_ffi_callback_hash_dtor()
872 if (callback_data->ret_type->type == FFI_TYPE_STRUCT) { in zend_ffi_callback_hash_dtor()
895 if (callback_data->type->func.args) { in zend_ffi_callback_trampoline()
899 ZEND_HASH_FOREACH_PTR(callback_data->type->func.args, arg_type) { in zend_ffi_callback_trampoline()
924 ret_type = ZEND_FFI_TYPE(callback_data->type->func.ret_type); in zend_ffi_callback_trampoline()
933 static void *zend_ffi_create_callback(zend_ffi_type *type, zval *value) /* {{{ */ in zend_ffi_create_callback() argument
942 if (type->attr & ZEND_FFI_ATTR_VARIADIC) { in zend_ffi_create_callback()
952 arg_count = type->func.args ? zend_hash_num_elements(type->func.args) : 0; in zend_ffi_create_callback()
966 callback_data->type = type; in zend_ffi_create_callback()
971 if (type->func.args) { in zend_ffi_create_callback()
975 ZEND_HASH_FOREACH_PTR(type->func.args, arg_type) { in zend_ffi_create_callback()
981 if (callback_data->arg_types[i]->type == FFI_TYPE_STRUCT) { in zend_ffi_create_callback()
992 callback_data->ret_type = zend_ffi_get_type(ZEND_FFI_TYPE(type->func.ret_type)); in zend_ffi_create_callback()
994 zend_ffi_return_unsupported(type->func.ret_type); in zend_ffi_create_callback()
996 if (callback_data->arg_types[i]->type == FFI_TYPE_STRUCT) { in zend_ffi_create_callback()
1005 …if (ffi_prep_cif(&callback_data->cif, type->func.abi, callback_data->arg_count, callback_data->ret… in zend_ffi_create_callback()
1014 if (callback_data->arg_types[i]->type == FFI_TYPE_STRUCT) { in zend_ffi_create_callback()
1018 if (callback_data->ret_type->type == FFI_TYPE_STRUCT) { in zend_ffi_create_callback()
1044 zend_ffi_type *type = ZEND_FFI_TYPE(cdata->type); in zend_ffi_cdata_get() local
1058 zend_ffi_cdata_to_zval(cdata, cdata->ptr, type, BP_VAR_R, rv, 0, 0, 0); in zend_ffi_cdata_get()
1066 zend_ffi_type *type = ZEND_FFI_TYPE(cdata->type); in zend_ffi_cdata_set() local
1080 zend_ffi_zval_to_cdata(cdata->ptr, type, value); in zend_ffi_cdata_set()
1086 static int zend_ffi_cdata_cast_object(zend_object *readobj, zval *writeobj, int type) /* {{{ */ in zend_ffi_cdata_cast_object() argument
1088 if (type == IS_STRING) { in zend_ffi_cdata_cast_object()
1090 zend_ffi_type *ctype = ZEND_FFI_TYPE(cdata->type); in zend_ffi_cdata_cast_object()
1144 …} else if ((ctype->attr & ZEND_FFI_ATTR_CONST) && ZEND_FFI_TYPE(ctype->pointer.type)->kind == ZEND… in zend_ffi_cdata_cast_object()
1154 } else if (type == _IS_BOOL) { in zend_ffi_cdata_cast_object()
1166 zend_ffi_type *type = ZEND_FFI_TYPE(cdata->type); in zend_ffi_cdata_read_field() local
1170 if (cache_slot && *cache_slot == type) { in zend_ffi_cdata_read_field()
1173 if (UNEXPECTED(type->kind != ZEND_FFI_TYPE_STRUCT)) { in zend_ffi_cdata_read_field()
1174 if (type->kind == ZEND_FFI_TYPE_POINTER) { in zend_ffi_cdata_read_field()
1185 type = ZEND_FFI_TYPE(type->pointer.type); in zend_ffi_cdata_read_field()
1187 if (UNEXPECTED(type->kind != ZEND_FFI_TYPE_STRUCT)) { in zend_ffi_cdata_read_field()
1193 field = zend_hash_find_ptr(&type->record.fields, field_name); in zend_ffi_cdata_read_field()
1200 *cache_slot = type; in zend_ffi_cdata_read_field()
1213 zend_ffi_type *field_type = field->type; in zend_ffi_cdata_read_field()
1219 field->type = field_type = zend_ffi_remember_type(field_type); in zend_ffi_cdata_read_field()
1235 zend_ffi_type *type = ZEND_FFI_TYPE(cdata->type); in zend_ffi_cdata_write_field() local
1239 if (cache_slot && *cache_slot == type) { in zend_ffi_cdata_write_field()
1242 if (UNEXPECTED(type->kind != ZEND_FFI_TYPE_STRUCT)) { in zend_ffi_cdata_write_field()
1243 if (type->kind == ZEND_FFI_TYPE_POINTER) { in zend_ffi_cdata_write_field()
1254 type = ZEND_FFI_TYPE(type->pointer.type); in zend_ffi_cdata_write_field()
1256 if (UNEXPECTED(type->kind != ZEND_FFI_TYPE_STRUCT)) { in zend_ffi_cdata_write_field()
1262 field = zend_hash_find_ptr(&type->record.fields, field_name); in zend_ffi_cdata_write_field()
1269 *cache_slot = type; in zend_ffi_cdata_write_field()
1291 zend_ffi_zval_to_cdata(ptr, ZEND_FFI_TYPE(field->type), value); in zend_ffi_cdata_write_field()
1302 zend_ffi_type *type = ZEND_FFI_TYPE(cdata->type); in zend_ffi_cdata_read_dim() local
1308 if (EXPECTED(type->kind == ZEND_FFI_TYPE_ARRAY)) { in zend_ffi_cdata_read_dim()
1309 if (UNEXPECTED((zend_ulong)(dim) >= (zend_ulong)type->array.length) in zend_ffi_cdata_read_dim()
1310 && (UNEXPECTED(dim < 0) || UNEXPECTED(type->array.length != 0))) { in zend_ffi_cdata_read_dim()
1315 …is_const = (cdata->flags & ZEND_FFI_FLAG_CONST) | (zend_ffi_flags)(type->attr & ZEND_FFI_ATTR_CONS… in zend_ffi_cdata_read_dim()
1317 dim_type = type->array.type; in zend_ffi_cdata_read_dim()
1322 type->array.type = dim_type = zend_ffi_remember_type(dim_type); in zend_ffi_cdata_read_dim()
1332 } else if (EXPECTED(type->kind == ZEND_FFI_TYPE_POINTER)) { in zend_ffi_cdata_read_dim()
1333 …is_const = (cdata->flags & ZEND_FFI_FLAG_CONST) | (zend_ffi_flags)(type->attr & ZEND_FFI_ATTR_CONS… in zend_ffi_cdata_read_dim()
1334 dim_type = type->pointer.type; in zend_ffi_cdata_read_dim()
1339 type->pointer.type = dim_type = zend_ffi_remember_type(dim_type); in zend_ffi_cdata_read_dim()
1360 zend_ffi_type *type = ZEND_FFI_TYPE(cdata->type); in zend_ffi_cdata_write_dim() local
1371 if (EXPECTED(type->kind == ZEND_FFI_TYPE_ARRAY)) { in zend_ffi_cdata_write_dim()
1372 if (UNEXPECTED((zend_ulong)(dim) >= (zend_ulong)type->array.length) in zend_ffi_cdata_write_dim()
1373 && (UNEXPECTED(dim < 0) || UNEXPECTED(type->array.length != 0))) { in zend_ffi_cdata_write_dim()
1378 …is_const = (cdata->flags & ZEND_FFI_FLAG_CONST) | (zend_ffi_flags)(type->attr & ZEND_FFI_ATTR_CONS… in zend_ffi_cdata_write_dim()
1379 type = ZEND_FFI_TYPE(type->array.type); in zend_ffi_cdata_write_dim()
1386 ptr = (void*)(((char*)cdata->ptr) + type->size * dim); in zend_ffi_cdata_write_dim()
1387 } else if (EXPECTED(type->kind == ZEND_FFI_TYPE_POINTER)) { in zend_ffi_cdata_write_dim()
1388 …is_const = (cdata->flags & ZEND_FFI_FLAG_CONST) | (zend_ffi_flags)(type->attr & ZEND_FFI_ATTR_CONS… in zend_ffi_cdata_write_dim()
1389 type = ZEND_FFI_TYPE(type->pointer.type); in zend_ffi_cdata_write_dim()
1394 ptr = (void*)((*(char**)cdata->ptr) + type->size * dim); in zend_ffi_cdata_write_dim()
1405 zend_ffi_zval_to_cdata(ptr, type, value); in zend_ffi_cdata_write_dim()
1439 static int zend_ffi_ctype_name(zend_ffi_ctype_name_buf *buf, const zend_ffi_type *type) /* {{{ */ in zend_ffi_ctype_name() argument
1445 switch (type->kind) { in zend_ffi_ctype_name()
1485 if (type->enumeration.tag_name) { in zend_ffi_ctype_name()
1486 …zend_ffi_ctype_name_prepend(buf, ZSTR_VAL(type->enumeration.tag_name), ZSTR_LEN(type->enumeration.… in zend_ffi_ctype_name()
1503 type = ZEND_FFI_TYPE(type->pointer.type); in zend_ffi_ctype_name()
1517 type = ZEND_FFI_TYPE(type->func.ret_type); in zend_ffi_ctype_name()
1530 if (type->attr & ZEND_FFI_ATTR_VLA) { in zend_ffi_ctype_name()
1534 } else if (!(type->attr & ZEND_FFI_ATTR_INCOMPLETE_ARRAY)) { in zend_ffi_ctype_name()
1536 char *s = zend_print_long_to_buf(str + sizeof(str) - 1, type->array.length); in zend_ffi_ctype_name()
1545 type = ZEND_FFI_TYPE(type->array.type); in zend_ffi_ctype_name()
1548 if (type->attr & ZEND_FFI_ATTR_UNION) { in zend_ffi_ctype_name()
1549 if (type->record.tag_name) { in zend_ffi_ctype_name()
1550 …zend_ffi_ctype_name_prepend(buf, ZSTR_VAL(type->record.tag_name), ZSTR_LEN(type->record.tag_name)); in zend_ffi_ctype_name()
1556 if (type->record.tag_name) { in zend_ffi_ctype_name()
1557 …zend_ffi_ctype_name_prepend(buf, ZSTR_VAL(type->record.tag_name), ZSTR_LEN(type->record.tag_name)); in zend_ffi_ctype_name()
1581 static ZEND_COLD void zend_ffi_return_unsupported(zend_ffi_type *type) /* {{{ */ in zend_ffi_return_unsupported() argument
1583 type = ZEND_FFI_TYPE(type); in zend_ffi_return_unsupported()
1584 if (type->kind == ZEND_FFI_TYPE_STRUCT) { in zend_ffi_return_unsupported()
1586 } else if (type->kind == ZEND_FFI_TYPE_ARRAY) { in zend_ffi_return_unsupported()
1594 static ZEND_COLD void zend_ffi_pass_unsupported(zend_ffi_type *type) /* {{{ */ in zend_ffi_pass_unsupported() argument
1596 type = ZEND_FFI_TYPE(type); in zend_ffi_pass_unsupported()
1597 if (type->kind == ZEND_FFI_TYPE_STRUCT) { in zend_ffi_pass_unsupported()
1599 } else if (type->kind == ZEND_FFI_TYPE_ARRAY) { in zend_ffi_pass_unsupported()
1607 static ZEND_COLD void zend_ffi_pass_incompatible(zval *arg, zend_ffi_type *type, uint32_t n, zend_e… in zend_ffi_pass_incompatible() argument
1612 if (!zend_ffi_ctype_name(&buf1, type)) { in zend_ffi_pass_incompatible()
1619 type = ZEND_FFI_TYPE(cdata->type); in zend_ffi_pass_incompatible()
1621 if (!zend_ffi_ctype_name(&buf2, type)) { in zend_ffi_pass_incompatible()
1634 static ZEND_COLD void zend_ffi_assign_incompatible(zval *arg, zend_ffi_type *type) /* {{{ */ in zend_ffi_assign_incompatible() argument
1639 if (!zend_ffi_ctype_name(&buf1, type)) { in zend_ffi_assign_incompatible()
1646 type = ZEND_FFI_TYPE(cdata->type); in zend_ffi_assign_incompatible()
1648 if (!zend_ffi_ctype_name(&buf2, type)) { in zend_ffi_assign_incompatible()
1661 static zend_string *zend_ffi_get_class_name(zend_string *prefix, const zend_ffi_type *type) /* {{{ … in zend_ffi_get_class_name() argument
1666 if (!zend_ffi_ctype_name(&buf, type)) { in zend_ffi_get_class_name()
1679 return zend_ffi_get_class_name(zobj->ce->name, ZEND_FFI_TYPE(cdata->type)); in zend_ffi_cdata_get_class_name()
1689 zend_ffi_type *type1 = ZEND_FFI_TYPE(cdata1->type); in zend_ffi_cdata_compare_objects()
1690 zend_ffi_type *type2 = ZEND_FFI_TYPE(cdata2->type); in zend_ffi_cdata_compare_objects()
1711 zend_ffi_type *type = ZEND_FFI_TYPE(cdata->type); in zend_ffi_cdata_count_elements() local
1713 if (type->kind != ZEND_FFI_TYPE_ARRAY) { in zend_ffi_cdata_count_elements()
1717 *count = type->array.length; in zend_ffi_cdata_count_elements()
1731 if (ZEND_FFI_TYPE_IS_OWNED(base_cdata->type)) { in zend_ffi_add()
1735 base_cdata->type = base_type; in zend_ffi_add()
1738 base_cdata->type = base_type = zend_ffi_remember_type(base_type); in zend_ffi_add()
1742 cdata->type = base_type; in zend_ffi_add()
1744 ptr_type = ZEND_FFI_TYPE(base_type)->pointer.type; in zend_ffi_add()
1753 ptr_type = base_type->array.type; in zend_ffi_add()
1759 base_type->array.type = ptr_type; in zend_ffi_add()
1762 base_type->array.type = ptr_type = zend_ffi_remember_type(ptr_type); in zend_ffi_add()
1766 new_type->pointer.type = ptr_type; in zend_ffi_add()
1768 cdata->type = ZEND_FFI_TYPE_MAKE_OWNED(new_type); in zend_ffi_add()
1787 zend_ffi_type *type1 = ZEND_FFI_TYPE(cdata1->type); in zend_ffi_cdata_do_operation()
1800 zend_ffi_type *type2 = ZEND_FFI_TYPE(cdata2->type); in zend_ffi_cdata_do_operation()
1807 t1 = ZEND_FFI_TYPE(type1->pointer.type); in zend_ffi_cdata_do_operation()
1810 t1 = ZEND_FFI_TYPE(type1->array.type); in zend_ffi_cdata_do_operation()
1814 t2 = ZEND_FFI_TYPE(type2->pointer.type); in zend_ffi_cdata_do_operation()
1817 t2 = ZEND_FFI_TYPE(type2->array.type); in zend_ffi_cdata_do_operation()
1837 zend_ffi_type *type2 = ZEND_FFI_TYPE(cdata2->type); in zend_ffi_cdata_do_operation()
1870 zend_ffi_type *type = ZEND_FFI_TYPE(cdata->type); in zend_ffi_cdata_it_valid() local
1872 return (iter->key >= 0 && iter->key < type->array.length) ? SUCCESS : FAILURE; in zend_ffi_cdata_it_valid()
1880 zend_ffi_type *type = ZEND_FFI_TYPE(cdata->type); in zend_ffi_cdata_it_get_current_data() local
1888 dim_type = type->array.type; in zend_ffi_cdata_it_get_current_data()
1893 type->array.type = dim_type = zend_ffi_remember_type(dim_type); in zend_ffi_cdata_it_get_current_data()
1899 …_R, &iter->value, (cdata->flags & ZEND_FFI_FLAG_CONST) | (zend_ffi_flags)(type->attr & ZEND_FFI_AT… in zend_ffi_cdata_it_get_current_data()
1939 zend_ffi_type *type = ZEND_FFI_TYPE(cdata->type); in zend_ffi_cdata_get_iterator() local
1942 if (type->kind != ZEND_FFI_TYPE_ARRAY) { in zend_ffi_cdata_get_iterator()
1965 zend_ffi_type *type = ZEND_FFI_TYPE(cdata->type); in zend_ffi_cdata_get_debug_info() local
1978 switch (type->kind) { in zend_ffi_cdata_get_debug_info()
1995 zend_ffi_cdata_to_zval(cdata, ptr, type, BP_VAR_R, &tmp, ZEND_FFI_FLAG_CONST, 0, 0); in zend_ffi_cdata_get_debug_info()
2008 } else if (ZEND_FFI_TYPE(type->pointer.type)->kind == ZEND_FFI_TYPE_VOID) { in zend_ffi_cdata_get_debug_info()
2015 …zend_ffi_cdata_to_zval(NULL, *(void**)ptr, ZEND_FFI_TYPE(type->pointer.type), BP_VAR_R, &tmp, ZEND… in zend_ffi_cdata_get_debug_info()
2023 ht = zend_new_array(zend_hash_num_elements(&type->record.fields)); in zend_ffi_cdata_get_debug_info()
2024 ZEND_HASH_FOREACH_STR_KEY_PTR(&type->record.fields, key, f) { in zend_ffi_cdata_get_debug_info()
2028 …nd_ffi_cdata_to_zval(NULL, f_ptr, ZEND_FFI_TYPE(f->type), BP_VAR_R, &tmp, ZEND_FFI_FLAG_CONST, 0, in zend_ffi_cdata_get_debug_info()
2039 ht = zend_new_array(type->array.length); in zend_ffi_cdata_get_debug_info()
2040 for (n = 0; n < type->array.length; n++) { in zend_ffi_cdata_get_debug_info()
2041 …zend_ffi_cdata_to_zval(NULL, ptr, ZEND_FFI_TYPE(type->array.type), BP_VAR_R, &tmp, ZEND_FFI_FLAG_C… in zend_ffi_cdata_get_debug_info()
2043 ptr = (void*)(((char*)ptr) + ZEND_FFI_TYPE(type->array.type)->size); in zend_ffi_cdata_get_debug_info()
2064 zend_ffi_type *type = ZEND_FFI_TYPE(cdata->type); in zend_ffi_cdata_get_closure() local
2067 if (type->kind != ZEND_FFI_TYPE_POINTER) { in zend_ffi_cdata_get_closure()
2073 type = ZEND_FFI_TYPE(type->pointer.type); in zend_ffi_cdata_get_closure()
2074 if (type->kind != ZEND_FFI_TYPE_FUNC) { in zend_ffi_cdata_get_closure()
2092 func->type = ZEND_INTERNAL_FUNCTION; in zend_ffi_cdata_get_closure()
2100 func->common.required_num_args = type->func.args ? zend_hash_num_elements(type->func.args) : 0; in zend_ffi_cdata_get_closure()
2107 func->internal_function.reserved[0] = type; in zend_ffi_cdata_get_closure()
2127 ctype->type = NULL; in zend_ffi_ctype_new()
2137 zend_ffi_type_dtor(ctype->type); in zend_ffi_ctype_free_obj()
2150 type1 = ZEND_FFI_TYPE(type1->pointer.type); in zend_ffi_is_same_type()
2151 type2 = ZEND_FFI_TYPE(type2->pointer.type); in zend_ffi_is_same_type()
2158 type1 = ZEND_FFI_TYPE(type1->array.type); in zend_ffi_is_same_type()
2159 type2 = ZEND_FFI_TYPE(type2->array.type); in zend_ffi_is_same_type()
2175 return zend_ffi_get_class_name(zobj->ce->name, ZEND_FFI_TYPE(ctype->type)); in zend_ffi_ctype_get_class_name()
2185 zend_ffi_type *type1 = ZEND_FFI_TYPE(ctype1->type); in zend_ffi_ctype_compare_objects()
2186 zend_ffi_type *type2 = ZEND_FFI_TYPE(ctype2->type); in zend_ffi_ctype_compare_objects()
2223 static void _zend_ffi_type_dtor(zend_ffi_type *type) /* {{{ */ in _zend_ffi_type_dtor() argument
2225 type = ZEND_FFI_TYPE(type); in _zend_ffi_type_dtor()
2227 switch (type->kind) { in _zend_ffi_type_dtor()
2229 if (type->enumeration.tag_name) { in _zend_ffi_type_dtor()
2230 zend_string_release(type->enumeration.tag_name); in _zend_ffi_type_dtor()
2234 if (type->record.tag_name) { in _zend_ffi_type_dtor()
2235 zend_string_release(type->record.tag_name); in _zend_ffi_type_dtor()
2237 zend_hash_destroy(&type->record.fields); in _zend_ffi_type_dtor()
2240 zend_ffi_type_dtor(type->pointer.type); in _zend_ffi_type_dtor()
2243 zend_ffi_type_dtor(type->array.type); in _zend_ffi_type_dtor()
2246 if (type->func.args) { in _zend_ffi_type_dtor()
2247 zend_hash_destroy(type->func.args); in _zend_ffi_type_dtor()
2248 pefree(type->func.args, type->attr & ZEND_FFI_ATTR_PERSISTENT); in _zend_ffi_type_dtor()
2250 zend_ffi_type_dtor(type->func.ret_type); in _zend_ffi_type_dtor()
2255 pefree(type, type->attr & ZEND_FFI_ATTR_PERSISTENT); in _zend_ffi_type_dtor()
2261 zend_ffi_type *type = Z_PTR_P(zv); in zend_ffi_type_hash_dtor() local
2262 zend_ffi_type_dtor(type); in zend_ffi_type_hash_dtor()
2269 zend_ffi_type_dtor(field->type); in zend_ffi_field_hash_dtor()
2277 zend_ffi_type_dtor(field->type); in zend_ffi_field_hash_persistent_dtor()
2285 zend_ffi_type_dtor(sym->type); in zend_ffi_symbol_hash_dtor()
2293 zend_ffi_type_dtor(sym->type); in zend_ffi_symbol_hash_persistent_dtor()
2301 zend_ffi_type_dtor(tag->type); in zend_ffi_tag_hash_dtor()
2309 zend_ffi_type_dtor(tag->type); in zend_ffi_tag_hash_persistent_dtor()
2316 zend_ffi_type_dtor(cdata->type); in zend_ffi_cdata_dtor()
2378 zend_ffi_type *type = ZEND_FFI_TYPE(old_cdata->type); in zend_ffi_cdata_clone_obj() local
2382 if (type->kind < ZEND_FFI_TYPE_POINTER) { in zend_ffi_cdata_clone_obj()
2385 new_cdata->type = type; in zend_ffi_cdata_clone_obj()
2386 new_cdata->ptr = emalloc(type->size); in zend_ffi_cdata_clone_obj()
2387 memcpy(new_cdata->ptr, old_cdata->ptr, type->size); in zend_ffi_cdata_clone_obj()
2411 …zend_ffi_cdata_to_zval(NULL, sym->addr, ZEND_FFI_TYPE(sym->type), read_type, rv, (zend_ffi_flags)s… in zend_ffi_read_var()
2420 new_type->pointer.type = ZEND_FFI_TYPE(sym->type); in zend_ffi_read_var()
2425 cdata->type = ZEND_FFI_TYPE_MAKE_OWNED(new_type); in zend_ffi_read_var()
2459 zend_ffi_zval_to_cdata(sym->addr, ZEND_FFI_TYPE(sym->type), value); in zend_ffi_write_var()
2464 static int zend_ffi_pass_arg(zval *arg, zend_ffi_type *type, ffi_type **pass_type, void **arg_value… in zend_ffi_pass_arg() argument
2469 zend_ffi_type_kind kind = type->kind; in zend_ffi_pass_arg()
2538 && ((ZEND_FFI_TYPE(type->pointer.type)->kind == ZEND_FFI_TYPE_CHAR) in zend_ffi_pass_arg()
2539 || (ZEND_FFI_TYPE(type->pointer.type)->kind == ZEND_FFI_TYPE_VOID))) { in zend_ffi_pass_arg()
2545 if (zend_ffi_is_compatible_type(type, ZEND_FFI_TYPE(cdata->type))) { in zend_ffi_pass_arg()
2546 if (ZEND_FFI_TYPE(cdata->type)->kind == ZEND_FFI_TYPE_POINTER) { in zend_ffi_pass_arg()
2558 } else if (ZEND_FFI_TYPE(type->pointer.type)->kind == ZEND_FFI_TYPE_FUNC) { in zend_ffi_pass_arg()
2559 void *callback = zend_ffi_create_callback(ZEND_FFI_TYPE(type->pointer.type), arg); in zend_ffi_pass_arg()
2569 zend_ffi_pass_incompatible(arg, type, n, execute_data); in zend_ffi_pass_arg()
2580 zend_ffi_pass_incompatible(arg, type, n, execute_data); in zend_ffi_pass_arg()
2585 kind = type->enumeration.kind; in zend_ffi_pass_arg()
2591 if (zend_ffi_is_compatible_type(type, ZEND_FFI_TYPE(cdata->type))) { in zend_ffi_pass_arg()
2592 *pass_type = zend_ffi_make_fake_struct_type(type);; in zend_ffi_pass_arg()
2597 zend_ffi_pass_incompatible(arg, type, n, execute_data); in zend_ffi_pass_arg()
2600 zend_ffi_pass_unsupported(type); in zend_ffi_pass_arg()
2643 zend_ffi_type *type = ZEND_FFI_TYPE(cdata->type); in zend_ffi_pass_var_arg() local
2645 return zend_ffi_pass_arg(arg, type, pass_type, arg_values, n, execute_data); in zend_ffi_pass_var_arg()
2658 zend_ffi_type *type = EX(func)->internal_function.reserved[0]; in ZEND_FUNCTION() local
2671 ZEND_ASSERT(type->kind == ZEND_FFI_TYPE_FUNC); in ZEND_FUNCTION()
2672 arg_count = type->func.args ? zend_hash_num_elements(type->func.args) : 0; in ZEND_FUNCTION()
2673 if (type->attr & ZEND_FFI_ATTR_VARIADIC) { in ZEND_FUNCTION()
2684 if (type->func.args) { in ZEND_FUNCTION()
2685 ZEND_HASH_FOREACH_PTR(type->func.args, arg_type) { in ZEND_FUNCTION()
2705 ret_type = zend_ffi_get_type(ZEND_FFI_TYPE(type->func.ret_type)); in ZEND_FUNCTION()
2707 zend_ffi_return_unsupported(type->func.ret_type); in ZEND_FUNCTION()
2712 …if (ffi_prep_cif_var(&cif, type->func.abi, arg_count, EX_NUM_ARGS(), ret_type, arg_types) != FFI_O… in ZEND_FUNCTION()
2729 if (type->func.args) { in ZEND_FUNCTION()
2730 ZEND_HASH_FOREACH_PTR(type->func.args, arg_type) { in ZEND_FUNCTION()
2742 ret_type = zend_ffi_get_type(ZEND_FFI_TYPE(type->func.ret_type)); in ZEND_FUNCTION()
2744 zend_ffi_return_unsupported(type->func.ret_type); in ZEND_FUNCTION()
2749 if (ffi_prep_cif(&cif, type->func.abi, arg_count, ret_type, arg_types) != FFI_OK) { in ZEND_FUNCTION()
2761 if (arg_types[n]->type == FFI_TYPE_STRUCT) { in ZEND_FUNCTION()
2765 if (ret_type->type == FFI_TYPE_STRUCT) { in ZEND_FUNCTION()
2774 …zend_ffi_cdata_to_zval(NULL, ret, ZEND_FFI_TYPE(type->func.ret_type), BP_VAR_R, return_value, 0, 1… in ZEND_FUNCTION()
2791 zend_ffi_type *type; in zend_ffi_get_func() local
2823 type = ZEND_FFI_TYPE(sym->type); in zend_ffi_get_func()
2824 ZEND_ASSERT(type->kind == ZEND_FFI_TYPE_FUNC); in zend_ffi_get_func()
2831 func->common.type = ZEND_INTERNAL_FUNCTION; in zend_ffi_get_func()
2839 func->common.required_num_args = type->func.args ? zend_hash_num_elements(type->func.args) : 0; in zend_ffi_get_func()
2846 func->internal_function.reserved[0] = type; in zend_ffi_get_func()
2945 zend_string *mangled_name = zend_ffi_mangled_func_name(name, ZEND_FFI_TYPE(sym->type)); in ZEND_METHOD()
2971 static int zend_ffi_same_types(zend_ffi_type *old, zend_ffi_type *type) /* {{{ */ in zend_ffi_same_types() argument
2973 if (old == type) { in zend_ffi_same_types()
2977 if (old->kind != type->kind in zend_ffi_same_types()
2978 || old->size != type->size in zend_ffi_same_types()
2979 || old->align != type->align in zend_ffi_same_types()
2980 || old->attr != type->attr) { in zend_ffi_same_types()
2986 return old->enumeration.kind == type->enumeration.kind; in zend_ffi_same_types()
2988 return old->array.length == type->array.length in zend_ffi_same_types()
2989 && zend_ffi_same_types(ZEND_FFI_TYPE(old->array.type), ZEND_FFI_TYPE(type->array.type)); in zend_ffi_same_types()
2991 return zend_ffi_same_types(ZEND_FFI_TYPE(old->pointer.type), ZEND_FFI_TYPE(type->pointer.type)); in zend_ffi_same_types()
2993 … if (zend_hash_num_elements(&old->record.fields) != zend_hash_num_elements(&type->record.fields)) { in zend_ffi_same_types()
2998 Bucket *b = type->record.fields.arData; in zend_ffi_same_types()
3018 || !zend_ffi_same_types(ZEND_FFI_TYPE(old_field->type), ZEND_FFI_TYPE(field->type))) { in zend_ffi_same_types()
3026 if (old->func.abi != type->func.abi in zend_ffi_same_types()
3027 …rgs ? zend_hash_num_elements(old->func.args) : 0) != (type->func.args ? zend_hash_num_elements(typ… in zend_ffi_same_types()
3028 … || !zend_ffi_same_types(ZEND_FFI_TYPE(old->func.ret_type), ZEND_FFI_TYPE(type->func.ret_type))) { in zend_ffi_same_types()
3032 Bucket *b = type->func.args->arData; in zend_ffi_same_types()
3065 return zend_ffi_same_types(ZEND_FFI_TYPE(old->type), ZEND_FFI_TYPE(sym->type)); in zend_ffi_same_symbols()
3075 return zend_ffi_same_types(ZEND_FFI_TYPE(old->type), ZEND_FFI_TYPE(tag->type)); in zend_ffi_same_tags()
3079 static int zend_ffi_subst_old_type(zend_ffi_type **dcl, zend_ffi_type *old, zend_ffi_type *type) /*… in zend_ffi_subst_old_type() argument
3084 if (ZEND_FFI_TYPE(*dcl) == type) { in zend_ffi_subst_old_type()
3091 return zend_ffi_subst_old_type(&dcl_type->pointer.type, old, type); in zend_ffi_subst_old_type()
3093 return zend_ffi_subst_old_type(&dcl_type->array.type, old, type); in zend_ffi_subst_old_type()
3095 if (zend_ffi_subst_old_type(&dcl_type->func.ret_type, old, type)) { in zend_ffi_subst_old_type()
3102 if (zend_ffi_subst_old_type((zend_ffi_type**)&Z_PTR_P(zv), old, type)) { in zend_ffi_subst_old_type()
3110 if (zend_ffi_subst_old_type(&field->type, old, type)) { in zend_ffi_subst_old_type()
3121 static void zend_ffi_cleanup_type(zend_ffi_type *old, zend_ffi_type *type) /* {{{ */ in zend_ffi_cleanup_type() argument
3128 zend_ffi_subst_old_type(&sym->type, old, type); in zend_ffi_cleanup_type()
3133 zend_ffi_subst_old_type(&tag->type, old, type); in zend_ffi_cleanup_type()
3139 static zend_ffi_type *zend_ffi_remember_type(zend_ffi_type *type) /* {{{ */ in zend_ffi_remember_type() argument
3146 type->attr |= ZEND_FFI_ATTR_STORED; in zend_ffi_remember_type()
3147 zend_hash_next_index_insert_ptr(FFI_G(weak_types), ZEND_FFI_TYPE_MAKE_OWNED(type)); in zend_ffi_remember_type()
3148 return type; in zend_ffi_remember_type()
3271 zend_string *mangled_name = zend_ffi_mangled_func_name(name, ZEND_FFI_TYPE(sym->type)); in zend_ffi_load()
3293 if (ZEND_FFI_TYPE_IS_OWNED(sym->type) in zend_ffi_load()
3294 && ZEND_FFI_TYPE(old_sym->type) != ZEND_FFI_TYPE(sym->type)) { in zend_ffi_load()
3295 zend_ffi_type *type = ZEND_FFI_TYPE(sym->type); in zend_ffi_load() local
3296 zend_ffi_cleanup_type(ZEND_FFI_TYPE(old_sym->type), ZEND_FFI_TYPE(type)); in zend_ffi_load()
3297 zend_ffi_type_dtor(type); in zend_ffi_load()
3318 if (ZEND_FFI_TYPE_IS_OWNED(tag->type) in zend_ffi_load()
3319 && ZEND_FFI_TYPE(old_tag->type) != ZEND_FFI_TYPE(tag->type)) { in zend_ffi_load()
3320 zend_ffi_type *type = ZEND_FFI_TYPE(tag->type); in zend_ffi_load() local
3321 zend_ffi_cleanup_type(ZEND_FFI_TYPE(old_tag->type), ZEND_FFI_TYPE(type)); in zend_ffi_load()
3322 zend_ffi_type_dtor(type); in zend_ffi_load()
3354 zend_ffi_type_dtor(sym->type); in zend_ffi_load()
3369 zend_ffi_type_dtor(tag->type); in zend_ffi_load()
3474 zend_ffi_type_dtor(dcl->type); in zend_ffi_cleanup_dcl()
3475 dcl->type = NULL; in zend_ffi_cleanup_dcl()
3499 static int zend_ffi_validate_vla(zend_ffi_type *type) /* {{{ */ in zend_ffi_validate_vla() argument
3501 if (!FFI_G(allow_vla) && (type->attr & ZEND_FFI_ATTR_VLA)) { in zend_ffi_validate_vla()
3509 static int zend_ffi_validate_incomplete_type(zend_ffi_type *type, zend_bool allow_incomplete_tag, z… in zend_ffi_validate_incomplete_type() argument
3511 if (!allow_incomplete_tag && (type->attr & ZEND_FFI_ATTR_INCOMPLETE_TAG)) { in zend_ffi_validate_incomplete_type()
3517 if (ZEND_FFI_TYPE(tag->type) == type) { in zend_ffi_validate_incomplete_type()
3518 if (type->kind == ZEND_FFI_TYPE_ENUM) { in zend_ffi_validate_incomplete_type()
3520 } else if (type->attr & ZEND_FFI_ATTR_UNION) { in zend_ffi_validate_incomplete_type()
3534 if (type == ZEND_FFI_TYPE(sym->type)) { in zend_ffi_validate_incomplete_type()
3542 } else if (!allow_incomplete_array && (type->attr & ZEND_FFI_ATTR_INCOMPLETE_ARRAY)) { in zend_ffi_validate_incomplete_type()
3545 } else if (!FFI_G(allow_vla) && (type->attr & ZEND_FFI_ATTR_VLA)) { in zend_ffi_validate_incomplete_type()
3553 static int zend_ffi_validate_type(zend_ffi_type *type, zend_bool allow_incomplete_tag, zend_bool al… in zend_ffi_validate_type() argument
3555 if (type->kind == ZEND_FFI_TYPE_VOID) { in zend_ffi_validate_type()
3559 return zend_ffi_validate_incomplete_type(type, allow_incomplete_tag, allow_incomplete_array); in zend_ffi_validate_type()
3563 static int zend_ffi_validate_var_type(zend_ffi_type *type, zend_bool allow_incomplete_array) /* {{{… in zend_ffi_validate_var_type() argument
3565 if (type->kind == ZEND_FFI_TYPE_FUNC) { in zend_ffi_validate_var_type()
3569 return zend_ffi_validate_type(type, 0, allow_incomplete_array); in zend_ffi_validate_var_type()
3576 if (zend_ffi_validate_var_type(ZEND_FFI_TYPE(dcl->type), 0) != SUCCESS) { in zend_ffi_validate_type_name()
3583 static int zend_ffi_subst_type(zend_ffi_type **dcl, zend_ffi_type *type) /* {{{ */ in zend_ffi_subst_type() argument
3588 if (*dcl == type) { in zend_ffi_subst_type()
3589 *dcl = ZEND_FFI_TYPE_MAKE_OWNED(type); in zend_ffi_subst_type()
3595 return zend_ffi_subst_type(&dcl_type->pointer.type, type); in zend_ffi_subst_type()
3597 return zend_ffi_subst_type(&dcl_type->array.type, type); in zend_ffi_subst_type()
3599 if (zend_ffi_subst_type(&dcl_type->func.ret_type, type)) { in zend_ffi_subst_type()
3606 if (zend_ffi_subst_type((zend_ffi_type**)&Z_PTR_P(zv), type)) { in zend_ffi_subst_type()
3614 if (zend_ffi_subst_type(&field->type, type)) { in zend_ffi_subst_type()
3629 if (ZEND_FFI_TYPE_IS_OWNED(tag->type)) { in zend_ffi_tags_cleanup()
3630 zend_ffi_type *type = ZEND_FFI_TYPE(tag->type); in zend_ffi_tags_cleanup() local
3631 zend_ffi_subst_type(&dcl->type, type); in zend_ffi_tags_cleanup()
3632 tag->type = type; in zend_ffi_tags_cleanup()
3644 zend_ffi_type *type, *type_ptr; in ZEND_METHOD() local
3683 zend_ffi_type_dtor(dcl.type); in ZEND_METHOD()
3699 type = ZEND_FFI_TYPE(dcl.type); in ZEND_METHOD()
3717 type_ptr = dcl.type; in ZEND_METHOD()
3721 type_ptr = type = ctype->type; in ZEND_METHOD()
3722 if (ZEND_FFI_TYPE_IS_OWNED(type)) { in ZEND_METHOD()
3723 type = ZEND_FFI_TYPE(type); in ZEND_METHOD()
3724 if (!(type->attr & ZEND_FFI_ATTR_STORED)) { in ZEND_METHOD()
3727 ctype->type = type; in ZEND_METHOD()
3729 ctype->type = type_ptr = type = zend_ffi_remember_type(type); in ZEND_METHOD()
3735 if (type->size == 0) { in ZEND_METHOD()
3741 ptr = pemalloc(type->size, flags & ZEND_FFI_FLAG_PERSISTENT); in ZEND_METHOD()
3742 memset(ptr, 0, type->size); in ZEND_METHOD()
3745 if (type->kind < ZEND_FFI_TYPE_POINTER) { in ZEND_METHOD()
3748 cdata->type = type_ptr; in ZEND_METHOD()
3771 if (ZEND_FFI_TYPE(cdata->type)->kind == ZEND_FFI_TYPE_POINTER) { in ZEND_METHOD()
3797 zend_ffi_type *old_type, *type, *type_ptr; in ZEND_METHOD() local
3827 zend_ffi_type_dtor(dcl.type); in ZEND_METHOD()
3843 type = ZEND_FFI_TYPE(dcl.type); in ZEND_METHOD()
3861 type_ptr = dcl.type; in ZEND_METHOD()
3865 type_ptr = type = ctype->type; in ZEND_METHOD()
3866 if (ZEND_FFI_TYPE_IS_OWNED(type)) { in ZEND_METHOD()
3867 type = ZEND_FFI_TYPE(type); in ZEND_METHOD()
3868 if (!(type->attr & ZEND_FFI_ATTR_STORED)) { in ZEND_METHOD()
3871 ctype->type = type; in ZEND_METHOD()
3873 ctype->type = type_ptr = type = zend_ffi_remember_type(type); in ZEND_METHOD()
3880 if (type->kind < ZEND_FFI_TYPE_POINTER && Z_TYPE_P(zv) < IS_STRING) { in ZEND_METHOD()
3884 cdata->type = type_ptr; in ZEND_METHOD()
3885 cdata->ptr = emalloc(type->size); in ZEND_METHOD()
3886 zend_ffi_zval_to_cdata(cdata->ptr, type, zv); in ZEND_METHOD()
3892 } else if (type->kind == ZEND_FFI_TYPE_POINTER && Z_TYPE_P(zv) == IS_LONG) { in ZEND_METHOD()
3895 cdata->type = type_ptr; in ZEND_METHOD()
3902 } else if (type->kind == ZEND_FFI_TYPE_POINTER && Z_TYPE_P(zv) == IS_NULL) { in ZEND_METHOD()
3905 cdata->type = type_ptr; in ZEND_METHOD()
3919 old_type = ZEND_FFI_TYPE(old_cdata->type); in ZEND_METHOD()
3923 if (type->kind < ZEND_FFI_TYPE_POINTER) { in ZEND_METHOD()
3926 cdata->type = type_ptr; in ZEND_METHOD()
3929 && type->kind != ZEND_FFI_TYPE_POINTER in ZEND_METHOD()
3930 && ZEND_FFI_TYPE(old_type->pointer.type)->kind == ZEND_FFI_TYPE_VOID) { in ZEND_METHOD()
3934 && type->kind == ZEND_FFI_TYPE_POINTER in ZEND_METHOD()
3935 …end_ffi_is_compatible_type(ZEND_FFI_TYPE(old_type->array.type), ZEND_FFI_TYPE(type->pointer.type))… in ZEND_METHOD()
3939 && type->kind == ZEND_FFI_TYPE_ARRAY in ZEND_METHOD()
3940 …nd_ffi_is_compatible_type(ZEND_FFI_TYPE(old_type->pointer.type), ZEND_FFI_TYPE(type->array.type)))… in ZEND_METHOD()
3942 } else if (type->size > old_type->size) { in ZEND_METHOD()
3970 ZEND_METHOD(FFI, type) /* {{{ */ in ZEND_METHOD() argument
3993 zend_ffi_type_dtor(dcl.type); in ZEND_METHOD()
4023 ctype->type = dcl.type; in ZEND_METHOD()
4033 zend_ffi_type *type; in ZEND_METHOD() local
4045 type = cdata->type; in ZEND_METHOD()
4046 if (ZEND_FFI_TYPE_IS_OWNED(type)) { in ZEND_METHOD()
4047 type = ZEND_FFI_TYPE(type); in ZEND_METHOD()
4048 if (!(type->attr & ZEND_FFI_ATTR_STORED)) { in ZEND_METHOD()
4051 cdata->type = type; in ZEND_METHOD()
4052 type = ZEND_FFI_TYPE_MAKE_OWNED(type); in ZEND_METHOD()
4054 cdata->type = type = zend_ffi_remember_type(type); in ZEND_METHOD()
4064 ctype->type = type; in ZEND_METHOD()
4074 zend_ffi_type *type; in ZEND_METHOD() local
4085 type = ZEND_FFI_TYPE(ctype->type); in ZEND_METHOD()
4087 if (type->kind == ZEND_FFI_TYPE_FUNC) { in ZEND_METHOD()
4090 } else if (type->kind == ZEND_FFI_TYPE_ARRAY && (type->attr & ZEND_FFI_ATTR_INCOMPLETE_ARRAY)) { in ZEND_METHOD()
4093 } else if (type->kind == ZEND_FFI_TYPE_VOID) { in ZEND_METHOD()
4096 } else if (type->attr & ZEND_FFI_ATTR_INCOMPLETE_TAG) { in ZEND_METHOD()
4101 if (ZEND_FFI_TYPE_IS_OWNED(ctype->type)) { in ZEND_METHOD()
4102 if (!(type->attr & ZEND_FFI_ATTR_STORED)) { in ZEND_METHOD()
4105 ctype->type = type; in ZEND_METHOD()
4106 type = ZEND_FFI_TYPE_MAKE_OWNED(type); in ZEND_METHOD()
4108 ctype->type = type = zend_ffi_remember_type(type); in ZEND_METHOD()
4119 zend_ffi_type_dtor(type); in ZEND_METHOD()
4121 …} else if (ZEND_FFI_TYPE(type)->kind == ZEND_FFI_TYPE_ARRAY && (ZEND_FFI_TYPE(type)->attr & ZEND_F… in ZEND_METHOD()
4123 zend_ffi_type_dtor(type); in ZEND_METHOD()
4130 new_type->size = n * ZEND_FFI_TYPE(type)->size; in ZEND_METHOD()
4131 new_type->align = ZEND_FFI_TYPE(type)->align; in ZEND_METHOD()
4132 new_type->array.type = type; in ZEND_METHOD()
4139 type = ZEND_FFI_TYPE_MAKE_OWNED(new_type); in ZEND_METHOD()
4143 ctype->type = type; in ZEND_METHOD()
4151 zend_ffi_type *type, *new_type; in ZEND_METHOD() local
4168 type = ZEND_FFI_TYPE(cdata->type); in ZEND_METHOD()
4176 new_type->pointer.type = type; in ZEND_METHOD()
4179 new_cdata->type = ZEND_FFI_TYPE_MAKE_OWNED(new_type); in ZEND_METHOD()
4184 if (ZEND_FFI_TYPE_IS_OWNED(cdata->type)) { in ZEND_METHOD()
4186 cdata->type = type; in ZEND_METHOD()
4187 new_type->pointer.type = ZEND_FFI_TYPE_MAKE_OWNED(type); in ZEND_METHOD()
4203 zend_ffi_type *type; in ZEND_METHOD() local
4213 type = ZEND_FFI_TYPE(cdata->type); in ZEND_METHOD()
4216 type = ZEND_FFI_TYPE(ctype->type); in ZEND_METHOD()
4222 RETURN_LONG(type->size); in ZEND_METHOD()
4229 zend_ffi_type *type; in ZEND_METHOD() local
4239 type = ZEND_FFI_TYPE(cdata->type); in ZEND_METHOD()
4242 type = ZEND_FFI_TYPE(ctype->type); in ZEND_METHOD()
4248 RETURN_LONG(type->align); in ZEND_METHOD()
4268 type1 = ZEND_FFI_TYPE(cdata1->type); in ZEND_METHOD()
4288 type2 = ZEND_FFI_TYPE(cdata2->type); in ZEND_METHOD()
4332 type1 = ZEND_FFI_TYPE(cdata1->type); in ZEND_METHOD()
4356 type2 = ZEND_FFI_TYPE(cdata2->type); in ZEND_METHOD()
4386 zend_ffi_type *type; in ZEND_METHOD() local
4398 type = ZEND_FFI_TYPE(cdata->type); in ZEND_METHOD()
4399 if (type->kind == ZEND_FFI_TYPE_POINTER) { in ZEND_METHOD()
4403 if (type->kind != ZEND_FFI_TYPE_POINTER && size > type->size) { in ZEND_METHOD()
4417 zend_ffi_type *type; in ZEND_METHOD() local
4430 type = ZEND_FFI_TYPE(cdata->type); in ZEND_METHOD()
4432 if (type->kind == ZEND_FFI_TYPE_POINTER) { in ZEND_METHOD()
4436 if (type->kind != ZEND_FFI_TYPE_POINTER && size > type->size) { in ZEND_METHOD()
4443 …if (type->kind == ZEND_FFI_TYPE_POINTER && ZEND_FFI_TYPE(type->pointer.type)->kind == ZEND_FFI_TYP… in ZEND_METHOD()
4445 …} else if (type->kind == ZEND_FFI_TYPE_ARRAY && ZEND_FFI_TYPE(type->array.type)->kind == ZEND_FFI_… in ZEND_METHOD()
4460 zend_ffi_type *type; in ZEND_METHOD() local
4474 type = ZEND_FFI_TYPE(cdata->type); in ZEND_METHOD()
4476 if (type->kind != ZEND_FFI_TYPE_POINTER){ in ZEND_METHOD()
4496 if (!zend_ffi_ctype_name(&buf, ZEND_FFI_TYPE(ctype->type))) { in ZEND_METHOD()
4627 static ZEND_COLD zval *zend_fake_read_dimension(zend_object *obj, zval *offset, int type, zval *rv)… in zend_fake_read_dimension() argument
4659 static ZEND_COLD zval *zend_fake_read_property(zend_object *obj, zend_string *member, int type, voi… in zend_fake_read_property() argument
4686 static zval *zend_fake_get_property_ptr_ptr(zend_object *obj, zend_string *member, int type, void *… in zend_fake_get_property_ptr_ptr() argument
4714 static int zend_fake_cast_object(zend_object *obj, zval *result, int type) in zend_fake_cast_object() argument
4716 switch (type) { in zend_fake_cast_object()
4738 static ZEND_COLD zval *zend_ffi_free_read_dimension(zend_object *obj, zval *offset, int type, zval … in zend_ffi_free_read_dimension() argument
4764 static ZEND_COLD zval *zend_ffi_free_read_property(zend_object *obj, zend_string *member, int type,… in zend_ffi_free_read_property() argument
5151 …D_FFI_TYPE_POINTER, .size=sizeof(void*), .align=_Alignof(void*), .pointer.type = (zend_ffi_type*)&…
5155 const zend_ffi_type *type; member
5208 …als->types, zend_ffi_types[i].name, strlen(zend_ffi_types[i].name), (void*)zend_ffi_types[i].type);
5274 if (!dcl->type) {
5277 dcl->type = (zend_ffi_type*)&zend_ffi_type_void;
5280 dcl->type = (zend_ffi_type*)&zend_ffi_type_char;
5283 dcl->type = (zend_ffi_type*)&zend_ffi_type_sint8;
5287 dcl->type = (zend_ffi_type*)&zend_ffi_type_uint8;
5293 dcl->type = (zend_ffi_type*)&zend_ffi_type_sint16;
5297 dcl->type = (zend_ffi_type*)&zend_ffi_type_uint16;
5302 dcl->type = (zend_ffi_type*)&zend_ffi_type_sint32;
5306 dcl->type = (zend_ffi_type*)&zend_ffi_type_uint32;
5313 dcl->type = (zend_ffi_type*)&zend_ffi_type_sint32;
5315 dcl->type = (zend_ffi_type*)&zend_ffi_type_sint64;
5321 dcl->type = (zend_ffi_type*)&zend_ffi_type_uint32;
5323 dcl->type = (zend_ffi_type*)&zend_ffi_type_uint64;
5330 dcl->type = (zend_ffi_type*)&zend_ffi_type_sint64;
5334 dcl->type = (zend_ffi_type*)&zend_ffi_type_uint64;
5337 dcl->type = (zend_ffi_type*)&zend_ffi_type_float;
5340 dcl->type = (zend_ffi_type*)&zend_ffi_type_double;
5344 dcl->type = (zend_ffi_type*)&zend_ffi_type_double;
5346 dcl->type = (zend_ffi_type*)&zend_ffi_type_long_double;
5367 zend_ffi_type *type; local
5375 type = zend_hash_str_find_ptr(&FFI_G(types), name, name_len);
5376 if (type) {
5386 zend_ffi_type *type; local
5391 dcl->type = ZEND_FFI_TYPE(sym->type);;
5398 type = zend_hash_str_find_ptr(&FFI_G(types), name, name_len);
5399 if (type) {
5400 dcl->type = type;
5420 switch (sym->type->kind) {
5449 zend_ffi_type *type = pemalloc(sizeof(zend_ffi_type), FFI_G(persistent)); local
5450 type->kind = ZEND_FFI_TYPE_ENUM;
5451 type->attr = FFI_G(default_type_attr) | (dcl->attr & ZEND_FFI_ENUM_ATTRS);
5452 type->enumeration.tag_name = NULL;
5453 if (type->attr & ZEND_FFI_ATTR_PACKED) {
5454 type->size = zend_ffi_type_uint8.size;
5455 type->align = zend_ffi_type_uint8.align;
5456 type->enumeration.kind = ZEND_FFI_TYPE_UINT8;
5458 type->size = zend_ffi_type_uint32.size;
5459 type->align = zend_ffi_type_uint32.align;
5460 type->enumeration.kind = ZEND_FFI_TYPE_UINT32;
5462 dcl->type = ZEND_FFI_TYPE_MAKE_OWNED(type);
5472 zend_ffi_type *enum_type = ZEND_FFI_TYPE(enum_dcl->type);
5570 sym->type = (zend_ffi_type*)sym_type;
5579 zend_ffi_type *type = pemalloc(sizeof(zend_ffi_type), FFI_G(persistent)); local
5580 type->kind = ZEND_FFI_TYPE_STRUCT;
5581 type->attr = FFI_G(default_type_attr) | (dcl->attr & ZEND_FFI_STRUCT_ATTRS);
5582 type->size = 0;
5583 type->align = dcl->align > 1 ? dcl->align : 1;
5585 type->attr |= ZEND_FFI_ATTR_UNION;
5587 dcl->type = ZEND_FFI_TYPE_MAKE_OWNED(type);
5588 type->record.tag_name = NULL;
5589 …zend_hash_init(&type->record.fields, 0, NULL, FFI_G(persistent) ? zend_ffi_field_hash_persistent_d…
5603 if (ZEND_FFI_TYPE(field->type)->attr & ZEND_FFI_ATTR_INCOMPLETE_ARRAY) {
5612 static int zend_ffi_validate_field_type(zend_ffi_type *type, zend_ffi_type *struct_type) /* {{{ */ argument
5614 if (type == struct_type) {
5617 } else if (zend_ffi_validate_var_type(type, 1) != SUCCESS) {
5620 if (type->attr & ZEND_FFI_ATTR_INCOMPLETE_ARRAY) {
5632 zend_ffi_type *struct_type = ZEND_FFI_TYPE(struct_dcl->type);
5637 field_type = ZEND_FFI_TYPE(field_dcl->type);
5658 field->type = field_dcl->type;
5663 field_dcl->type = field_type; /* reset "owned" flag */
5666 zend_ffi_type_dtor(field->type);
5675 zend_ffi_type *struct_type = ZEND_FFI_TYPE(struct_dcl->type);
5682 field_type = ZEND_FFI_TYPE(field_dcl->type);
5711 new_field->type = field->type;
5716 field->type = ZEND_FFI_TYPE(field->type); /* reset "owned" flag */
5720 zend_ffi_type_dtor(new_field->type);
5736 zend_ffi_type_dtor(field_dcl->type);
5737 field_dcl->type = NULL;
5743 zend_ffi_type *struct_type = ZEND_FFI_TYPE(struct_dcl->type);
5749 field_type = ZEND_FFI_TYPE(field_dcl->type);
5826 field->type = field_dcl->type;
5829 field_dcl->type = field_type; /* reset "owned" flag */
5833 zend_ffi_type_dtor(field->type);
5845 zend_ffi_type *struct_type = ZEND_FFI_TYPE(dcl->type);
5860 zend_ffi_type *type = pemalloc(sizeof(zend_ffi_type), FFI_G(persistent)); local
5861 type->kind = ZEND_FFI_TYPE_POINTER;
5862 type->attr = FFI_G(default_type_attr) | (dcl->attr & ZEND_FFI_POINTER_ATTRS);
5863 type->size = sizeof(void*);
5864 type->align = _Alignof(void*);
5866 if (zend_ffi_validate_vla(ZEND_FFI_TYPE(dcl->type)) != SUCCESS) {
5870 type->pointer.type = dcl->type;
5871 dcl->type = ZEND_FFI_TYPE_MAKE_OWNED(type);
5878 static int zend_ffi_validate_array_element_type(zend_ffi_type *type) /* {{{ */ argument
5880 if (type->kind == ZEND_FFI_TYPE_FUNC) {
5883 } else if (type->kind == ZEND_FFI_TYPE_ARRAY && (type->attr & ZEND_FFI_ATTR_INCOMPLETE_ARRAY)) {
5887 return zend_ffi_validate_type(type, 0, 1);
5895 zend_ffi_type *type; local
5898 element_type = ZEND_FFI_TYPE(dcl->type);
5924 type = pemalloc(sizeof(zend_ffi_type), FFI_G(persistent));
5925 type->kind = ZEND_FFI_TYPE_ARRAY;
5926 type->attr = FFI_G(default_type_attr) | (dcl->attr & ZEND_FFI_ARRAY_ATTRS);
5927 type->size = length * element_type->size;
5928 type->align = element_type->align;
5929 type->array.type = dcl->type;
5930 type->array.length = length;
5931 dcl->type = ZEND_FFI_TYPE_MAKE_OWNED(type);
5938 static int zend_ffi_validate_func_ret_type(zend_ffi_type *type) /* {{{ */ argument
5940 if (type->kind == ZEND_FFI_TYPE_FUNC) {
5943 } else if (type->kind == ZEND_FFI_TYPE_ARRAY) {
5947 return zend_ffi_validate_incomplete_type(type, 1, 0);
5953 zend_ffi_type *type; local
5957 ret_type = ZEND_FFI_TYPE(dcl->type);
6018 type = pemalloc(sizeof(zend_ffi_type), FFI_G(persistent));
6019 type->kind = ZEND_FFI_TYPE_FUNC;
6020 type->attr = FFI_G(default_type_attr) | (dcl->attr & ZEND_FFI_FUNC_ATTRS);
6021 type->size = sizeof(void*);
6022 type->align = 1;
6023 type->func.ret_type = dcl->type;
6027 type->func.abi = FFI_DEFAULT_ABI;
6031 type->func.abi = FFI_FASTCALL;
6036 type->func.abi = FFI_THISCALL;
6041 type->func.abi = FFI_STDCALL;
6046 type->func.abi = FFI_PASCAL;
6051 type->func.abi = FFI_REGISTER;
6056 type->func.abi = FFI_MS_CDECL;
6061 type->func.abi = FFI_SYSV;
6066 type->func.abi = FFI_VECTORCALL_PARTIAL;
6070 type->func.abi = FFI_DEFAULT_ABI;
6076 type->func.args = NULL;
6077 _zend_ffi_type_dtor(type);
6081 type->func.args = args;
6082 dcl->type = ZEND_FFI_TYPE_MAKE_OWNED(type);
6091 zend_ffi_type *type; local
6098 type = ZEND_FFI_TYPE(arg_dcl->type);
6099 if (type->kind == ZEND_FFI_TYPE_ARRAY) {
6100 if (ZEND_FFI_TYPE_IS_OWNED(arg_dcl->type)) {
6101 type->kind = ZEND_FFI_TYPE_POINTER;
6102 type->size = sizeof(void*);
6106 new_type->attr = FFI_G(default_type_attr) | (type->attr & ZEND_FFI_POINTER_ATTRS);
6109 new_type->pointer.type = ZEND_FFI_TYPE(type->array.type);
6110 arg_dcl->type = ZEND_FFI_TYPE_MAKE_OWNED(new_type);
6112 } else if (type->kind == ZEND_FFI_TYPE_FUNC) {
6118 new_type->pointer.type = arg_dcl->type;
6119 arg_dcl->type = ZEND_FFI_TYPE_MAKE_OWNED(new_type);
6121 if (zend_ffi_validate_incomplete_type(type, 1, 1) != SUCCESS) {
6128 zend_hash_next_index_insert_ptr(*args, (void*)arg_dcl->type);
6145 && zend_ffi_is_same_type(ZEND_FFI_TYPE(sym->type), ZEND_FFI_TYPE(dcl->type))
6148 zend_ffi_type_dtor(dcl->type);
6152 zend_ffi_type *type = ZEND_FFI_TYPE(dcl->type); local
6154 if (type->kind == ZEND_FFI_TYPE_FUNC) {
6156 && zend_ffi_same_types(ZEND_FFI_TYPE(sym->type), type)) {
6158 zend_ffi_type_dtor(dcl->type);
6163 && zend_ffi_is_same_type(ZEND_FFI_TYPE(sym->type), type)
6166 zend_ffi_type_dtor(dcl->type);
6174 if (zend_ffi_validate_vla(ZEND_FFI_TYPE(dcl->type)) != SUCCESS) {
6178 if (dcl->align && dcl->align > ZEND_FFI_TYPE(dcl->type)->align) {
6179 if (ZEND_FFI_TYPE_IS_OWNED(dcl->type)) {
6180 ZEND_FFI_TYPE(dcl->type)->align = dcl->align;
6182 zend_ffi_type *type = pemalloc(sizeof(zend_ffi_type), FFI_G(persistent)); local
6184 memcpy(type, ZEND_FFI_TYPE(dcl->type), sizeof(zend_ffi_type));
6185 type->attr |= FFI_G(default_type_attr);
6186 type->align = dcl->align;
6187 dcl->type = ZEND_FFI_TYPE_MAKE_OWNED(type);
6192 sym->type = dcl->type;
6194 dcl->type = ZEND_FFI_TYPE(dcl->type); /* reset "owned" flag */
6197 zend_ffi_type *type; local
6199 type = ZEND_FFI_TYPE(dcl->type);
6200 …if (zend_ffi_validate_type(type, (dcl->flags & ZEND_FFI_DCL_STORAGE_CLASS) == ZEND_FFI_DCL_EXTERN,…
6207 sym->kind = (type->kind == ZEND_FFI_TYPE_FUNC) ? ZEND_FFI_SYM_FUNC : ZEND_FFI_SYM_VAR;
6208 sym->type = dcl->type;
6210 dcl->type = type; /* reset "owned" flag */
6214 zend_ffi_type_dtor(dcl->type);
6224 zend_ffi_type *type; local
6232 zend_ffi_type *type = ZEND_FFI_TYPE(tag->type); local
6238 } else if (!incomplete && !(type->attr & ZEND_FFI_ATTR_INCOMPLETE_TAG)) {
6246 } else if (!incomplete && !(type->attr & ZEND_FFI_ATTR_INCOMPLETE_TAG)) {
6254 } else if (!incomplete && !(type->attr & ZEND_FFI_ATTR_INCOMPLETE_TAG)) {
6262 dcl->type = type;
6264 type->attr &= ~ZEND_FFI_ATTR_INCOMPLETE_TAG;
6273 type = ZEND_FFI_TYPE(dcl->type);
6274 type->record.tag_name = zend_string_copy(tag_name);
6278 type = ZEND_FFI_TYPE(dcl->type);
6279 type->record.tag_name = zend_string_copy(tag_name);
6283 type = ZEND_FFI_TYPE(dcl->type);
6284 type->enumeration.tag_name = zend_string_copy(tag_name);
6288 tag->type = ZEND_FFI_TYPE_MAKE_OWNED(dcl->type);
6289 dcl->type = ZEND_FFI_TYPE(dcl->type);
6291 dcl->type->attr |= ZEND_FFI_ATTR_INCOMPLETE_TAG;
6546 static int zend_ffi_nested_type(zend_ffi_type *type, zend_ffi_type *nested_type) /* {{{ */ argument
6552 if (nested_type->pointer.type == &zend_ffi_type_char) {
6553 nested_type->pointer.type = type;
6554 return zend_ffi_validate_vla(ZEND_FFI_TYPE(type));
6556 return zend_ffi_nested_type(type, nested_type->pointer.type);
6561 if (nested_type->array.type == &zend_ffi_type_char) {
6562 nested_type->array.type = type;
6563 if (zend_ffi_validate_array_element_type(ZEND_FFI_TYPE(type)) != SUCCESS) {
6567 if (zend_ffi_nested_type(type, nested_type->array.type) != SUCCESS) {
6571 nested_type->size = nested_type->array.length * ZEND_FFI_TYPE(nested_type->array.type)->size;
6572 nested_type->align = ZEND_FFI_TYPE(nested_type->array.type)->align;
6578 nested_type->func.ret_type = type;
6579 return zend_ffi_validate_func_ret_type(ZEND_FFI_TYPE(type));
6581 return zend_ffi_nested_type(type, nested_type->func.ret_type);
6594 if (!nested_dcl->type || nested_dcl->type == &zend_ffi_type_char) {
6595 nested_dcl->type = dcl->type;
6597 if (zend_ffi_nested_type(dcl->type, nested_dcl->type) != SUCCESS) {
6602 dcl->type = nested_dcl->type;
6609 dcl->align = MAX(align_dcl->align, ZEND_FFI_TYPE(align_dcl->type)->align);
6993 switch (ZEND_FFI_TYPE(dcl->type)->kind) {
7120 zend_ffi_type_dtor(dcl->type);
7215 zend_ffi_type *type; local
7218 type = ZEND_FFI_TYPE(dcl->type);
7219 val->kind = (type->size > 0xffffffff) ? ZEND_FFI_VAL_UINT64 : ZEND_FFI_VAL_UINT32;
7220 val->u64 = type->size;
7221 zend_ffi_type_dtor(dcl->type);
7260 val->u64 = ZEND_FFI_TYPE(dcl->type)->align;
7261 zend_ffi_type_dtor(dcl->type);