This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] [3/5] Types reference counting [make_function_type-objfile]

On Fri, 26 Jun 2009 15:23:00 +0200, Ulrich Weigand wrote:
> - I think the symbol readers should always return per-objfile types.  This
>   just makes everything simpler, in particular allocation of derived types
>   (as you notice).  I think it would also good to be able to guarantee that
>   TYPE_OBJFILE of every symbol type is non-NULL ...

This IMO means "any two types somehow interconnected (by TYPE_TARGET_TYPE,
TYPE_INDEX_TYPE etc.) should have the same TYPE_OBJFILE".

> - The Java generated types should *not* go onto the "fake" dynamics objfile
>   in the first place.  That objfile is somewhat bogus in that it isn't
>   associated with an architecture (thus breaking my per-type architecture
>   effort), and it also don't help with type lifetime issues as the fake
>   objfile never goes away.  I think those types should be allocated with
>   a NULL objfile (in the future are per-gdbarch types) instead.

I see now dynamics_objfile should be replaced by NULL TYPE_OBJFILE and being
a discardable type to be processed by the types garbage collector (which is
still not checked-in).

> Also, I think the implementation is broken in the "type smashing" case:
> if there is an incoming type allocated in objfile A, but the argument to
> make_function_type specifies objfile B,

I do not think it can happen.  So far always type A referencing -> type
B either had the same TYPE_OBJFILE or TYPE_OBJFILE(B) was NULL.  Using such
assertion-checks without facing problems.

As there cannot be a DWARF reference across objfiles (there can be one just
across CUs) cross-file type references use TYPE_IS_OPAQUE and they get
resolved each time on dereferencing such reference by calling check_typedef.

> Therefore, I'd prefer to fix the two problems mentioned above, and then
> revert your patch.

If the current rule:
# So far always type A referencing -> type B had either the same TYPE_OBJFILE

will be changed to:
# Type A referencing -> type B had the same TYPE_OBJFILE.

I only welcome it and sure I agree with reverting my patch afterwards.


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