Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Idea: Special handling of constructors of virtual classes #219

Open
sei-eschwartz opened this issue Apr 28, 2022 · 0 comments
Open

Idea: Special handling of constructors of virtual classes #219

sei-eschwartz opened this issue Apr 28, 2022 · 0 comments

Comments

@sei-eschwartz
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants