Skip to content

Idea: Special handling of constructors of virtual classes #219

Open
@sei-eschwartz

Description

@sei-eschwartz

In MSVC, constructors of virtual classes take an argument that indicates whether or not to instantiate virtual bases. This literally results in a conditional jump. This is telling in multiple ways.

  1. I believe it indicates that the method must be a constructor. I think (must have not tested) that if the virtual constructor is inlined, the compiler will always know if the argument is set or not, and so the branch will be removed. Here is an example: https://godbolt.org/z/114bhe93x

  2. Any vftable installation that occurs in the init vbase branch obviously doesn't belong to us.

Here is a simple example where on line 72 C0::vftable is a vftable on the virtual base C0 that is installed in the branch: https://godbolt.org/z/PzdoznMqz

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions