Commit Graph

194 Commits

Author SHA1 Message Date
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