Lines Matching refs:field

347 	zend_ffi_field *field;  in zend_ffi_face_struct_add_fields()  local
349 ZEND_HASH_MAP_FOREACH_PTR(&type->record.fields, field) { in zend_ffi_face_struct_add_fields()
350 switch (ZEND_FFI_TYPE(field->type)->kind) { in zend_ffi_face_struct_add_fields()
384 zend_ffi_type *field_type = ZEND_FFI_TYPE(field->type); in zend_ffi_face_struct_add_fields()
625 static uint64_t zend_ffi_bit_field_read(void *ptr, zend_ffi_field *field) /* {{{ */ in zend_ffi_bit_field_read() argument
627 size_t bit = field->first_bit; in zend_ffi_bit_field_read()
628 size_t last_bit = bit + field->bits - 1; in zend_ffi_bit_field_read()
638 mask = (1U << field->bits) - 1U; in zend_ffi_bit_field_read()
667 static void zend_ffi_bit_field_to_zval(void *ptr, zend_ffi_field *field, zval *rv) /* {{{ */ in zend_ffi_bit_field_to_zval() argument
669 uint64_t val = zend_ffi_bit_field_read(ptr, field); in zend_ffi_bit_field_to_zval()
670 if (ZEND_FFI_TYPE(field->type)->kind == ZEND_FFI_TYPE_CHAR in zend_ffi_bit_field_to_zval()
671 || ZEND_FFI_TYPE(field->type)->kind == ZEND_FFI_TYPE_SINT8 in zend_ffi_bit_field_to_zval()
672 || ZEND_FFI_TYPE(field->type)->kind == ZEND_FFI_TYPE_SINT16 in zend_ffi_bit_field_to_zval()
673 || ZEND_FFI_TYPE(field->type)->kind == ZEND_FFI_TYPE_SINT32 in zend_ffi_bit_field_to_zval()
674 || ZEND_FFI_TYPE(field->type)->kind == ZEND_FFI_TYPE_SINT64) { in zend_ffi_bit_field_to_zval()
676 uint64_t shift = 64 - (field->bits % 64); in zend_ffi_bit_field_to_zval()
685 static void zend_ffi_zval_to_bit_field(void *ptr, zend_ffi_field *field, zval *value) /* {{{ */ in zend_ffi_zval_to_bit_field() argument
688 size_t bit = field->first_bit; in zend_ffi_zval_to_bit_field()
689 size_t last_bit = bit + field->bits - 1; in zend_ffi_zval_to_bit_field()
697 mask = ((1U << field->bits) - 1U) << pos; in zend_ffi_zval_to_bit_field()
1215 zend_ffi_field *field; in zend_ffi_cdata_read_field() local
1218 field = *(cache_slot + 1); in zend_ffi_cdata_read_field()
1230 field = zend_hash_find_ptr(&type->record.fields, field_name); in zend_ffi_cdata_read_field()
1231 if (UNEXPECTED(!field)) { in zend_ffi_cdata_read_field()
1238 *(cache_slot + 1) = field; in zend_ffi_cdata_read_field()
1263 if (EXPECTED(!field->bits)) { in zend_ffi_cdata_read_field()
1264 zend_ffi_type *field_type = field->type; in zend_ffi_cdata_read_field()
1270 field->type = field_type = zend_ffi_remember_type(field_type); in zend_ffi_cdata_read_field()
1273 ptr = (void*)(((char*)ptr) + field->offset); in zend_ffi_cdata_read_field()
1274 …type, read_type, rv, (cdata->flags & ZEND_FFI_FLAG_CONST) | (zend_ffi_flags)field->is_const, 0, 0); in zend_ffi_cdata_read_field()
1276 zend_ffi_bit_field_to_zval(ptr, field, rv); in zend_ffi_cdata_read_field()
1288 zend_ffi_field *field; in zend_ffi_cdata_write_field() local
1291 field = *(cache_slot + 1); in zend_ffi_cdata_write_field()
1307 field = zend_hash_find_ptr(&type->record.fields, field_name); in zend_ffi_cdata_write_field()
1308 if (UNEXPECTED(!field)) { in zend_ffi_cdata_write_field()
1315 *(cache_slot + 1) = field; in zend_ffi_cdata_write_field()
1342 } else if (UNEXPECTED(field->is_const)) { in zend_ffi_cdata_write_field()
1347 if (EXPECTED(!field->bits)) { in zend_ffi_cdata_write_field()
1348 ptr = (void*)(((char*)ptr) + field->offset); in zend_ffi_cdata_write_field()
1349 zend_ffi_zval_to_cdata(ptr, ZEND_FFI_TYPE(field->type), value); in zend_ffi_cdata_write_field()
1351 zend_ffi_zval_to_bit_field(ptr, field, value); in zend_ffi_cdata_write_field()
2332 zend_ffi_field *field = Z_PTR_P(zv); in zend_ffi_field_hash_dtor() local
2333 zend_ffi_type_dtor(field->type); in zend_ffi_field_hash_dtor()
2334 efree(field); in zend_ffi_field_hash_dtor()
2340 zend_ffi_field *field = Z_PTR_P(zv); in zend_ffi_field_hash_persistent_dtor() local
2341 zend_ffi_type_dtor(field->type); in zend_ffi_field_hash_persistent_dtor()
2342 free(field); in zend_ffi_field_hash_persistent_dtor()
3074 zend_ffi_field *old_field, *field; in zend_ffi_same_types() local
3090 field = Z_PTR(b->val); in zend_ffi_same_types()
3091 if (old_field->offset != field->offset in zend_ffi_same_types()
3092 || old_field->is_const != field->is_const in zend_ffi_same_types()
3093 || old_field->is_nested != field->is_nested in zend_ffi_same_types()
3094 || old_field->first_bit != field->first_bit in zend_ffi_same_types()
3095 || old_field->bits != field->bits in zend_ffi_same_types()
3096 || !zend_ffi_same_types(ZEND_FFI_TYPE(old_field->type), ZEND_FFI_TYPE(field->type))) { in zend_ffi_same_types()
3160 zend_ffi_field *field; in zend_ffi_subst_old_type() local
3187 ZEND_HASH_MAP_FOREACH_PTR(&dcl_type->record.fields, field) { in zend_ffi_subst_old_type()
3188 if (zend_ffi_subst_old_type(&field->type, old, type)) { in zend_ffi_subst_old_type()
3668 zend_ffi_field *field; in zend_ffi_subst_type() local
3695 ZEND_HASH_MAP_FOREACH_PTR(&dcl_type->record.fields, field) { in zend_ffi_subst_type()
3696 if (zend_ffi_subst_type(&field->type, type)) { in zend_ffi_subst_type()
5987 zend_ffi_field *field = NULL; local
5989 ZEND_HASH_MAP_REVERSE_FOREACH_PTR(&struct_type->record.fields, field) {
5992 if (ZEND_FFI_TYPE(field->type)->attr & ZEND_FFI_ATTR_INCOMPLETE_ARRAY) {
6020 zend_ffi_field *field; local
6032 field = pemalloc(sizeof(zend_ffi_field), FFI_G(persistent));
6037 field->offset = 0;
6044 field->offset = struct_type->size;
6047 field->type = field_dcl->type;
6048 field->is_const = (bool)(field_dcl->attr & ZEND_FFI_ATTR_CONST);
6049 field->is_nested = 0;
6050 field->first_bit = 0;
6051 field->bits = 0;
6054 if (!zend_hash_str_add_ptr(&struct_type->record.fields, name, name_len, field)) {
6055 zend_ffi_type_dtor(field->type);
6056 pefree(field, FFI_G(persistent));
6066 zend_ffi_field *field; local
6092 ZEND_HASH_MAP_FOREACH_STR_KEY_PTR(&field_type->record.fields, key, field) {
6096 new_field->offset = field->offset;
6098 new_field->offset = struct_type->size + field->offset;
6100 new_field->type = field->type;
6101 new_field->is_const = field->is_const;
6103 new_field->first_bit = field->first_bit;
6104 new_field->bits = field->bits;
6105 field->type = ZEND_FFI_TYPE(field->type); /* reset "owned" flag */
6115 zend_hash_next_index_insert_ptr(&struct_type->record.fields, field);
6134 zend_ffi_field *field; local
6179 field = pemalloc(sizeof(zend_ffi_field), FFI_G(persistent));
6184 field->offset = 0;
6185 field->first_bit = 0;
6186 field->bits = bits->u64;
6201 field->offset = prev_field->offset;
6202 field->first_bit = prev_field->first_bit + prev_field->bits;
6203 field->bits = bits->u64;
6205 field->offset = struct_type->size;
6206 field->first_bit = 0;
6207 field->bits = bits->u64;
6210 struct_type->size = field->offset + ((field->first_bit + field->bits) + 7) / 8;
6212 struct_type->size = field->offset + (((field->first_bit + field->bits) + 31) / 32) * 4;
6215 field->type = field_dcl->type;
6216 field->is_const = (bool)(field_dcl->attr & ZEND_FFI_ATTR_CONST);
6217 field->is_nested = 0;
6221 if (!zend_hash_str_add_ptr(&struct_type->record.fields, name, name_len, field)) {
6222 zend_ffi_type_dtor(field->type);
6223 pefree(field, FFI_G(persistent));
6227 zend_hash_next_index_insert_ptr(&struct_type->record.fields, field);