On Friday 2014-02-28 11:04 +0000, Neil wrote: > Henri Sivonen wrote: > >Any chance static atoms could reside as plain old static C data structures > >in the data segment of libxul.so instead of being heap-allocated? > > > At least under MSVC, they have vtables, so they need to be > constructed, so they're not static. Note that their string storage > is static, through the use of fake string buffers (possibly this > should be switched to fake literal strings).
Remember that since this is all in a shared library (which might be loaded at different addresses, or even different addresses in different processes [1]), you also have to worry about relocations. In other words, whenever you have a pointer in a static data structure pointing to some other data, that pointer needs to get fixed up when the library loads, which makes the memory that pointer is in less likely to be shared across processes (depending, I guess, on how many processes are able to load the library at its default address, which may in turn depend on security features that try to randomize library base addresses). This also slows down loading of shared libraries. Or something like that; please correct me if this is wrong. -David [1] Shouldn't be an issue with Nuwa-cloned processes on B2G, though. -- 𝄞 L. David Baron http://dbaron.org/ 𝄂 𝄢 Mozilla https://www.mozilla.org/ 𝄂 Before I built a wall I'd ask to know What I was walling in or walling out, And to whom I was like to give offense. - Robert Frost, Mending Wall (1914)
signature.asc
Description: Digital signature
_______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform