summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean Guyomarc'h <jean@guyomarch.bzh>2018-01-08 22:20:33 +0100
committerJean Guyomarc'h <jean@guyomarch.bzh>2018-01-08 22:20:33 +0100
commitacc2cf874bb06a6811fa037adcf38f12b240dbcd (patch)
tree7b159e9fd2a10587c1de430440e22dc2c9baa537
parentf654f7e2995095cd15d1fd3080ac2d80eadc9f45 (diff)
experimental: add hot/cold labels
This gives scraps of perfs. Not fantastic, but still a bit.
-rw-r--r--src/lib/eo/Eo.h8
-rw-r--r--src/lib/eo/eo.c22
2 files changed, 17 insertions, 13 deletions
diff --git a/src/lib/eo/Eo.h b/src/lib/eo/Eo.h
index cb4d064297..347b735f14 100644
--- a/src/lib/eo/Eo.h
+++ b/src/lib/eo/Eo.h
@@ -10,6 +10,10 @@
10 10
11#define EO_NO_PTR_INDIRECTION 11#define EO_NO_PTR_INDIRECTION
12 12
13#define EINA_COLD __attribute__ ((cold));
14#define EINA_HOT __attribute__ ((hot));
15
16
13#define EOLIAN 17#define EOLIAN
14 18
15/* When used, this indicates that the function is an Eo API. */ 19/* When used, this indicates that the function is an Eo API. */
@@ -1229,13 +1233,13 @@ typedef struct _Efl_Object_Call_Cache
1229// of the cacheline that was already fetched should yield better cache 1233// of the cacheline that was already fetched should yield better cache
1230// hits. 1234// hits.
1231#define EFL_FUNC_COMMON_OP_END(Obj, Name, DefRet, ErrorCase) \ 1235#define EFL_FUNC_COMMON_OP_END(Obj, Name, DefRet, ErrorCase) \
1232__##Name##_op_create: \ 1236__##Name##_op_create: EINA_COLD \
1233 if (EINA_UNLIKELY(___cache.op != EFL_NOOP)) memset(&___cache, 0, sizeof(___cache)); \ 1237 if (EINA_UNLIKELY(___cache.op != EFL_NOOP)) memset(&___cache, 0, sizeof(___cache)); \
1234 ___cache.op = _efl_object_op_api_id_get(EFL_FUNC_COMMON_OP_FUNC(Name), Obj, #Name, __FILE__, __LINE__); \ 1238 ___cache.op = _efl_object_op_api_id_get(EFL_FUNC_COMMON_OP_FUNC(Name), Obj, #Name, __FILE__, __LINE__); \
1235 if (___cache.op == EFL_NOOP) goto __##Name##_failed; \ 1239 if (___cache.op == EFL_NOOP) goto __##Name##_failed; \
1236 ___cache.generation = _efl_object_init_generation; \ 1240 ___cache.generation = _efl_object_init_generation; \
1237 goto __##Name##_op_create_done; \ 1241 goto __##Name##_op_create_done; \
1238__##Name##_failed: \ 1242__##Name##_failed: EINA_COLD\
1239 ErrorCase \ 1243 ErrorCase \
1240 return DefRet; 1244 return DefRet;
1241#define _EFL_OBJECT_API_BEFORE_HOOK 1245#define _EFL_OBJECT_API_BEFORE_HOOK
diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c
index ae13754fcf..a9c10d5e54 100644
--- a/src/lib/eo/eo.c
+++ b/src/lib/eo/eo.c
@@ -417,21 +417,21 @@ _efl_super_cast(const Eo *eo_id, const Efl_Class *cur_klass, Eina_Bool super)
417 417
418 return (Eo *) eo_id; 418 return (Eo *) eo_id;
419 419
420do_klass: 420do_klass: EINA_COLD
421 // efl_super(Class) is extremely rarely used, so TLS write is fine 421 // efl_super(Class) is extremely rarely used, so TLS write is fine
422 EINA_SAFETY_ON_FALSE_RETURN_VAL(super, NULL); 422 EINA_SAFETY_ON_FALSE_RETURN_VAL(super, NULL);
423 _super_klass = super_klass; 423 _super_klass = super_klass;
424 return (Eo *) eo_id; 424 return (Eo *) eo_id;
425 425
426err: 426err: EINA_COLD
427 _EO_POINTER_ERR(cur_klass, "Class (%p) is an invalid ref.", cur_klass); 427 _EO_POINTER_ERR(cur_klass, "Class (%p) is an invalid ref.", cur_klass);
428 return NULL; 428 return NULL;
429#ifdef EO_DEBUG 429#ifdef EO_DEBUG
430err_obj: 430err_obj: EINA_COLD
431 _EO_POINTER_ERR(eo_id, "Object (%p) is an invalid ref, class=%p (%s).", eo_id, cur_klass, efl_class_name_get(cur_klass)); 431 _EO_POINTER_ERR(eo_id, "Object (%p) is an invalid ref, class=%p (%s).", eo_id, cur_klass, efl_class_name_get(cur_klass));
432 return NULL; 432 return NULL;
433#endif 433#endif
434err_obj_hierarchy: 434err_obj_hierarchy: EINA_COLD
435 _EO_POINTER_ERR(eo_id, "Object (%p) class=%p (%s) is not an instance of class=%p (%s).", eo_id, efl_class_get(eo_id), efl_class_name_get(eo_id), cur_klass, efl_class_name_get(cur_klass)); 435 _EO_POINTER_ERR(eo_id, "Object (%p) class=%p (%s) is not an instance of class=%p (%s).", eo_id, efl_class_get(eo_id), efl_class_name_get(eo_id), cur_klass, efl_class_name_get(cur_klass));
436 return NULL; 436 return NULL;
437} 437}
@@ -619,15 +619,15 @@ composite_continue:
619 file, line, func_name, cache->op, main_klass->desc->name); 619 file, line, func_name, cache->op, main_klass->desc->name);
620 goto err; 620 goto err;
621 } 621 }
622err_cache_op: 622err_cache_op: EINA_COLD
623 ERR("%s:%d: unable to resolve %s api func '%s' in class '%s'.", 623 ERR("%s:%d: unable to resolve %s api func '%s' in class '%s'.",
624 file, line, (!is_obj ? "class" : "regular"), 624 file, line, (!is_obj ? "class" : "regular"),
625 func_name, klass->desc->name); 625 func_name, klass->desc->name);
626 goto err; 626 goto err;
627err_func_src: 627err_func_src: EINA_COLD
628 ERR("in %s:%d: you called a pure virtual func '%s' (%d) of class '%s'.", 628 ERR("in %s:%d: you called a pure virtual func '%s' (%d) of class '%s'.",
629 file, line, func_name, cache->op, klass->desc->name); 629 file, line, func_name, cache->op, klass->desc->name);
630err: 630err: EINA_COLD
631 if (is_obj) 631 if (is_obj)
632 { 632 {
633 if (EINA_UNLIKELY(obj->auto_unref != 0)) 633 if (EINA_UNLIKELY(obj->auto_unref != 0))
@@ -642,13 +642,13 @@ err:
642 642
643 // yes - special "move out of hot path" code blobs with goto's for 643 // yes - special "move out of hot path" code blobs with goto's for
644 // speed reasons to have intr prefetches work better and miss less 644 // speed reasons to have intr prefetches work better and miss less
645ok_cur_klass: 645ok_cur_klass: EINA_HOT
646 func = _eo_kls_itr_next(klass, cur_klass, cache->op, super); 646 func = _eo_kls_itr_next(klass, cur_klass, cache->op, super);
647 if (!func) goto end; 647 if (!func) goto end;
648 klass = func->src; 648 klass = func->src;
649 goto ok_cur_klass_back; 649 goto ok_cur_klass_back;
650 650
651ok_klass: 651ok_klass: EINA_HOT
652 { 652 {
653 EO_CLASS_POINTER_GOTO_PROXY(eo_id, _klass, err_klass); 653 EO_CLASS_POINTER_GOTO_PROXY(eo_id, _klass, err_klass);
654 klass = _klass; 654 klass = _klass;
@@ -660,7 +660,7 @@ ok_klass:
660 } 660 }
661 goto ok_klass_back; 661 goto ok_klass_back;
662 662
663obj_super: 663obj_super: EINA_HOT
664 { 664 {
665 cur_klass = obj->cur_klass; 665 cur_klass = obj->cur_klass;
666 super = obj->super; 666 super = obj->super;
@@ -679,7 +679,7 @@ obj_super:
679 } 679 }
680 goto obj_super_back; 680 goto obj_super_back;
681 681
682err_klass: 682err_klass: EINA_COLD
683 _EO_POINTER_ERR(eo_id, "in %s:%d: func '%s': obj_id=%p is an invalid ref.", file, line, func_name, eo_id); 683 _EO_POINTER_ERR(eo_id, "in %s:%d: func '%s': obj_id=%p is an invalid ref.", file, line, func_name, eo_id);
684 return EINA_FALSE; 684 return EINA_FALSE;
685} 685}