[Kde-bindings] SMOKEv4 proposals

Arno Rehn arno at arnorehn.de
Sat Sep 8 14:25:20 UTC 2012


Hi,

now that Qt5 beta is released, I'd like propose some BC and/or
functionality breaking changes for SMOKE (hopefully finished in time
for KDE Frameworks 5):

(1) Move dynamic dispatch resolution from SMOKE to the binding libs.
     Reason: Currently, some multiple inheritance + dynamic_cast
     sorcery decides whether the virtual method call should be
     resolved with dynamic dispatch or not. While it works as expected,
     it is horribly slow.
     The bindings normally keep track of whether an object was allocated
     by SMOKE. This information can be used to determine
     whether to use dynamic dispatch or not. I've already implemented
     this in the 'smokev4' branch in smokegen. The default 'classFn
     method id' will call the dynamically dispatched method, 'id + 1'
     will do a direct call.

(2) Get rid of the 'external' boolean field in Smoke::Class. It already
     has 'flags' and Smoke::cf_undefined, which serves the same purpose.
     (already implemented in the 'smokev4' branch).

(3) Get rid of Smoke::classMap. It's a hack to do quick cross-module
     class lookups, but it introduces a big std::map which holds copies
     of all class names, essentially duplicating the information.

(4) Create a new, but entirely optional to use, singleton object which
     manages the loaded smoke modules. It will keep track of all loaded
     modules, contain intelligent algorithms to do cross-module class
     lookups and generally have a higher-level interface than the
     low-level 'Smoke' class. It should only depend on the C++ standard
     library. We already have some parts for this: SmokeClass,
     SmokeMethod, SmokeType, etc.. are currently all copied to every
     bindings project, but are rarely used. For a different project, I've
     already extended their interfaces quite a bit (sorry for the long
     link):
 
http://quickgit.kde.org/index.php?p=scratch%2Farnorehn%2Fqtcrack.git&a=blob&h=0fb6331e8439dae9aaf21cd4f1899effcf3a1fe5&hb=a7df18898e8008aa33df5e0dc05cecfd558d114a&f=smokeext%2Fsmokeutils.h

(5) Add more meta information to smoke. We've already discussed adding
     method argument names, which sounds like a good idea and shouldn't
     weigh too much with proper string interning.
     We should also consider having only one 'string table' in the smoke
     lib, which could save some more bytes (e.g. many classnames will be
     identical to the constructor names, some argument names are probably
     identical to some method names, etc..).
     It would be greate if we can come up with something that lets us
     add more meta-information later without breaking BC again. Adding
     traditional virtual methods to the 'Smoke' class might not be such
     good idea because it would break C compatibility, but maybe some
     'manual' offset table with pointers to structs/funcs could be used.

Can you think of anything else?

Looking forward to your feedback :-)

-- 
Arno Rehn


More information about the Kde-bindings mailing list