Commit Graph

41 Commits

Author SHA1 Message Date
Mike Blumenkrantz 4ca3a51ca6 eina_cow: rework debug profile safety checks for recursive writes
Summary:
recursive writes are not inherently bad, so long as the pointer is
consistently re-set (handled automatically by macros), and they are nearly
unavoidable in some places such as eo/evas internals

issues may arise in a specific corner case of recursive writes when a pointer
has been hashed for garbage collection, so adjust the checks to watch for this
specific case instead of crashing on every case

fix T7005

Reviewers: devilhorns

Reviewed By: devilhorns

Subscribers: cedric, #committers

Tags: #efl

Maniphest Tasks: T7005

Differential Revision: https://phab.enlightenment.org/D6284
2018-06-15 11:39:53 -04:00
Jean Guyomarc'h 34d9f20706 eina: remove usless newline
Summary:
ecore_evas: remove debug

eina: unregister log level when done with

Fixes a constant memory leak.

eina: introduce EINA_HOT and EINA_COLD

These attributes respectivelly expand to __attribute__ ((hot)) and
__attribute__ ((cold)) when available. They allow to mark functions are
being hot/cold (frequently used or not) as well as to qualify labels
within a function (likely/unlikely branches).

eo: speed-up generated calls by removing call cache

The call cache needed to by thread-local, to avoid concurrency issues.
Problem with TLS is that is adds an extra overhead, which appears to be
greater than the optimization the cache provides.

Op is naturally atomic, because it is an unsigned integer. As such, it
cannot be tempered with while another thread is reading it. When
entering the generated function, the first operation done is reading
'op'. If we have concurrency, we will have access sequences returning
either EFL_NOOP or a VALID op, because 'op' is not set until the very
end of the function, when everything has been computed. As such, we now
use the 'op' atomic integer to instore a lock-free/wait-free mechanism,
which allows to drop the TLS nature of the cache, speeding up the access
to the cache, and therefore making functions execute faster.

We don't test anymore the generation count. This can be put as a
limitation. If means that if you call efl_object_shutdown() and
re-initialize it later with different data, opcodes will be invalid.
I am not sure there is any usecase for this to ever happen.
We could move all the caches in a dedicated section, that can be
overwritten after a call to efl_object_shutdown(), but I am not sure it
will be very portable.

Benchmark: mean over 3 executions of
   ELM_TEST_AUTOBOUNCE=100 time elementary_test -to genlist

```
                     BEFORE               AFTER
------------------------------------------------------------
time (ns)            11114111647.0        9147676220.0
frames               2872.3333333333335   2904.6666666666665
time per frame (ns)  3869364.6666666665   3149535.3333333335
user time (s)        11.096666666666666   9.22
cpu (%)              22.666666666666668   18.333333333333332
```

Ref T6580

Reviewers: raster, cedric

Subscribers: cedric, jpeg

Maniphest Tasks: T6580

Differential Revision: https://phab.enlightenment.org/D5738
2018-01-16 17:50:46 +09:00
Cedric Bail 3a15c5bbb3 Revert "eina: work around current strange behavior seen in eina_cow."
This reverts commit e4107b2936.
2013-12-04 18:33:05 +09:00
Cedric Bail 4f161f0c8d Revert "eina: more work around to limit problem."
This reverts commit c5db264e0a.
2013-12-04 18:33:05 +09:00
Cedric Bail c5db264e0a eina: more work around to limit problem. 2013-12-04 16:31:49 +09:00
Cedric Bail e4107b2936 eina: work around current strange behavior seen in eina_cow.
This is not perfect, it will just limit the propagation of the problem
for some time. Yes, it does hide it under the carpet, but that's better
than having a crash. Problem seems to be in Eina_Hash, but is really
difficult to reproduce and fix for the moment.
2013-12-04 15:36:17 +09:00
Carsten Haitzler 0f21e4cfa7 eina - fix set-but-unused warning in eina_cow when valgrind off 2013-12-01 13:52:53 +09:00
Boris Faure f45618d15b fix eina_cow issues. Closes T581, T527 2013-11-30 15:41:08 +01:00
Cedric BAIL 425b399172 eina: remove the value from the hash before changing it !
This should fix bug T439.
2013-11-17 12:20:02 +01:00
Cedric Bail e6c4bcc57d eina: let pass the right size. 2013-11-09 20:43:20 +09:00
Cedric Bail 926f4c5e84 efl: detect 64 bits correctly. 2013-11-09 19:48:31 +09:00
Cedric Bail 613947ac0d eina: make eina_cow_free reset the pointer to the default read only value. 2013-11-04 12:45:25 +09:00
Sebastian Dransfeld 336f6ec328 efl: formatting 2013-06-20 13:28:18 +02:00
Galatsanos 'godfath3r' Panagiotis c8b9e0540b eina: fix a clang warning in eina_cow.
Signed-off-by: Cedric Bail <cedric.bail@samsung.com>
2013-05-08 18:17:00 +09:00
Cedric Bail 9547166878 eina: little speed improvement by reducing chance to call function. 2013-04-11 18:07:09 +09:00
Cedric Bail dd4a5215d7 eina: add some more debug information. 2013-04-04 23:50:18 +09:00
Cedric BAIL 7ebe7373e6 eina: make it possible to disable Eina_Cow GC at instantiation time. 2013-04-02 17:11:05 +09:00
Cedric BAIL 7e004cea85 eina: let's not run the GC on memcpy things. 2013-04-02 13:41:47 +09:00
Cedric BAIL 78984b9e7a eina: correctly remove reference from hash and make cow garbage collector work. 2013-04-01 18:38:24 +09:00
Cedric BAIL 4a584fcc32 eina: correctly advertise to valgrind Eina_Cow memory size. 2013-03-22 20:15:05 +09:00
Boris 'billiob' Faure 61c50e9d1c eina-cow: fix valgrind instrumentation 2013-03-20 21:18:49 +01:00
Cedric BAIL a40c41b1bd eina: fix use of Valgrind macro in Eina_Cow. 2013-03-20 11:01:03 +09:00
Cedric BAIL e02bb36e3a eina: improve speed of Eina_Cow.
* Use an Eina_Hash for the garbage collector list.
* Turn off garbage collection on object that are unlikely to match.

This patch make 1.8 as fast as 1.7 again.
2013-03-20 10:59:56 +09:00
Tom Hacohen d84de4adf1 Disable cow magic in dev profile, instead of a hack in the source.
Well played cedric, making me revert your patch and thus breaking the build.
2013-03-19 15:45:44 +00:00
Tom Hacohen 60c9ba4a8f Revert "eina: reenable them as it was a bug from Tasn."
This reverts commit a9041777d4.

Re-disable them as it was a bug from Cedric.

This is the cause for the huge slowdown.
2013-03-19 15:37:55 +00:00
Cedric Bail a9041777d4 eina: reenable them as it was a bug from Tasn. 2013-03-20 00:16:12 +09:00
Cedric Bail 68213b7f78 eina: disable Eina_Cow magic completely for the moment. 2013-03-19 23:42:12 +09:00
Stefan Schmidt b3c1a6c1c5 eina: Add execinfo.h to avoid implicit declarations.
If we have backtrace support we should also add the header before
using the backtrace and backtrace_symbols_fd functions.
2013-03-19 08:38:11 +00:00
Cedric BAIL 5f2ec224e9 eina: speed up Eina_Cow.
* Use Eina_Hash instead of Eina_List to remember what memory did change.
* Turn off Eina_Cow use of Eina_Magic when doing a release as it is only
used internaly and we should not make any mistake there.
2013-03-19 15:11:50 +09:00
Cedric BAIL 1c9470e071 eina: improve logging and debugging infra for Eina_Cow. 2013-03-04 11:08:21 +09:00
Cedric BAIL 6414b0864f efl/eina: fix some memleak and improve speed of eina_cow_memcpy.
SVN revision: 83375
2013-01-28 00:22:21 +00:00
Boris Faure fb3c280a95 efl: more valgrind related fixes on eina_cow
SVN revision: 83311
2013-01-24 21:42:18 +00:00
Boris Faure 8d13c5ce3e efl: eina_cow: fix some valgrind instrumentation
SVN revision: 83308
2013-01-24 21:06:41 +00:00
Cedric BAIL eff597ea1e eina: fix some warning.
SVN revision: 83196
2013-01-24 02:58:00 +00:00
Cedric BAIL 05b4d1b3cd efl/eina: improve Eina_Cow.
- Add valgrind macro arround Eina_Cow internal data.
- Add a #define for Eina_Magic on Eina_Cow returned pointer.
- Fix a bug done during free on a mempool data (Need to improve
mempool to catch this one more easily next time).


SVN revision: 83191
2013-01-24 01:42:20 +00:00
Cedric BAIL 94b31ce5da efl: simplify logic of eina_cow.
SVN revision: 83051
2013-01-22 03:52:55 +00:00
Cedric BAIL 41b70693b7 efl: fix leak in eina_cow.
Patch by Paulo Alcantara <pcacjr@zytor.com>.


SVN revision: 83014
2013-01-20 11:02:48 +00:00
Cedric BAIL c8ff22bf5b efl: let's be nice on NULL.
SVN revision: 82930
2013-01-17 10:29:31 +00:00
Cedric BAIL 515282006f efl: Add Eina_Cow_Data...
SVN revision: 82923
2013-01-17 06:51:35 +00:00
Cedric BAIL c7aead6fdc efl: fix cow after review by k-s.
NOTE: I didn't find a way to tell valgrind that some memory is read only.


SVN revision: 82742
2013-01-14 03:34:19 +00:00
Cedric BAIL 0e50f122e5 efl: Add eina copy on write infrastructure.
SVN revision: 82396
2013-01-08 09:17:56 +00:00