[Issue 24333] New: Inline ClassInfo with the vtbl
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Jan 11 22:59:39 UTC 2024
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 at puremagic.com
Reporter: bugzilla at 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
--
More information about the Digitalmars-d-bugs
mailing list