Well, I just found another bug in the gc. This one was a confusion between
two related variables. The symptom would be scanning the wrong
offsets (read: utter chaos, possible segfault) if a pointer was interior.
So usually this bug would not manifest (since most pointers are head
pointers).

Basically here:

void flx_collector_t::scan_object(void *p, int reclimit)
{
  Word_t reachable = (parity & 1UL) ^ 1UL;
again:
  if(debug)
    fprintf(stderr,"Scan object %p, reachable bit value = 
%d\n",p,(int)reachable);
  Word_t cand = (Word_t)p;
  Word_t fp=cand;
  Word_t *w = (Word_t*)JudyLLast(j_shape,&fp,&je);

we find a value equal to or less than the key store in fp.
After the lookup is done, usually some such key is stored
in fp, and its shape is stored in *w.

The problem was I was scanning the object starting at p,
the input pointer, possibly interior, instead of fp.

I actually found this bug because I'm looking at extending the collector
to support "user defined pointer finders", basically by storing a function
in the shape object.

This is a REALLY important improvement. For a start, it is mandatory
if we're going to allow the user to make Judy arrays with *either* the
index or the value being a Felix pointer.

But perhaps more obvious .. it allows Felix allocated
C++ Standard library containers like "vector" to contain
Felix managed pointers, eg 

        var px = new stl_vector[T];

where T is some Felix type. Basically, we can just use the containers
STL begin/end iterators. 

Note this will NOT work if the container is a local variable, instead
of a pointer, because the "conservative scan of the stack" only finds
Felix managed pointers. Vector, for example, won't have any of these
in the top level object, so the ones living in the actual data store will
never be found.



--
john skaller
skal...@users.sourceforge.net





------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to