tasn pushed a commit to branch master.

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

commit f28f6ecbfa7a19c0425a33edd6a72d7bc8293e1e
Author: Tom Hacohen <t...@stosb.com>
Date:   Thu Oct 15 18:03:27 2015 +0100

    Eo: Move op resolve check to where it belongs (out of hot path).
    
    It was put in the wrong place. It should abort early if it detects we
    can't resolve, and shouldn't check it if we already know it's OK.
---
 src/lib/eo/Eo.h                          | 7 +++++--
 src/lib/eo/eo.c                          | 5 +++++
 src/tests/eo/suite/eo_test_call_errors.c | 2 +-
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/lib/eo/Eo.h b/src/lib/eo/Eo.h
index 3e5ad42..fc450c2 100644
--- a/src/lib/eo/Eo.h
+++ b/src/lib/eo/Eo.h
@@ -484,8 +484,11 @@ typedef struct _Eo_Call_Cache
 #define EO_FUNC_COMMON_OP(Name, DefRet)                                 \
      static Eo_Call_Cache ___cache; /* static 0 by default */           \
      Eo_Op_Call_Data ___call;                                           \
-     if (___cache.op == EO_NOOP)                                        \
-       ___cache.op = _eo_api_op_id_get(EO_FUNC_COMMON_OP_FUNC(Name));   \
+     if (EINA_UNLIKELY(___cache.op == EO_NOOP))                         \
+       {                                                                \
+          ___cache.op = _eo_api_op_id_get(EO_FUNC_COMMON_OP_FUNC(Name)); \
+          if (___cache.op == EO_NOOP) return DefRet;                    \
+       }                                                                \
      if (!_eo_call_resolve(#Name, &___call, &___cache,                  \
                            __FILE__, __LINE__)) return DefRet;          \
      _Eo_##Name##_func _func_ = (_Eo_##Name##_func) ___call.func;       \
diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c
index 2742dc6..1d046c2 100644
--- a/src/lib/eo/eo.c
+++ b/src/lib/eo/eo.c
@@ -743,6 +743,11 @@ _eo_api_op_id_get(const void *api_func)
 #endif
    eina_spinlock_release(&_ops_storage_lock);
 
+   if (op == EO_NOOP)
+     {
+        ERR("Unable to resolve op for api func %p", api_func);
+     }
+
    return op;
 }
 
diff --git a/src/tests/eo/suite/eo_test_call_errors.c 
b/src/tests/eo/suite/eo_test_call_errors.c
index e6a9883..5a03cd8 100644
--- a/src/tests/eo/suite/eo_test_call_errors.c
+++ b/src/tests/eo/suite/eo_test_call_errors.c
@@ -37,7 +37,7 @@ START_TEST(eo_api_not_implemented_call)
    Eo *obj = eo_add(SIMPLE_CLASS, NULL);
    fail_if(!obj);
 
-   TEST_EO_ERROR("_eo_call_resolve", "%s:%d: unable to resolve %s api func 
'%s' in class '%s'.");
+   TEST_EO_ERROR("_eo_api_op_id_get", "Unable to resolve op for api func %p");
    eo_do(obj, simple_no_implementation());
    fail_unless(ctx.did);
 

-- 


Reply via email to