Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: b40ae72cfcfd0eec05c5b464dffca7a1c4352172
      
https://github.com/Perl/perl5/commit/b40ae72cfcfd0eec05c5b464dffca7a1c4352172
  Author: Richard Leach <richardle...@users.noreply.github.com>
  Date:   2025-07-25 (Fri, 25 Jul 2025)

  Changed paths:
    M embed.fnc
    M hv.c
    M proto.h
    M sv.c
    M sv_inline.h

  Log Message:
  -----------
  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_bodies`
    is 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.



To unsubscribe from these emails, change your notification settings at 
https://github.com/Perl/perl5/settings/notifications

Reply via email to