jpeg pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=ec71288548bf0fa2d2d14a7e979d67b467ee3079

commit ec71288548bf0fa2d2d14a7e979d67b467ee3079
Author: Jean-Philippe Andre <jp.an...@samsung.com>
Date:   Wed Apr 19 13:51:27 2017 +0900

    eo: Micro-optimize function calls
    
    This is related to the previous changes to efl_super.
---
 src/lib/eo/eo.c | 41 ++++++++++++++++++++++++++---------------
 1 file changed, 26 insertions(+), 15 deletions(-)

diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c
index bfa950b..a533f7a 100644
--- a/src/lib/eo/eo.c
+++ b/src/lib/eo/eo.c
@@ -451,24 +451,16 @@ _efl_object_call_resolve(Eo *eo_id, const char 
*func_name, Efl_Object_Op_Call_Da
         obj = _obj;
         klass = _obj->klass;
         vtable = EO_VTABLE(obj);
-        if (_obj->cur_klass)
+        is_override = _obj_is_override(obj);
+        if (EINA_UNLIKELY(_obj->cur_klass != NULL))
           {
-             cur_klass = _obj->cur_klass;
-             super = _obj->super;
-             _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;
           }
 
-        if (_obj_is_override(obj) && cur_klass && super &&
-            (_eo_class_id_get(cur_klass) == EFL_OBJECT_OVERRIDE_CLASS))
-          {
-             /* Doing a efl_super(obj, EFL_OBJECT_OVERRIDE_CLASS) should 
result in calling
-              * as if it's a normal class. */
-             vtable = &klass->vtable;
-             cur_klass = NULL;
-          }
-
-        is_override = _obj_is_override(obj) && (cur_klass == NULL);
-
+obj_super_back:
         call->obj = obj;
         _efl_ref(_obj);
      }
@@ -636,6 +628,25 @@ ok_klass:
      }
    goto ok_klass_back;
 
+obj_super:
+   {
+      cur_klass = obj->cur_klass;
+      super = obj->super;
+      obj->cur_klass = NULL;
+
+      if (_obj_is_override(obj) && cur_klass && super &&
+          (_eo_class_id_get(cur_klass) == EFL_OBJECT_OVERRIDE_CLASS))
+        {
+           /* Doing a efl_super(obj, EFL_OBJECT_OVERRIDE_CLASS) should
+            * result in calling as if it's a normal class. */
+           vtable = &klass->vtable;
+           cur_klass = NULL;
+        }
+
+      is_override = _obj_is_override(obj) && (cur_klass == NULL);
+   }
+   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;

-- 


Reply via email to