This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: In the search of heap enlightenment...


Mikael Djurfeldt <mdj@nada.kth.se> writes:

> Greg Harvey <Greg.Harvey@thezone.net> writes:
> 
> > Does anyone actually use segments with ncells!=1, or is it a vestigial
> > feature?
> 
> It is not used currently.
> 
> However, I think we should keep that code as an option for the future
> if it doesn't involve big costs.  Having 4-word cells in addition to
> 2-word cells could be used to optimize the representation of some data
> types to gain both speed and space.
> 

It can be fairly expensive when the gc marks are moved off of the
objects and into separate heap cells. Currently, it's able to get at
those marks by doing a few shifts and &'s with the location of the
cell. With variable ncells, tho, it means that setting a gc mark also
requires looking up the segment that the object is in, and figuring
out the correct shifts and masks to get at the mark locations. 

As it is, I don't think that the current gc will work reliably with
ncells != 1 (and it certainly isn't easy to get an object of the size
you want). For objects that would benefit from 4 words (I'm thinking
objects that would otherwise have to do a small malloc), it might be
better to have a small copying heap to do allocation from. This still
wastes a pointer word, but would probably perform better than having
to malloc the space, and allows the cell heap to stay uniform.

-- 
Greg