Skip to content

bodies_by_type: SVt_PVFM bodies use an arena, just like all other bodies - #24808

Open
richardleach wants to merge 5 commits into
Perl:bleadfrom
richardleach:all_bodies_use_arenas
Open

richardleach wants to merge 5 commits into
Perl:bleadfrom
richardleach:all_bodies_use_arenas

Conversation

@richardleach

Copy link
Copy Markdown
Contributor

On a build that uses SV arenas, only the SVt_PVFM body is allocated,
with all other types being bodiless (e.g. SVt_IV) or using arenas.

Hot functions that add or remove bodies therefore have to perform a
check - which is effectively for a rare type - every time and contain
code to deal with both arenas & allocations.

The first commit in this PR makes SVt_PVFM bodies also use an arena.
This enables simplification of any core function that adds or removes a body.

The subsequent PRs make such changes to:

  • Perl_newSV_type
  • Perl_sv_upgrade
  • S_sv_dup_common
  • Perl_sv_clear

  • This set of changes does not require a perldelta entry.

On a build that uses SV arenas, only the SVt_PVFM body is allocated,
with all other types being bodiless (e.g. SVt_IV) or using arenas.

Hot functions that add or remove bodies therefore have to perform a
check - which is effectively for a rare type - every time and contain
code to deal with both arenas & allocations.

This commit makes this body type also use an arena, allowing for
simplification of any core function that adds or removes a body.
This commit also duplicates the "free_rv" code for SVt_IV to directly
use rather than jumping to the shared code to hopefully help codegen.

(With gcc, at least, this commit led to better code layout for
bodiless SVs, regardless of content. Overall this commit caused a
slight reduction in the number of generated instructions, so
the "free_rv" duplication wasn't at the cost of code bloat.)

@tonycoz tonycoz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My first thought: what's a PVFM? (yeah, formats)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants