bodies_by_type: SVt_PVFM bodies use an arena, just like all other bodies - #24808
Open
richardleach wants to merge 5 commits into
Open
richardleach wants to merge 5 commits into
richardleach wants to merge 5 commits into
Conversation
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
approved these changes
Sep 17, 2026
tonycoz
left a comment
Contributor
There was a problem hiding this comment.
My first thought: what's a PVFM? (yeah, formats)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
On a build that uses SV arenas, only the
SVt_PVFMbody 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_PVFMbodies 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_typePerl_sv_upgradeS_sv_dup_commonPerl_sv_clear