Message ID | 20250210133134.90879-1-philmd@linaro.org |
---|---|
Headers | show |
Series | qom: Constify class_data | expand |
On 10/2/25 14:31, Philippe Mathieu-Daudé wrote: > Since v1: > - Make XtensaConfigList::config not const (Max) > - Update / test rust (Paolo) > - Constify InterfaceInfo[] > > Following Richard's suggestion [*], make QOM class data *const*. > > [*] https://lore.kernel.org/qemu-devel/f4ec871d-e759-44bc-a10b-872322330a3f@linaro.org/ I'm only seeing +3KiB in .rodata for each binary... > Philippe Mathieu-Daudé (11): > target/i386: Constify X86CPUModel uses > target/sparc: Constify SPARCCPUClass::cpu_def > target/xtensa: Finalize config in xtensa_register_core() > target/riscv: Declare RISCVCPUClass::misa_mxl_max as RISCVMXL > target/riscv: Convert misa_mxl_max using GLib macros > hw: Declare various const data as 'const' > hw: Make class data 'const' > qom: Have class_base_init() take a const data argument > qom: Have class_init() take a const data argument > qom: Constify TypeInfo::class_data > qom: Constify InterfaceInfo[] interfaces > 1119 files changed, 2066 insertions(+), 2002 deletions(-) >
On 2/10/25 05:46, Philippe Mathieu-Daudé wrote: > On 10/2/25 14:31, Philippe Mathieu-Daudé wrote: >> Since v1: >> - Make XtensaConfigList::config not const (Max) >> - Update / test rust (Paolo) >> - Constify InterfaceInfo[] >> >> Following Richard's suggestion [*], make QOM class data *const*. >> >> [*] https://lore.kernel.org/qemu-devel/f4ec871d-e759-44bc-a10b-872322330a3f@linaro.org/ > > I'm only seeing +3KiB in .rodata for each binary... > >> Philippe Mathieu-Daudé (11): >> target/i386: Constify X86CPUModel uses >> target/sparc: Constify SPARCCPUClass::cpu_def >> target/xtensa: Finalize config in xtensa_register_core() >> target/riscv: Declare RISCVCPUClass::misa_mxl_max as RISCVMXL >> target/riscv: Convert misa_mxl_max using GLib macros >> hw: Declare various const data as 'const' >> hw: Make class data 'const' >> qom: Have class_base_init() take a const data argument >> qom: Have class_init() take a const data argument >> qom: Constify TypeInfo::class_data >> qom: Constify InterfaceInfo[] interfaces There is some additional data that can be made const after this [1], though still not lots. But the additional data that Paolo was going to add for 99 riscv bottles of beer on the wall would have been quite a bit more than 3k. r~ [1] -static M48txxInfo m48txx_isa_info[] = { +static const M48txxInfo m48txx_isa_info[] = { -static M48txxInfo m48txx_sysbus_info[] = { +static const M48txxInfo m48txx_sysbus_info[] = { -static struct EHCIPCIInfo ehci_pci_info[] = { +static const struct EHCIPCIInfo ehci_pci_info[] = { -static UHCIInfo uhci_info[] = { +static const UHCIInfo uhci_info[] = { -static UHCIInfo uhci_info[] = { +static const UHCIInfo uhci_info[] = { -static StreamSinkClass xilinx_axidma_data_stream_class = { +static const StreamSinkClass xilinx_axidma_data_stream_class = { -static StreamSinkClass xilinx_axidma_control_stream_class = { +static const StreamSinkClass xilinx_axidma_control_stream_class = {
On 10/2/25 18:02, Richard Henderson wrote: > On 2/10/25 05:46, Philippe Mathieu-Daudé wrote: >> On 10/2/25 14:31, Philippe Mathieu-Daudé wrote: >>> Since v1: >>> - Make XtensaConfigList::config not const (Max) >>> - Update / test rust (Paolo) >>> - Constify InterfaceInfo[] >>> >>> Following Richard's suggestion [*], make QOM class data *const*. >>> >>> [*] https://lore.kernel.org/qemu-devel/f4ec871d-e759-44bc- >>> a10b-872322330a3f@linaro.org/ >> >> I'm only seeing +3KiB in .rodata for each binary... >> >>> Philippe Mathieu-Daudé (11): >>> target/i386: Constify X86CPUModel uses >>> target/sparc: Constify SPARCCPUClass::cpu_def >>> target/xtensa: Finalize config in xtensa_register_core() >>> target/riscv: Declare RISCVCPUClass::misa_mxl_max as RISCVMXL >>> target/riscv: Convert misa_mxl_max using GLib macros >>> hw: Declare various const data as 'const' >>> hw: Make class data 'const' >>> qom: Have class_base_init() take a const data argument >>> qom: Have class_init() take a const data argument >>> qom: Constify TypeInfo::class_data >>> qom: Constify InterfaceInfo[] interfaces > > There is some additional data that can be made const after this [1], > though still not lots. But the additional data that Paolo was going to > add for 99 riscv bottles of beer on the wall would have been quite a bit > more than 3k. > > > r~ > > > [1] > > -static M48txxInfo m48txx_isa_info[] = { > +static const M48txxInfo m48txx_isa_info[] = { > > -static M48txxInfo m48txx_sysbus_info[] = { > +static const M48txxInfo m48txx_sysbus_info[] = { > > -static struct EHCIPCIInfo ehci_pci_info[] = { > +static const struct EHCIPCIInfo ehci_pci_info[] = { > > -static UHCIInfo uhci_info[] = { > +static const UHCIInfo uhci_info[] = { > > -static UHCIInfo uhci_info[] = { > +static const UHCIInfo uhci_info[] = { Doh, I took not for these but forgot 🤦🏻 > -static StreamSinkClass xilinx_axidma_data_stream_class = { > +static const StreamSinkClass xilinx_axidma_data_stream_class = { > > -static StreamSinkClass xilinx_axidma_control_stream_class = { > +static const StreamSinkClass xilinx_axidma_control_stream_class = { >