digitalmars.D.bugs - [Issue 24333] New: Inline ClassInfo with the vtbl
- d-bugmail puremagic.com (45/45) Jan 11 https://issues.dlang.org/show_bug.cgi?id=24333
https://issues.dlang.org/show_bug.cgi?id=24333 Issue ID: 24333 Summary: Inline ClassInfo with the vtbl Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: bugzilla digitalmars.com deadalnix writes: The current layout of objects is as follow: +-----------+ +-----------+ +-----------+ | __vtbl +--->| typeid +--->| ClassInfo | +-----------+ +-----------+ | | | __monitor | | method0 | | ... | +-----------+ +-----------+ | | | field0 | | method1 | +-----------+ +-----------+ +-----------+ | field1 | | ... | +-----------+ +-----------+ | ... | +-----------+ This causes a ton of extra indirections that are not necessary. instead the following layout ought to be used: +-----------+ +-----------+ | __vtbl +--->| ClassInfo | +-----------+ | | | __monitor | | ... | +-----------+ | | | field0 | +-----------+ +-----------+ | method0 | | field1 | +-----------+ +-----------+ | method1 | | ... | +-----------+ +-----------+ | ... | +-----------+ Alternatively, it is possible to have the pointer point at the first method and subtract to get the typeid. The important part is that there is only one indirection now. https://forum.dlang.org/post/hteuczyclxajakrisxjd forum.dlang.org --
Jan 11