Perl_more_bodies - figure out sizing from sv_type
Perl_more_bodies allocates and sets up a new arena for the likes of SV body, HE, and HVAUX structs. It has traditionally been called with three arguments:
- the
svtype - the size of the structs that the arena will contain
- the size of the arena to allocate
This commit changes the function definition such that it only takes a single argument: the svtype. From that, and with a bit of additional logic to account of HE and HVAUX using the indexes notionally for SVt_NULL and SVt_IV, Perl_more_bodies can figure out the sizing for itself.
The rationale for this is that:
- When an application is starting up, the need to call
Perl_more_bodiesis the unlikely case in each new SV allocation or upgrade. - When the application has reached a steady state, the function may not be called regardless of how many SVs are created or upgraded.
With Perl_newSV_type being an inline function, there are a lot of potential callers to this function though, each of which will have two mov instructions for pushing the two size parameters onto the stack should the need to call Perl_more_bodies arise. Removing two instructions from each potential call site should help reduce binary size a little and avoid taking up unnecessary space in the CPU's instruction buffer.
- This set of changes does not require a perldelta entry.
I like this patch. It is long overdue.
Any committers have any concerns with this PR?
Looks good otherwise.