A system is presented for optimizing safe downcasting and similar programming idioms in an object-oriented programming language. The system operates by receiving a source program written in the object-oriented programming language. The system compiles this source program into an intermediate representation. Next, the system examines the intermediate representation to identify the use of a virtual function call to determine if an object of a given base class is a member of a given derived class. Such usage facilitates safe downcasting of the object from the given base class to the given derived class. If the intermediate representation uses the virtual function call in this manner, the system replaces the virtual function call with a comparison of a virtual function table pointer associated with the object to an address of a virtual function table associated with the given derived class. The compiler finishes compiling the intermediate representation into executable binary code.

 
Web www.patentalert.com

> Authorizing a requesting entity to operate upon data structures

~ 00322