gpt4 book ai didi

c++ - "vtable fixup"是什么意思?

转载 作者:太空狗 更新时间:2023-10-29 20:01:16 27 4
gpt4 key购买 nike

我听说过“vtable fixup”这个术语。这是什么意思?我没有成功问谷歌。我已经知道 vtable 是什么,所以不需要定义。

最佳答案

对我来说,Google显示 vtable fixups 是 PE (Windows) 可执行文件格式的一个特殊功能。根据 ECMA's PE spec,它们提供了一种实现 vtables 的有效方式(针对 C++ 和其他语言) :

Certain languages, which choose not to follow the common type system runtime model, may have virtual functions which need to be represented in a v-table. These v-tables are laid out by the compiler, not by the runtime. Finding the correct v-table slot and calling indirectly through the value held in that slot is also done by the compiler. The VtableFixups field in the runtime header contains the location and size of an array of Vtable Fixups (see clause 14.5.1). V-tables shall be emitted into a read-write section of the PE file.

Each entry in this array describes a contiguous array of v-table slots of the specified size. Each slot starts out initialized to the metadata token value for the method they need to call. At image load time, the runtime Loader will turn each entry into a pointer to machine code for the CPU and can be called directly.

关于c++ - "vtable fixup"是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2224677/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com