This is the mail archive of the
mailing list for the Archer project.
Re: [python] don't try to free "independent" types
Tom> But, maybe some hybrid scheme could work.
I was thinking some more and it might not be too extreme to solve
The idea would be to have a lookaside reference count. However,
instead of reference counting a given struct type, the count would
apply to an entire hierarchy of types, as created by
copy_type_recursive. That is, we'd have a hash map whose entries
would be 'struct type *'s and whose value would be a reference count,
with multiple keys pointing to a single counter. This would prevent
us from freeing any type in the hierarchy before its time.
Reference counting for types referred to by values would be handled in
allocate_value and a small number of other places.
Then we'd need some additional code to register new types created by
things like make_pointer_type. This is probably the time-consuming bit.
Perhaps it could be done by changing alloc_type.
I wonder if I'm missing something. If I can't think of anything, I
will try to implement this soon.