[K42-discussion] static_buf in gentmp

Donour Sizemore donour at cs.unm.edu
Thu Jan 4 09:01:00 EST 2007


Donour Sizemore wrote:
> Dilma DaSilva wrote:
>> Donour Sizemore writes:
>>  > I'm getting linking errors like this:
>>  > 
>> [examples removed]
>>
>>  > That seem to be coming from the code created from gentmp.awk.
>>  > 
>>  > -- gentmp.awk --
>>  > function createStandardFunc()
>>  > {
>>  >    ...
>>  >   
>>  >   printf("template<> char 
>>  > %s<INSTNAME>::static_buf[sizeof(%s<INSTNAME>)]\n",TMclass,TMclass)              
>>  >  > XF;
>>  >   
>>  >    ...
>>  > --
>>  > 
>>  > 
>>  > Does anybody know what the purpose of the static_buf member?
>>  > 
>>
>> Donour,
>>
>> I was not familiar with this "static_buf", but poking around I see that
>> the generated code for TypeMgrServer (for example in file
>> powerpc/fullDeb/lib/libc/cobj/tmplTplXTypeMgrServer.I) invokes
>>     TplMetaTypeMgrServer<INSTNAME> *self = new(static_buf) TplMetaTypeMgrServer<INSTNAME>;
>>                                                            
>> and then
>>     DREFGOBJ(TheTypeMgrRef)->registerTypeHdlr(typeID(), xoh,(uval)self);
>>
>> This means that method TypeMgr::registerTypeHdlr (in lib/libc/cobj/TypeMgr.C) stores 
>> the allocated static_buf as "localPtr", which can be retrieved by
>> method TypeMgr::getTypeLocalPtr (invoked from giveAccessSetClientData
>> or giveAccessInternal).
>>
>> What do you have on your generated TplMetaTypeMgrServer.H?
>>
> 
> I'm sorry. I don't understand the question.
> 

If you're asking about the contents of TplMetaTypeMgrServer.H, I have

--
...

template <class T>
class TplMetaTypeMgrServer : public MetaObj {

         ...

protected:
         TplMetaTypeMgrServer(){};
         TplMetaTypeMgrServer(MetaObj::FakeType t):MetaObj(t){};
         static char static_buf[];
         inline void * operator new(size_t size, void* buf){
                 return (void*)buf;
         };
public:
         ...
};

--







More information about the K42-discussion mailing list