On Fri, Feb 28, 2014 at 05:59:13AM -0800, Nathan Froyd wrote:
> ----- Original Message -----
> > http://en.wikipedia.org/wiki/Plain_Old_Data_Structures
> > 
> > 
> > confirms that POD can't have a vptr :-)
> 
> 
> class Interface {
> public:
>   constexpr Interface() {}
>   virtual int f() = 0;
> };
> 
> class Concrete : public Interface {
> public:
>   constexpr Concrete() {}
>   virtual int f();
> };
> 
> Concrete c;
> 
> run through |g++ -std=c++0x -O2 -o - -S| (gcc 4.6, x86-64) gives:
> 
>       .file   "vtables.cpp"
>       .globl  c
>       .data
>       .align 8
>       .type   c, @object
>       .size   c, 8
> c:
>       .quad   _ZTV8Concrete+16
> 
> No initialization code in sight.  clang does the same, with or without the 
> constexpr.

I think the actually tricky part of making the atoms themselves live in
rodata is that they need to be layed out as if they were in a hash table
so that we can get the atom for a string in O(1).  I think we could do
that by reimplementing some bits of the hash table in python and then
spewing out a giant .S file layed out as if its a hash table, but seems
like a bit of work and its not clear off hand to me that it would be a
big win.

Trev

> 
> -Nathan
> _______________________________________________
> dev-platform mailing list
> dev-platform@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-platform
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to