Perl_more_bodies - figure out sizing from sv_type #23360
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:svtype
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:
Perl_more_bodies
is the unlikely case in each new SV allocation or upgrade.With
Perl_newSV_type
being an inline function, there are a lot of potential callers to this function though, each of which will have twomov
instructions for pushing the two size parameters onto the stack should the need to callPerl_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.