On Tuesday 10 July 2007 18:37:59 Will Coleda wrote: > Discussion on IRC today about how we can improve the state of the GC > system. One of the things that came up was that perhaps we shouldn't > be poking inside PMC guts outside of src/*pmc/: instead, we should be > using vtable access. > > I currently see ~500 instances where we use PMC_data() outside pmc > code (after a build, so probably some generated code in there.) > > I think if we had an example of how these should be fixed, that'd > help others contribute, so, lets pick one and dissect it. > > Here's a function from src/key.c : > > /* > > FUNCDOC: key_next > Returns the next key if C<key> is in a sequence of linked keys. > > */ > > PARROT_API > PMC * > key_next(SHIM_INTERP, PMC *key /*NN*/) > { > return key->pmc_ext ? (PMC *)PMC_data(key) : NULL; > } > > Is this in need of fixing? If so, how? If not, is there a better > function to show off what needs fixing?
This isn't a great example, as the guts of hashes and keys and iterators are all over various files instead of nicely encapsulated in .pmc files. A better example may be PMC_cont(), strewn about ops, other PMCs, the calling conventions, and the like. Unraveling that will be tricky. -- c