efl/src/lib/eo
Jean-Philippe Andre df304d0155 eo: Add beta API for auto_unref after a call
Before screaming in horror (C++...) here's why we may need this:
Efl.Part.part API returns an object that is by definition valid for a
single function call only. Enforcing this in practice is actually quite
hard as all implementation functions must manually take care of the
life-cycle. This is a lot of code in many places and a lot of
opportunities to forget to properly handle that life-cycle. Also, this
means any invalid function call on a part will leak an object.

This API absolutely must remain either "internal" or "beta" and
definitely not become abused by applications. On top of that such an API
can cause great trouble for bindings like C++. As a consequence, only
specially crafted APIs like efl_part() should return an object marked as
auto_unref.

Alternatively this API could be defined in Eo.h or some other
Eo_Internal.h. I placed it in efl_object.eo because it's much more
convenient :) (read: I'm lazy)

****

Performance notes:

Tested with clang & gcc (with -O2), I had a look at the output of perf
top, in particular the asm view. I used eo_bench in a loop. My
conclusions are:

- EINA_LIKELY/UNLIKELY actually works. The jump statement varies
  according to the expectation. I highly doubt all those ugly goto in
  eo.c / Eo.h are even useful.

- The impact of auto_unref on a call_resolve is so small it doesn't even
  appear in the trace. It is significant inside call_end, though
  (obviously, that function is just a few lines long). That function
  accounts for ~1% to ~4% of all CPU time. The impact of auto_unref in
  call_end is ~4% of the function time. This means ~0.16% of all CPU
  time (worst measured case). _efl_object_op_api_id_get simply doesn't
  show up because of caching, so the extra check there is negligible.

PS: I also tested EINA_LIKELY/UNLIKELY by compiling with -O2 and looking
at the output with objdump. The flag is well respected, and the jump
instructions are what you would expect (no jump for LIKELY and jump for
UNLIKELY). Conclusion: The goto's in eo.c only make the code harder to
read...
2017-10-18 11:02:16 +09:00
..
CMakeLists.txt cmake/eo: add description (fills eo.pc file) 2017-01-23 19:34:39 -02:00
Eo.h eo: introduce function definitions with fallback 2017-09-29 11:00:37 +02:00
efl_class.eo docs: eo: finish up docs for eo 2016-11-10 15:14:42 +01:00
efl_future.c Efl_Future: class name (string) using "." for namespace. 2016-12-12 02:30:33 -02:00
efl_future.h eo: add missing since tags for functions added during 1.19 cycle 2017-02-14 21:47:15 +01:00
efl_interface.eo Eo: Rename most of Eo to the Efl prefix. 2016-08-11 17:04:43 +01:00
efl_object.eo eo: Add beta API for auto_unref after a call 2017-10-18 11:02:16 +09:00
efl_object_override.eo Eo: Rename most of Eo to the Efl prefix. 2016-08-11 17:04:43 +01:00
eina_types.eot eo: Use any_value in eina_types.eot 2017-10-17 17:31:38 +09:00
eo.c eo: Add beta API for auto_unref after a call 2017-10-18 11:02:16 +09:00
eo_add_fallback.c all: use void if we really want to make sure we do not accept parameters 2016-12-06 17:16:24 +01:00
eo_add_fallback.h Eo: Finish the renaming of Eo to the EFL. 2016-08-15 15:07:42 +01:00
eo_base_class.c eo: Add beta API for auto_unref after a call 2017-10-18 11:02:16 +09:00
eo_class_class.c Eo: Rename most of Eo to the Efl prefix. 2016-08-11 17:04:43 +01:00
eo_private.h eo: Add beta API for auto_unref after a call 2017-10-18 11:02:16 +09:00
eo_ptr_indirection.c eo: Improve invalid EO ID error message 2017-06-22 13:19:23 +09:00
eo_ptr_indirection.h eo: Add debug_name read-only property to ease debugging 2017-08-04 10:24:03 +09:00
eo_ptr_indirection.x eo - eoid - finally rtemove option to not have eoid. it doesn't work 2017-05-17 15:04:01 +09:00