From 1d0b37a9e6a497811b2a6c2cb45ff56c2fceeb78 Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Fri, 12 May 2017 19:50:17 +0900 Subject: [PATCH] eo - eoid - finally rtemove option to not have eoid. it doesn't work we use too many bits for metadata now so eoid is broken... remove it as an option so people dont break out the foot guns --- configure.ac | 13 ------------- src/lib/eo/eo.c | 39 ++++----------------------------------- src/lib/eo/eo_private.h | 7 ------- src/lib/eo/eo_ptr_indirection.c | 21 --------------------- src/lib/eo/eo_ptr_indirection.h | 4 ++-- src/lib/eo/eo_ptr_indirection.x | 13 ------------- 6 files changed, 6 insertions(+), 91 deletions(-) diff --git a/configure.ac b/configure.ac index 70f3a09..12d7f26 100644 --- a/configure.ac +++ b/configure.ac @@ -2219,19 +2219,6 @@ AC_ARG_ENABLE([fribidi], ], [want_fribidi="yes"]) -# Eo Id -AC_ARG_ENABLE([eo_id], - [AS_HELP_STRING([--disable-eo-id],[disable Eo indirection. @<:@default=enabled@:>@])], - [ - if test "x${enableval}" = "xyes" ; then - want_eo_id="yes" - else - want_eo_id="no" - CFOPT_WARNING="xyes" - fi - ], - [want_eo_id="yes"]) - # Harfbuzz AC_ARG_ENABLE([harfbuzz], [AS_HELP_STRING([--enable-harfbuzz],[enable complex text shaping and layouting support. @<:@default=disabled@:>@])], diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c index a533f7a..a2db103 100644 --- a/src/lib/eo/eo.c +++ b/src/lib/eo/eo.c @@ -272,11 +272,7 @@ _vtable_func_clean_all(Eo_Vtable *vtable) /* END OF DICH */ -#ifdef HAVE_EO_ID -# define _EO_ID_GET(Id) ((Eo_Id) (Id)) -#else -# define _EO_ID_GET(Id) ((Eo_Id) ((Id) ? ((Eo_Header *) (Id))->id : 0)) -#endif +#define _EO_ID_GET(Id) ((Eo_Id) (Id)) static inline Eina_Bool @@ -294,30 +290,9 @@ _eo_is_a_class(const Eo *eo_id) } static inline _Efl_Class * -_eo_class_pointer_get(const Efl_Class *klass_id, const char *func_name, const char *file, int line) +_eo_class_pointer_get(const Efl_Class *klass_id) { -#ifdef HAVE_EO_ID return ID_CLASS_GET((Eo_Id)klass_id); - (void)func_name; - (void)file; - (void)line; -#else - Eo_Header *klass = (Eo_Header *)klass_id; - if (EINA_UNLIKELY(!klass)) - { - eina_log_print(_eo_log_dom, - EINA_LOG_LEVEL_DBG, - file, func_name, line, - "klass_id is NULL. Possibly unintended access?"); - return NULL; - } - if (EINA_UNLIKELY(!EINA_MAGIC_CHECK(klass, EO_CLASS_EINA_MAGIC))) - { - eina_magic_fail(klass, klass->__magic, EO_CLASS_EINA_MAGIC, file, func_name, line); - return NULL; - } - return (_Efl_Class *) klass_id; -#endif } static const char * @@ -874,9 +849,6 @@ _efl_add_internal_start(const char *file, int line, const Efl_Class *klass_id, E obj->refcount++; obj->klass = klass; -#ifndef HAVE_EO_ID - EINA_MAGIC_SET((Eo_Header *) obj, EO_EINA_MAGIC); -#endif obj->header.id = _eo_id_allocate(obj, parent_id); Eo *eo_id = _eo_obj_id_get(obj); @@ -1379,7 +1351,7 @@ efl_class_new(const Efl_Class_Description *desc, const Efl_Class *parent_id, ... if (parent_id) { - parent = _eo_class_pointer_get(parent_id, __FUNCTION__, __FILE__, __LINE__); + parent = _eo_class_pointer_get(parent_id); if (!parent) return NULL; } @@ -1431,7 +1403,7 @@ efl_class_new(const Efl_Class_Description *desc, const Efl_Class *parent_id, ... extn_id = va_arg(p_list, Eo_Id *); while (extn_id) { - extn = _eo_class_pointer_get((Efl_Class *)extn_id, __FUNCTION__, __FILE__, __LINE__); + extn = _eo_class_pointer_get((Efl_Class *)extn_id); if (EINA_LIKELY(extn != NULL)) { switch (extn->desc->type) @@ -1495,9 +1467,6 @@ efl_class_new(const Efl_Class_Description *desc, const Efl_Class *parent_id, ... } klass = calloc(1, _eo_class_sz + extn_sz + mro_sz + mixins_sz); -#ifndef HAVE_EO_ID - EINA_MAGIC_SET((Eo_Header *) klass, EO_CLASS_EINA_MAGIC); -#endif eina_spinlock_new(&klass->objects.trash_lock); eina_spinlock_new(&klass->iterators.trash_lock); klass->parent = parent; diff --git a/src/lib/eo/eo_private.h b/src/lib/eo/eo_private.h index 96cd593..93fcba9 100644 --- a/src/lib/eo/eo_private.h +++ b/src/lib/eo/eo_private.h @@ -83,9 +83,6 @@ void _vtable_func_clean_all(Eo_Vtable *vtable); struct _Eo_Header { -#ifndef HAVE_EO_ID - EINA_MAGIC -#endif Eo_Id id; }; @@ -224,11 +221,7 @@ void _efl_object_parent_sink_set(Eo *obj, Eina_Bool sink); static inline Eo *_eo_header_id_get(const Eo_Header *header) { -#ifdef HAVE_EO_ID return (Eo *) header->id; -#else - return (Eo *) header; -#endif } /* Retrieves the pointer to the object from the id */ diff --git a/src/lib/eo/eo_ptr_indirection.c b/src/lib/eo/eo_ptr_indirection.c index 2ef278a..0dcb0b9 100644 --- a/src/lib/eo/eo_ptr_indirection.c +++ b/src/lib/eo/eo_ptr_indirection.c @@ -25,7 +25,6 @@ _eo_pointer_error(const Eo *obj_id, const char *func_name, const char *file, int _eo_log_obj_report((Eo_Id)obj_id, EINA_LOG_LEVEL_ERR, func_name, file, line); } -#ifdef HAVE_EO_ID static void _eo_obj_pointer_invalid(const Eo_Id obj_id, Eo_Id_Data *data, @@ -68,12 +67,10 @@ _eo_obj_pointer_invalid(const Eo_Id obj_id, ); _eo_log_obj_report(obj_id, EINA_LOG_LEVEL_ERR, func_name, file, line); } -#endif _Eo_Object * _eo_obj_pointer_get(const Eo_Id obj_id, const char *func_name, const char *file, int line) { -#ifdef HAVE_EO_ID _Eo_Id_Entry *entry; Generation_Counter generation; Table_Index mid_table_id, table_id, entry_id; @@ -183,22 +180,4 @@ err_shared: err: _eo_obj_pointer_invalid(obj_id, data, domain, func_name, file, line); return NULL; -#else - Eo_Header *obj = (Eo_Header *)obj_id; - if (EINA_UNLIKELY(!obj)) - { - eina_log_print(_eo_log_dom, - EINA_LOG_LEVEL_DBG, - file, func_name, line, - "obj_id is NULL. Possibly unintended access?"); - return NULL; - } - if (EINA_UNLIKELY(!EINA_MAGIC_CHECK(obj, EO_EINA_MAGIC))) - { - eina_magic_fail(obj, obj->__magic, EO_EINA_MAGIC, file, func_name, line); - _eo_log_obj_report(obj_id, EINA_LOG_LEVEL_ERR, func_name, file, line); - return NULL; - } - return (_Eo_Object *) obj_id; -#endif } diff --git a/src/lib/eo/eo_ptr_indirection.h b/src/lib/eo/eo_ptr_indirection.h index afe5a4a..c0aaff8 100644 --- a/src/lib/eo/eo_ptr_indirection.h +++ b/src/lib/eo/eo_ptr_indirection.h @@ -121,14 +121,14 @@ void _eo_pointer_error(const Eo *obj_id, const char *func_name, const char *file #define EO_CLASS_POINTER_GOTO(klass_id, klass, label) \ _Efl_Class *klass; \ do { \ - klass = _eo_class_pointer_get(klass_id, __FUNCTION__, __FILE__, __LINE__); \ + klass = _eo_class_pointer_get(klass_id); \ if (!klass) goto label; \ } while (0) #define EO_CLASS_POINTER_GOTO_PROXY(klass_id, klass, label) \ _Efl_Class *klass; \ do { \ - klass = _eo_class_pointer_get(klass_id, func_name, file, line); \ + klass = _eo_class_pointer_get(klass_id); \ if (!klass) goto label; \ } while (0) diff --git a/src/lib/eo/eo_ptr_indirection.x b/src/lib/eo/eo_ptr_indirection.x index fcaa787..d9bd863 100644 --- a/src/lib/eo/eo_ptr_indirection.x +++ b/src/lib/eo/eo_ptr_indirection.x @@ -358,12 +358,9 @@ _eo_id_domain_compatible(const Eo *o1, const Eo *o2) static inline void _eo_obj_pointer_done(const Eo_Id obj_id) { -#ifdef HAVE_EO_ID Efl_Id_Domain domain = (obj_id >> SHIFT_DOMAIN) & MASK_DOMAIN; if (EINA_LIKELY(domain != EFL_ID_DOMAIN_SHARED)) return; eina_lock_release(&(_eo_table_data_shared_data->obj_lock)); -#endif - (void)obj_id; } ////////////////////////////////////////////////////////////////////////// @@ -483,7 +480,6 @@ _search_tables(Eo_Id_Table_Data *tdata) static inline Eo_Id _eo_id_allocate(const _Eo_Object *obj, const Eo *parent_id) { -#ifdef HAVE_EO_ID _Eo_Id_Entry *entry = NULL; Eo_Id_Data *data; Eo_Id_Table_Data *tdata; @@ -555,17 +551,11 @@ shared_err: eina_lock_release(&(_eo_table_data_shared_data->obj_lock)); } return id; -#else - (void) obj; - (void) parent_id; - return MASK_OBJ_TAG; -#endif } static inline void _eo_id_release(const Eo_Id obj_id) { -#ifdef HAVE_EO_ID _Eo_Ids_Table *table; _Eo_Id_Entry *entry; Generation_Counter generation; @@ -683,9 +673,6 @@ _eo_id_release(const Eo_Id obj_id) eina_lock_release(&(_eo_table_data_shared_data->obj_lock)); } ERR("obj_id %p is not pointing to a valid object. Maybe it has already been freed.", (void *)obj_id); -#else - EINA_MAGIC_SET((Eo_Header *) obj_id, EO_FREED_EINA_MAGIC); -#endif } static inline void -- 2.7.4