summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2015-10-15 18:03:27 +0100
committerTom Hacohen <tom@stosb.com>2015-10-19 10:22:41 +0100
commit8bd7c9e4295a3d9c1732ec57c386633660abe303 (patch)
treeb3ac4c4a5b9cf6828d14d3e7b13fe749dc99a44a
parent37c07b07d492a37185b0e5dc404a6efa03c4ad16 (diff)
downloadefl-8bd7c9e4295a3d9c1732ec57c386633660abe303.tar.gz
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.
-rw-r--r--src/lib/eo/Eo.h7
-rw-r--r--src/lib/eo/eo.c14
-rw-r--r--src/tests/eo/suite/eo_test_call_errors.c2
3 files changed, 11 insertions, 12 deletions
diff --git a/src/lib/eo/Eo.h b/src/lib/eo/Eo.h
index 6ddc2381a0..19aba96024 100644
--- a/src/lib/eo/Eo.h
+++ b/src/lib/eo/Eo.h
@@ -468,8 +468,11 @@ EAPI extern Eo_Hook_Call eo_hook_call_post;
#define EO_FUNC_COMMON_OP(Name, DefRet) \
Eo_Op_Call_Data ___call; \
static Eo_Op ___op = EO_NOOP; \
- if (___op == EO_NOOP) \
- ___op = _eo_api_op_id_get(EO_FUNC_COMMON_OP_FUNC(Name)); \
+ if (EINA_UNLIKELY(___op == EO_NOOP)) \
+ { \
+ ___op = _eo_api_op_id_get(EO_FUNC_COMMON_OP_FUNC(Name)); \
+ if (___op == EO_NOOP) return DefRet; \
+ } \
if (!_eo_call_resolve(#Name, ___op, &___call, __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 4e6d2ebc08..6af86d6232 100644
--- a/src/lib/eo/eo.c
+++ b/src/lib/eo/eo.c
@@ -529,15 +529,6 @@ _eo_call_resolve(const char *func_name, const Eo_Op op, Eo_Op_Call_Data *call, c
klass = (is_obj) ? fptr->o.obj->klass : fptr->o.kls;
- if (op == EO_NOOP)
- {
- ERR("%s:%d: unable to resolve %s api func '%s' in class '%s'.",
- file, line, (!is_obj ? "class" : "regular"),
- func_name, klass->desc->name);
-
- return EINA_FALSE;
- }
-
/* If we have a current class, we need to itr to the next. */
if (fptr->cur_klass)
{
@@ -703,6 +694,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 e6a9883d6c..5a03cd83b7 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);