> On Mon, 2009-05-11 at 13:51 +1200, Amos Jeffries wrote: >> >> We are currently hitting issues with template instance duplication >> (resolvable) and with instance initialization during AclReg static >> init >> context in the library model. >> >> What are the views on creating an ACL 'instance collection' class >> which >> can be created with new/delete and has as fields one instance of each >> ACL >> class/strategised template which needs to be instantiated (ie all of >> the >> built ones)? > > That is precisely the prototype registry which already exists. > > Something must have broken it.
Do we? I thought we had a dynamic registry where the bunch of global instances self-registered when first called (in AclReg.cc)? What appears broken with that is the self-registration part of the process. Self-registration does not work when the compiler has optimized the global instances and all code which is not explicitly referenced from the main binary. see Alex research earlier about static vs convenience libraries. Our current hack to fix the above (*Reg.cc) is causing dynamic template instantiation in a static context which sometimes causes compilers to generate bad optimization code. I mean making the collection of global Instances a set of dynamically new()/delete()'d locals owned by the registry itself. So AclReg.cc becomes an init() method of the registry and does new() on everything. Registry destructor cleans up. The register() bits morph slightly to a constructor that receives a ptr to the registry and uses it instead of a default constructor that uses a global registry. PS. I took another look at the breakage that made me RFC, and I got the auth and ACL code mixed up. It's auth that is currently fubar again. But the principle holds: model is broken and we do need to fix it. Amos
