summaryrefslogtreecommitdiff
path: root/src/lib/eo
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-04-19 13:51:27 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-04-19 14:44:14 +0900
commitec71288548bf0fa2d2d14a7e979d67b467ee3079 (patch)
tree6b3e311db89895b56e8ed45007e6980b71a68026 /src/lib/eo
parent9a81165830f56dde712b67627219ffb9304beac9 (diff)
eo: Micro-optimize function calls
This is related to the previous changes to efl_super.
Diffstat (limited to 'src/lib/eo')
-rw-r--r--src/lib/eo/eo.c41
1 files changed, 26 insertions, 15 deletions
diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c
index bfa950bad7..a533f7af23 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
451 obj = _obj; 451 obj = _obj;
452 klass = _obj->klass; 452 klass = _obj->klass;
453 vtable = EO_VTABLE(obj); 453 vtable = EO_VTABLE(obj);
454 if (_obj->cur_klass) 454 is_override = _obj_is_override(obj);
455 if (EINA_UNLIKELY(_obj->cur_klass != NULL))
455 { 456 {
456 cur_klass = _obj->cur_klass; 457 // YES this is a goto with a label to return. this is a
457 super = _obj->super; 458 // micro-optimization to move infrequent code out of the
458 _obj->cur_klass = NULL; 459 // hot path of the function
460 goto obj_super;
459 } 461 }
460 462
461 if (_obj_is_override(obj) && cur_klass && super && 463obj_super_back:
462 (_eo_class_id_get(cur_klass) == EFL_OBJECT_OVERRIDE_CLASS))
463 {
464 /* Doing a efl_super(obj, EFL_OBJECT_OVERRIDE_CLASS) should result in calling
465 * as if it's a normal class. */
466 vtable = &klass->vtable;
467 cur_klass = NULL;
468 }
469
470 is_override = _obj_is_override(obj) && (cur_klass == NULL);
471
472 call->obj = obj; 464 call->obj = obj;
473 _efl_ref(_obj); 465 _efl_ref(_obj);
474 } 466 }
@@ -636,6 +628,25 @@ ok_klass:
636 } 628 }
637 goto ok_klass_back; 629 goto ok_klass_back;
638 630
631obj_super:
632 {
633 cur_klass = obj->cur_klass;
634 super = obj->super;
635 obj->cur_klass = NULL;
636
637 if (_obj_is_override(obj) && cur_klass && super &&
638 (_eo_class_id_get(cur_klass) == EFL_OBJECT_OVERRIDE_CLASS))
639 {
640 /* Doing a efl_super(obj, EFL_OBJECT_OVERRIDE_CLASS) should
641 * result in calling as if it's a normal class. */
642 vtable = &klass->vtable;
643 cur_klass = NULL;
644 }
645
646 is_override = _obj_is_override(obj) && (cur_klass == NULL);
647 }
648 goto obj_super_back;
649
639err_klass: 650err_klass:
640 _EO_POINTER_ERR(eo_id, "in %s:%d: func '%s': obj_id=%p is an invalid ref.", file, line, func_name, eo_id); 651 _EO_POINTER_ERR(eo_id, "in %s:%d: func '%s': obj_id=%p is an invalid ref.", file, line, func_name, eo_id);
641 return EINA_FALSE; 652 return EINA_FALSE;