Skip to content

Commit 8802b94

Browse files
committed
Perl_sv_upgrade_fresh added to inline.h
When a new SV is created and upgraded to a type known at compile time, using the general-purpose upgrade function (sv_upgrade) is clunky. Specifically, it is too big to be inlined, contains many branches that can logically be resolved at compile time for known start & end types, and the lookup of the correct body_details struct may add CPU cycles. This commit does two things: * adds Perl_sv_upgrade_fresh for use with SVs of type SVt_NULL * moves structure, macro and function definitions required to allow this new function to reside in inline.h Subsequent commits will make use of this new function.
1 parent ebfc9d5 commit 8802b94

File tree

6 files changed

+415
-254
lines changed

6 files changed

+415
-254
lines changed

embed.fnc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1947,6 +1947,7 @@ ApdMb |void |sv_unref |NN SV* sv
19471947
Apd |void |sv_unref_flags |NN SV *const ref|const U32 flags
19481948
Cpd |void |sv_untaint |NN SV *const sv
19491949
Apd |void |sv_upgrade |NN SV *const sv|svtype new_type
1950+
Cpdix |void |sv_upgrade_fresh |NN SV *const sv|svtype new_type
19501951
ApdMb |void |sv_usepvn |NN SV* sv|NULLOK char* ptr|STRLEN len
19511952
Apd |void |sv_usepvn_flags|NN SV *const sv|NULLOK char* ptr|const STRLEN len\
19521953
|const U32 flags

embed.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -717,6 +717,7 @@
717717
#define sv_unref_flags(a,b) Perl_sv_unref_flags(aTHX_ a,b)
718718
#define sv_untaint(a) Perl_sv_untaint(aTHX_ a)
719719
#define sv_upgrade(a,b) Perl_sv_upgrade(aTHX_ a,b)
720+
#define sv_upgrade_fresh(a,b) Perl_sv_upgrade_fresh(aTHX_ a,b)
720721
#define sv_usepvn_flags(a,b,c,d) Perl_sv_usepvn_flags(aTHX_ a,b,c,d)
721722
#define sv_utf8_decode(a) Perl_sv_utf8_decode(aTHX_ a)
722723
#define sv_utf8_downgrade_flags(a,b,c) Perl_sv_utf8_downgrade_flags(aTHX_ a,b,c)

0 commit comments

Comments
 (0)