Speed up QObject::connect with function pointers

When resolving the signal/slot of connect(&Foo::bar, ...) we place a meta-call
to map the address to the method index. Once we have found the index, we don't
need to continue but can return the result right away.

Change-Id: I67bb22df394d7c22dc1731367c0961b958ed77b3
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
This commit is contained in:
Simon Hausmann 2016-01-22 13:15:19 +01:00
parent 684e5587d5
commit e782501532

View File

@ -1254,6 +1254,7 @@ void Generator::generateStaticMetacall()
fprintf(out, " if (*reinterpret_cast<_t *>(func) == static_cast<_t>(&%s::%s)) {\n",
cdef->classname.constData(), f.name.constData());
fprintf(out, " *result = %d;\n", methodindex);
fprintf(out, " return;\n");
fprintf(out, " }\n }\n");
}
if (!anythingUsed)