-
-
Notifications
You must be signed in to change notification settings - Fork 267
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
Check unnecessary vtbl emissions #662
Comments
Notes so far: The failure happens in DtoDefineFunction() for std.array.Appender!(string[]).Appender.Data.__xopEquals because semantic3 is never run for it (not even while gagged). DMD does not call toObjFile on this FuncDeclaration at all and doesn't semantic3 it either. It does not even call toObjFile on the TemplateInstance Appender!(string[]). For that TemplateInstance not even semantic() is run. The next step would be to figure out why we run TemplateInstance::semantic() for Appender!(string[]). |
I played a bit with the error message. DtoDefineFunction() is called for every method of std.array.Appender - with no semantic3 run. |
When we codegen object.destroy!(Font) (dmd does this too), we call IrTypeClass:get() for B.Font and that generates the vtbl for that class (I don't think dmd does that). To get the vtbl we call semantic3 on all members (makeTextData in the test case) and that generates the Appender!(string[]) template instance but doesn't semantic3 it. We either need to ensure we semantic3 the template instances generated during our calls back into the frontend for vtbl generation - or make sure we don't emit it in the first place. |
I think we should just try to not emit the vtbl at all, unless there is a compelling use case as to why not doing so is a bug in DMD. Even then, we should probably try to fix this upstream. |
The original symptoms should be worked around by #1709.
Still needs to be looked into. |
Vtables are emitted once into the CU owning the class declaration. They are needed for the class init symbol, which is also emitted in that CU, so definitely not superfluous. The testcase (nowadays requiring |
Reported by temtaine in news group (http://forum.dlang.org/post/yephpwnmvkcpyjnpbzti@forum.dlang.org). Look at the following modules:
A.d
B.d
C.d
D.d
ldc2 -c A.d B.d C.d D.d
works butldc2 -c A.d
produces an error message.The text was updated successfully, but these errors were encountered: