[RFA] Handle dereferencing Rust trait objects

Tom Tromey tom@tromey.com
Thu Nov 16 23:26:00 GMT 2017


>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

Pedro> std::unordered_map + pointers (or really small objects) makes me
Pedro> cry.  :-)  That has nasty memory overhead/footprint, with
Pedro> unordered_map being a node container...

I could do something else.  A vector of pairs, sorted by address; or an
htab_t.

Pedro> Can you say something about the number of elements that usually
Pedro> ends up in this map in some reasonably sized Rust-using app (Firefox?)?

I will look at this tomorrow.

Pedro> I'm assuming that you end up with many contiguous symbols pointing to
Pedro> the same psymtab?  Would an addrmap (addrmap.h/c) be a good fit here?
Pedro> Maybe not if we don't have the size of the psymbols handy when
Pedro> we build this...  :-/

Yes, the size isn't known, because psymtab reading doesn't really look
at the types.

Maybe an addrmap wouldn't be too bad though.  Perhaps I'll try a couple
of ideas and try to see what uses the least memory.

Pedro> This reinterpret_cast looks like a big hammer here.  Why not
Pedro> static_cast?

I changed it.  Not sure why I had that .. maybe leftover from before I
used derivation.

Pedro> A symbol can't be both is_cplus_template_function and is_rust_vtable,
Pedro> I think it'd be better long term if we merged the tag to a single
Pedro> enum bitfield (with two bits).  But it's not that big a deal and
Pedro> can always be done later.

I can do this.

Tom



More information about the Gdb-patches mailing list