This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[C++] Optimizing dynamic_cast to a final C++ class


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]