From: Andy Lester Date: Thu, 17 Nov 2005 07:53:38 +0000 (-0600) Subject: Sort subs now in embed.fnc X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f0f5dc9dd6402292e51fb413bf662b3e54145006;p=p5sagit%2Fp5-mst-13.2.git Sort subs now in embed.fnc Message-ID: <20051117135338.GA31715@petdance.com> p4raw-id: //depot/perl@26147 --- diff --git a/embed.fnc b/embed.fnc index aa43973..f3385fc 100644 --- a/embed.fnc +++ b/embed.fnc @@ -1186,6 +1186,18 @@ sR |CV* |get_db_sub |NN SV **svp|NN CV *cv sR |SV* |method_common |NN SV* meth|NULLOK U32* hashp #endif +#if defined(PERL_IN_PP_SORT_C) || defined(PERL_DECL_PROT) +s |I32 |sv_ncmp |NN SV *a|NN SV *b +s |I32 |sv_i_ncmp |NN SV *a|NN SV *b +s |I32 |amagic_ncmp |NN SV *a|NN SV *b +s |I32 |amagic_i_ncmp |NN SV *a|NN SV *b +s |I32 |amagic_cmp |NN SV *a|NN SV *b +s |I32 |amagic_cmp_locale|NN SV *a|NN SV *b +s |I32 |sortcv |NN SV *a|NN SV *b +s |I32 |sortcv_xsub |NN SV *a|NN SV *b +s |I32 |sortcv_stacked |NN SV *a|NN SV *b +#endif + #if defined(PERL_IN_PP_SYS_C) || defined(PERL_DECL_PROT) s |OP* |doform |NN CV *cv|NN GV *gv|NN OP *retop s |int |emulate_eaccess|NN const char* path|Mode_t mode diff --git a/embed.h b/embed.h index 3f3b668..d534f17 100644 --- a/embed.h +++ b/embed.h @@ -1207,6 +1207,19 @@ #define method_common S_method_common #endif #endif +#if defined(PERL_IN_PP_SORT_C) || defined(PERL_DECL_PROT) +#ifdef PERL_CORE +#define sv_ncmp S_sv_ncmp +#define sv_i_ncmp S_sv_i_ncmp +#define amagic_ncmp S_amagic_ncmp +#define amagic_i_ncmp S_amagic_i_ncmp +#define amagic_cmp S_amagic_cmp +#define amagic_cmp_locale S_amagic_cmp_locale +#define sortcv S_sortcv +#define sortcv_xsub S_sortcv_xsub +#define sortcv_stacked S_sortcv_stacked +#endif +#endif #if defined(PERL_IN_PP_SYS_C) || defined(PERL_DECL_PROT) #ifdef PERL_CORE #define doform S_doform @@ -3198,6 +3211,19 @@ #define method_common(a,b) S_method_common(aTHX_ a,b) #endif #endif +#if defined(PERL_IN_PP_SORT_C) || defined(PERL_DECL_PROT) +#ifdef PERL_CORE +#define sv_ncmp(a,b) S_sv_ncmp(aTHX_ a,b) +#define sv_i_ncmp(a,b) S_sv_i_ncmp(aTHX_ a,b) +#define amagic_ncmp(a,b) S_amagic_ncmp(aTHX_ a,b) +#define amagic_i_ncmp(a,b) S_amagic_i_ncmp(aTHX_ a,b) +#define amagic_cmp(a,b) S_amagic_cmp(aTHX_ a,b) +#define amagic_cmp_locale(a,b) S_amagic_cmp_locale(aTHX_ a,b) +#define sortcv(a,b) S_sortcv(aTHX_ a,b) +#define sortcv_xsub(a,b) S_sortcv_xsub(aTHX_ a,b) +#define sortcv_stacked(a,b) S_sortcv_stacked(aTHX_ a,b) +#endif +#endif #if defined(PERL_IN_PP_SYS_C) || defined(PERL_DECL_PROT) #ifdef PERL_CORE #define doform(a,b,c) S_doform(aTHX_ a,b,c) diff --git a/pp_sort.c b/pp_sort.c index 7580bf3..34d21fd 100644 --- a/pp_sort.c +++ b/pp_sort.c @@ -33,16 +33,6 @@ #define small xsmall #endif -static I32 sortcv(pTHX_ SV *a, SV *b); -static I32 sortcv_stacked(pTHX_ SV *a, SV *b); -static I32 sortcv_xsub(pTHX_ SV *a, SV *b); -static I32 sv_ncmp(pTHX_ SV *a, SV *b); -static I32 sv_i_ncmp(pTHX_ SV *a, SV *b); -static I32 amagic_ncmp(pTHX_ SV *a, SV *b); -static I32 amagic_i_ncmp(pTHX_ SV *a, SV *b); -static I32 amagic_cmp(pTHX_ SV *a, SV *b); -static I32 amagic_cmp_locale(pTHX_ SV *a, SV *b); - #define sv_cmp_static Perl_sv_cmp #define sv_cmp_locale_static Perl_sv_cmp_locale @@ -1685,7 +1675,7 @@ PP(pp_sort) start = p1 - max; sortsvp(aTHX_ start, max, - is_xsub ? sortcv_xsub : hasargs ? sortcv_stacked : sortcv); + is_xsub ? S_sortcv_xsub : hasargs ? S_sortcv_stacked : S_sortcv); if (!(flags & OPf_SPECIAL)) { LEAVESUB(cv); @@ -1703,13 +1693,13 @@ PP(pp_sort) sortsvp(aTHX_ start, max, (priv & OPpSORT_NUMERIC) ? ( ( ( priv & OPpSORT_INTEGER) || all_SIVs) - ? ( overloading ? amagic_i_ncmp : sv_i_ncmp) - : ( overloading ? amagic_ncmp : sv_ncmp ) ) + ? ( overloading ? S_amagic_i_ncmp : S_sv_i_ncmp) + : ( overloading ? S_amagic_ncmp : S_sv_ncmp ) ) : ( IN_LOCALE_RUNTIME ? ( overloading - ? amagic_cmp_locale + ? S_amagic_cmp_locale : sv_cmp_locale_static) - : ( overloading ? amagic_cmp : sv_cmp_static))); + : ( overloading ? S_amagic_cmp : sv_cmp_static))); } if (priv & OPpSORT_REVERSE) { SV **q = start+max-1; @@ -1745,7 +1735,7 @@ PP(pp_sort) } static I32 -sortcv(pTHX_ SV *a, SV *b) +S_sortcv(pTHX_ SV *a, SV *b) { dVAR; const I32 oldsaveix = PL_savestack_ix; @@ -1769,7 +1759,7 @@ sortcv(pTHX_ SV *a, SV *b) } static I32 -sortcv_stacked(pTHX_ SV *a, SV *b) +S_sortcv_stacked(pTHX_ SV *a, SV *b) { dVAR; const I32 oldsaveix = PL_savestack_ix; @@ -1809,7 +1799,7 @@ sortcv_stacked(pTHX_ SV *a, SV *b) } static I32 -sortcv_xsub(pTHX_ SV *a, SV *b) +S_sortcv_xsub(pTHX_ SV *a, SV *b) { dVAR; dSP; const I32 oldsaveix = PL_savestack_ix; @@ -1838,7 +1828,7 @@ sortcv_xsub(pTHX_ SV *a, SV *b) static I32 -sv_ncmp(pTHX_ SV *a, SV *b) +S_sv_ncmp(pTHX_ SV *a, SV *b) { const NV nv1 = SvNSIV(a); const NV nv2 = SvNSIV(b); @@ -1846,7 +1836,7 @@ sv_ncmp(pTHX_ SV *a, SV *b) } static I32 -sv_i_ncmp(pTHX_ SV *a, SV *b) +S_sv_i_ncmp(pTHX_ SV *a, SV *b) { const IV iv1 = SvIV(a); const IV iv2 = SvIV(b); @@ -1859,7 +1849,7 @@ sv_i_ncmp(pTHX_ SV *a, SV *b) : Nullsv; static I32 -amagic_ncmp(pTHX_ register SV *a, register SV *b) +S_amagic_ncmp(pTHX_ register SV *a, register SV *b) { SV * const tmpsv = tryCALL_AMAGICbin(a,b,ncmp); if (tmpsv) { @@ -1876,11 +1866,11 @@ amagic_ncmp(pTHX_ register SV *a, register SV *b) return d ? -1 : 0; } } - return sv_ncmp(aTHX_ a, b); + return S_sv_ncmp(aTHX_ a, b); } static I32 -amagic_i_ncmp(pTHX_ register SV *a, register SV *b) +S_amagic_i_ncmp(pTHX_ register SV *a, register SV *b) { SV * const tmpsv = tryCALL_AMAGICbin(a,b,ncmp); if (tmpsv) { @@ -1897,11 +1887,11 @@ amagic_i_ncmp(pTHX_ register SV *a, register SV *b) return d ? -1 : 0; } } - return sv_i_ncmp(aTHX_ a, b); + return S_sv_i_ncmp(aTHX_ a, b); } static I32 -amagic_cmp(pTHX_ register SV *str1, register SV *str2) +S_amagic_cmp(pTHX_ register SV *str1, register SV *str2) { SV * const tmpsv = tryCALL_AMAGICbin(str1,str2,scmp); if (tmpsv) { @@ -1922,7 +1912,7 @@ amagic_cmp(pTHX_ register SV *str1, register SV *str2) } static I32 -amagic_cmp_locale(pTHX_ register SV *str1, register SV *str2) +S_amagic_cmp_locale(pTHX_ register SV *str1, register SV *str2) { SV * const tmpsv = tryCALL_AMAGICbin(str1,str2,scmp); if (tmpsv) { diff --git a/proto.h b/proto.h index 9acd42f..4ad3b66 100644 --- a/proto.h +++ b/proto.h @@ -3307,6 +3307,45 @@ STATIC SV* S_method_common(pTHX_ SV* meth, U32* hashp) #endif +#if defined(PERL_IN_PP_SORT_C) || defined(PERL_DECL_PROT) +STATIC I32 S_sv_ncmp(pTHX_ SV *a, SV *b) + __attribute__nonnull__(pTHX_1) + __attribute__nonnull__(pTHX_2); + +STATIC I32 S_sv_i_ncmp(pTHX_ SV *a, SV *b) + __attribute__nonnull__(pTHX_1) + __attribute__nonnull__(pTHX_2); + +STATIC I32 S_amagic_ncmp(pTHX_ SV *a, SV *b) + __attribute__nonnull__(pTHX_1) + __attribute__nonnull__(pTHX_2); + +STATIC I32 S_amagic_i_ncmp(pTHX_ SV *a, SV *b) + __attribute__nonnull__(pTHX_1) + __attribute__nonnull__(pTHX_2); + +STATIC I32 S_amagic_cmp(pTHX_ SV *a, SV *b) + __attribute__nonnull__(pTHX_1) + __attribute__nonnull__(pTHX_2); + +STATIC I32 S_amagic_cmp_locale(pTHX_ SV *a, SV *b) + __attribute__nonnull__(pTHX_1) + __attribute__nonnull__(pTHX_2); + +STATIC I32 S_sortcv(pTHX_ SV *a, SV *b) + __attribute__nonnull__(pTHX_1) + __attribute__nonnull__(pTHX_2); + +STATIC I32 S_sortcv_xsub(pTHX_ SV *a, SV *b) + __attribute__nonnull__(pTHX_1) + __attribute__nonnull__(pTHX_2); + +STATIC I32 S_sortcv_stacked(pTHX_ SV *a, SV *b) + __attribute__nonnull__(pTHX_1) + __attribute__nonnull__(pTHX_2); + +#endif + #if defined(PERL_IN_PP_SYS_C) || defined(PERL_DECL_PROT) STATIC OP* S_doform(pTHX_ CV *cv, GV *gv, OP *retop) __attribute__nonnull__(pTHX_1)