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) <rasterman.com>
Reviewed-by: Stefan Schmidt <stefan@datenfreihafen.org>
Differential Revision: https://phab.enlightenment.org/D11591
This commit is contained in:
Marcel Hollerbach 2020-03-24 19:54:56 +01:00
parent 43ac889bc1
commit 790a63c15f
1 changed files with 15 additions and 49 deletions

View File

@ -544,42 +544,28 @@ _efl_object_call_resolve(Eo *eo_id, const char *func_name, Efl_Object_Op_Call_Da
_Eo_Object *obj = NULL; _Eo_Object *obj = NULL;
const Eo_Vtable *vtable = NULL; const Eo_Vtable *vtable = NULL;
const op_type_funcs *func; const op_type_funcs *func;
Eina_Bool is_obj;
Eina_Bool super = EINA_TRUE; Eina_Bool super = EINA_TRUE;
if (EINA_UNLIKELY(!eo_id)) goto on_null; if (EINA_UNLIKELY(!eo_id)) goto on_null;
call->eo_id = eo_id; 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)) obj = _obj;
{ klass = _obj->klass;
EO_OBJ_POINTER_RETURN_VAL_PROXY(eo_id, _obj, EINA_FALSE); vtable = EO_VTABLE2(obj);
if (EINA_UNLIKELY(_obj->cur_klass != NULL))
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
{ {
// YES this is a goto with a label to return. this is a // YES this is a goto with a label to return. this is a
// micro-optimization to move infrequent code out of the // micro-optimization to move infrequent code out of the
// hot path of the function // 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; main_klass = klass;
@ -604,8 +590,7 @@ ok_cur_klass_back:
if (EINA_LIKELY(func->func && func->src)) if (EINA_LIKELY(func->func && func->src))
{ {
call->func = func->func; call->func = func->func;
call->data = _efl_data_scope_get(obj, func->src);
if (is_obj) call->data = _efl_data_scope_get(obj, func->src);
return EINA_TRUE; return EINA_TRUE;
} }
@ -616,7 +601,6 @@ ok_cur_klass_back:
end: end:
/* Try composite objects */ /* Try composite objects */
if (is_obj)
{ {
Eina_List *itr; Eina_List *itr;
Eo *emb_obj_id; 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'.", ERR("in %s:%d: you called a pure virtual func '%s' (%d) of class '%s'.",
file, line, func_name, op, klass->desc->name); file, line, func_name, op, klass->desc->name);
err: err:
if (is_obj) _apply_auto_unref(obj, eo_id);
{ _efl_unref(obj);
_apply_auto_unref(obj, eo_id); _eo_obj_pointer_done((Eo_Id)eo_id);
_efl_unref(obj);
_eo_obj_pointer_done((Eo_Id)eo_id);
}
return EINA_FALSE; return EINA_FALSE;
// yes - special "move out of hot path" code blobs with goto's for // yes - special "move out of hot path" code blobs with goto's for
@ -681,18 +663,6 @@ ok_cur_klass:
klass = func->src; klass = func->src;
goto ok_cur_klass_back; 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: obj_super:
{ {
cur_klass = obj->cur_klass; cur_klass = obj->cur_klass;
@ -711,10 +681,6 @@ obj_super:
} }
goto obj_super_back; 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: on_null:
if (EINA_UNLIKELY(efl_del_api_generation != _efl_object_init_generation)) if (EINA_UNLIKELY(efl_del_api_generation != _efl_object_init_generation))
{ {