// Implementation of the non-virtual do_oop dispatch. // // The same implementation is used for do_metadata, do_klass, and do_cld. // // Preconditions: // - Base has a pure virtual do_oop // - Only one of the classes in the inheritance chain from OopClosureType to // Base implements do_oop. // // Given the preconditions: // - If &OopClosureType::do_oop is resolved to &Base::do_oop, then there is no // implementation of do_oop between Base and OopClosureType. However, there // must be one implementation in one of the subclasses of OopClosureType. // In this case we take the virtual call. // // - Conversely, if &OopClosureType::do_oop is not resolved to &Base::do_oop, // then we've found the one and only concrete implementation. In this case we // take a non-virtual call. // // Because of this it's clear when we should call the virtual call and // when the non-virtual call should be made. // // The way we find if &OopClosureType::do_oop is resolved to &Base::do_oop is to // check if the resulting type of the class of a member-function pointer to // &OopClosureType::do_oop is equal to the type of the class of a // &Base::do_oop member-function pointer. Template parameter deduction is used // to find these types, and then the IsSame trait is used to check if they are // equal. Finally, SFINAE is used to select the appropriate implementation. // // Template parameters: // T - narrowOop or oop // Receiver - the resolved type of the class of the // &OopClosureType::do_oop member-function pointer. That is, // the klass with the do_oop member function. // Base - klass with the pure virtual do_oop member function. // OopClosureType - The dynamic closure type // // Parameters: // closure - The closure to call // p - The oop (or narrowOop) field to pass to the closure
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.13Bemerkung:
(vorverarbeitet am 2026-06-10)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.