2 ms·
Very nice. As a follow up would be interesting to also reverse engineer the structure of the vtable itself. I guess it’s a list of pointers to the method implem
by returningfory2 28d ago
Very nice. As a follow up would be interesting to also reverse engineer the structure of the vtable itself. I guess it’s a list of pointers to the method implementations?
- ashdnazg 28d agoNot just pointers, it also has info such as alignment. (Shameless plug) I wrote a relevant article recently: https://ashdnazg.github.io/articles/26/Downcasting-Arcs-in-Rust https://ashdnazg.github.io/articles/26/Downcasting-Arcs-in-R...
- returningfory2 28d agoAwesome, thank you for sharing!
- derf_ 27d agoMy first question was, if the vtable only has a single function in it (as in these examples), can the compiler optimize it to a function pointer to save an indirection?
- SkiFire13 27d agoThe vtable contains at least the following informations: - the size of the pointed type - the alignment of the pointed type - a function pointer for its drop glue That's already quite big to inline to save on indirection, and this is before adding more methods.