Commit c7aaa28
committed
de-mathom Perl_sv_taint() part 4 add SvTAINTTC() tailcall API
Perl_newSVnv/Perl_newSViv/Perl_newSVuv, currently have to save the fresh
SV *, either on C stack, or in non volatile registers, around the
possible Perl_sv_taint() fn call inside SvTAINT(). If Perl_sv_taint()
returns its SV * argument, and assigns it back to the same C var, now
these 3 performance critical SV allocator functions, after plucking
the SV head from the arena, these 3 function never ever have to
store the fresh SV * back to C stack for any reason during their execution.
This optimization removes pop/push pairs of the C compiler saving
non-volatile registers and restoring them at function entry and exit since
after SvTAINTTC() change, NO variables AT ALL, have to be saved around
any function calls in Perl_newSVnv/Perl_newSViv/Perl_newSVuv. Also the
SV head *, after being delinked/removed from an areana, can now be
stored through the whole function, in the x86 EAX/x64 RAX register, and
pass through to the caller, without a final (non vol) reg to
(vol retval reg) mov/copy cpu op.
Remember eax/rax/retval registers, are always wiped after each fn call,
but the refactoring of SvTAINTTC() conviently returns the
SV * back to us, in the ABI return register, and we let the fresh
SV * glide through on the "heavy" Perl_sv_taint() branch, from
Perl_sv_taint() to Perl_newSViv()'s caller, without touching it, 0
machine code ops.
Few code sites were changed from SvTAINT() to SvTAINTTC(), to keep this
patch smaller, and the Perl_sv_set*vXXX() category of functions, all have
void return types and can't be chained. Also the Perl_sv_taint() branch
can be tail called or converted to a JMP insted of CALL, if the CC/OS/ABI
wants to now.
This is the final part of speeding up
Perl_newSVnv/Perl_newSViv/Perl_newSVuv there is nothing else to remove or
optimze.1 parent 4645be2 commit c7aaa28
4 files changed
+24
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1130 | 1130 | | |
1131 | 1131 | | |
1132 | 1132 | | |
1133 | | - | |
| 1133 | + | |
1134 | 1134 | | |
1135 | 1135 | | |
1136 | 1136 | | |
1137 | 1137 | | |
1138 | | - | |
| 1138 | + | |
1139 | 1139 | | |
1140 | 1140 | | |
1141 | 1141 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10037 | 10037 | | |
10038 | 10038 | | |
10039 | 10039 | | |
10040 | | - | |
| 10040 | + | |
10041 | 10041 | | |
10042 | 10042 | | |
10043 | 10043 | | |
| |||
10073 | 10073 | | |
10074 | 10074 | | |
10075 | 10075 | | |
10076 | | - | |
| 10076 | + | |
10077 | 10077 | | |
10078 | 10078 | | |
10079 | 10079 | | |
| |||
10172 | 10172 | | |
10173 | 10173 | | |
10174 | 10174 | | |
10175 | | - | |
| 10175 | + | |
10176 | 10176 | | |
10177 | 10177 | | |
10178 | 10178 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1721 | 1721 | | |
1722 | 1722 | | |
1723 | 1723 | | |
| 1724 | + | |
| 1725 | + | |
| 1726 | + | |
| 1727 | + | |
| 1728 | + | |
| 1729 | + | |
| 1730 | + | |
| 1731 | + | |
| 1732 | + | |
| 1733 | + | |
| 1734 | + | |
| 1735 | + | |
| 1736 | + | |
| 1737 | + | |
| 1738 | + | |
1724 | 1739 | | |
1725 | 1740 | | |
1726 | 1741 | | |
| |||
1739 | 1754 | | |
1740 | 1755 | | |
1741 | 1756 | | |
| 1757 | + | |
| 1758 | + | |
| 1759 | + | |
1742 | 1760 | | |
1743 | 1761 | | |
1744 | 1762 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
985 | 985 | | |
986 | 986 | | |
987 | 987 | | |
988 | | - | |
| 988 | + | |
989 | 989 | | |
990 | 990 | | |
991 | 991 | | |
| |||
0 commit comments