Marc-André Lureau <[email protected]> writes: > Rename QAPISchemaUsedTypes to QAPISchemaTypeAnalysis and broaden type > collection: instead of discovering types transitively from commands and > events, register every non-implicit type upfront in visit_needed() and > let visit_end() resolve their dependencies. > > This is needed so that QOM property types that are defined in the QAPI > schema but not referenced by any command or event still appear in > query-qmp-schema output, making them introspectable by management tools. > > Commands and events still register their (often implicit) argument and > return types, which visit_needed() intentionally skips.
Either I'm confused, or this paragraph is misleading. Before the patch, we emit the types used directly or indirectly by commands and events. This ensures that you can start introspection at a command or and event, then follow type references. We emit exactly the types reachable that way. Afterwards, we emit the types used directly or indirectly by commands, events, and user-defined types. Now you can also start introspection at a QOM property, then follow type references. Since we don't know which types are referenced from QOM properties, we emit all the types that could be. The only types that can't are implicit base types and the builtin integer types we don't expose externally. We could instead simply emit all types and call it a day. > This makes the x86-64 query-qmp-schema grow from 244K to 265K. Based on current master I see it grow by 9% from 246KiB to 267KiB. If I make it emit *all* types, it instead grows by 11% to 274KiB. > Signed-off-by: Marc-André Lureau <[email protected]> If we simply emit all types, we can drop the previous patch, and dumb down introspect.py to visit the types without ado: drop .visit_needed(), ._use_type() and all that. Thoughts?
