[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 24/26] rust: qom: move device_id to PL011 class side
From: |
Zhao Liu |
Subject: |
Re: [PATCH 24/26] rust: qom: move device_id to PL011 class side |
Date: |
Wed, 18 Dec 2024 22:30:45 +0800 |
> No, Self is not PL011Class. Self is PL011State (or PL011Luminary/ and it
> always remains the same. What changes is *what part* of the class is
> overwritten, but the order of calls from qom/object.c follows the same
> logic in both C and Rust.
Thanks! Now I feel I see!
For C side, type_initialize() will allocate a new class instance by
`ti->class = g_malloc0(ti->class_size)`, then actually C side's parent
class_init will initialize that new class instance.
For Rust side, the initialization call chain will initialize Self's
embedded parent class, one by one.
So that's fine!
> > Maybe the confusion is because I implemented class_init twice instead of
> > > using a separate trait "PL011Impl"?
> >
> > Ah, yes! But I think the Rust call chain should not use class_init anymore
> > but should use a different method. This way, the original class_init would
> > only serve the C QOM. A separate trait might break the inheritance
> > relationship similar to ClassInitImpl.
> >
>
> Do you still think that this is the case?
No, now this patch is fine for me!
Thanks,
Zhao
- [PATCH 15/26] rust: qom: split ObjectType from ObjectImpl trait, (continued)
- [PATCH 15/26] rust: qom: split ObjectType from ObjectImpl trait, Paolo Bonzini, 2024/12/09
- [PATCH 24/26] rust: qom: move device_id to PL011 class side, Paolo Bonzini, 2024/12/09
- Re: [PATCH 24/26] rust: qom: move device_id to PL011 class side, Zhao Liu, 2024/12/16
- Re: [PATCH 24/26] rust: qom: move device_id to PL011 class side, Paolo Bonzini, 2024/12/17
- Re: [PATCH 24/26] rust: qom: move device_id to PL011 class side, Zhao Liu, 2024/12/18
- Re: [PATCH 24/26] rust: qom: move device_id to PL011 class side, Paolo Bonzini, 2024/12/18
- Re: [PATCH 24/26] rust: qom: move device_id to PL011 class side, Paolo Bonzini, 2024/12/18
- Re: [PATCH 24/26] rust: qom: move device_id to PL011 class side, Zhao Liu, 2024/12/18
- Re: [PATCH 24/26] rust: qom: move device_id to PL011 class side, Paolo Bonzini, 2024/12/18
- Re: [PATCH 24/26] rust: qom: move device_id to PL011 class side,
Zhao Liu <=
Re: [PATCH 24/26] rust: qom: move device_id to PL011 class side, Zhao Liu, 2024/12/18
[PATCH 26/26] rust: callbacks: allow passing optional callbacks as (), Paolo Bonzini, 2024/12/09
[PATCH 23/26] rust: qom: add initial subset of methods on Object, Paolo Bonzini, 2024/12/09
[PATCH 21/26] rust: tests: allow writing more than one test, Paolo Bonzini, 2024/12/09