Skip to content

Commit d349122

Browse files
bulk88khwilliamson
authored andcommitted
sv.c: sv_2mortal() move SvTEMP_on(sv); for RISC CPUs
RISC CPUs can not read from memory and do anything else in 1 opcode. These x64 instructions are impossible to do in 1 opcode on ARM. F7 42 0C 00 00 01 08 test dword ptr [rdx+0Ch], 8010000h and 0F BA 6B 0C 13 bts dword ptr [rbx+0Ch], 13h Since editing macro SvIMMORTAL() to remove SvREADONLY() is out of scope, flip the order around, so the contents sv->sv_flags can be reused, and not re-read around fn call Perl_tmps_grow_p(). sv_2mortal() is a libperl export, it doesn't inline. "SvTEMP_on(sv);" can not have any CC inline synergy/de-duping opportunities with its caller frame, regardless if SvTEMP_on() is on the top or bottom of sv_2mortal(). sv.c itself never calls sv_2mortal(). All functions inside sv.c use the lightweight PUSH_EXTEND_MORTAL__SV_C() macro, not sv_2mortal().
1 parent 0643bb9 commit d349122

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sv.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9739,8 +9739,8 @@ Perl_sv_2mortal(pTHX_ SV *const sv)
97399739
return sv;
97409740
if (SvIMMORTAL(sv))
97419741
return sv;
9742-
PUSH_EXTEND_MORTAL__SV_C(sv);
9743-
SvTEMP_on(sv);
9742+
SvTEMP_on(sv); /* optimize for RISC, SvIMMORTAL() contains SvREADONLY() */
9743+
PUSH_EXTEND_MORTAL__SV_C(sv);;
97449744
return sv;
97459745
}
97469746

0 commit comments

Comments
 (0)