Compare commits

...

3 Commits

Author SHA1 Message Date
Marcel Hollerbach 94b31a640e eo: use eina_prefetch
we should prefetch the func pointer here.
Later on we are accessing the func pointer in a streak, after that, we
do not use it anymore.

Differential Revision: https://phab.enlightenment.org/D11593
2020-03-25 10:20:13 +01:00
Marcel Hollerbach adbc82b33e eo: move all call assignment
this improves the cache performance a lot. Caches are only invalidated
once, and not multiple times.

Differential Revision: https://phab.enlightenment.org/D11592
2020-03-25 10:19:59 +01:00
Marcel Hollerbach 7750964a1b 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.

Differential Revision: https://phab.enlightenment.org/D11591
2020-03-25 10:19:46 +01:00
1 changed files with 16 additions and 50 deletions

View File

@ -544,42 +544,25 @@ _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:
_efl_ref(_obj);
main_klass = klass;
@ -594,6 +577,7 @@ ok_klass_back:
else
{
func = _vtable_func_get(vtable, op);
EINA_PREFETCH_NOCACHE(func);
// this is not very likely to happen - but may if its an invalid
// call or a composite object, but either way, it's not very likely
// so make it a goto to save on instruction cache
@ -603,9 +587,10 @@ ok_cur_klass_back:
if (EINA_LIKELY(func->func && func->src))
{
call->eo_id = eo_id;
call->obj = obj;
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))
{