aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/eo
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/eo')
-rw-r--r--src/lib/eo/Eo.h264
-rw-r--r--src/lib/eo/eo.c102
-rw-r--r--src/lib/eo/eo_base_class.c28
-rw-r--r--src/lib/eo/eo_private.h109
-rw-r--r--src/lib/eo/eo_ptr_indirection.c2
-rw-r--r--src/lib/eo/eo_ptr_indirection.x41
6 files changed, 373 insertions, 173 deletions
diff --git a/src/lib/eo/Eo.h b/src/lib/eo/Eo.h
index 19aba96024..f099f1ee5e 100644
--- a/src/lib/eo/Eo.h
+++ b/src/lib/eo/Eo.h
@@ -112,6 +112,102 @@ typedef struct _Eo_Opaque Eo;
*/
typedef Eo Eo_Class;
+#define HAVE_EO_ID
+typedef uintptr_t Eo_Id;
+typedef struct _Eo_Class _Eo_Class;
+
+typedef void (*eo_op_func_type)(Eo *, void *class_data, va_list *list);
+typedef struct op_type_funcs
+{
+ eo_op_func_type func;
+ const _Eo_Class *src;
+} op_type_funcs;
+
+
+struct _Eo_Header
+{
+#ifndef HAVE_EO_ID
+ EINA_MAGIC
+#endif
+ Eo_Id id;
+};
+typedef struct _Eo_Header Eo_Header;
+
+struct _Eo_Object
+{
+ Eo_Header header;
+ const _Eo_Class *klass;
+#ifdef EO_DEBUG
+ Eina_Inlist *xrefs;
+ Eina_Inlist *data_xrefs;
+#endif
+
+ Eina_List *composite_objects;
+
+ int refcount;
+ int datarefcount;
+
+ Eina_Bool condtor_done:1;
+ Eina_Bool finalized:1;
+
+ Eina_Bool composite:1;
+ Eina_Bool del_triggered:1;
+ Eina_Bool destructed:1;
+ Eina_Bool manual_free:1;
+ ///struct _Eo_Context context;
+};
+typedef struct _Eo_Class_Description Eo_Class_Description;
+typedef struct Eo_Extension_Data_Offset Eo_Extension_Data_Offset;
+typedef struct _Dich_Chain1 Dich_Chain1;
+struct _Eo_Class
+{
+ Eo_Header header;
+
+ const _Eo_Class *parent;
+ const Eo_Class_Description *desc;
+ Dich_Chain1 *chain; /**< The size is chain size */
+
+ const _Eo_Class **extensions;
+
+ Eo_Extension_Data_Offset *extn_data_off;
+
+ const _Eo_Class **mro;
+
+ /* cached object for faster allocation */
+ struct {
+ Eina_Trash *trash;
+ Eina_Spinlock trash_lock;
+ unsigned int trash_count;
+ } objects;
+
+ /* cached iterator for faster allocation cycle */
+ struct {
+ Eina_Trash *trash;
+ Eina_Spinlock trash_lock;
+ unsigned int trash_count;
+ } iterators;
+
+ unsigned int obj_size; /**< size of an object of this class */
+ unsigned int chain_size;
+ unsigned int base_id;
+ unsigned int data_offset; /* < Offset of the data within object data. */
+
+ Eina_Bool constructed : 1;
+ /* [extensions*] + NULL */
+ /* [mro*] + NULL */
+ /* [extensions data offset] + NULL */
+};
+
+ __attribute__ ((visibility("default"))) struct _Eo_Object *_eo_obj_pointer_get(const Eo_Id obj_id);
+ EAPI _Eo_Class * _eo_class_pointer_get(const Eo_Class *klass_id);
+
+struct _Eo_Id_Resolve_Cache
+{
+ int flags;
+ Eo* eoid;
+ struct _Eo_Object* object;
+};
+
/**
* @var _eo_class_creation_lock
* This variable is used for locking purposes in the class_get function
@@ -447,8 +543,15 @@ typedef void (*Eo_Hook_Call)(const Eo_Class *klass_id, const Eo *obj, const char
EAPI extern Eo_Hook_Call eo_hook_call_pre;
EAPI extern Eo_Hook_Call eo_hook_call_post;
+typedef struct op_type_funcs op_type_funcs;
+typedef struct _Eo_Class _Eo_Class;
+typedef struct _Eo_Object _Eo_Object;
+
+EAPI const op_type_funcs *_dich_func_get(const _Eo_Class *klass, Eo_Op op);
+EAPI void *_eo_data_scope_get(const _Eo_Object *obj, const _Eo_Class *klass);
+
// to pass the internal function call to EO_FUNC_BODY (as Func parameter)
-#define EO_FUNC_CALL(...) __VA_ARGS__
+#define EO_FUNC_CALL(...) , __VA_ARGS__
#define EO_HOOK_CALL_PREPARE(Hook, FuncName) \
if (Hook) \
@@ -464,6 +567,89 @@ EAPI extern Eo_Hook_Call eo_hook_call_post;
# define EO_FUNC_COMMON_OP_FUNC(Name) ((const void *) #Name)
#endif
+#define EO_FUNC_VOID_API_DEFINE(Name, Args, ...) \
+ EOAPI void Name(Eo const* ___object, ##__VA_ARGS__); \
+ EOAPI void _eo_impl_##Name(_Eo_Class const* ___klass, Eo* ___oid, _Eo_Object const* ___object, ##__VA_ARGS__) \
+ { \
+ typedef Eo_Base * (*_Eo_func)(Eo*, void *obj_data, ##__VA_ARGS__); \
+ static Eo_Op ___op = EO_NOOP; \
+ if (EINA_UNLIKELY(___op == EO_NOOP)) \
+ { \
+ fprintf(stderr, "%s %s:%d\n", __func__, __FILE__, __LINE__); fflush(stderr); \
+ ___op = _eo_api_op_id_get(EO_FUNC_COMMON_OP_FUNC(Name)); \
+ fprintf(stderr, "%s %s:%d\n", __func__, __FILE__, __LINE__); fflush(stderr); \
+ if (___op == EO_NOOP) return 0; \
+ } \
+ fprintf(stderr, "%s %s:%d\n", __func__, __FILE__, __LINE__); fflush(stderr); \
+ const op_type_funcs *___func = _dich_func_get(___klass, ___op); \
+ fprintf(stderr, "%s %s:%d\n", __func__, __FILE__, __LINE__); fflush(stderr); \
+ fprintf(stderr, "___func %p\n", ___func); fflush(stderr); \
+ fprintf(stderr, "___func->func %p\n", ___func->func);fflush(stderr); \
+ fprintf(stderr, "___func->src %p\n", ___func->src);fflush(stderr); \
+ _Eo_func ___func_ = (_Eo_func) ___func->func; \
+ void* ___data = _eo_data_scope_get(___object, ___func->src); \
+ ___func_((Eo*)___oid, ___data Args); \
+ } \
+ EOAPI void Name(Eo const* ___object, ##__VA_ARGS__) \
+ { \
+ _Eo_Object* ___obj = (_Eo_Object*)_eo_obj_pointer_get((Eo_Id)___object); \
+ if(___obj) { \
+ _eo_impl_##Name(___obj->klass, ___object, ___obj Args); \
+ } \
+ } \
+ EOAPI void eo_super_##Name(Eo_Class const* ___klass, Eo const* ___object, ##__VA_ARGS__) \
+ { \
+ _Eo_Object* ___obj = (_Eo_Object*)_eo_obj_pointer_get((Eo_Id)___object); \
+ if(___obj) { \
+ _Eo_Class* ___kls = (_Eo_Class*)_eo_class_pointer_get((Eo_Id)___klass); \
+ if(___kls) \
+ return _eo_impl_##Name(___kls, ___object, ___obj Args); \
+ } \
+ } \
+
+#define EO_FUNC_API_DEFINE(Name, R, DefRet, Args, ...) \
+ EOAPI R Name(Eo const* ___object, ##__VA_ARGS__); \
+ EOAPI R _eo_impl_##Name(_Eo_Class const* ___klass, Eo* ___oid, _Eo_Object const* ___object, ##__VA_ARGS__) \
+ { \
+ typedef Eo_Base * (*_Eo_func)(Eo*, void *obj_data, ##__VA_ARGS__); \
+ static Eo_Op ___op = EO_NOOP; \
+ if (EINA_UNLIKELY(___op == EO_NOOP)) \
+ { \
+ fprintf(stderr, "%s %s:%d\n", __func__, __FILE__, __LINE__); fflush(stderr); \
+ ___op = _eo_api_op_id_get(EO_FUNC_COMMON_OP_FUNC(Name)); \
+ fprintf(stderr, "%s %s:%d\n", __func__, __FILE__, __LINE__); fflush(stderr); \
+ if (___op == EO_NOOP) return 0; \
+ } \
+ fprintf(stderr, "%s %s:%d\n", __func__, __FILE__, __LINE__); fflush(stderr); \
+ const op_type_funcs *___func = _dich_func_get(___klass, ___op); \
+ fprintf(stderr, "%s %s:%d\n", __func__, __FILE__, __LINE__); fflush(stderr); \
+ fprintf(stderr, "___func %p\n", ___func); fflush(stderr); \
+ fprintf(stderr, "___func->func %p\n", ___func->func);fflush(stderr); \
+ fprintf(stderr, "___func->src %p\n", ___func->src);fflush(stderr); \
+ _Eo_func ___func_ = (_Eo_func) ___func->func; \
+ void* ___data = _eo_data_scope_get(___object, ___func->src); \
+ R _ret; \
+ _ret = ___func_((Eo*)___oid, ___data Args); \
+ return _ret; \
+ } \
+ EOAPI R Name(Eo const* ___object, ##__VA_ARGS__) \
+ { \
+ _Eo_Object* ___obj = (_Eo_Object*)_eo_obj_pointer_get((Eo_Id)___object); \
+ if(___obj) { \
+ return _eo_impl_##Name(___obj->klass, ___object, ___obj Args); \
+ } \
+ } \
+ EOAPI R eo_super_##Name(Eo_Class const* ___klass, Eo const* ___object, ##__VA_ARGS__) \
+ { \
+ _Eo_Object* ___obj = (_Eo_Object*)_eo_obj_pointer_get((Eo_Id)___object); \
+ if(___obj) { \
+ _Eo_Class* ___kls = (_Eo_Class*)_eo_class_pointer_get((Eo_Id)___klass); \
+ if(___kls) \
+ return _eo_impl_##Name(___kls, ___object, ___obj Args); \
+ } \
+ } \
+
+
// cache OP id, get real fct and object data then do the call
#define EO_FUNC_COMMON_OP(Name, DefRet) \
Eo_Op_Call_Data ___call; \
@@ -543,13 +729,13 @@ EAPI Eo_Op _eo_api_op_id_get(const void *api_func);
EAPI Eina_Bool _eo_call_resolve(const char *func_name, const Eo_Op op, Eo_Op_Call_Data *call, const char *file, int line);
// start of eo_do barrier, gets the object pointer and ref it, put it on the stask
- EAPI Eina_Bool _eo_do_start(const Eo *obj, const Eo_Class *cur_klass, Eina_Bool is_super, void *eo_stack);
+EAPI Eo* _eo_do_start(const Eo *obj, const Eo_Class *cur_klass, Eina_Bool is_super, void *eo_stack);
// end of the eo_do barrier, unref the obj, move the stack pointer
EAPI void _eo_do_end(void *eo_stack);
// end of the eo_add. Calls finalize among others
-EAPI Eo * _eo_add_end(void *eo_stack);
+EAPI Eo * _eo_add_end(Eo* obj_id, void *eo_stack, int x);
// XXX: We cheat and make it const to indicate to the compiler that the value never changes
EAPI EINA_CONST void *_eo_stack_get(void);
@@ -558,35 +744,48 @@ EAPI EINA_CONST void *_eo_stack_get(void);
#define _eo_do_common(eoid, clsid, is_super, ...) \
do { \
+ fprintf(stderr, "do super %s %s:%d\n", __func__, __FILE__, __LINE__); fflush(stderr); \
_eo_do_start(eoid, clsid, is_super, _eo_stack_get()); \
+ fprintf(stderr, "do super %s %s:%d\n", __func__, __FILE__, __LINE__); fflush(stderr); \
__VA_ARGS__; \
+ fprintf(stderr, "do super %s %s:%d\n", __func__, __FILE__, __LINE__); fflush(stderr); \
_eo_do_end(_eo_stack_get()); \
+ fprintf(stderr, "do super %s %s:%d\n", __func__, __FILE__, __LINE__); fflush(stderr); \
} while (0)
#define _eo_do_common_ret(eoid, clsid, is_super, ret_tmp, func) \
( \
+ fprintf(stderr, "do super %s %s:%d\n", __func__, __FILE__, __LINE__), fflush(stderr), \
_eo_do_start(eoid, clsid, is_super, _eo_stack_get()), \
+ fprintf(stderr, "do super %s %s:%d\n", __func__, __FILE__, __LINE__), fflush(stderr), \
ret_tmp = func, \
+ fprintf(stderr, "do super %s %s:%d\n", __func__, __FILE__, __LINE__), fflush(stderr), \
_eo_do_end(_eo_stack_get()), \
+ fprintf(stderr, "do super %s %s:%d\n", __func__, __FILE__, __LINE__), fflush(stderr), \
ret_tmp \
)
-#define eo_do(eoid, ...) _eo_do_common(eoid, NULL, EINA_FALSE, __VA_ARGS__)
+//#define eo_do(eoid, ...) _eo_do_common(eoid, NULL, EINA_FALSE, __VA_ARGS__)
-#define eo_do_super(eoid, clsid, func) _eo_do_common(eoid, clsid, EINA_TRUE, func)
+#define eo_do(eoid, ...) do { __VA_ARGS__; } while(0)
-#define eo_do_ret(eoid, ret_tmp, func) _eo_do_common_ret(eoid, NULL, EINA_FALSE, ret_tmp, func)
+ //#define eo_do_super(eoid, clsid, func) _eo_do_common(eoid, clsid, EINA_TRUE, func)
-#define eo_do_super_ret(eoid, clsid, ret_tmp, func) _eo_do_common_ret(eoid, clsid, EINA_TRUE, ret_tmp, func)
+ //#define eo_do_ret(eoid, ret_tmp, func) _eo_do_common_ret(eoid, NULL, EINA_FALSE, ret_tmp, func)
-#define eo_do_part(eoid, part_func, ...) \
+#define eo_do_ret(eoid, ret_tmp, func) \
+ (ret_tmp = (func))
+
+ //#define eo_do_super_ret(eoid, clsid, ret_tmp, func) _eo_do_common_ret(eoid, clsid, EINA_TRUE, ret_tmp, func)
+ /*
+#define eo_do_part(eoid, part_func, ...) \
do { \
Eo *__eo_part = eoid; \
eo_do(eoid, __eo_part = part_func); \
eo_do(__eo_part, __VA_ARGS__); \
} while (0)
-
+ */
/*****************************************************************************/
/**
@@ -597,15 +796,28 @@ EAPI EINA_CONST void *_eo_stack_get(void);
* @see eo_class_name_get()
*/
EAPI const Eo_Class *eo_class_get(const Eo *obj);
-
-#define _eo_add_common(klass, parent, is_ref, ...) \
- ( \
- _eo_do_start(_eo_add_internal_start(__FILE__, __LINE__, klass, parent, is_ref), \
- klass, EINA_FALSE, _eo_stack_get()) \
- , ##__VA_ARGS__, \
- (Eo *) _eo_add_end(_eo_stack_get()) \
- )
-
+ /*
+ #define _eo_add_common(klass, parent, is_ref, ...) \
+ ( \
+ (Eo *) _eo_add_end \
+ ( \
+ _eo_do_start(_eo_add_internal_start(__FILE__, __LINE__, klass, parent, is_ref), \
+ klass, EINA_FALSE, _eo_stack_get()) \
+ , _eo_stack_get() \
+ , (0, ##__VA_ARGS__ , 0)))
+ */
+#define _eo_add_common(obj, klass, parent, is_ref, ...) \
+ do { \
+ obj = _eo_add_internal_start(__FILE__, __LINE__, klass, parent, is_ref); \
+ fprintf(stderr, "eo1: %p\n", obj); fflush(stderr); \
+ obj = _eo_do_start(obj, klass, EINA_FALSE, _eo_stack_get()); \
+ fprintf(stderr, "eo2: %p\n", obj); fflush(stderr); \
+ {__VA_ARGS__;} \
+ fprintf(stderr, "eo3: %p\n", obj); fflush(stderr); \
+ obj = _eo_add_end(obj, _eo_stack_get(), 0); \
+ fprintf(stderr, "eo4: %p\n", obj); fflush(stderr); \
+ } while(0)
+
/**
* @def eo_add
* @brief Create a new object and call its constructor(If it exits).
@@ -625,7 +837,7 @@ EAPI const Eo_Class *eo_class_get(const Eo *obj);
* @param ... The ops to run.
* @return An handle to the new object on success, NULL otherwise.
*/
-#define eo_add(klass, parent, ...) _eo_add_common(klass, parent, EINA_FALSE, ##__VA_ARGS__)
+#define eo_add(obj, klass, parent, ...) _eo_add_common(obj, klass, parent, EINA_FALSE, ##__VA_ARGS__)
/**
* @def eo_add_ref
@@ -642,9 +854,11 @@ EAPI const Eo_Class *eo_class_get(const Eo *obj);
* @param ... The ops to run.
* @return An handle to the new object on success, NULL otherwise.
*/
-#define eo_add_ref(klass, parent, ...) _eo_add_common(klass, parent, EINA_TRUE, ##__VA_ARGS__)
+#define eo_add_ref(obj, klass, parent, ...) _eo_add_common(obj, klass, parent, EINA_TRUE, ##__VA_ARGS__)
EAPI Eo * _eo_add_internal_start(const char *file, int line, const Eo_Class *klass_id, Eo *parent, Eina_Bool ref);
+struct _Eo_Call_Stack;
+EAPI Eo * _eo_add_internal_end(Eo *eo_id, struct _Eo_Call_Stack *stack);
/**
* @brief Get a pointer to the data of an object for a specific class.
@@ -902,7 +1116,7 @@ typedef void (*eo_key_data_free_func)(void *);
*/
#define eo_weak_unref(wref) \
do { \
- if (*wref) eo_do(*wref, eo_wref_del(wref)); \
+ if (*wref) eo_do(*wref, eo_wref_del(*wref, wref)); \
} while (0)
/**
@@ -993,8 +1207,8 @@ EAPI const Eo_Event_Description *eo_base_legacy_only_event_description_get(const
*
* @see eo_event_callback_priority_add()
*/
-#define eo_event_callback_add(desc, cb, data) \
- eo_event_callback_priority_add(desc, \
+#define eo_event_callback_add(obj, desc, cb, data) \
+ eo_event_callback_priority_add(obj, desc, \
EO_CALLBACK_PRIORITY_DEFAULT, cb, data)
/**
@@ -1007,8 +1221,8 @@ EAPI const Eo_Event_Description *eo_base_legacy_only_event_description_get(const
*
* @see eo_event_callback_array_priority_add()
*/
-#define eo_event_callback_array_add(array, data) \
- eo_event_callback_array_priority_add(array, \
+#define eo_event_callback_array_add(obj, array, data) \
+ eo_event_callback_array_priority_add(obj, array, \
EO_CALLBACK_PRIORITY_DEFAULT, data)
/**
diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c
index ee72b742e6..8f543518de 100644
--- a/src/lib/eo/eo.c
+++ b/src/lib/eo/eo.c
@@ -19,7 +19,7 @@
/* Used inside the class_get functions of classes, see #EO_DEFINE_CLASS */
EAPI Eina_Spinlock _eo_class_creation_lock;
-int _eo_log_dom = -1;
+__attribute__ ((visibility("default"))) int _eo_log_dom = -1;
static _Eo_Class **_eo_classes;
static Eo_Id _eo_classes_last_id;
@@ -32,7 +32,7 @@ static size_t _eo_sz = 0;
static size_t _eo_class_sz = 0;
static void _eo_condtor_reset(_Eo_Object *obj);
-static inline void *_eo_data_scope_get(const _Eo_Object *obj, const _Eo_Class *klass);
+/* static inline void *_eo_data_scope_get(const _Eo_Object *obj, const _Eo_Class *klass); */
static inline void *_eo_data_xref_internal(const char *file, int line, _Eo_Object *obj, const _Eo_Class *klass, const _Eo_Object *ref_obj);
static inline void _eo_data_xunref_internal(_Eo_Object *obj, void *data, const _Eo_Object *ref_obj);
@@ -90,7 +90,7 @@ _dich_copy_all(_Eo_Class *dst, const _Eo_Class *src)
}
}
-static inline const op_type_funcs *
+EAPI const op_type_funcs *
_dich_func_get(const _Eo_Class *klass, Eo_Op op)
{
size_t idx1 = DICH_CHAIN1(op);
@@ -186,7 +186,7 @@ _eo_is_a_class(const Eo *eo_id)
return !!(oid & MASK_CLASS_TAG);
}
-static inline _Eo_Class *
+EAPI _Eo_Class *
_eo_class_pointer_get(const Eo_Class *klass_id)
{
#ifdef HAVE_EO_ID
@@ -473,10 +473,9 @@ _eo_do_internal(const Eo *eo_id, const Eo_Class *cur_klass_id,
return EINA_TRUE;
}
-EAPI Eina_Bool
+EAPI Eo*
_eo_do_start(const Eo *eo_id, const Eo_Class *cur_klass_id, Eina_Bool is_super, void *eo_stack)
{
- Eina_Bool ret = EINA_TRUE;
Eo_Stack_Frame *fptr;
Eo_Call_Stack *stack = eo_stack;
@@ -492,12 +491,12 @@ _eo_do_start(const Eo *eo_id, const Eo_Class *cur_klass_id, Eina_Bool is_super,
fptr->o.obj = NULL;
fptr->cur_klass = NULL;
- ret = EINA_FALSE;
+ return NULL;
}
stack->frame_ptr++;
- return ret;
+ return eo_id;
}
EAPI void
@@ -832,20 +831,20 @@ _eo_add_internal_start(const char *file, int line, const Eo_Class *klass_id, Eo
_eo_ref(obj);
- eo_do(eo_id, eo_parent_set(parent_id));
+ eo_do(eo_id, eo_parent_set(eo_id, parent_id));
/* If there's a parent. Ref. Eo_add should return an object with either a
* parent ref, or with the lack of, just a ref. */
{
Eo *parent_tmp;
- if (ref && eo_do_ret(eo_id, parent_tmp, eo_parent_get()))
+ if (ref && eo_do_ret(eo_id, parent_tmp, eo_parent_get(eo_id)))
{
_eo_ref(obj);
}
}
/* eo_id can change here. Freeing is done on the resolved object. */
- eo_do(eo_id, eo_id = eo_constructor());
+ eo_do(eo_id, eo_id = eo_constructor(eo_id));
if (!eo_id)
{
ERR("Object of class '%s' - Error while constructing object",
@@ -858,7 +857,7 @@ _eo_add_internal_start(const char *file, int line, const Eo_Class *klass_id, Eo
return eo_id;
}
-static Eo *
+EAPI Eo *
_eo_add_internal_end(Eo *eo_id, Eo_Call_Stack *stack)
{
Eo_Stack_Frame *fptr;
@@ -909,11 +908,20 @@ cleanup:
}
EAPI Eo *
-_eo_add_end(void *eo_stack)
-{
- Eo *ret = eo_finalize();
- ret = _eo_add_internal_end(ret, eo_stack);
- _eo_do_end(eo_stack);
+_eo_add_end(Eo* obj_id, void *eo_stack, int x)
+{
+ Eo* ret = NULL;
+ if(obj_id)
+ {
+ fprintf(stderr, "%s %s:%d\n", __func__, __FILE__, __LINE__); fflush(stderr);
+ ret = eo_finalize(obj_id);
+ fprintf(stderr, "%s %s:%d\n", __func__, __FILE__, __LINE__); fflush(stderr);
+ ret = _eo_add_internal_end(ret, eo_stack);
+ fprintf(stderr, "%s %s:%d\n", __func__, __FILE__, __LINE__); fflush(stderr);
+ _eo_do_end(eo_stack);
+ }
+ fprintf(stderr, "%s %s:%d\n", __func__, __FILE__, __LINE__); fflush(stderr);
+ fprintf(stderr, "%s %s:%d\n", __func__, __FILE__, __LINE__); fflush(stderr);
return ret;
}
@@ -1190,6 +1198,7 @@ eo_class_new(const Eo_Class_Description *desc, const Eo_Class *parent_id, ...)
/* Build class extensions list */
{
DBG("Started building extensions list for class '%s'", desc->name);
+ fprintf(stderr, "Started building extensions list for class '%s'\n", desc->name); fflush(stderr);
extn_list = NULL;
const _Eo_Class *extn = NULL;
const Eo_Id *extn_id = NULL;
@@ -1220,6 +1229,7 @@ eo_class_new(const Eo_Class_Description *desc, const Eo_Class *parent_id, ...)
extn_sz = sizeof(_Eo_Class *) * (eina_list_count(extn_list) + 1);
DBG("Finished building extensions list for class '%s'", desc->name);
+ fprintf(stderr, "Finished building extensions list for class '%s'\n", desc->name); fflush(stderr);
}
/* Prepare mro list */
@@ -1244,6 +1254,7 @@ eo_class_new(const Eo_Class_Description *desc, const Eo_Class *parent_id, ...)
const _Eo_Class *kls_itr;
DBG("Started building Mixins list for class '%s'", desc->name);
+ fprintf(stderr, "Started building Mixins list for class '%s'\n", desc->name); fflush(stderr);
mixins = NULL;
EINA_LIST_FOREACH(mro, itr, kls_itr)
@@ -1258,6 +1269,7 @@ eo_class_new(const Eo_Class_Description *desc, const Eo_Class *parent_id, ...)
mixins_sz += sizeof(Eo_Extension_Data_Offset);
DBG("Finished building Mixins list for class '%s'", desc->name);
+ fprintf(stderr, "Finished building Mixins list for class '%s'\n", desc->name); fflush(stderr);
}
klass = calloc(1, _eo_class_sz + extn_sz + mro_sz + mixins_sz);
@@ -1297,6 +1309,7 @@ eo_class_new(const Eo_Class_Description *desc, const Eo_Class *parent_id, ...)
*(extn_itr++) = extn;
DBG("Added '%s' extension", extn->desc->name);
+ fprintf(stderr, "Added '%s' extension\n", extn->desc->name); fflush(stderr);
}
*(extn_itr) = NULL;
}
@@ -1310,6 +1323,7 @@ eo_class_new(const Eo_Class_Description *desc, const Eo_Class *parent_id, ...)
*(mro_itr++) = kls_itr;
DBG("Added '%s' to MRO", kls_itr->desc->name);
+ fprintf(stderr, "Added '%s' to MRO\n", kls_itr->desc->name); fflush(stderr);
}
*(mro_itr) = NULL;
}
@@ -1331,6 +1345,7 @@ eo_class_new(const Eo_Class_Description *desc, const Eo_Class *parent_id, ...)
extn_data_itr++;
DBG("Added '%s' to Data Offset info", kls_itr->desc->name);
+ fprintf(stderr, "Added '%s' to Data Offset info\n", kls_itr->desc->name);
}
extn_data_itr->klass = 0;
extn_data_itr->offset = 0;
@@ -1410,6 +1425,7 @@ eo_class_new(const Eo_Class_Description *desc, const Eo_Class *parent_id, ...)
_eo_class_constructor(klass);
DBG("Finished building class '%s'", klass->desc->name);
+ fprintf(stderr, "Finished building class '%s'\n", klass->desc->name); fflush(stderr);
return _eo_class_id_get(klass);
}
@@ -1499,13 +1515,18 @@ EAPI void
eo_del(const Eo *obj)
{
Eo *parent_tmp;
- if (eo_do_ret(obj, parent_tmp, eo_parent_get()))
+ fprintf(stderr, "%s %s:%d\n", __func__, __FILE__, __LINE__); fflush(stderr);
+ if (eo_do_ret(obj, parent_tmp, eo_parent_get(obj)))
{
- eo_do(obj, eo_parent_set(NULL));
+ fprintf(stderr, "%s %s:%d\n", __func__, __FILE__, __LINE__); fflush(stderr);
+ eo_do(obj, eo_parent_set(obj, NULL));
+ fprintf(stderr, "%s %s:%d\n", __func__, __FILE__, __LINE__); fflush(stderr);
}
else
{
+ fprintf(stderr, "%s %s:%d\n", __func__, __FILE__, __LINE__); fflush(stderr);
eo_unref(obj);
+ fprintf(stderr, "%s %s:%d\n", __func__, __FILE__, __LINE__); fflush(stderr);
}
}
@@ -1541,7 +1562,7 @@ _eo_data_scope_safe_get(const _Eo_Object *obj, const _Eo_Class *klass)
return NULL;
}
-static inline void *
+EAPI void *
_eo_data_scope_get(const _Eo_Object *obj, const _Eo_Class *klass)
{
if (EINA_LIKELY(klass->desc->type != EO_CLASS_TYPE_MIXIN))
@@ -1871,3 +1892,44 @@ eo_manual_free(Eo *obj_id)
return EINA_TRUE;
}
+__attribute__ ((visibility("default"))) _Eo_Object *
+_eo_obj_pointer_get(const Eo_Id obj_id)
+{
+#ifdef HAVE_EO_ID
+ _Eo_Id_Entry *entry;
+ Generation_Counter generation;
+ Table_Index mid_table_id, table_id, entry_id;
+
+ // NULL objects will just be sensibly ignored. not worth complaining
+ // every single time.
+ if (!obj_id)
+ {
+ DBG("obj_id is NULL. Possibly unintended access?");
+ return NULL;
+ }
+ else if (!(obj_id & MASK_OBJ_TAG))
+ {
+ DBG("obj_id is not a valid object id.");
+ return NULL;
+ }
+
+ EO_DECOMPOSE_ID(obj_id, mid_table_id, table_id, entry_id, generation);
+
+ /* Check the validity of the entry */
+ if (_eo_ids_tables[mid_table_id] && TABLE_FROM_IDS)
+ {
+ entry = &(TABLE_FROM_IDS->entries[entry_id]);
+ if (entry && entry->active && (entry->generation == generation))
+ return entry->ptr;
+ }
+
+ ERR("obj_id %p is not pointing to a valid object. Maybe it has already been freed.",
+ (void *)obj_id);
+
+ return NULL;
+#else
+ return (_Eo_Object *) obj_id;
+#endif
+
+}
+
diff --git a/src/lib/eo/eo_base_class.c b/src/lib/eo/eo_base_class.c
index f99ca37289..e763300945 100644
--- a/src/lib/eo/eo_base_class.c
+++ b/src/lib/eo/eo_base_class.c
@@ -66,7 +66,7 @@ _eo_base_key_data_set(Eo *obj, Eo_Base_Data *pd,
if (!key) return;
- eo_do(obj, eo_key_data_del(key); );
+ eo_do(obj, eo_key_data_del(obj, key); );
node = malloc(sizeof(Eo_Generic_Data_Node));
if (!node) return;
@@ -103,9 +103,9 @@ _eo_base_parent_set(Eo *obj, Eo_Base_Data *pd, Eo *parent_id)
if (pd->parent == parent_id)
return;
- if (eo_do_ret(obj, tmp, eo_composite_part_is()) && pd->parent)
+ if (eo_do_ret(obj, tmp, eo_composite_part_is(obj)) && pd->parent)
{
- eo_do(pd->parent, eo_composite_detach(obj));
+ eo_do(pd->parent, eo_composite_detach(pd->parent, obj));
}
if (pd->parent)
@@ -574,7 +574,7 @@ _eo_base_event_callback_priority_add(Eo *obj, Eo_Base_Data *pd,
{
const Eo_Callback_Array_Item arr[] = { {desc, func}, {NULL, NULL}};
- eo_do(obj, eo_event_callback_call(EO_EV_CALLBACK_ADD, (void *)arr));
+ eo_do(obj, eo_event_callback_call(obj, EO_EV_CALLBACK_ADD, (void *)arr));
}
}
@@ -596,7 +596,7 @@ _eo_base_event_callback_del(Eo *obj, Eo_Base_Data *pd,
cb->delete_me = EINA_TRUE;
pd->deletions_waiting = EINA_TRUE;
_eo_callbacks_clear(pd);
- eo_do(obj, eo_event_callback_call(EO_EV_CALLBACK_DEL, (void *)arr); );
+ eo_do(obj, eo_event_callback_call(obj, EO_EV_CALLBACK_DEL, (void *)arr); );
return;
}
}
@@ -621,7 +621,7 @@ _eo_base_event_callback_array_priority_add(Eo *obj, Eo_Base_Data *pd,
_eo_callbacks_sorted_insert(pd, cb);
{
- eo_do(obj, eo_event_callback_call(EO_EV_CALLBACK_ADD, (void *)array); );
+ eo_do(obj, eo_event_callback_call(obj, EO_EV_CALLBACK_ADD, (void *)array); );
}
}
@@ -641,7 +641,7 @@ _eo_base_event_callback_array_del(Eo *obj, Eo_Base_Data *pd,
pd->deletions_waiting = EINA_TRUE;
_eo_callbacks_clear(pd);
- eo_do(obj, eo_event_callback_call(EO_EV_CALLBACK_DEL, (void *)array); );
+ eo_do(obj, eo_event_callback_call(obj, EO_EV_CALLBACK_DEL, (void *)array); );
return;
}
}
@@ -729,7 +729,7 @@ _eo_event_forwarder_callback(void *data, Eo *obj, const Eo_Event_Description *de
Eo *new_obj = (Eo *) data;
Eina_Bool ret = EINA_FALSE;
- eo_do(new_obj, ret = eo_event_callback_call(desc, (void *)event_info); );
+ eo_do(new_obj, ret = eo_event_callback_call(new_obj, desc, (void *)event_info); );
return ret;
}
@@ -743,7 +743,7 @@ _eo_base_event_callback_forwarder_add(Eo *obj, Eo_Base_Data *pd EINA_UNUSED,
/* FIXME: Add it EO_MAGIC_RETURN(new_obj, EO_EINA_MAGIC); */
- eo_do(obj, eo_event_callback_add(desc, _eo_event_forwarder_callback, new_obj); );
+ eo_do(obj, eo_event_callback_add(obj, desc, _eo_event_forwarder_callback, new_obj); );
}
EOLIAN static void
@@ -754,7 +754,7 @@ _eo_base_event_callback_forwarder_del(Eo *obj, Eo_Base_Data *pd EINA_UNUSED,
/* FIXME: Add it EO_MAGIC_RETURN(new_obj, EO_EINA_MAGIC); */
- eo_do(obj, eo_event_callback_del(desc, _eo_event_forwarder_callback, new_obj); );
+ eo_do(obj, eo_event_callback_del(obj, desc, _eo_event_forwarder_callback, new_obj); );
}
EOLIAN static void
@@ -829,7 +829,7 @@ _eo_base_composite_attach(Eo *parent_id, Eo_Base_Data *pd EINA_UNUSED, Eo *comp_
comp_obj->composite = EINA_TRUE;
parent->composite_objects = eina_list_prepend(parent->composite_objects, comp_obj_id);
- eo_do(comp_obj_id, eo_parent_set(parent_id));
+ eo_do(comp_obj_id, eo_parent_set(comp_obj_id, parent_id));
return EINA_TRUE;
}
@@ -845,7 +845,7 @@ _eo_base_composite_detach(Eo *parent_id, Eo_Base_Data *pd EINA_UNUSED, Eo *comp_
comp_obj->composite = EINA_FALSE;
parent->composite_objects = eina_list_remove(parent->composite_objects, comp_obj_id);
- eo_do(comp_obj_id, eo_parent_set(NULL));
+ eo_do(comp_obj_id, eo_parent_set(comp_obj_id, NULL));
return EINA_TRUE;
}
@@ -981,14 +981,14 @@ _eo_base_destructor(Eo *obj, Eo_Base_Data *pd)
while (pd->children)
{
child = eina_list_data_get(pd->children);
- eo_do(child, eo_parent_set(NULL));
+ eo_do(child, eo_parent_set(child, NULL));
}
if (pd->parent)
{
ERR("Object '%p' still has a parent at the time of destruction.", obj);
eo_ref(obj);
- eo_do(obj, eo_parent_set(NULL));
+ eo_do(obj, eo_parent_set(obj, NULL));
}
_eo_generic_data_del_all(pd);
diff --git a/src/lib/eo/eo_private.h b/src/lib/eo/eo_private.h
index 135966daf6..ea78f04527 100644
--- a/src/lib/eo/eo_private.h
+++ b/src/lib/eo/eo_private.h
@@ -32,7 +32,7 @@
} while (0)
-extern int _eo_log_dom;
+__attribute__ ((visibility("default"))) extern int _eo_log_dom;
#ifdef CRI
#undef CRI
@@ -65,7 +65,7 @@ typedef struct _Eo_Object _Eo_Object;
typedef struct _Eo_Header Eo_Header;
/* Retrieves the pointer to the object from the id */
-static inline _Eo_Object *_eo_obj_pointer_get(const Eo_Id obj_id);
+//EAPI _Eo_Object *_eo_obj_pointer_get(const Eo_Id obj_id);
/* Allocates an entry for the given object */
static inline Eo_Id _eo_id_allocate(const _Eo_Object *obj);
@@ -78,97 +78,60 @@ static inline void _eo_free_ids_tables(void);
void _eo_condtor_done(Eo *obj);
-struct _Eo_Header
-{
-#ifndef HAVE_EO_ID
- EINA_MAGIC
-#endif
- Eo_Id id;
-};
-
-struct _Eo_Object
-{
- Eo_Header header;
- const _Eo_Class *klass;
-#ifdef EO_DEBUG
- Eina_Inlist *xrefs;
- Eina_Inlist *data_xrefs;
-#endif
-
- Eina_List *composite_objects;
-
- int refcount;
- int datarefcount;
-
- Eina_Bool condtor_done:1;
- Eina_Bool finalized:1;
-
- Eina_Bool composite:1;
- Eina_Bool del_triggered:1;
- Eina_Bool destructed:1;
- Eina_Bool manual_free:1;
-};
-
/* FIXME: Change the type to something generic that makes sense for eo */
typedef void (*eo_op_func_type)(Eo *, void *class_data, va_list *list);
typedef struct _Dich_Chain1 Dich_Chain1;
-typedef struct
-{
- eo_op_func_type func;
- const _Eo_Class *src;
-} op_type_funcs;
-
struct _Dich_Chain1
{
op_type_funcs *funcs;
};
-typedef struct
+typedef struct Eo_Extension_Data_Offset
{
const _Eo_Class *klass;
size_t offset;
} Eo_Extension_Data_Offset;
-struct _Eo_Class
-{
- Eo_Header header;
+struct _Eo_Class;
+// {
+// Eo_Header header;
- const _Eo_Class *parent;
- const Eo_Class_Description *desc;
- Dich_Chain1 *chain; /**< The size is chain size */
+// const _Eo_Class *parent;
+// const Eo_Class_Description *desc;
+// Dich_Chain1 *chain; /**< The size is chain size */
- const _Eo_Class **extensions;
+// const _Eo_Class **extensions;
- Eo_Extension_Data_Offset *extn_data_off;
+// Eo_Extension_Data_Offset *extn_data_off;
- const _Eo_Class **mro;
+// const _Eo_Class **mro;
- /* cached object for faster allocation */
- struct {
- Eina_Trash *trash;
- Eina_Spinlock trash_lock;
- unsigned int trash_count;
- } objects;
+// /* cached object for faster allocation */
+// struct {
+// Eina_Trash *trash;
+// Eina_Spinlock trash_lock;
+// unsigned int trash_count;
+// } objects;
- /* cached iterator for faster allocation cycle */
- struct {
- Eina_Trash *trash;
- Eina_Spinlock trash_lock;
- unsigned int trash_count;
- } iterators;
+// /* cached iterator for faster allocation cycle */
+// struct {
+// Eina_Trash *trash;
+// Eina_Spinlock trash_lock;
+// unsigned int trash_count;
+// } iterators;
- unsigned int obj_size; /**< size of an object of this class */
- unsigned int chain_size;
- unsigned int base_id;
- unsigned int data_offset; /* < Offset of the data within object data. */
+// unsigned int obj_size; /**< size of an object of this class */
+// unsigned int chain_size;
+// unsigned int base_id;
+// unsigned int data_offset; /* < Offset of the data within object data. */
- Eina_Bool constructed : 1;
- /* [extensions*] + NULL */
- /* [mro*] + NULL */
- /* [extensions data offset] + NULL */
-};
+// Eina_Bool constructed : 1;
+// /* [extensions*] + NULL */
+// /* [mro*] + NULL */
+// /* [extensions data offset] + NULL */
+// };
typedef struct
{
@@ -214,11 +177,11 @@ _eo_del_internal(const char *file, int line, _Eo_Object *obj)
const _Eo_Class *klass = obj->klass;
- eo_do(_eo_id_get(obj), eo_event_callback_call(EO_EV_DEL, NULL));
+ eo_do(_eo_id_get(obj), eo_event_callback_call(_eo_id_get(obj), EO_EV_DEL, NULL));
_eo_condtor_reset(obj);
- eo_do(_eo_id_get(obj), eo_destructor());
+ eo_do(_eo_id_get(obj), eo_destructor(_eo_id_get(obj)));
if (!obj->condtor_done)
{
@@ -232,7 +195,7 @@ _eo_del_internal(const char *file, int line, _Eo_Object *obj)
Eo *emb_obj;
EINA_LIST_FOREACH_SAFE(obj->composite_objects, itr, itr_n, emb_obj)
{
- eo_do(_eo_id_get(obj), eo_composite_detach(emb_obj));
+ eo_do(_eo_id_get(obj), eo_composite_detach(_eo_id_get(obj), emb_obj));
}
}
diff --git a/src/lib/eo/eo_ptr_indirection.c b/src/lib/eo/eo_ptr_indirection.c
index ee559014f3..e5a9238f4b 100644
--- a/src/lib/eo/eo_ptr_indirection.c
+++ b/src/lib/eo/eo_ptr_indirection.c
@@ -5,7 +5,7 @@
#include "eo_ptr_indirection.h"
/* Tables handling pointers indirection */
-_Eo_Ids_Table **_eo_ids_tables[MAX_MID_TABLE_ID] = { NULL };
+__attribute__ ((visibility("default"))) _Eo_Ids_Table **_eo_ids_tables[MAX_MID_TABLE_ID] = { NULL };
/* Current table used for following allocations */
_Eo_Ids_Table *_current_table = NULL;
diff --git a/src/lib/eo/eo_ptr_indirection.x b/src/lib/eo/eo_ptr_indirection.x
index 2faae7529e..b9138bcaf5 100644
--- a/src/lib/eo/eo_ptr_indirection.x
+++ b/src/lib/eo/eo_ptr_indirection.x
@@ -227,7 +227,7 @@ typedef struct
} _Eo_Ids_Table;
/* Tables handling pointers indirection */
-extern _Eo_Ids_Table **_eo_ids_tables[MAX_MID_TABLE_ID];
+__attribute__ ((visibility("default"))) extern _Eo_Ids_Table **_eo_ids_tables[MAX_MID_TABLE_ID];
/* Current table used for following allocations */
extern _Eo_Ids_Table *_current_table;
@@ -259,45 +259,6 @@ extern Generation_Counter _eo_generation_counter;
/* Macro used for readability */
#define TABLE_FROM_IDS _eo_ids_tables[mid_table_id][table_id]
-static inline _Eo_Object *
-_eo_obj_pointer_get(const Eo_Id obj_id)
-{
-#ifdef HAVE_EO_ID
- _Eo_Id_Entry *entry;
- Generation_Counter generation;
- Table_Index mid_table_id, table_id, entry_id;
-
- // NULL objects will just be sensibly ignored. not worth complaining
- // every single time.
- if (!obj_id)
- {
- DBG("obj_id is NULL. Possibly unintended access?");
- return NULL;
- }
- else if (!(obj_id & MASK_OBJ_TAG))
- {
- DBG("obj_id is not a valid object id.");
- return NULL;
- }
-
- EO_DECOMPOSE_ID(obj_id, mid_table_id, table_id, entry_id, generation);
-
- /* Check the validity of the entry */
- if (_eo_ids_tables[mid_table_id] && TABLE_FROM_IDS)
- {
- entry = &(TABLE_FROM_IDS->entries[entry_id]);
- if (entry && entry->active && (entry->generation == generation))
- return entry->ptr;
- }
-
- ERR("obj_id %p is not pointing to a valid object. Maybe it has already been freed.",
- (void *)obj_id);
-
- return NULL;
-#else
- return (_Eo_Object *) obj_id;
-#endif
-}
static inline _Eo_Id_Entry *
_get_available_entry(_Eo_Ids_Table *table)