On 05/15/11 06:53, Gabe Black wrote: > I'm working on some patches that pull the kernel stuff out of the System > object into it's own thing, and I'm running into some circular includes > in the generated files. I have a new Workload object which Process and > Kernel inherit from and which has a pointer back to System, and System > has a pointer to kernel. More or less the WorkloadParams header includes > the SystemParams header includes the KernelParams header includes the > WorkloadParams header, and things break. This could be fixed by still > making inheritance include the base class header files but make > parameter pointers use prototype declarations. Does anybody know how to > actually implement that? > > Gabe > _______________________________________________ > m5-dev mailing list > m5-dev@m5sim.org > http://m5sim.org/mailman/listinfo/m5-dev
Ok, I think I sort of figured that part out (example patch attached) but now SWIG is unhappy. It's including the param struct for an object which no longer includes the param header files for all parameters it has, so it doesn't have definitions for their Param structs, or their base class Param structs. Then it sets up these conversion functions which cast things around using those types. I don't know why or how to change it, and I'm getting lost in all this SWIG goop, and python generating SWIG files and python files getting turned into wrapper .cc files including other generated files including each other, and my head a-splode. So if somebody (Nate) could please look at this and figure out what's going on that would be great. This sort of thing should work, so this is something we should fix. It would also make my life easier if I didn't actually write any of the code for this yet. Testing any patches would probably be ok. Gabe
# HG changeset patch # Parent 685345c45fe5600c2d745ea86846688e8e36ade7 diff -r 685345c45fe5 -r 17f669336cf9 src/python/m5/SimObject.py --- a/src/python/m5/SimObject.py Sun May 15 03:20:19 2011 -0700 +++ b/src/python/m5/SimObject.py Sun May 15 04:04:44 2011 -0700 @@ -98,7 +98,15 @@ instanceDict = {} def default_cxx_predecls(cls, code): - code('#include "params/$cls.hh"') + class_path = cls._value_dict['cxx_class'].split('::') + # A forward class declaration is sufficient since we are just + # declaring a pointer. + for ns in class_path[:-1]: + code('namespace $ns {') + code('class $0;', class_path[-1]) + for ns in reversed(class_path[:-1]): + code('} // namespace $ns') + code() def default_swig_predecls(cls, code): code('%import "python/m5/internal/param_$cls.i"')
_______________________________________________ m5-dev mailing list m5-dev@m5sim.org http://m5sim.org/mailman/listinfo/m5-dev