Commit Graph

24 Commits

Author SHA1 Message Date
Carsten Haitzler 50d508866e eo invalid err - make the thread self more useful like main. 2016-09-17 05:49:32 +09:00
Carsten Haitzler 60f84b733a eo - id lookup failure expansive error print for ebbter debug
whenan eoid lookup fails, now print a lot of information on the issue
like the actual id, generation of the id, if its a class or object
(the class bit), if its ref or super bit is set, the actual id (which
includes the table heirachy), which thread id it is, what domain the
object id is and the current and local domains as well as what domains
are mapped in.
2016-09-16 18:51:22 +09:00
Carsten Haitzler 8b159aab68 eo - move eoid lookup to ptr indir file and clean up some code
this improves the readability of some of the new domain related and
ptr indir code..
2016-09-09 18:53:20 +09:00
Carsten Haitzler 09f19c3c73 eo - make eo id table TLS private data for thread safety and speed
This moved all the eoid tables, eoid lookup caches, generation count
information ad eo_isa cache into a TLS segment of memory that is
thread private. There is also a shared domain for EO objects that all
threads can access, but it has an added cost of a lock. This means
objects accessed outside the thread they were created in cannot be
accessed by another thread unless they are adopted in temporarily, or
create4d with the shared domain active at the time of creation. child
objects will use their parent object domain if created with a parent
object passed in. If you were accessing EO (EFL) objects across threads
before then this will actually now cause your code to fail as it was
invalid before to do this as no actual objects were threadsafe in EFL,
so this will force things to "fail early".
ecore_thread_main_loop_begin() and end() still work as this uses the
eo domain adoption features to temporarily adopt a domain during this
section and then return it when done.

This returns speed back to eo brining the overhead in my tests of
lookup for the elm genlist autobounce test in elementary from about
5-7% down to 2.5-2.6%. A steep drop.

This does not mean everything is perfect. Still to do are:

1. Tests in the test suite
2. Some API's to help for sending objects from thread to thread
3. Make the eo call cache TLS data to make it also safe
4. Look at other locks in eo and probably move them to TLS data
5. Make eo resolve and call wrappers that call the real method func do
   recursive mutex wrapping of the given object IF it is a shared object
   to provide threadsafety transparently for shared objects (but adding
   some overhead as a result)
6. Test test est, and that is why this commit is going in now for wider
   testing
7. Decide how to make this work with sending IPC (between threads)
8. Deciding what makes an object sendable (a sendable property in base?)
9. Deciding what makes an object shareable (a sharable property in base?)
2016-09-07 18:17:10 +09:00
Jean-Philippe Andre 0dd9e02df2 Eo: Add internal function call on pointer errors
Useful for GDB: break on this function when things go wrong.
Similar to eina_safety.

I guess we could set some Eina_Error and maybe even have error
callbacks for easier application debugging. Later.
2015-12-29 20:55:50 +09:00
Cedric Bail c435968f69 eo: a little more inlining, give me a 10% speed improvement. 2013-07-01 18:18:40 +09:00
Jérémy Zurcher 6667acf5a2 eo ptr ind: fix comments 2013-05-17 11:39:01 +02:00
Jérémy Zurcher f253cfc12c eo ptr ind: empty tables are freed except 1 kept as spare
- this reduces unused memory usage
- the spare table avoids the free/alloc corner case
2013-05-17 10:35:16 +02:00
Jérémy Zurcher 3e4127da52 eo ptr ind: current_table -> _current_table 2013-05-17 09:23:00 +02:00
Jérémy Zurcher 5244c20118 eo ptr ind: store partial Eo Id in the table
- very small speed up
- maybe later use this to avoid table indexes not NULL checks
  in _eo_id_release and _eo_obj_pointer_get
2013-05-16 15:00:08 +02:00
Jérémy Zurcher f2efa26459 eo ptr ind: use of mprotect when EINA_DEBUG_MALLOC is set
- to enable this feature, compile with --with-profile=debug
- the mid tables and tables are write protected after modifications,
  you will segfault if you mess with them
2013-05-16 13:17:12 +02:00
Jérémy Zurcher 380435abdb eo ptr ind: set generation counter range to [1;max-1]
- so we never generate an Eo Id equal to 0,
  thus don't need to skip the first top table index anymore
2013-05-16 13:17:12 +02:00
Jérémy Zurcher 00af0e77e3 eo ptr ind: minimize amount of wasted memory
- because of mmap PAGE_SIZE alignement and added magic header, almost a
  memory page is wasted per table and mid table allocation.
- reducing the number of tables per mid table and the number of entries
  per table solves this.
2013-05-16 13:17:11 +02:00
Jérémy Zurcher a9e69d519c eo ptr ind: mostly cosmetic
- add and use SHIFT_* macros
- rename queue into fifo
- try to clarify the structure top table -> mid table -> table[entry]
2013-05-16 13:17:11 +02:00
Jérémy Zurcher 4e88ad4dd6 eo ptr in: follow naming convention for static fcts 2013-05-05 18:19:14 +02:00
Jérémy Zurcher 94b6dff74c eo ptr ind: speed up by caching last used table
- keep a reference to the last used table and it's indexes
   - use this table prior to normal search through table arrays
2013-05-05 15:18:01 +02:00
Jérémy Zurcher 10aafd711d eo ptr ind: fix indentation 2013-05-05 15:18:01 +02:00
Jérémy Zurcher f769128dca eo ptr ind: pack memory, use in mmap fifo as recycle trash
- pack active flag and generation nbr in an _Eo_Id_Entry struct
  - replace Eina_Trash with a fifo which lives in mmaped memory owned by eo_id.
  - fifo uses indexes instead of pointers to spare memory
  - never used entries are served first, then those in the fifo
    are reused, thus we ensure that a freed entry won't soon be reused.
2013-05-03 21:28:32 +02:00
Jérémy Zurcher 994318eebe eo_ptr_ind: pack ptr, active flag and generation all together
use of an array of the below struct instead of 3 separate arrays
leads to better cache performance and smaller memory usage
typedef struct
{
  _Eo *ptr;
  unsigned int active     : 1;
  unsigned int generation : BITS_FOR_GENERATION_COUNTER;
} _Eo_Id_Entry;
2013-04-28 00:43:53 +02:00
Jérémy Zurcher 41dc1764f3 eo_ptr_ind: fix hdr->size in _eo_id_mem_alloc 2013-04-28 00:17:07 +02:00
Carsten Haitzler 76a748b08d rejig 32bit eoid allocation to 5.5.12. 2013-04-24 16:20:18 +09:00
Carsten Haitzler 4cf68bf728 eoid -> use mmap for allocating id tables. makes it a separate memory
regions with page separations... this allows us more direct control
over access and visibility.
2013-04-23 23:39:37 +09:00
Carsten Haitzler c9ad644be2 eoid -> rjid 64bit bit allocations for.. not so much bloat. 2013-04-23 23:39:37 +09:00
Daniel Zaoui 337fac0e73 Eo: pointers indirection mechanism for objects and classes
Summary: This feature replaces Eo pointers with ids to prevent bad usage
or reuse of these pointers. It doesn't change API.
The mechanism uses tables storing the real pointers to the objects.
See the src/lib/eo/eo_ptr_indirection.c file for more details on the
mechanism.
2013-04-23 09:50:40 +03:00