path: root/src/lib/eo (follow)
Commit message (Collapse)AuthorAgeFilesLines
* eo: move wref_add/wref_del to CDaniel Kolesa2017-04-263-20/+26
* eo: move future_link to CDaniel Kolesa2017-04-263-8/+13
* eo: hide dbg_info from eo filesDaniel Kolesa2017-04-213-13/+21
| | | | Continues b780cf2af299ce17be260486bb7ab64badddbaec.
* eo: move event related structures and callback to CDaniel Kolesa2017-04-212-28/+30
| | | | | | We don't need to keep this in eo files anymore because the APIs using them are now fully in C. This also allows removal of the event callback builtin from Eolian.
* eo: move unbindable event APIs to CDaniel Kolesa2017-04-203-78/+123
| | | | | | | | | In a few classes, this requires some manual expansion. This should not break anything but it's also fairly ugly; a better solution would be appreciated, for now we do this. Similar changes will be done to a few other Efl.Object APIs as well at later point.
* eo: move Efl_Event definition back to CDaniel Kolesa2017-04-202-8/+12
| | | | It's not used anywhere in eo files and has a void pointer.
* eo: Micro-optimize function callsJean-Philippe Andre2017-04-191-15/+26
| | | | This is related to the previous changes to efl_super.
* eo: Remove super bit from eo idJean-Philippe Andre2017-04-192-17/+5
| | | | | It is not required anymore as the super class and super bit can be stored inside the object data. See the previous patches.
* eo: Add docs for efl_super and efl_cast (doxygen)Jean-Philippe Andre2017-04-191-0/+70
* eo: Add new API efl_castJean-Philippe Andre2017-04-192-7/+24
| | | | | | | | | | | | | | | | | | This is similar to efl_super but the specified class is the one we want to call the function on. This is similar to dynamic_cast<> in C++. Note: both efl_super() and efl_cast() need documentation! This is an experimental feature. Fixes T5311 @feature Maniphest Tasks: T5311 Differential Revision: https://phab.enlightenment.org/D4797
* eo: Remove lock from efl_superJean-Philippe Andre2017-04-192-29/+31
| | | | | | | | | | | | | | | | | I've always really disliked this lock. If someone calls a non-eo function by accident with efl_super() then you'll most likely end up in a deadlock. This adds the cur_klass pointer to the object itself, exploiting the fact that we have 8 bytes of padding (on 64 bits, at least). Also, this opens the door to efl_cast() which would be similar to efl_super() except that only a dynamic cast is done, not a call to the parent function. make benchmark shows a performance improvement, surprisingly. This is a bit experimental. See also the following commit (efl_cast)
* eo: Use COW to save 8~16 bytes per objectJean-Philippe Andre2017-04-183-49/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This uses Eina_Cow to implement support for rarely used features in EO objects. This covers: - composite objects (eg. UI widgets: combobox, text, video, win) - vtable for efl_object_override - del_intercept All of these features are quite tricky to get right and while very useful, should still be used with great care. With this patch, the size of an _Eo_Object struct comes down from 80 bytes (rounded up from 72b) to 64 bytes (rounded up from 56b) on 64 bits. Also I haven't measured precisely but I don't expect any performance impact since the COW data is more likely to remain in L1/L2 cache, as the default one will be used most often. Unfortunately, the results of "make benchmark" have been quite inconsistent over multiple runs. This saves ~64kb in elementary_test (>4k objects) at the cost of ~100 calls to COW write (del intercept on some events). @optimization Reviewers: raster, cedric Differential Revision: https://phab.enlightenment.org/D4796
* eo: Fix crash in case of API misuseJean-Philippe Andre2017-04-181-1/+4
| | | | | | | | | | If efl_object_override() is called with a function that does not exist in the original class, it may lead to a crash on indexing an non-existing array in the vtable. This is really just a safety check, as the usage was wrong: * You are only allowed to override functions that are defined in the * class or any of its interfaces (that is, efl_isa returning true).
* eo: Make _eo_obj_pointer_done an inline functionJean-Philippe Andre2017-02-213-12/+11
| | | | @optimization
* eo: ensure the generation is correctly clampedMarcel Hollerbach2017-02-161-5/+27
| | | | | | | | | | | | | | | | | | | | | | | | Summary: when a few recursive event emissions are happening, and in some deep recursive level a subscription to the same object is happening, the subscription would just be executed when the complete recursion is done. that is wrong. The subscription needs to be executed when the event is called after the subscription is added, undepended from any recursive level. That fixes that and adds a regression test for it. This was discovered in e, since e gives a lot of error messages about a eo object that is already freed. It turned out this object is returned from evas, and exactly the above happened to the EFL_EVENT_DEL subscription of that object. Test Plan: make check Reviewers: tasn, cedric, stefan_schmidt Subscribers: stefan_schmidt, netstar, zmike, raster, jpeg Differential Revision: https://phab.enlightenment.org/D4656 Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
* eo: Fix shadow variable warningJean-Philippe Andre2017-02-151-1/+1
* eo_debug: Remove some abusive goto where not neededJean-Philippe Andre2017-02-151-15/+13
| | | | | | | goto was used for micro-optimization. There is absolutely no need for those if we're using the slow path with eo_debug. Simplify the code.
* eo_debug: Some more log improvementsJean-Philippe Andre2017-02-151-13/+9
| | | | Nothing fancy here...
* eo_debug: Improve dangling xref debug logs even moreJean-Philippe Andre2017-02-152-29/+65
| | | | | | | | | | In case of manual free, as is heavily used by Evas, we can't really print an ERR if there are still references before free has been called. This may not be ideal from a pure EO point of view but considering how Evas uses manual free this is the best solution to avoid polluting debug logs.
* eo_debug: Improve one logJean-Philippe Andre2017-02-152-1/+13
| | | | | | | | | | | | | | | This changes the following message when the object is referencing its own data. Also lowers from ERR to WRN and adds the class name for the referenced data. ERR<17450>:eo /home/jpeg/e/core/efl/src/lib/eo/eo_private.h:337 _efl_unref_internal() in /home/jpeg/e/core/efl/src/lib/eo/eo.c:620: func '_efl_object_call_end' Data of object 0x400000021008db58 is still referenced by object 0x400000021008db58 Note that evas and elm have a few calls to efl_data_ref(obj, NULL) which are imho quite ugly: not using the return value and not specifying the data class. I'm keeping them as-is for now.
* eo: add missing since tags for functions added during 1.19 cycleStefan Schmidt2017-02-141-2/+4
* eo base - fix warnings for debug logs to get format string types happyCarsten Haitzler (Rasterman)2017-02-121-9/+9
| | | | | gcc is very unhappy with these log prints - specifically on arm 32bit. this fixes it so we can focus on real warnings/issues.
* efl base class - fix warning about comparing differing sizesCarsten Haitzler (Rasterman)2017-02-111-1/+2
| | | | | | | yes - we compare a difference between 2 ptrs and an index which is a uint. the safe thing here is to promote the unit to the ptrdiff_t type. reality is we cant have more than 2^32 cb's on an object anyway... so this should be ok.
* efl_object: document when callbacks are calledMarcel Hollerbach2017-02-101-1/+9
* docs: eina: add doc for new eina value typeStefan Schmidt2017-02-091-1/+1
* efl: add efl_model and efl_ui_view classesLarry Jr2017-02-061-0/+2
| | | | | | | | | | | | Efl.Model.Container and Efl.Model.Item to efl/interfaces are used to create Efl.Model objects with predefined property values. This is useful to any situation where we want an Efl.Model with explicit defined property values. Efl.Ui.View and Efl.Ui.Factory are used to connect Efl.Models with Widgets, Elm.Layout and Efl.Ui.Image has changed to use news interfaces Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
* cmake/eo: add description (fills eo.pc file)Gustavo Sverzut Barbieri2017-01-231-0/+2
* cmake: add eoMarcel Hollerbach2017-01-231-0/+27
* eo - remove the spare eo domain for now for future expansionCarsten Haitzler (Rasterman)2017-01-121-2/+2
* eo_debug: print tracebacks for more errors.Gustavo Sverzut Barbieri2016-12-202-0/+4
| | | | | If eo_debug (libeo_dbg/EO_DEBUG), then print tracebacks if lifecycle is being tracked.
* Eo: remove unreachable code in isa.Tom Hacohen2016-12-151-1/+0
| | | | | | | | | This condition can never be true. It can't be NULL here. A NULL here would have caused a crash earlier, though it can only be NULL if an allocation fails, which is something that we don't really handle for smallish allocations. CID1366823
* Efl_Future: class name (string) using "." for namespace.Gustavo Sverzut Barbieri2016-12-121-1/+1
| | | | | Following recent eolian change, the string must have "." to split namespace, not "_".
* eo_lifecycle: on log level info (3), show leaked objects.Gustavo Sverzut Barbieri2016-12-081-0/+36
| | | | | | | Since we keep a log of created and deleted objects, we can walk the log and see which were leaked. As this is expensive, do only if log level is greater than 3 (INFO, DEBUG...), with backtrace of object creation being displayed as backtrace if running as level 4 (DEBUG).
* Eo: Fix efl_isa() sometimes returning wrong results with extensionsTom Hacohen2016-12-071-22/+23
| | | | | | | | | | | | | | | | | | | | This fixes an issue where efl_isa() wouldn't work for extensions or ancestors of extensions of a class. Example: Class A implements interface F2 F2 inherits from interface F1 obj is of class A Before this patch efl_isa(obj, F1) would return false, now it returns true as expected. This is just one example, there is a whole array of variations to this issue that are now fixed. Thanks to Gustavo for reminding me of this. @fix
* eo: guard lifecycle obj log inside spinlock.Gustavo Sverzut Barbieri2016-12-061-1/+12
| | | | | since the array can be pushed or looked up from multiple threads we must have a lock in place.
* eo: guard all efl_super() checks under EO_DEBUG.Gustavo Sverzut Barbieri2016-12-061-2/+2
| | | | | | Tom is worried about performance hit (god, checking a bit in a pointer we'll fetch to memory anyway, since we return it masked), so guard under EO_DEBUG.
* all: use void if we really want to make sure we do not accept parametersStefan Schmidt2016-12-061-1/+1
| | | | | | In C we need this to make clear that we really do not accept parameters. Found by the smatch source code matcher. I had run and fixed this before but it seems to creep in again over time.
* eo: efl_super() can receive a class as first parameter.Gustavo Sverzut Barbieri2016-12-061-1/+1
| | | | This fixes the src/tests/eo/test_function_overrides
* eo: Fix potential inifinite loopJean-Philippe Andre2016-12-051-10/+10
| | | | | I saw a little oopsie in patch fc48161910fc013674f4af9e19. This amends it to avoid a potential infinite loop.
* eo: Make error message less nebulousJean-Philippe Andre2016-12-051-1/+2
| | | | | | When writing this ERR log I thought about "thread" (it's really the keyword here) but eventually reworded to "context". Let's be clearer about the possible issue here.
* eo: do not use eina_trash when running on valgrind.Gustavo Sverzut Barbieri2016-12-031-1/+11
| | | | This allows valgrind to show when the object was created and deleted.
* eo: fix compilation without HAVE_BACKTRACE.Gustavo Sverzut Barbieri2016-12-031-36/+36
| | | | | | | time_get() function was used even in that case to log when objects were created or deleted. thanks @vtorri.
* eo: fix missing Evil.h includeGustavo Sverzut Barbieri2016-12-031-0/+4
* eo: fix build on macOSJean Guyomarc'h2016-12-031-0/+4
| | | | | Commit 227463bd introduces macOS-specific code, but without including the header that provides the used declarations.
* eo: more information when we cannot resolve method.Gustavo Sverzut Barbieri2016-12-022-2/+19
| | | | | | | | | | | | | | | | | | | _efl_object_api_op_id_get() will query a hash for the given pointer, however if it wasn't populated, it will return "NOOP" and we're hopeless while debugging on what happened. Common case is to use the incorrect method, like: obj = efl_add(CLS1, ...); cls2_method(obj); Since we did not create CLS2, it won't populate its methods on the hash, thus the lookup will return NOOP. With this change the function now gets the target object and function name so reports an insightful message such as: ERR:eo file.c:123 cls2_method() Unable to resolve op for api func 0x7ff492ddea00 for obj=0x400000007e8ee1df (CLS1)
* eo: allow valgrind-like tracking of object lifecycle.Gustavo Sverzut Barbieri2016-12-025-50/+614
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Eo pointer indirection is super nice as it avoids you to access invalid memory, but this extra checks inhibits valgrind's own tracking of memory lifecycle, usually it would report when the object was created and when the object is deleted, both as stack traces. This commits introduces logging of object creation and destruction under its own eina_log_domain and controlled by EO_LIFECYCLE_DEBUG and EO_LIFECYCLE_NO_DEBUG envvars. These will only be available if compiled with EO_DEBUG, thus shouldn't cause any performance hits on production code. Running a bogus app with invalid efl_class_name_get() and double efl_del() will report as below: ```sh $ export EO_LIFECYCLE_NO_DEBUG=Efl_Loop_Timer,Efl_Promise,Efl_Future $ export EO_LIFECYCLE_DEBUG=1 $ export EINA_LOG_LEVELS=eo_lifecycle:4 $ /tmp/bogus_app DBG:eo_lifecycle lib/eo/eo.c:2712 _eo_log_obj_init() will log all object allocation and free DBG:eo_lifecycle lib/eo/eo.c:2788 _eo_log_obj_init() will NOT log class 'Efl_Future' DBG:eo_lifecycle lib/eo/eo.c:2788 _eo_log_obj_init() will NOT log class 'Efl_Promise' DBG:eo_lifecycle lib/eo/eo.c:2788 _eo_log_obj_init() will NOT log class 'Efl_Loop_Timer' DBG:eo_lifecycle lib/eo/eo.c:2665 _eo_log_obj_new() new obj=0x563fa35a1aa0 obj_id=0x4000000002cf38ef class=0x563fa35a1450 (Efl_Vpath_Core) [0.0004] DBG:eo_lifecycle lib/eo/eo.c:2665 _eo_log_obj_new() new obj=0x563fa35af8d0 obj_id=0x4000000006cf38f0 class=0x563fa35aecf0 (Efl_Loop) [0.0005] DBG:eo_lifecycle lib/eo/eo.c:2665 _eo_log_obj_new() new obj=0x563fa35d61a0 obj_id=0x400000007ecf390e class=0x563fa35d48f0 (Efl_Net_Dialer_Simple) [0.0054] DBG:eo_lifecycle lib/eo/eo.c:2665 _eo_log_obj_new() new obj=0x563fa35d6470 obj_id=0x4000000082cf390f class=0x563fa35d0d60 (Efl_Net_Dialer_Tcp) [0.0055] DBG:eo_lifecycle lib/eo/eo.c:2665 _eo_log_obj_new() new obj=0x563fa35d75b0 obj_id=0x4000000086cf3910 class=0x563fa35d66b0 (Efl_Io_Queue) [0.0056] DBG:eo_lifecycle lib/eo/eo.c:2665 _eo_log_obj_new() new obj=0x563fa35d8f70 obj_id=0x400000008acf3911 class=0x563fa35d7860 (Efl_Io_Copier) [0.0057] DBG:eo_lifecycle lib/eo/eo.c:2665 _eo_log_obj_new() new obj=0x563fa35df980 obj_id=0x40000000a6cf3918 class=0x563fa35d66b0 (Efl_Io_Queue) [0.0058] DBG:eo_lifecycle lib/eo/eo.c:2665 _eo_log_obj_new() new obj=0x563fa35dfc30 obj_id=0x40000000aacf3919 class=0x563fa35d7860 (Efl_Io_Copier) [0.0058] will efl_class_name_get() with invalid handle: ERR:eo lib/eo/eo.c:1013 efl_class_name_get() Class (0x2000000000000029) is an invalid ref. ERR:eo_lifecycle lib/eo/eo.c:1013 efl_class_name_get() obj_id=0x2000000000000029 was neither created or deleted (EO_LIFECYCLE_NO_DEBUG='Efl_Loop_Timer,Efl_Promise,Efl_Future'). DBG:eo_lifecycle lib/eo/eo.c:2688 _eo_log_obj_free() free obj=0x563fa35df980 obj_id=0x40000000a6cf3918 class=0x563fa35d66b0 (Efl_Io_Queue) [0.0061] DBG:eo_lifecycle lib/eo/eo.c:2688 _eo_log_obj_free() free obj=0x563fa35dfc30 obj_id=0x40000000aacf3919 class=0x563fa35d7860 (Efl_Io_Copier) [0.0061] DBG:eo_lifecycle lib/eo/eo.c:2688 _eo_log_obj_free() free obj=0x563fa35d75b0 obj_id=0x4000000086cf3910 class=0x563fa35d66b0 (Efl_Io_Queue) [0.0061] DBG:eo_lifecycle lib/eo/eo.c:2688 _eo_log_obj_free() free obj=0x563fa35d8f70 obj_id=0x400000008acf3911 class=0x563fa35d7860 (Efl_Io_Copier) [0.0061] DBG:eo_lifecycle lib/eo/eo.c:2688 _eo_log_obj_free() free obj=0x563fa35d6470 obj_id=0x4000000082cf390f class=0x563fa35d0d60 (Efl_Net_Dialer_Tcp) [0.0063] DBG:eo_lifecycle lib/eo/eo.c:2688 _eo_log_obj_free() free obj=0x563fa35d61a0 obj_id=0x400000007ecf390e class=0x563fa35d48f0 (Efl_Net_Dialer_Simple) [0.0063] will double free: ERR:eo ../src/lib/eo/efl_object.eo.c:78 efl_del() EOID 0x400000007ecf390e is not a valid object. EOID domain=0, current_domain=0, local_domain=0. EOID generation=2cf390e, id=1f, ref=1, super=0. Thread self=main. Available domains [0 1 ]. Maybe it has been deleted or does not belong to your thread? ERR:eo_lifecycle ../src/lib/eo/efl_object.eo.c:78 efl_del() obj_id=0x400000007ecf390e created obj=0x563fa35d61a0, class=0x563fa35d48f0 (Efl_Net_Dialer_Simple) [0.0054s, 0.0009 ago]: ERR:eo_lifecycle ../src/lib/eo/efl_object.eo.c:78 efl_del() 0x007f2c0bc6d0ea: libeo_dbg.so+0x90ea (in src/lib/eo/.libs/libeo_dbg.so 0x7f2c0bc64000) ERR:eo_lifecycle ../src/lib/eo/efl_object.eo.c:78 efl_del() 0x007f2c0bc6ca62: _efl_add_internal_start+0x1c2 (in src/lib/eo/.libs/libeo_dbg.so 0x7f2c0bc64000) ERR:eo_lifecycle ../src/lib/eo/efl_object.eo.c:78 efl_del() 0x00563fa15dc95f: bogus_app+0x295f (in /tmp/bogus_app 0x563fa15da000) ERR:eo_lifecycle ../src/lib/eo/efl_object.eo.c:78 efl_del() 0x007f2c0ace7291: __libc_start_main+0xf1 (in /usr/lib/libc.so.6 0x7f2c0acc7000) ERR:eo_lifecycle ../src/lib/eo/efl_object.eo.c:78 efl_del() 0x00563fa15dc48a: _start+0x2a (in /tmp/bogus_app 0x563fa15da000) ERR:eo_lifecycle ../src/lib/eo/efl_object.eo.c:78 efl_del() obj_id=0x400000007ecf390e deleted obj=0x563fa35d61a0, class=0x563fa35d48f0 (Efl_Net_Dialer_Simple) [0.0063s, 0.0000 ago]: ERR:eo_lifecycle ../src/lib/eo/efl_object.eo.c:78 efl_del() 0x007f2c0bc6d8ba: libeo_dbg.so+0x98ba (in src/lib/eo/.libs/libeo_dbg.so 0x7f2c0bc64000) ERR:eo_lifecycle ../src/lib/eo/efl_object.eo.c:78 efl_del() 0x007f2c0bc6d711: libeo_dbg.so+0x9711 (in src/lib/eo/.libs/libeo_dbg.so 0x7f2c0bc64000) ERR:eo_lifecycle ../src/lib/eo/efl_object.eo.c:78 efl_del() 0x007f2c0bc6beb8: libeo_dbg.so+0x7eb8 (in src/lib/eo/.libs/libeo_dbg.so 0x7f2c0bc64000) ERR:eo_lifecycle ../src/lib/eo/efl_object.eo.c:78 efl_del() 0x007f2c0bc6c06e: _efl_object_call_end+0x4e (in src/lib/eo/.libs/libeo_dbg.so 0x7f2c0bc64000) ERR:eo_lifecycle ../src/lib/eo/efl_object.eo.c:78 efl_del() 0x007f2c0bc75725: efl_del+0x105 (in src/lib/eo/.libs/libeo_dbg.so 0x7f2c0bc64000) ERR:eo_lifecycle ../src/lib/eo/efl_object.eo.c:78 efl_del() 0x00563fa15dcd54: lt-efl_net_dialer_simple_example+0x2d54 (in /tmp/bogus_app 0x563fa15da000) ERR:eo_lifecycle ../src/lib/eo/efl_object.eo.c:78 efl_del() 0x007f2c0ace7291: __libc_start_main+0xf1 (in /usr/lib/libc.so.6 0x7f2c0acc7000) ERR:eo_lifecycle ../src/lib/eo/efl_object.eo.c:78 efl_del() 0x00563fa15dc48a: _start+0x2a (in /tmp/bogus_app 0x563fa15da000) ERR:eo_lifecycle ../src/lib/eo/efl_object.eo.c:78 efl_del() obj_id=0x400000007ecf390e was already deleted 0.0000 seconds ago! ```
* eo: check for empty vtable and failed extensions.Gustavo Sverzut Barbieri2016-12-021-0/+3
| | | | | | | | | if for some reason we fail to validate a class, then we should skip that extension. This may result in an empty vtable, then check for that and avoid a crash. This is very unlike to happen in practice, but I've forced some validation errors and could get to that.
* eo: improve logs by always showing event source, minor refactor.Gustavo Sverzut Barbieri2016-12-025-114/+139
| | | | | | | | | Instead of 2 sets of macro, one for HAVE_EO_ID and another without, use a single set of macros and have the implementation of _eo_class_pointer_get() and _eo_obj_pointer_get() to do the actual These functions now take the source information so the logs reflect that and not always the same function.
* eo: fix oops on efl_replace() documentationBruno Dilly2016-12-021-1/+1
* Eo: Add efl_replace() function.Guilherme Iscaro2016-12-021-0/+22
| | | | This new function adds a new way to safely replace Eo pointer values.