qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 2/7] target-alpha: Turn CPU definitions into sub


From: Eduardo Habkost
Subject: Re: [Qemu-devel] [PATCH 2/7] target-alpha: Turn CPU definitions into subclasses
Date: Thu, 6 Dec 2012 14:09:38 -0200
User-agent: Mutt/1.5.21 (2010-09-15)

On Thu, Dec 06, 2012 at 04:51:31PM +0100, Andreas Färber wrote:
> Am 06.12.2012 16:29, schrieb Eduardo Habkost:
> > On Wed, Oct 31, 2012 at 04:03:59AM +0100, Andreas Färber wrote:
> > [...]
> >> +static void alpha_cpu_register(const AlphaCPUInfo *info)
> >> +{
> >> +    TypeInfo type_info = {
> >> +        .name = info->name,
> >> +        .parent = TYPE_ALPHA_CPU,
> >> +        .instance_init = info->initfn,
> >> +    };
> >> +
> >> +    type_register_static(&type_info);
> > 
> > You should use type_register() instead of type_register_static(), here.
> 
> I still don't understand why. (CC'ing Anthony, Paolo, Peter)
> 
> The TypeInfo argument is in no way retained inside
> qom/object.c:type_register_internal().
> Therefore the lifetime of TypeInfo should be completely irrelevant for
> the static/non-static decision and the documentation should be fixed IMO.
> Is there a reason to do it differently? What would we want to do with
> TypeInfo after transfer of its field values to TypeImpl?

The current implementation doesn't matter. It can change at any minute. The
interface, on the other hand, is documented as:

  type_register_static:
  @info: The #TypeInfo of the new type.

  @info and all of the strings it points to should exist for the life time
  that the type is registered.

-- 
Eduardo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]