Commit Graph

465 Commits

Author SHA1 Message Date
Tom Hacohen 0bebaed0ac Eo do: use the __thread directive when available to manage call stack.
This is faster in most cases, and to be honest, should be much faster
than it is. I don't understand why there's no better directive to mark a
variable as *really* important thread storage that is used all the time.
2015-11-09 11:43:04 +00:00
Tom Hacohen 3e40b45be6 Eo: Remove extra paranoid-never could happen safety checks.
I was not able to reach those without arbitrary memory corruption, but
in that case we are in trouble anyway.
2015-11-09 11:43:04 +00:00
Tom Hacohen 6ed69b1d11 Eo: Reorganise some of the code and cleanup.
This is cleaner and makes more sense.
2015-11-09 11:43:04 +00:00
Tom Hacohen 3782931c50 Eo: Removed weird unneeded condition. 2015-11-09 11:43:04 +00:00
Tom Hacohen f28f6ecbfa 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.
2015-11-09 11:43:04 +00:00
Tom Hacohen f7f7fc69cf Eo: Split object checking from class checking and simplify.
The check there was wrong for objects anyway, and was ultra conservative
for classes.
2015-11-09 11:43:04 +00:00
Tom Hacohen 680388472e Eo: Reduce call stack memory footprint.
We don't really need the eo_id most of the time, and when we do, it's
very easy to get it. It's better if we just don't save the eo_id on the
stack, and just save if it's an object or a class instead.
2015-11-09 11:43:04 +00:00
Tom Hacohen adbc534703 Eo: Remove useless optimisation that is more harm than good.
It seems that the idea behind that optimisation, is to save object data
fetching when calling functions implemented by the object's class inside
functions implemented by the object's class. This should be rare enough
not to worth the upkeep, memory reads and memory writes, especially
since for all cases apart of mixins (for which this optimisation won't
work for anyway), the upkeep is more costly than fetching the data
again.
2015-11-09 11:43:04 +00:00
Tom Hacohen 748b90d295 Eo: use correct mask when checking if an id is a class 2015-11-09 11:43:04 +00:00
Tom Hacohen 44ca3a3669 Eo: Optimise object data fetching a bit more.
Removed safety check that is not necessary. This may seem small,
but this in addition to the previous commit, account for around
2% of CPU usage.
2015-11-09 11:43:04 +00:00
Tom Hacohen 1ed0edfb9e Eo: Optimise object data fetching (minor).
Pre-calculate object data offset for improved performance.
2015-11-09 11:43:04 +00:00
Carsten Haitzler c2b4137f77 eo - move cache lookup into the hot path if as it only is valid there
minor speedup ... really minor - but correct.
2015-10-24 12:23:53 +09:00
Carsten Haitzler 29884844d4 efl eo - pass test suite function overrides again after adding cache
removing the klass member meant removing hooks and keeping cache small
but that meant not using it. this meand if the object is not an obj...
i removed the:

call->obj = _eo_class_id_get(call->klass);

line - seemed harmless/pointless. apparently not. so put it back but
use the klass there in local vars and not in call as it's not there
(and not needed).

fix.
2015-10-22 09:35:11 +09:00
Carsten Haitzler 8b48906401 eo - oops remove warning cpp i accidentally put in! 2015-10-21 22:27:06 +09:00
Carsten Haitzler 9ef9f2deb8 eo resolv cache - remove params passed to resolv func for efficiency
we pass both the callcache and the op id - both are static and filled
in at runtime, so merge them into the same struct. this should lead to
better alignment/padding with the offset array and the next slot and
op fields, probably saving about 4-8 bytes of rame per method with no
downsides. also pass in only cache ptr, not both cache ptr and opid -
less passing of stuff around and should be better.
2015-10-21 22:23:18 +09:00
Carsten Haitzler 7cc41473a3 efl - eo - massively improve eo cal resolv and data scope get with cache
BEWARE! this breaks eo ABI. _eo_call_resolve and _eo_data_scope_get
are 2 of the biggest cpu users in eo. they easily consume like 10-15%
cpu between them on tests that drive a lot of api - like simply
scrolling a genlist around. this is a lot of overhead for efl. this
fixes that to make them far leaner. In fact this got an overall 10%
cpu usage drop and that includes all of the actual rendering, and code
work, so this would drop the eo overhead of these functions incredibly
low. using this much cpu just on doing call marshalling is a bug and
thus - this is a fix, but ... with an abi break to boot. more abi
breaks may happen before release to try and get them all in this
release so we don't have to do them again later.

note i actually tested 4, 3, 2, and 1 cache slots, and 1 was the
fastest. 2 was very close behind and then it got worse. all were
better than with no cache though.

benchmark test method:

export ELM_ENGINE=gl
export ELM_TEST_AUTOBOUNCE=1

while [ 1 ]; do sync; sync; sync; time elementary_test -to genlist;
sleep 1; done

take the 2nd to the 8th results (7 runs) and total up system and user
time. copmpare this to the same without the cache. with the cache cpu
time used is 90.3% of the cpu time used without - thus a win. at least
in my tests.

@fix
2015-10-21 20:16:06 +09:00
Carsten Haitzler 94ebd96df5 eo - another 1.5 percent speedup in eo_bench eo_do by removing err handl
so we do a bit of error handling like does a stack fail to allocate,
does setting the tls var fail, have the stack frames been nulled or
not allocated, etc. - these acutally cost every call because they mean
some extra compare and branches, but ore because they cause a lot fo
extra code to be generated, thus polluting instruction cache with code
and cacheline fetches of code that we rarely take - if ever.

every if () and DBG, ERR etc. does cost something. in really hotpath
code like this, i think it's best we realize that these checks will
basically never be triggered, because if a stack fails to grow... we
likely alreayd blew our REAL stack for the C/C++ side and that can't
allocate anymore and has already just crashed (no magic message there -
just segv). so in this case i think this checking is pointless and
just costs us rather than gets us anything.
2015-10-17 11:42:46 +09:00
Tom Hacohen 07ea62419a Eo do: Reuse stack fetching across eo functions.
This causes a significant speed up (around 10% here) and is definitely
worth it. The way it's done lets the compiler cache the value across
different eo_do calls, and across the parts of eo_do. Start and end.

This breaks ABI.
2015-10-16 16:38:46 +01:00
Tom Hacohen 3ee44dcef0 Eo do: optimise getting the thread call stack for the main loop thread.
This may look like an insignificant change, but it doubles the speed of
this function, and since this function is called so often, it actually
improves my benchmarks by around 8%.
2015-10-16 16:38:44 +01:00
Tom Hacohen b61556aa87 Eo: Move mainloop checks inside Eo.
This breaks ABI in a harmless way, and it will give us the ability to
drastically improve Eo in the future without breaking ABI again, thus
allowing us to declare Eo stable for this release if we choose to.
2015-10-16 14:53:22 +01:00
Tom Hacohen 535076f425 Eo: Fix confusing indentation and style. 2015-10-14 20:43:07 +01:00
Tom Hacohen fd61ff69b3 Eo: Fix Eo on Windows.
We use function names instead of function pointers of Windows, because
of dll import/export issues (more in a comment in eo.c). Before this
commit we were comparing the pointers to the strings instead of the
content in some of the places, which caused op desc lookup not to work.
This fixes that.

Thanks to vtorri for his assistance.

@fix
2015-10-09 12:18:30 +01:00
Tom Hacohen 6a4c603e0f Eo: Remove dead code.
This removes code that became dead in commit:
389c6d35f2
The commit doesn't explain why we don't shrink or grow when using mmap,
but this is how it is. No reason to keep old code there.

CID 1240224

@fix
2015-10-04 15:01:27 +01:00
Tom Hacohen 001aa98942 Eo: Clean up windows code a bit more.
Merge more parts of it with the non-windows code.
2015-09-30 08:38:47 +01:00
Tom Hacohen e2344b9b9e Eo: reduce memory usage across applications.
As described by Carsten in his email to edev ML titled:
"[E-devel] eo stability - i think we need to postpone that"
with the switch to Eo2 we significantly increased our usage of RW memory
pages, and thus significantly increased our memory usage when running
multiple applications.

The problem was that during the migration to Eo2 the op id cache and the
op description arrays were merged, causing the op description arrays to
no longer be RO. This patch enables users of Eo (mainly Eolian) to
declare those arrays as const (RO) again, saving that memory.

There might be performance implications with this patch. I had to remove
the op desc array sorting, and I used a hash table for the lookup. I
think the op desc sorting doesn't really affect performance because that
array is seldom accessed and is usually pretty short. The hash table
is not a problem either, because it's  behind the scenes, so it can be
changed to a more efficient data structure if the hash table is not good
enough. The hash table itself is also rarely accessed, so it's mostly
about memory.

Please keep an eye for any bugs, performance or excessive memory usage.
I believe this should be better on all fronts.

This commit *BREAKS ABI*.

@fix
2015-09-28 18:39:15 +01:00
Tom Hacohen 9328524da4 Eo: Remove EO_SENTINEL.
This was never really needed because we always had the count.
Removing this now because we are already breaking API and ABI.
2015-09-28 15:52:50 +01:00
Tom Hacohen 35a482141d Eo: Clean up windows code.
We were keeping a struct member that wasn't really needed on windows.
Since we already broke ABI, we can afford to clean this up.
2015-09-28 15:26:51 +01:00
Tom Hacohen 12c3986866 Eo: Fix eo function name getter on windows. 2015-09-28 15:24:44 +01:00
Tom Hacohen 37f84b7e96 Eo: Drop doc field from ops and events.
This hasn't been used for a while. Since we are going to break Eo a bit anyway
it's a good opportunity to drop this.

This may cause a slight performance issues with legacy events, such as
smart callbacks. This shouldn't really be a problem as we've migrated away from
them. If it does, we need to migrate the remaining parts. Only relevant
for callbacks that are added before the classes are created, which
shouldn't be possible except for smart, only for old evas callbacks.
2015-09-28 15:09:16 +01:00
Tom Hacohen acc158a2bf Revert "Revert "Eo base: Change parent_set to be an assignment of ref.""
Had to revert it until I pushed the changes to elm, which I had issues
with. Now the patch can safely go back in.

This reverts commit 37abea3831.
2015-08-26 10:47:06 +01:00
Tom Hacohen 37abea3831 Revert "Eo base: Change parent_set to be an assignment of ref."
Damn, this breaks some things. Reverting until fixed.

This reverts commit 9c78ee0bf4.
2015-08-26 10:33:24 +01:00
Tom Hacohen 9c78ee0bf4 Eo base: Change parent_set to be an assignment of ref.
After this change, parent_set assigns a ref, so for example:
  obj = eo_add(CLASS, parent); /* Ref is 1 */
  eo_do(obj, eo_parent_set(parent2)); /* Ref is 1 */
  eo_ref(obj); /* Ref is 2 */
  eo_do(obj, eo_parent_set(NULL)); /* Ref is 1, giving the ref to NULL */
  eo_do(obj, eo_parent_set(parent)); /* Ref is 1 */

This is following a discussion on the ML about commit
8689d54471.

@feature
2015-08-26 10:11:18 +01:00
Carsten Haitzler c6011926ba eo - silence ERR logs on constructor fail - this is valid behavior
@fix

XXX: Given EFL usage of objects, construction is a perfectly valid thing
to do. we shouldn't complain about it as handling a NULL obj creation is
the job of the caller. a perfect example here is ecore_con and ecore_ipc
where you create a con or ipc obj then set up type/destination/port and
the finalize of the constructor does the actual connect and thus this
fails or succeeds based on if service is there.

until there is a better solution - don't complain here.
2015-06-24 19:28:04 +09:00
Tom Hacohen db6c17627f Eo: Fix windows support.
This is heavily based on a patch by Vincent Torri. I just refactored it
a bit so it doesn't break ABI on Linux, only on Windows (where it was
broken anyway).

This patch changes things so on Windows, functions are looked up only
based on their name. Because of the indirection (and export/import
tables) windows does, this is the only reasonable way to make it work.
2015-06-18 14:23:08 +01:00
Tom Hacohen d85029a5c0 Eo: Fix a potentially dangerous lack of {}.
You should always use curly brackets. Especially when the inside statement
has its own curlys. This can be confusing and has already lead to bugs in
many projects.
2015-06-18 14:23:08 +01:00
Tom Hacohen 293d286977 Eo: rename conflicting internal Eo_Base to Eo_Header
This name conflicts with the class Eo.Base and should have
been called Eo_Header from the start anyway.
2015-05-28 17:47:59 +01:00
Tom Hacohen 1d4c028034 Eo: Fix typo in error message.
Thanjs to q66 for reporting.
2015-05-21 10:52:36 +01:00
Tom Hacohen c02bab4149 Eo: Better handle object cleanup on failure.
While unrefing twice works, it's cleaner to unref the ref we
have and delete normally. It will handle parnet detachments in
a nicer way, and is just more correct.
2015-05-20 16:48:33 +01:00
Tom Hacohen 92fb2917cb Eo: Remove eo_error_set() and clean up finalizer()
This is another cleanup in perparation for the Eo stable release.
This is no longer needed thanks to the proper error reporting with
eo_constructor()'s new return value.

The finalizer change cleans it up a bit so it catches more cases/issues.
This also means that the finalizer cleans up the object in all cases,
and not only some.

@feature.
2015-05-20 16:25:38 +01:00
Tom Hacohen 6efbfe227a Eo: Add a return value to eo_constructor().
From now on, constructors should return a value, usually the object
being worked on, or NULL (if the constructor failed). This can also
be used for implementing singletons, by just always returning the same
object from the constructor.

This is one of the final steps towards stabilizing Eo.

@feature
2015-05-20 13:03:24 +01:00
Tom Hacohen e27f40111d Eo: Mark composite APIs as beta.
Until now we used @protected, but now we can finally properly use @beta.
2015-05-08 16:18:36 +01:00
Tom Hacohen 1506ec30ba Eo base: mark composite API as not ready. 2015-05-06 15:46:18 +01:00
Tom Hacohen e891c56f60 Revert "eo: add eo_error_get"
As discussed on IRC and ML. We are in a feature freeze phase, and this
patch is not essential. Furthermore, this patch was never discussed.

This reverts commit 537c7fe9e3.
2015-04-15 08:18:25 +01:00
Jaehwan Kim 537c7fe9e3 eo: add eo_error_get
This is pair of eo_error_set.
2015-04-15 13:57:42 +09:00
Tom Hacohen a791d97bfc Eo: Remove GCCism and make it more portable.
This affects eo_do() and eo_add() that used to use the ({}) GCCism.
Following a discussion with Peter de Ridder after my talk at FOSDEM,
we've decided to reopen the GCCism (works with other gcc compatible
compilers like clang and intelc) discussion, and after a bit of back and
forth it was decided to make things more portable, at the cost of ease
of use.

For example:
if (eo_do(obj, visible_get()))
is no longer allowed, the portable alternative
Eina_Bool tmp;
if (eo_do_ret(obj, tmp, visible_get()))
is to be used instead.

However:
eo_do(obj, a = a_get(), b = b_get(), bool_set(!bool_get))
are still allowed and OK.

eo_do(obj, if (a_get()) return;);
is no longer allowed, but:
eo_do(obj, if (a_get()) something());
is still allowed.

For clarity, this commit only incorporates the Eo changes, and not the
EFL changes to make the efl conform with this change.

Thanks again to Peter de Ridder for triggering this important discussion
which led to this change.
2015-02-23 17:16:02 +00:00
Tom Hacohen 40cb2cd3d4 Eo add: beef up error reporting.
In some cases object ceration would fail without an error,
this is bad and should not happen.

Thanks to cedric for reporting.
2015-01-23 16:51:18 +00:00
Nicolas Aguirre 2982b05288 Eo: use int for _eo_init_count intsead of Eina_Bool 2015-01-12 14:48:22 +01:00
Avi Levin b384cd3f62 eo: Fix bad addressing in _eo_classes array
The header.id was masked before using it as index in the _eo_classes
array and was not unmasked when used.
It hasn't caused segfault (by sheer luck) but was wrong.

@fix
2015-01-08 14:29:07 +00:00
Jérémy Zurcher 18ceed4daf Eo: protect against recursive object destruction calls, fixes T1741
Summary:
    Eo: semantic obj->del replaced by obj->destructed
    Eo: protect against recursive object destruction calls
    Eo: add tests for bfada4b

Reviewers: JackDanielZ, tasn

Reviewed By: tasn

Subscribers: cedric

Maniphest Tasks: T1741

Differential Revision: https://phab.enlightenment.org/D1675

Fixes T1741

@fix
2014-11-18 15:25:34 +00:00
Tom Hacohen 2cd728373c Eo comp: Remove dead code following the composite fix.
This removes dead code resulting from Cedric's fix:
3550c38080.
2014-10-28 15:19:41 +00:00
Cedric BAIL 3550c38080 eo: fix composite to actually work.
So I don't really understand why the code was not there before, but it resulted
in my experiment of making a combobox for elementary just impossible. Now it
work at least.
2014-10-27 23:44:40 +01:00
Tom Hacohen 01a487d881 Eo composite: Fix composite object functions to be eo functions.
For some reason, they were normal functions instead of eo functions,
which makes them harder to bind, less safe, and just wrong.
This commit fixes that.
2014-10-21 12:37:00 +01:00
Tom Hacohen 5db7a70603 Revert "Revert "Eo: Move eo_add_ref logic inside the library.""
This reverts commit 11da942184.

Can't reproduce with the non-existent bug report, thus have no choice
but consider it as working.
2014-10-10 09:30:52 +01:00
Mike Blumenkrantz 11da942184 Revert "Eo: Move eo_add_ref logic inside the library."
This reverts commit 8d16d8eb57.

this broke child object deletion in all the cases that I tested and regular object deletion in some cases as well
2014-10-09 21:07:30 -04:00
Tom Hacohen 8d16d8eb57 Eo: Move eo_add_ref logic inside the library.
It was a stupid lazy decision to leave it outside. Having it inside is safer
and cleaner.
2014-10-02 15:02:48 +01:00
Tom Hacohen bc6b6aa457 Eo: Better define the relationship of eo_add/del/ref/unref.
Now it's more clear and consistent. This commit complements the previous
eo_add commit (a7560dbc61).

Now eo_add should be matched with eo_del
eo_ref with eo_unref
eo_add_ref with eo_unref + eo_del

Essentially, the change is that if you have the ref to an object, you
need to unref it. Thus making ref/unref unneeded for most people who use
things (carefully) in c. If however, you would like to delete an object
previously created by you, you should eo_del (counter-part to eo_add).

It's still recommended you ref/unref when dealing with objects in
scopes, as you can't know when an object might just get deleted as a
by-product of another call.

This fixes an issue found by JackDanielZ.
2014-09-30 14:53:09 +01:00
Tom Hacohen a7560dbc61 Eo: Change eo_add/del/unref behaviour.
Before this change eo_add() used to create an object with 1 ref, and if
the object had a parent, a second ref.
Now, eo_add() always returns an object with 1 ref, and eo_add_ref()
    preserves the old behaviour (for bindings).

eo_unref now un-parents if refcount is 0, and eo_del() is an alias for
eo_unref (will change to be a way to ensure an object is dead and goes
        to zombie-land even if still refed).
2014-09-25 17:38:45 +01:00
Tom Hacohen b33372b1f6 Eo do: simplify eo_do macro.
This moves the mainloop check inside the function. There was never need
for it to be in client code (i.e a header/macro).
This is better suited inside eo_do_start because this is a macro some
bindings have to re-implement, and we definitely don't want it to be any
more complicated than it has to be.

This breaks ABI and makes elm 1.12 depend on efl 1.11. This is not an issue
as because of eolian and interfaces it's already the case.
2014-09-23 14:36:20 +01:00
Jérémy Zurcher b3ffe9229a eo: call stack depth is 1024 2014-09-23 10:51:05 +02:00
Jérémy Zurcher 389c6d35f2 eo: call stack can grow/shrink when not using mmap
- if HAVE_MMAP call stack do not shrink and abort() when should grow
- otherwise it's a growing/shrinking stack using realloc
2014-09-23 10:47:24 +02:00
Jérémy Zurcher 88c5996dc1 eo: remove stack->max_size
- define EO_CALL_STACK_SIZE instead of stack->max_size
- we are talking about size here not maxsize
2014-09-23 10:43:36 +02:00
Jérémy Zurcher dc3add048f eo: remove XXX, it's ok now ... 2014-09-23 10:41:13 +02:00
Jérémy Zurcher a4c3299f41 eo: unify error msgs 2014-09-23 10:29:44 +02:00
Jérémy Zurcher 95e610d89a eo: call stack remove stack->dropcount
stack->shrink_frame does the same but more efficiently
change the value of EO_CALL_STACK_SHRINK_DROP if needed
2014-09-23 10:26:33 +02:00
Jérémy Zurcher 007efb5f05 eo: fix call stack shrink_frame
- do never shrink under EO_CALL_STACK_DEPTH_MIN size
- set shrink_frame at (current_size/2) - EO_CALL_STACK_SHRINK_OFFSET
2014-09-23 10:24:06 +02:00
Jérémy Zurcher 209a7506c3 eo: remove FIXME: Thread Local Storage
done in d39d7050
2014-09-23 10:21:26 +02:00
Cedric BAIL d86f094d67 eo: do not call eina_tls_get as often when in the main loop.
eina_tls_get is really slow, having a fast path for the main loop does really
help us right now. It is also unlikely that slowing down a little bit the use
of eo in thread is going to have any impact on application speed any time soon.

I win a +10% on expedite benchmark compared to without.

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2014-09-04 18:11:45 +02:00
Cedric BAIL 68384fc7ef eo: let's be consistent and use the portable flag MAP_ANON. 2014-09-03 17:14:39 +02:00
Tom Hacohen 2a0937b889 Eo base: Add a property to indicate if the object is finalized;
This enables checking if an object is being created, or has already been
finalized. This is useful in functions that you want to allow
only during the creation phase (i.e inside the eo_add()).
2014-08-29 10:26:23 +01:00
Daniel Kolesa 78acf69e20 eo, autotools: check for mmap feature rather than OS (mmap is POSIX) 2014-08-21 11:54:17 +01:00
Jean Guyomarc'h dc8e006e4f eo: mmap()/unmap() are also supported on OSX
Reviewers: raster, raoulh
@feature

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D1240

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2014-08-21 12:04:53 +02:00
Tom Hacohen 46b3643ff0 Revert "eo: replace composite_objects Eina_List with an array of Eo_Object*"
Comp objects are rare, and since we allow using classes as interfaces,
we end up allocating a lot of memory for something we don't even use.
That's why it was a linked list in the first place, and that's why it
should remain a list.

This is almost a complete revert. I reverted the code itself, and the
intent (use of array instead of list), but not the tests, or the new
return value added to comp_detach, which is useful.

This reverts commit ef09ef7489.
2014-06-13 18:20:24 +01:00
Jean-Philippe Andre 188ffd412c Eo: Fix crash on WIN32 (wrong check for NULL)
Thanks vtorri for the report
2014-06-10 14:57:58 +09:00
Cedric BAIL acc99074d1 eo: force zeroing memory on non Linux system.
@fix
2014-06-09 19:55:40 +02:00
Tom Hacohen 10626ff538 Eo: Fix and use the abstract class .eo file.
Until now it was just there, but never generated or used.
2014-06-03 09:19:19 +01:00
Tom Hacohen f92e5d50f9 Eo: Add eo_finalize. A func that's called at the end of eo_add.
This function lets you hook at the end of eo_add and override it for a
class. This is essentially the first step towards killing custom
constructors. Instead of having a custom constructor, you should just
do:
eo_add(CLASS, parent, a_set(3), b_set("eou"));
eo_constructor is called at the beginning for pre-init things.
eo_finalize is called at the end, for actually finalizing and doing
things. This cleans up the API and possibly saves a lot of things that
would have been stupid and slow in the past, like loading an elm widget
with an existing theme, and then changing the theme.

** This breaks Eo ABI, please recompile elementary and everything else that
creates eo objects.

@feature
2014-05-30 11:22:36 +01:00
Guillaume Friloux 949b51af24 Fix unused param warning when building on non linux. 2014-05-30 10:38:27 +02:00
Jean-Philippe Andre f4a0c8054f Win64: Fix a bunch of warnings
Fix invalid casts.
Use printf("%z") where appropriate.
Fix unused variables warnings.

Thanks vtorri for the patch.

@fix
2014-05-29 20:02:16 +09:00
Jean-Philippe Andre 02f24d76e1 Eo: Add function name to OP desc on Windows
Match function names when the API pointer is out of range.
Reviewed by TAsn and modified according to his comments :)

Differential Revision: https://phab.enlightenment.org/D876
2014-05-21 18:03:53 +09:00
Tom Hacohen 8784685120 Eo: Rename descs2 to descs (remnant of the Eo2 change). 2014-05-09 08:26:25 +01:00
Jérémy Zurcher 0b97c11ea2 eo: improve error reporting, update tests 2014-05-08 13:44:47 +02:00
Jérémy Zurcher 0ce3154656 eo: improve error reporting for _eo_api_op_id_get() 2014-05-08 00:15:53 +02:00
Tom Hacohen e699087521 Eo: fixed misleading indentation. 2014-05-01 13:28:30 +01:00
Carsten Haitzler 1ed6e2cf9c improve eo call stack
it now does up to 8192 entries and madvise unused upper pages when
dropping. also delay dropping to avoi too many syscalls
2014-04-22 20:24:27 +09:00
Carsten Haitzler f21cfc0554 eo - callstack. realloc is a bad idea. use mmap and keep addr fixed
this fixes and eo2 problem where when callstack grows (or shrinks)
and realloc nas to relocate memory, the frame ptrs like fptr become
invalid and all sorts of hell ensues.

this uses mmap so blowing the stack will segv, not scribble over
memory, also its separated from malloc heap, and now big enough to not
need to size ... ever (1024 entries).
2014-04-22 19:19:24 +09:00
Cedric Bail cb43636bd1 eo: do not risk dereferencing NULL.
CID 1199563.
2014-04-17 21:10:34 +02:00
Carsten Haitzler 08484aa646 formatting fix (spacing) 2014-04-17 16:35:43 +09:00
Tom Hacohen d77a7ce468 Eo: eo_do now returns called func's value + default ret fix.
It's now completely valid to do:
a = eo_do(obj, a_get());

or:
b = eo_do(obj, a_set(1), b_get());

Also, the default return value for eo2 functions is now also returned
when the object is invalid, not just when the object does not match
class.

It's a small refactor that fixed both issues at once.

@feature
@fix
2014-04-14 10:54:08 +01:00
Tom Hacohen 68a1f1941a Eo: Fix class checking.
Without this patch, NULL, and random garbage are detected as classes.
This fixes is.
2014-04-14 10:54:08 +01:00
Daniel Zaoui 1a895149e7 Eo: fix warning on printf 2014-04-10 11:42:54 +03:00
Tom Hacohen a77f090256 Eo2: Make internal function static + improved debug output. 2014-04-10 04:20:21 +01:00
Tom Hacohen c32bb4fe95 Eo2: Updated naming Eo2->Eo. 2014-04-10 04:20:21 +01:00
Tom Hacohen 80faa56ed3 Eo2: Removed more Eo1 code. 2014-04-10 04:20:21 +01:00
Tom Hacohen 3c46e7dab8 Eo2: Removed a lot of Eo1 code. 2014-04-10 04:20:21 +01:00
Tom Hacohen 9d332da1f8 Eo2: Adjust to composite object changes. 2014-04-10 04:20:21 +01:00
Jérémy Zurcher d39d705087 eo2: call stack is now thread safe
create/destroy tls key (_eo2_call_stack_key) at eo_init()/eo_shutdown().
use _eo2_call_stack_get() to allocate the stack when required.
register _eo2_call_stack_free() as eina_tls_cb_new() delete callback.
2014-04-10 04:20:21 +01:00
Jérémy Zurcher f812b38a66 eo2: do not allow ill formed class creation
eo_class_new() returns NULL on error in _eo2_class_funcs_set().
it covers: NULL API func, API redefined, dich func override,
overriding non-existing fct.
2014-04-10 04:20:20 +01:00
Jérémy Zurcher 70fe1398fd eo2: if _eo2_class_funcs_set() fails eo_class_new() returns NULL
call to _eo2_class_funcs_set() is moved out of _eo_class_constructor()
into eo_class_new().
2014-04-10 04:20:20 +01:00
Jérémy Zurcher a0d761cfa9 eo2: _eo2_call_resolve() fails if op is EO_NOOP 2014-04-10 04:20:20 +01:00
Jérémy Zurcher 9d2eeb7a8b eo2: improve _eo2_class_funcs_set() errors support
as op descs are sorted, we can't output fct indexes in error msgs, but
as they are sorted using api_fct as key, we can detect multiple usage of
the same api_fct which leads to an unpredictable call to whatever is
returned by _eo2_api_op_id_get()->_eo2_api_desc_get().

it is still possible to instanciate an object of a not well defined class.
2014-04-10 04:20:20 +01:00
Jérémy Zurcher a9c325c124 eo2: normalize ERR msgs 2014-04-10 04:20:20 +01:00
Jérémy Zurcher c506ce2e1f eo2: fix err msg in _dich_func_set() 2014-04-10 04:20:20 +01:00
Jérémy Zurcher 82af591b83 eo2: improve _eo_op_id_name_get() to support eo1/2 2014-04-10 04:20:20 +01:00
Jérémy Zurcher 19245b48f8 eo2: add _eo2_op_id_desc_get() 2014-04-10 04:20:20 +01:00
Jérémy Zurcher e41f2804b4 eo2: improve err msg in _eo2_api_op_id_get() and _eo2_call_resolve() 2014-04-10 04:20:20 +01:00
Jérémy Zurcher 63c271dc5e eo2: fix indentation 2014-04-10 04:20:20 +01:00
Jérémy Zurcher d3cd7cd63c eo2: do not try to unref classes in eo2_do_end() 2014-04-10 04:20:20 +01:00
Jérémy Zurcher 56ae6cf32e eo2: remove memset() in _eo2_do_end() as all stack fields are set in _eo2_do_start() 2014-04-10 04:20:20 +01:00
Jérémy Zurcher adb5b8776d eo2: no need to resolve eo_id when we reuse previous stack frame 2014-04-10 04:20:20 +01:00
Jérémy Zurcher ae536bdd84 eo2: call stack grows and shrinks 2014-04-10 04:20:20 +01:00
Jérémy Zurcher 1834e3ff12 eo2: remove dead code 2014-04-10 04:20:20 +01:00
Tom Hacohen 0dc70153e5 eo2: optimize eo2_do_super func relove a bit.
no need to call dich_func_get twice, just reuse the value previously
fetched.
2014-04-10 04:20:20 +01:00
Tom Hacohen 08aca96bc3 eo2: get rid of eo2_stack_depth_get.
This is super internal, no reason why it should be exposed.

We should just implement automatic stack growth.
2014-04-10 04:20:20 +01:00
Tom Hacohen 2fe10219c0 eo2: prefixed internal functions with _.
This is done to prevent code completion from picking them up.
2014-04-10 04:20:19 +01:00
Tom Hacohen ebae305a9e eo2: fixed validity checks for eo2_do_super.
The class should be checked to be valid and non-null.
This fixes the issues with eo_suite.
2014-04-10 04:20:19 +01:00
Tom Hacohen 1890fdf27f eo2: fixed eo2_do call order.
This fixes the mixin test and general calling order.
"Next class" can only be known per op. That's why super should be
restricted to only one op.
2014-04-10 04:20:19 +01:00
Tom Hacohen d9ceddf63a eo2: fixed formatting. 2014-04-10 04:20:19 +01:00
Tom Hacohen b8ae43b464 eo2: prefix all the eo2_*internal* functions with an underscore.
This prevents them from being auto-completed by IDEs which makes
development nicer.
2014-04-10 04:20:19 +01:00
Tom Hacohen a588c7d99e eo2: correctly handle eo2_do(NULL, ...). 2014-04-10 04:20:19 +01:00
Jérémy Zurcher b08ae598a8 eo2: do not restrict search for api in class extensions to some class types 2014-04-10 04:20:19 +01:00
Jérémy Zurcher ca1f245366 eo2: _eo2_api_desc_get can look into interfaces extensions too 2014-04-10 04:20:19 +01:00
Jérémy Zurcher 541cf25723 eo2: eo2_add_internal_end() return NULL if do_error is set 2014-04-10 04:20:19 +01:00
Jérémy Zurcher 9c1856bf82 eo2: support NULL op_descs 2014-04-10 04:20:19 +01:00
Jérémy Zurcher 11595dc40c eo2: fix mixim elaboration
a mixin class must not inherit
- _eo2_api_desc_get()
      accept NULL klass param
      EO_CLASS_TYPE_REGULAR_NO_INSTANT is an acceptable extension class type for
- _eo2_class_funcs_set() do not shout if parent is NULL
2014-04-10 04:20:18 +01:00
Jérémy Zurcher 23e2c29298 eo2: remove EO2_CLASS_FUNC_* macros
there is no more difference in class or regular functions prototypes and definitions

- eo2_api_op_id_get() uses _eo_is_a_class() at runtime
- add 'void *class_data EINA_UNUSED' parameter to eo2_base class functions
- Eo2_Op_Call_Data.klass is kept only for eo2_hook_call_pre end eo2_hook_call_post,
  but could be removed easily
2014-04-10 04:20:18 +01:00
Tom Hacohen 5e92ffb121 eo2: improved error messages on failed resolves. 2014-04-10 04:20:18 +01:00
Jérémy Zurcher eb01d1c3e8 eo2: add EO2_CLASS_CLASS 2014-04-10 04:20:18 +01:00
Jérémy Zurcher 47d560b720 eo2: support composites object
_eo2_api_desc_get() searches extensions classes
eo2_call_resolve() searches composites objects
2014-04-10 04:20:18 +01:00
Jérémy Zurcher 2e9ae2a571 eo2: optimize eo2_call_resolve and call stack 2014-04-10 04:20:18 +01:00
Jérémy Zurcher e51e397b89 eo2: fix eo_base_data_get(), eo_composite_attach(), eo_composite_detach() 2014-04-10 04:20:18 +01:00
Jérémy Zurcher fc448f89af eo2: clean up and speed up call stack usage 2014-04-10 04:20:18 +01:00
Jérémy Zurcher 4bbd97913d eo2: eo2_add_internal_start use trash and fix MAGIC 2014-04-10 04:20:18 +01:00
Jérémy Zurcher 782092f7af eo2: eo2_do() and eo2_do_super() supports objects and classes 2014-04-10 04:20:18 +01:00
Jérémy Zurcher 93f85f095e eo2: rewrite eo2_do_start(...)
we need Eo_Class *cur_klass for eo2_do_super
 be sure not to update stack pointer before we can't fail anymore
2014-04-10 04:20:18 +01:00
Jérémy Zurcher 2be91e465a eo2: change a few variable names
in the EPAI, don't show that Eo* could be IDs.
in the implementation, use klass_id and obj_id
if you know or want it to be a class or an object,
use eo_id in general cases.
2014-04-10 04:20:18 +01:00
Jérémy Zurcher c9ccc700fd eo2: add eo2_parent_set(), eo2_parent_get(), eo2_children_iterator_new()
imported from eo_base_class.c as is in
a7f417e 2013-12-24 23:45:30 +0900 <Carsten Haitzler (Rasterman)>
2014-04-10 04:20:17 +01:00
Jérémy Zurcher 796b151c27 eo2: minor fixes after huge rebase
indentation
use _Eo_Object * instead of _Eo *
use EO_CLASS_POINTER_RETURN_VAL(), _eo_id_get(), and _eo_class_id_get().
2014-04-10 04:20:17 +01:00
Jérémy Zurcher 3a86881941 eo2: eo2_do_start use EO_OBJ_POINTER_ macros not _eo_obj_pointer_get 2014-04-10 04:20:17 +01:00
Jérémy Zurcher 74f7bf3633 eo2: eo2_call_resolve_internal support undef HAVE_EO_ID 2014-04-10 04:20:17 +01:00
Jérémy Zurcher 2af0764eeb eo2: _eo2_api_desc_get: walks in mro not in klass->parent 2014-04-10 04:20:17 +01:00
Jérémy Zurcher fe23e26d0e eo2: add DBG msg in eo2_class_funcs_set 2014-04-10 04:20:17 +01:00
Cedric Bail 8613ebe403 eo2: memset will be faster, still why not using NULL instead of -1 ? 2014-04-10 04:20:17 +01:00
Cedric Bail 0b279b600e eo2: we can rely on LD_PRELOAD for those hook, so removing them. 2014-04-10 04:20:17 +01:00
Cedric Bail 4b97591634 eo2: add hook for beinning and start of all function execution and for all _do.
NOTE: I don't know what the _CLASS_FUNC are, so I may have broken stuff there.
2014-04-10 04:20:17 +01:00
Jérémy Zurcher bbab74320a eo2: fix eo2 custom constructors 2014-04-10 04:20:17 +01:00
Jérémy Zurcher ebc90200a6 eo2: sprinkle with 'const' 2014-04-10 04:20:17 +01:00
Jérémy Zurcher 8959832be4 eo2: fixed EO2_CLASS_FUNC_BODY and etc. functions. 2014-04-10 04:20:17 +01:00
Jérémy Zurcher 4f73887b47 eo2: remove EO2_OP_FUNC_VIRTUAL
a pure virtual function is an EO2_OP_FUNC
with NULL as private function implementation pointer
2014-04-10 04:20:17 +01:00
Tom Hacohen 5f45e57b89 eo2: revert "eo2_add accepts non-defauld constructors"
We want to have normal functions as non-default constructors, not va_arg
ones. What we should do is split the object creation to two parts again.
The creation, the constructing (changes using the macro) and the
verification/end part that checks the constructor has been called.

This reverts commit 2ff2ce1894f173b306a896bda595e1a7768c074d.
2014-04-10 04:20:17 +01:00
Jérémy Zurcher 7be0748b34 eo2: implement class function support 2014-04-10 04:20:17 +01:00
Jérémy Zurcher e82c0f6bf7 eo2: fix indent 2014-04-10 04:20:17 +01:00
Jérémy Zurcher 42ad23c5c8 eo2: eo2_add accepts non-defauld constructors 2014-04-10 04:20:17 +01:00
Jérémy Zurcher 2d5baec80c eo2: call _eo2_class_funcs_set from _eo_class_constructor 2014-04-10 04:20:16 +01:00
Jérémy Zurcher b6991985ed eo2: eo2_do() uses __attribute__ cleanup
to protect us against bad use of break, goto, return ... in eo2_do,
we use __attribute__((cleanup(eo2_do_end))) to ensure that eo2_do_end()
is called whatever.
2014-04-10 04:20:16 +01:00
Jérémy Zurcher adc1ac0c23 eo2: add eo2_call_stack_depth 2014-04-10 04:20:16 +01:00
Jérémy Zurcher eeff3e898c eo2: EO2_CALL_STACK_SIZE -> EO2_CALL_STACK_DEPTH 2014-04-10 04:20:16 +01:00
Jérémy Zurcher 1aa3b1536f eo2: add virtual func support 2014-04-10 04:20:16 +01:00
Jérémy Zurcher 13b1d03def eo2: _eo2_api_desc_get() searches the class hierarchy 2014-04-10 04:20:16 +01:00
Jérémy Zurcher 5febcc9ff1 eo2: oops, forgot to init desc to NULL in eo2_api_op_id_get() 2014-04-10 04:20:16 +01:00
Jérémy Zurcher d61a31a645 eo2: can't detect return in a eo2_do macro, *sigh* 2014-04-10 04:20:16 +01:00
Jérémy Zurcher 9c4731f606 eo2: eo2_api_op_id_get search in parent klasses too 2014-04-10 04:20:16 +01:00
Jérémy Zurcher 1d9d0cee9c eo2: EO2_OP_FUNC_OVERRIDE copy doc from overriden func 2014-04-10 04:20:16 +01:00
Jérémy Zurcher 2edd305507 eo2: set eo2_constructor and eo2_destructor chaining 2014-04-10 04:20:16 +01:00
Jérémy Zurcher 7621758c80 eo2: use EO2_VERSION 2014-04-10 04:20:16 +01:00
Jérémy Zurcher c17a30dfb9 eo2: add cur_klass in call Stack and eo2_do_super
in eo2_do_start(), reuse previous stack fetched pointers when possible
2014-04-10 04:20:16 +01:00
Jérémy Zurcher 68fb3d4c03 eo2: improve func overriding
add klass_id parameter to eo2_get_op_id()
in op descriptions, allow NULL fct pointer for virtual,
and use EO2_OP_OVERRIDE to declare overriding.
2014-04-10 04:20:16 +01:00
Jérémy Zurcher 6a16edc888 eo2: call stack Proof Of Concept
no grow/shrink or thread local storage
2014-04-10 04:20:16 +01:00
Jérémy Zurcher 2490a1bef2 eo2: better op_descs integration
struct _Eo_Class_Description swallows
Eo2_Op_Description *descs2;
2014-04-10 04:20:15 +01:00
Jérémy Zurcher f05f51dd60 eo2: _Eo_Class_Description swallows op_descs
remove OpDescs argument from macros,
eo2_get_op_id() uses binary search
2014-04-10 04:20:15 +01:00
Jérémy Zurcher bc6019c154 eo2: add comments end clean up 2014-04-10 04:20:15 +01:00
Jérémy Zurcher 23ae1fc453 eo2: use internal unref, break if eo2_start returns NULL 2014-04-10 04:20:15 +01:00
Jérémy Zurcher 473609e1d3 eo2: eliminate the need of OPID and Eo_Op_Func_Description
at class elaboration, sort the op descriptions using the function pointer.
when calling a function, do a dichotomic search in the
class op descriptions to find the corresponding OP_ID,
then keep it in a static variable.
2014-04-10 04:20:15 +01:00
Jérémy Zurcher ef873b7b29 eo2: fix obj_data retrieval and speed up
obj_data which is built from func->src not obj->klass.
replace eo2_func_get() and eo2_data_scope_get() calls
with one call to eo2_call_resolve().
2014-04-10 04:20:15 +01:00
Jérémy Zurcher 71341334a9 eo2: add eo2_data_scope_get()
use it in function body
2014-04-10 04:20:15 +01:00
Tom Hacohen 35856fdd13 eo2: Eo2 first commit. 2014-04-10 04:20:15 +01:00
Tom Hacohen 8955c514c7 Eo: all classes are allowed in extension list.
All classes are allowed, because all classes can be used as interfaces in
order to override behaviour. This is especially needed for mixins and broke
the eo2 tests.
2014-04-01 14:22:00 +01:00
Stefan Schmidt 3716e9b12c eo: Make sure we have a va_end matching the va_start before returning.
Was fien on the normal path but missing on the error path. Also remove
the spurious break after the return. Would never be reached. Looks like
a copy and paste bug to me.

CID 1187638
2014-03-19 16:46:36 +01:00
Tom Hacohen e280f32c01 Eo: removed redundant macro. 2014-03-11 15:58:43 +00:00
Tom Hacohen 122a2f890e Eo: Made eo id for classes a bit more secure.
This patch sets the one before most significant bit on for classes. This
means that class ids are now very big, compared to the old ids which
were growing small integers (1, 2, 3...).
This makes accidental passing of integers (corrupted obj pointers) less
common.

@feature
2014-03-11 15:56:30 +00:00
Jérémy Zurcher ef09ef7489 eo: replace composite_objects Eina_List with an array of Eo_Object*
as we don't support multiple composites of the same class,
and know at class elaboration how many composites we should have,
we can create the composites array and pack it at the end of the object.
2014-03-05 23:57:39 +01:00
Jérémy Zurcher b763db3666 eo: memory waste at mixin class elaboration
@fix

mixins data offsets are stored in Eo_Extension_Data_Offset[],
if the constructed class is a mixin, do not reserve space for its
private data, the class is in mixins list and will be handled at
Eo_Extension_Data_Offset computation.

see  _eo_data_scope_get(...) for private data retrieval
2014-03-05 22:44:21 +01:00
Jérémy Zurcher c7922f92bc eo: revert 13502a1 and 7821df1
I'm running out of time, will look at it later
2014-02-27 15:02:45 +01:00
Jérémy Zurcher 2d52015823 eo: first check class desc in eo_class_new 2014-02-26 16:25:01 +01:00
Jérémy Zurcher 7821df17dc eo: replace composite_objects Eina_List with an array of Eo_Object*
as we don't support multiple composites of the same class,
and know at class elaboration how many composites we should have,
we can create the composites array and pack it at the end of the object.
2014-02-26 16:25:00 +01:00
Jérémy Zurcher 5be3b666b2 eo: block regular non-instantiable classes in class extension list 2014-02-26 16:25:00 +01:00
Jérémy Zurcher e199230615 eo: eo_composite_attach check composite class, disallow duplicates
eo_composite_attach fail if the class of the composite is not
listed in the parent class extensions, or if there is already a
composite of the same class. The later because calls are
forwarded to the first responding composite, see _eo_op_internal().
2014-02-26 16:25:00 +01:00
Tom Hacohen 05d2701474 Eo: Fixed eo_manual_free to always return a value.
I wonder how come this wasn't triggered in 64bit and only in 32.
2013-11-26 13:08:55 +00:00
Tom Hacohen d6ac2464bb Eo: Make eo_manual_free() return a success flag.
eo_manual_free() can fail in some cases, and it is useful for users of
this API to know about it in order to decide what to do.
2013-11-26 12:10:53 +00:00
Jérémy Zurcher 1648b67c5b eo: add EO_CLASS_CLASS
it's an empty class without operations,
used as a return value for eo_class_get() when the caller is a class
2013-10-13 00:00:13 +02:00
Cedric Bail 435caae51a eo: use Eina_Spinlock instead of Eina_Lock.
This is an ABI/API break for Eo, you will need to rebuild everything that use Eo.
2013-10-11 11:08:17 +09:00
Tom Hacohen baf0fc4268 Eo: Don't compare desc to NULL as it can never be NULL at that stage.
Fixes coverity CID1039420.
2013-09-30 14:32:47 +01:00
Tom Hacohen 42d29b55e5 Eo: don't va_start without a matching va_end.
Fixes coverity CID1099707.
2013-09-30 14:10:21 +01:00
Tom Hacohen 8ca320a1fc Eo: don't va_start without a matching va_end.
Fixes coverity CID1099708.
2013-09-30 14:07:20 +01:00
Tom Hacohen cb92a60a61 Eo: merge _eo_obj_dov_internal and _eo_class_dov_internal.
They are the same except for really minor differences.
2013-09-27 17:21:08 +01:00
Tom Hacohen 7ed7d7da8b Eo: class_get on a class should not return itself.
This is there until we create a Class class of which all classes are
instances.
2013-09-27 16:50:34 +01:00
Tom Hacohen 832fc5b5ce Manually revert "eo: replace Eo_Class with Eo"
This reverts commit ee1b0833ed

I did it manually because the code changed too much.

We actually want this type, it makes things more clear and easier to
understand.
2013-09-27 16:40:32 +01:00
Tom Hacohen ba5af54f6d Eo: Fixed the type _eo_id_get accepts. 2013-09-27 14:01:47 +01:00
Tom Hacohen 01effff86f Eo: Get rid of the _Eo type, it's not needed.
We have Eo_Base for that.
2013-09-27 14:01:47 +01:00
Tom Hacohen c64637e500 Eo: Use __FILE__ and __LINE__ instead of random values. 2013-09-27 14:01:47 +01:00
Tom Hacohen 1059f802bf Eo: Rename Eo_Header to Eo_Base. 2013-09-27 14:01:47 +01:00
Tom Hacohen e17e66db8c Eo: Get rid of handle. Use the shared header for detection. 2013-09-27 14:01:47 +01:00
Tom Hacohen 5e90d51013 Eo: Merge common part of class and object.
First step toward getting rid of "handle".
2013-09-27 14:01:47 +01:00
Tom Hacohen 8dbbc16731 Eo: Class_Id and Object_Id are now the same type. 2013-09-27 14:01:47 +01:00
Tom Hacohen 2a82ff95e4 Eo: unify the class func and normal func prototypes.
Conflicts:
	src/lib/eo/eo.c
2013-09-27 14:01:47 +01:00
Tom Hacohen 298527191e Eo: Fixed unused warnings when have EO_ID. 2013-09-27 14:01:47 +01:00
Jérémy Zurcher 9fa35820ca eo: ojb_ref -> class_ref 2013-09-27 14:01:46 +01:00
Jérémy Zurcher f4c1bff0f3 eo: eo_do_super_internal() supports objects and classes
eo_class_do_super() macro calls eo_do_super()
eo_class_do_super_internal() and _eo_class_op_internal() are removed

Conflicts:
	src/lib/eo/eo.c
2013-09-27 14:01:46 +01:00
Jérémy Zurcher c4b40aae0d eo: eo_class_get() supports objects and classes 2013-09-27 14:01:46 +01:00
Jérémy Zurcher 8855024e16 eo: eo_class_name_get() supports objects and classes 2013-09-27 14:01:46 +01:00
Jérémy Zurcher ef62885c93 eo: eo_vdo_internal() supports objects and classes
Conflicts:
	src/lib/eo/Eo.h
	src/lib/eo/eo.c
2013-09-27 14:01:46 +01:00
Jérémy Zurcher 12bfc76483 eo: eo_do_internal() supports objects and classes
eo_class_do() macro calls eo_do()
eo_class_do_internal()  is removed
op_type argument is remove from eo_do, eo_vdo_internal

Conflicts:
	src/lib/eo/eo.c
2013-09-27 14:01:46 +01:00
Jérémy Zurcher f43287a261 eo: add _eo_is_a_class(const Eo *obj_id) 2013-09-27 14:01:46 +01:00
Jérémy Zurcher 41bd91379e eo: _Eo -> _Eo_Object
Conflicts:
	src/lib/eo/eo.c
2013-09-27 14:01:46 +01:00
Jérémy Zurcher ee1b0833ed eo: replace Eo_Class with Eo 2013-09-27 14:01:46 +01:00
Jérémy Zurcher 5913f78b4f eo: if !HAVE_EO_ID front-pad _Eo_Class and _Eo_Object with _Eo_Handle
this is the first step on the road to remove class specific EAPI from Eo.h
using this handle we will know if a Eo* is a class or an object pointer

Conflicts:
	src/lib/eo/eo.c
2013-09-27 14:01:46 +01:00
Tom Hacohen 1845ffe5b0 Eo: remove the classe's EINA_MAGIC when using eo_id. 2013-09-26 16:26:55 +01:00
Cedric Bail 936a8072f2 eo: make eo_parent_get/set part of eo_base_class. 2013-09-25 13:34:18 +09:00
Jérémy Zurcher 2041e995fc eo: fix EO_DEBUG compilation 2013-09-23 11:07:07 +02:00
Cedric Bail 7f23deb723 eo: fix typo. 2013-09-13 16:46:08 +09:00
Cedric Bail cd77853222 eo: add eo_childrens_iterator_new().
The goal would be to replace the smart children list and friends. The
problem is that they differ in content. Smart children and Eo children are
the same, but Elm children and them differ. If I put this function as a
virtual, it would be possible to override the list of children and if we
start using it in Evas render loop, that could result in "weird" behavior.

I have added the use of a simplified Eina_Trash mempool kind of feature
to have some fast path for allocation if we start using it in Evas render
loop.
2013-09-11 16:08:06 +09:00
Cedric Bail 5290befb53 eo: add a small object cache to make memory recycling faster. 2013-09-11 11:23:50 +09:00
Jérémy Zurcher 5afa29af59 eo: slight speed up 2013-08-09 16:03:09 +02:00
Cedric Bail a865b77c14 eo: another small micro optimization giving a 10% speed increase. 2013-07-04 13:02:28 +09:00
Cedric Bail 7849c5de32 eo: 30% speed improvement in message propagation. 2013-06-28 10:18:39 +09:00
Jérémy Zurcher 8619bf1323 eo_class_new: reorder last operations in class creation 2013-06-18 00:08:58 +02:00
Jérémy Zurcher 2350f1fb30 eo_class_new: pack ext data offsets at the end of _Eo_Class 2013-06-17 23:48:22 +02:00
Jérémy Zurcher 841b46fc90 eo_class_new: speed up mixins offset table creation 2013-06-17 23:47:15 +02:00
Jérémy Zurcher 5f83d1a80b eo_class_new: check parent and desc before doing anything 2013-06-17 23:41:45 +02:00
Jérémy Zurcher 4eb2fb0bb6 eo_class_new: pack mro at the end of _Eo_Class 2013-06-17 23:41:02 +02:00
Jérémy Zurcher e0293a421f eo_class_new: remove duplicates in extensions as well as in mro 2013-06-17 23:38:04 +02:00
Jérémy Zurcher 2f79056078 eo_class_new: pack extensions at the end of _Eo_Class 2013-06-17 23:35:48 +02:00
Jérémy Zurcher 0c4c7ecd3a eo_class_new: add and use _eo_class_sz 2013-06-17 23:33:19 +02:00
Jérémy Zurcher 4d2f4a1ae5 eo_class_new: replace class field extn_data_size with obj_size 2013-06-17 23:32:50 +02:00
Jérémy Zurcher 1f7ae48215 eo_class_new: fix big memory waste
extn_data_size is not equal to extn_data_off,
current class data size and data offset must be substracted first

elementary_test bubble peak usage goes from 13.7 MiB to 12.5 MiB
2013-06-10 16:42:15 +02:00
Jérémy Zurcher 4e742bf0bf eo: fix advertised object size in dbg msg 2013-06-10 16:42:15 +02:00
Daniel Zaoui a435306974 Eo: improve error message. 2013-06-03 14:31:31 +03:00
Daniel Zaoui 08d81394aa Eo: fix for castings. 2013-05-02 15:31:57 +03:00
Daniel Zaoui af401b4083 Eo: fix for unitialized value 2013-05-01 21:45:57 +03:00
Daniel Zaoui f6a37f88d2 Eo: Add reference functions for objects data
We want to introduce a new mechanism concerning the data of the Eo
objects.
The goal is to improve the memory management by defragmenting the memory
banks used by the Eo objects. The first phase has been done by raster
and consists in allocating the objects into a separate memory region
that the one used by malloc. So now, we know where our objects are
located.
Now, moving objects means moving data of objects. The issue we have here
is that a lot of data pointers are stored into data of other objects,
e.g Evas Object data into lists for rendering...
We need a way to reference the data and eo_data_get doesn't provide us
that. So we need to improve the API for data extraction by requesting
from the developer if the data will be stored or not. Five functions are
supplied:
- eo_data_scope_get: no referencing, the data pointer is no more used after
exiting the function.
- eo_data_ref: reference the data of the object. It means that while the
data is referenced, the object cannot be moved.
- eo_data_xref: reference the data of the object but for debug purpose,
we associate the objects that references. Same behavior as eo_data_ref
for non-debug.
- eo_data_unref: unreference the data of an object.
- eo_data_xunref: unreference the data of an object previously
referenced by another object.

I deprecated the eo_data_get function. Most of the time,
eo_data_scope_get needs to be used.

In the next patches, I changed the eo_data_get to the corresponding
functions, according to the usage of the data pointer.

The next step is to find all the places in the code where the data is
stored but not yet referenced. This will be done by:
- requesting from every object to unreference all data to other objects.
- moving all the objects from one region to another
- requesting from every object to rerefenrence the data.
- debugging by hunting the segmentation faults and other weird
creatures.
2013-05-01 10:37:08 +03:00
Daniel Zaoui 2ac4cdce76 Eo: Fix for warning on 64 bits. 2013-04-30 15:41:05 +03:00
Tom Hacohen 007bdd41c1 Eo: Eo_Class_Id should be uintptr_t not size_t. 2013-04-24 16:55:11 +01: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
Daniel Willmann 8a19bb4b29 Eo: Print location of the calling functions in eo log output
Because of the way eo is dispatching method calls of objects the usual
error log you get if you mix up objects or try to call non-existent
methods is:

ERR<12404>:eo lib/eo/eo.c:362 _eo_dov_internal() Can't find func for op
0x24 (ecore_audio_obj_in:ECORE_AUDIO_OBJ_IN_SUB_ID_SPEED_GET) for class
'ecore_audio_obj_out_pulse'. Aborting.

Of course the problem is not really in lib/eo/eo.c, but in the function
calling eo_do()

Now the macros pass source file and line number on to the _internal
functions so we can log where the error originally happened:

ERR<1938>:eo lib/eo/eo.c:362 _eo_dov_internal() in
lib/ecore_audio/ecore_audio_obj_out_pulse.c:119: Can't find func for op
0x24 (ecore_audio_obj_in:ECORE_AUDIO_OBJ_IN_SUB_ID_SPEED_GET) for class
'ecore_audio_obj_out_pulse'. Aborting.

This makes debugging with eo a lot easier.

Signed-off-by: Daniel Willmann <d.willmann@samsung.com>
2013-04-17 15:56:45 +01:00
Tom Hacohen 269e3a7797 Eo: Fixed an error in in _eo_callback_remove and a few minor things.
The other things are not really issues but more about silencing clang.
Thanks to clang-analyzer.
2013-04-12 17:17:38 +01:00
Tom Hacohen 263e54d705 Eo: Moved the debug info functions to the base class code. 2013-04-12 13:49:26 +01:00
Cedric Bail 2d9ec2159c eo: let's cache this value. 2013-04-11 18:07:09 +09:00
Daniel Willmann ab19019711 eo: Indicate that numbers in error messages are in hex - prefix with 0x
The message "Expected a and got b" is a bit misleading :-)

Signed-off-by: Daniel Willmann <d.willmann@samsung.com>
2013-04-09 13:45:30 +01:00
Cedric BAIL a13456b04c eo: let's not duplicate our align code with a less efficient one. 2013-04-04 12:21:05 +09:00
Daniel Juyung Seo c16daf940f eo.c: fixed formatting. 2013-04-03 09:31:24 +09:00
Cedric BAIL 2063e4353d efl: integrate eina_log_timing. 2013-03-27 21:43:45 +09:00