Skip to content

Commit 52959c8

Browse files
committed
Time::HiRes.xs switch croak_xs_unimplemented() to cv_name(), less bloat
-I measured S_croak_xs_unimplemented() at 0x88 bytes of MSVC 2022 -O1 x64 machine code. The optimization probably isn't worth it if break even is 0x88/(7*3) = 6.47 unimpl stubs. Just use exported function cv_name(), we don't need to perfectly match croak_xs_usage()'s text/logic.
1 parent b5c9bac commit 52959c8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

dist/Time-HiRes/HiRes.xs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -979,6 +979,10 @@ static void
979979
S_croak_xs_unimplemented(const CV *const cv)
980980
{
981981
dTHX;
982+
SV* sv = cv_name(cv, NULL, 0);
983+
Perl_croak_nocontext(
984+
"%s::%s(): unimplemented in this platform" + (sizeof("%s::")-1), SvPVX(sv));
985+
#if 0
982986
char buf[sizeof("CODE(0x%" UVxf ")") + (sizeof(UV)*8)];
983987
const char * pv1;
984988
const GV *const gv = CvGV(cv);
@@ -1002,6 +1006,7 @@ S_croak_xs_unimplemented(const CV *const cv)
10021006
"%s::%s(): unimplemented in this platform" + (sizeof("%s::")-1),
10031007
pv1);
10041008
}
1009+
#endif
10051010
}
10061011
#define croak_xs_unimplemented S_croak_xs_unimplemented
10071012

0 commit comments

Comments
 (0)