aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml
diff options
context:
space:
mode:
authorThomas McGuire <thomas.mcguire.qnx@kdab.com>2012-08-15 09:33:18 +0200
committerQt by Nokia <qt-info@nokia.com>2012-08-24 11:28:51 +0200
commit8f893d1d675b09d0a5f2add1df7a9970bb3cb227 (patch)
treef2ffce92ae86464404c95d3d6c11c220c0ea8d1b /src/qml
parente8e3c206ac0d2ff436f7166fb73f33a7e8259b6a (diff)
Document the vTable hack.
This was not immediately obvious, so better document this clever trick. Change-Id: I0d4a06396b9a709b29b46726d9a65d53600e3fa2 Reviewed-by: Chris Adams <christopher.adams@nokia.com>
Diffstat (limited to 'src/qml')
-rw-r--r--src/qml/qml/qqmlabstractbinding_p.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/qml/qml/qqmlabstractbinding_p.h b/src/qml/qml/qqmlabstractbinding_p.h
index 1ce0a23149..a49b591a6c 100644
--- a/src/qml/qml/qqmlabstractbinding_p.h
+++ b/src/qml/qml/qqmlabstractbinding_p.h
@@ -162,6 +162,14 @@ private:
inline QQmlAbstractBinding *nextBinding() const;
inline void setNextBinding(QQmlAbstractBinding *);
+ // Pointer to the next binding in the linked list of bindings.
+ // Being a pointer, the address is always aligned to at least 4 bytes, which means the last two
+ // bits of the pointer are free to be used for something else. They are used to store the binding
+ // type. The binding type serves as an index into the static vTables array, which is used instead
+ // of a compiler-generated vTable. Instead of virtual functions, pointers to static functions in
+ // the vTables array are used for dispatching.
+ // This saves a compiler-generated pointer to a compiler-generated vTable, and thus reduces
+ // the binding object size by sizeof(void*).
uintptr_t m_nextBindingPtr;
static VTable *vTables[];