[C++] Optimizing dynamic_cast to a final C++ class
Florian Weimer
fweimer@redhat.com
Tue Nov 5 12:37:00 GMT 2013
I've looked at optimizing dynamic_cast to final C++ class. In theory,
it should be possible to load the vtable pointer, compare it to the
expected value, and use the original pointer if it matches, or NULL
otherwise (for pointers, references are similar but need the conditional
throw).
But I remember a discussion on the cxxabi list that vtables are not
deduplicated if they are contained in multiple libraries, so a simple
pointer comparison won't do. Is there anything else that could be used
as a reliable marker? If not, do you think it would be feasible to add
a fast-path for final target classes to the __dynamic_cast implementation?
--
Florian Weimer / Red Hat Product Security Team
More information about the Gcc
mailing list