Skip to content

Arg type info: Add a struct to get just once type information

Marco Trevisan requested to merge 3v1n0/gjs:arg-type-info into master

This is based on !496 (merged), while there are some cleanups that could be done when !504 (merged) lands. And in general a prerequisite of a further refactory I'm doing, so probably better to review it alone.

While processing arguments from a GITypeInfo we perform various operations multiple times to get the type information, and especially for arrays or interface types we happen to do the same various times.

As per this, use a smart struct that makes sure that when we pass a GIBaseInfo to the arg functions we initialize all the values we care about for each type so that we can just pass around to the internal functions just one struct pointer that contains all without having to perform further calls.

Everything is kept as constant expression so that the actual code should just access to the saved members quickly.

A part from cleaning up the code and avoiding to repeat the same things multiple times, the main purpose here is to improve the arg-cache so that we can avoid keeping cached the type-info, and just pass a properly filled GjsTypeInfo from the saved data.

Edited by Marco Trevisan

Merge request reports