把虚方法调用转换成直接方法调用,叫做单形monomorphic调用变换。
Converting a virtual method call to a direct method call is called monomorphic call transformation.
例如,一个虚方法调用需要查看接收方对象的类调用,以便找出哪个实际目标实现了接收方对象的虚方法。
A virtual method invocation, for example, involves looking at the class of the receiver object for the call to discover which actual target implements the virtual method for the receiver object.
当然,如果类层次结构发生变化,并且出现另外的目标方法,则JIT编译器可以更正最初生成的代码以便执行虚调用。
Of course, if the class hierarchy changes and a second target method becomes possible, then the JIT compiler can correct the originally generated code so that the virtual invocation is performed.
Widget(所有pygtk部件的基类)的一些foo方法在内部调用虚方法do_foo。
Several foo methods of gtk.Widget (the base class for all PyGTK widgets) internally call the virtual methods do_foo.
编译器可以使用间接调用执行优化,如提升循环外虚方法地址的加载。
The compiler can perform optimizations with indirect calls such as hoisting the load of a virtual method address out of a loop.
编译器可以使用间接调用执行优化,如提升循环外虚方法地址的加载。
The compiler can perform optimizations with indirect calls such as hoisting the load of a virtual method address out of a loop.
应用推荐