From 790a63c15f92a9fc5928c78c7f3c5b69f8e8d1fd Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Tue, 24 Mar 2020 19:54:56 +0100 Subject: [PATCH] eo: there is no reason to equip for calls to classes calls to classes are not needed anymore, since class inheritance is not a thing anymore. After removing is_obj from the function the compile can optimize the code better, since assignments to fields are not conditionally anymore. Reviewed-by: Carsten Haitzler (Rasterman) Reviewed-by: Stefan Schmidt Differential Revision: https://phab.enlightenment.org/D11591 --- src/lib/eo/eo.c | 64 ++++++++++++------------------------------------- 1 file changed, 15 insertions(+), 49 deletions(-) diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c index 9f1c4f03ba..e0988b9f28 100644 --- a/src/lib/eo/eo.c +++ b/src/lib/eo/eo.c @@ -544,42 +544,28 @@ _efl_object_call_resolve(Eo *eo_id, const char *func_name, Efl_Object_Op_Call_Da _Eo_Object *obj = NULL; const Eo_Vtable *vtable = NULL; const op_type_funcs *func; - Eina_Bool is_obj; Eina_Bool super = EINA_TRUE; if (EINA_UNLIKELY(!eo_id)) goto on_null; call->eo_id = eo_id; - is_obj = _eo_is_a_obj(eo_id); + EO_OBJ_POINTER_RETURN_VAL_PROXY(eo_id, _obj, EINA_FALSE); - if (EINA_LIKELY(is_obj == EINA_TRUE)) - { - EO_OBJ_POINTER_RETURN_VAL_PROXY(eo_id, _obj, EINA_FALSE); - - obj = _obj; - klass = _obj->klass; - vtable = EO_VTABLE2(obj); - if (EINA_UNLIKELY(_obj->cur_klass != NULL)) - { - // YES this is a goto with a label to return. this is a - // micro-optimization to move infrequent code out of the - // hot path of the function - goto obj_super; - } - -obj_super_back: - call->obj = obj; - _efl_ref(_obj); - } - else + obj = _obj; + klass = _obj->klass; + vtable = EO_VTABLE2(obj); + if (EINA_UNLIKELY(_obj->cur_klass != NULL)) { // YES this is a goto with a label to return. this is a // micro-optimization to move infrequent code out of the // hot path of the function - goto ok_klass; + goto obj_super; } -ok_klass_back: + +obj_super_back: + call->obj = obj; + _efl_ref(_obj); main_klass = klass; @@ -604,8 +590,7 @@ ok_cur_klass_back: if (EINA_LIKELY(func->func && func->src)) { call->func = func->func; - - if (is_obj) call->data = _efl_data_scope_get(obj, func->src); + call->data = _efl_data_scope_get(obj, func->src); return EINA_TRUE; } @@ -616,7 +601,6 @@ ok_cur_klass_back: end: /* Try composite objects */ - if (is_obj) { Eina_List *itr; Eo *emb_obj_id; @@ -665,12 +649,10 @@ err_func_src: ERR("in %s:%d: you called a pure virtual func '%s' (%d) of class '%s'.", file, line, func_name, op, klass->desc->name); err: - if (is_obj) - { - _apply_auto_unref(obj, eo_id); - _efl_unref(obj); - _eo_obj_pointer_done((Eo_Id)eo_id); - } + _apply_auto_unref(obj, eo_id); + _efl_unref(obj); + _eo_obj_pointer_done((Eo_Id)eo_id); + return EINA_FALSE; // yes - special "move out of hot path" code blobs with goto's for @@ -681,18 +663,6 @@ ok_cur_klass: klass = func->src; goto ok_cur_klass_back; -ok_klass: - { - EO_CLASS_POINTER_GOTO_PROXY(eo_id, _klass, err_klass); - klass = _klass; - vtable = &klass->vtable; - cur_klass = _super_klass; - if (cur_klass) _super_klass = NULL; - call->obj = NULL; - call->data = NULL; - } - goto ok_klass_back; - obj_super: { cur_klass = obj->cur_klass; @@ -711,10 +681,6 @@ obj_super: } goto obj_super_back; -err_klass: - _EO_POINTER_ERR(eo_id, "in %s:%d: func '%s': obj_id=%p is an invalid ref.", file, line, func_name, eo_id); - return EINA_FALSE; - on_null: if (EINA_UNLIKELY(efl_del_api_generation != _efl_object_init_generation)) {