line |
true |
false |
branch |
195
|
5277854 |
1168407 |
for (p2 = list2; b < last; ) { |
199
|
8278924 |
1168407 |
for (p = b+2, t = p; ++p < last; t = ++p) { |
200
|
4169477 |
4109446 |
if ((cmp(aTHX_ *t, *p) > 0) != sense) break; |
206
|
14168 |
5277193 |
if (r >= t) p = r = t; /* too short to care about */ |
208
|
11413 |
13030 |
while (((cmp(aTHX_ *(p-1), *p) > 0) == sense) && |
|
10275 |
1138 |
while (((cmp(aTHX_ *(p-1), *p) > 0) == sense) && |
210
|
1138 |
13030 |
if (p <= q) { |
220
|
3103 |
5288258 |
if (q > b) { /* run of greater than 2 at b */ |
225
|
1632 |
1471 |
if ((p == t) && |
|
95 |
1537 |
if ((p == t) && |
226
|
64 |
31 |
((t + 1) == last) && |
230
|
926 |
2177 |
if (sense) |
231
|
2004 |
926 |
while (b < --p) { |
238
|
9388317 |
5291361 |
while (q < p) { /* simple pairs */ |
240
|
4691956 |
4696361 |
if (sense) { |
246
|
5277789 |
13572 |
if (((b = p) == t) && ((t+1) == last)) { |
|
760452 |
4517337 |
if (((b = p) == t) && ((t+1) == last)) { |
251
|
13508 |
5277853 |
} while (b < t); |
366
|
1168427 |
270 |
if (nmemb <= 1) return; /* sorted trivially */ |
368
|
5968 |
1162459 |
if ((flags & SORTf_DESC) != 0) { |
374
|
16525 |
1151902 |
if (nmemb <= SMALLSORT) aux = small; /* use stack for aux array */ |
375
|
0 |
16525 |
else { Newx(aux,nmemb,gptr); } /* allocate auxiliary array */ |
389
|
5757015 |
1168407 |
if (runs == 0) { |
404
|
36112274 |
8983465 |
while (f1 < l1 && f2 < l2) { |
426
|
16960781 |
19151493 |
if (cmp(aTHX_ *f1, *f2) <= 0) { |
442
|
7454704 |
53677683 |
if ((p = PINDEX(b, i)) >= t) { |
449
|
25020113 |
28657570 |
} else if (cmp(aTHX_ *q, *p) <= sense) { |
453
|
24757389 |
262724 |
if (++run >= RTHRESH) i += i; |
464
|
239154 |
36112274 |
while (b < t) { |
466
|
74467 |
164687 |
if (cmp(aTHX_ *q, *p) <= sense) { |
474
|
16960781 |
19151493 |
if (q == f1) { |
475
|
10512042 |
16960781 |
FROMTOUPTO(f2, tp2, t); |
478
|
14801798 |
19151493 |
FROMTOUPTO(f1, tp2, t); |
485
|
5877508 |
3105957 |
if (f1 == l1) { |
486
|
1553890 |
4323618 |
if (f2 < l2) FROMTOUPTO(f2, tp2, l2); |
|
473935 |
1553890 |
if (f2 < l2) FROMTOUPTO(f2, tp2, l2); |
487
|
1521573 |
3105957 |
} else FROMTOUPTO(f1, tp2, l1); |
490
|
7922975 |
1060490 |
if (--level == 0) goto done; |
493
|
3226450 |
4696525 |
} while ((runs = stackp->runs) == 0); |
504
|
4696525 |
5864932 |
while (runs > 2) { |
515
|
1577992 |
4286940 |
if (runs == 1) { |
524
|
745382 |
832610 |
if (iwhich) { /* Belongs in aux, currently in base */ |
530
|
680479 |
745382 |
FROMTOUPTO(f1, f2, t); /* copy */ |
532
|
724693 |
107917 |
} else if (level == 0) goto done; /* single run at level 0 */ |
543
|
2388213 |
1898727 |
if (!iwhich) { /* Merged runs belong in aux, copy 1st */ |
551
|
5230577 |
1898727 |
FROMTOUPTO(f1, f2, t); /* copy both runs */ |
558
|
16525 |
1151882 |
if (aux != small) Safefree(aux); /* free iff allocated */ |
559
|
6016 |
1162391 |
if (flags) { |
780
|
48 |
0 |
if (num_elts <= 1) { |
785
|
20 |
28 |
if (num_elts > QSORT_PLAY_SAFE) { |
788
|
47184 |
20 |
for (n = num_elts; n > 1; ) { |
806
|
7908 |
7719 |
if ((part_right - part_left) >= qsort_break_even) { |
903
|
3940 |
3968 |
if (s < 0) { |
907
|
8 |
3932 |
if (s == 0) { |
911
|
2610 |
1322 |
} else if (s > 0) { |
914
|
1323 |
1287 |
if (s < 0) { |
918
|
11 |
1276 |
} else if (s == 0) { |
929
|
134 |
3834 |
} else if (s == 0) { |
932
|
13 |
121 |
if (s < 0) { |
936
|
107 |
14 |
} else if (s == 0) { |
950
|
2574 |
1260 |
if (s < 0) { |
953
|
1304 |
1270 |
if (s < 0) { |
957
|
8 |
1262 |
} else if (s == 0) { |
967
|
7 |
1253 |
} else if (s == 0) { |
1004
|
219684 |
53394 |
while ((still_work_on_left = (u_right >= part_left))) { |
1006
|
106717 |
112967 |
if (s < 0) { |
1008
|
107221 |
5746 |
} else if (s == 0) { |
1010
|
2900 |
2846 |
if (pc_left != u_right) { |
1025
|
223375 |
51744 |
while ((still_work_on_right = (u_left <= part_right))) { |
1027
|
108733 |
114642 |
if (s < 0) { |
1029
|
5771 |
108871 |
} else if (s == 0) { |
1031
|
2828 |
2943 |
if (pc_right != u_left) { |
1044
|
107221 |
53394 |
if (still_work_on_left) { |
1049
|
63385 |
43836 |
if (still_work_on_right) { |
1073
|
1119 |
42717 |
if (pc_left == u_right) { |
1083
|
45486 |
7908 |
} else if (still_work_on_right) { |
1090
|
1310 |
44176 |
if (pc_right == u_left) { |
1137
|
1155 |
6753 |
if (swapped < 3) { |
1156
|
7788 |
120 |
if (part_left < pc_left) { |
1160
|
7760 |
28 |
if (pc_right < part_right) { |
1168
|
3660 |
4100 |
if ((part_right - pc_right) > (pc_left - part_left)) { |
1194
|
31 |
89 |
} else if (pc_right < part_right) { |
1203
|
82 |
7 |
if (next_stack_entry == 0) { |
1222
|
20813 |
7719 |
for (i = part_left + 1; i <= part_right; ++i) { |
1228
|
37429 |
7082 |
for (j = i - 1; j >= part_left; --j) { |
1229
|
23698 |
13731 |
if (qsort_cmp(i, j) >= 0) { |
1236
|
13518 |
7295 |
if (j != i) { |
1241
|
23698 |
13518 |
for (k = i - 1; k >= j; --k) |
1251
|
7678 |
41 |
if (next_stack_entry == 0) { |
1327
|
61659 |
225251 |
if (sense) |
1329
|
32307 |
29352 |
return (ap > bp) ? 1 : ((ap < bp) ? -1 : 0); |
|
0 |
32307 |
return (ap > bp) ? 1 : ((ap < bp) ? -1 : 0); |
1341
|
0 |
0 |
if (sense) |
1344
|
0 |
0 |
return (ap > bp) ? 1 : ((ap < bp) ? -1 : 0); |
|
0 |
0 |
return (ap > bp) ? 1 : ((ap < bp) ? -1 : 0); |
1352
|
24 |
24 |
if ((flags & SORTf_STABLE) != 0) { |
1357
|
24 |
0 |
if (nmemb <= 1) return; /* sorted trivially */ |
1360
|
10 |
14 |
if (nmemb <= SMALLSORT) indir = small; |
1361
|
0 |
10 |
else { Newx(indir, nmemb, gptr *); } |
1364
|
24116 |
24 |
for (n = nmemb, pp = indir, q = list1; n--; ) *pp++ = q++; |
1370
|
0 |
24 |
if (flags & SORTf_DESC) |
1377
|
24116 |
24 |
for (n = nmemb; n--; ) { |
1389
|
84 |
24032 |
if (n != j) { /* all's well if n == j */ |
1396
|
23910 |
84 |
} while ((j = i) != n); |
1413
|
10 |
14 |
if (indir != small) { Safefree(indir); } |
1416
|
0 |
24 |
} else if ((flags & SORTf_DESC) != 0) { |
1463
|
48 |
1168697 |
if (flags & SORTf_QSORT) |
1482
|
2632993 |
6831 |
I32 gimme = GIMME; |
|
207 |
2632786 |
I32 gimme = GIMME; |
1496
|
12009 |
2627815 |
if ((priv & OPpSORT_DESCEND) != 0) |
1498
|
56 |
2639768 |
if ((priv & OPpSORT_QSORT) != 0) |
1500
|
84 |
2639740 |
if ((priv & OPpSORT_STABLE) != 0) |
1503
|
235 |
2639589 |
if (gimme != G_ARRAY) { |
|
0 |
235 |
if (gimme != G_ARRAY) { |
1511
|
58415 |
2581174 |
if (flags & OPf_STACKED) { |
1512
|
53079 |
5336 |
if (flags & OPf_SPECIAL) { |
1523
|
5339 |
0 |
if (cv && SvPOK(cv)) { |
|
21 |
5318 |
if (cv && SvPOK(cv)) { |
1524
|
21 |
0 |
const char * const proto = SvPV_nolen_const(MUTABLE_SV(cv)); |
1525
|
21 |
0 |
if (proto && strEQ(proto, "$$")) { |
|
21 |
0 |
if (proto && strEQ(proto, "$$")) { |
|
21 |
0 |
if (proto && strEQ(proto, "$$")) { |
|
21 |
0 |
if (proto && strEQ(proto, "$$")) { |
1529
|
5339 |
0 |
if (cv && CvISXSUB(cv) && CvXSUB(cv)) { |
|
2 |
5337 |
if (cv && CvISXSUB(cv) && CvXSUB(cv)) { |
|
0 |
2 |
if (cv && CvISXSUB(cv) && CvXSUB(cv)) { |
1532
|
5337 |
0 |
else if (!(cv && CvROOT(cv))) { |
|
4 |
5333 |
else if (!(cv && CvROOT(cv))) { |
1533
|
1 |
3 |
if (gv) { |
1536
|
1 |
0 |
else if (!CvANON(cv) && (gv = CvGV(cv))) { |
|
1 |
0 |
else if (!CvANON(cv) && (gv = CvGV(cv))) { |
1539
|
4 |
0 |
if (!autogv && ( |
|
3 |
1 |
if (!autogv && ( |
1540
|
4 |
0 |
autogv = gv_autoload_pvn( |
1545
|
0 |
3 |
cv = GvCVu(autogv); |
1560
|
2 |
5333 |
if (is_xsub) |
1574
|
2550 |
2637038 |
if (priv & OPpSORT_INPLACE) { |
1578
|
4 |
2546 |
max = AvFILL(av) + 1; |
1579
|
4 |
2546 |
if (SvMAGICAL(av)) { |
1580
|
0 |
4 |
MEXTEND(SP, max); |
1581
|
12 |
4 |
for (i=0; i < max; i++) { |
1583
|
12 |
0 |
*SP++ = (svp) ? *svp : NULL; |
1589
|
1 |
2545 |
if (SvREADONLY(av)) |
1608
|
2637042 |
2545 |
copytmps = !sorting_av && PL_sortcop; |
|
2580885 |
56157 |
copytmps = !sorting_av && PL_sortcop; |
1609
|
19886809 |
2639587 |
for (i=max; i > 0 ; i--) { |
1610
|
19886809 |
0 |
if ((*p1 = *p2++)) { /* Weed out nulls. */ |
1611
|
803361 |
19083448 |
if (copytmps && SvPADTMP(*p1) && !IS_PADGV(*p1)) |
|
38 |
803323 |
if (copytmps && SvPADTMP(*p1) && !IS_PADGV(*p1)) |
1614
|
19038629 |
848180 |
if (!PL_sortcop) { |
1615
|
90866 |
18947763 |
if (priv & OPpSORT_NUMERIC) { |
1616
|
2 |
90864 |
if (priv & OPpSORT_INTEGER) { |
1617
|
2 |
0 |
if (!SvIOK(*p1)) |
1621
|
90863 |
1 |
if (!SvNSIOK(*p1)) |
|
90357 |
506 |
if (!SvNSIOK(*p1)) |
1623
|
11037 |
79827 |
if (all_SIVs && !SvSIOK(*p1)) |
|
10531 |
506 |
if (all_SIVs && !SvSIOK(*p1)) |
1628
|
14401 |
18933362 |
if (!SvPOK(*p1)) |
1632
|
13299 |
19025330 |
if (SvAMAGIC(*p1)) |
|
116 |
13183 |
if (SvAMAGIC(*p1)) |
|
116 |
0 |
if (SvAMAGIC(*p1)) |
1640
|
2545 |
2637042 |
if (sorting_av) |
1643
|
1166237 |
1473350 |
if (max > 1) { |
1645
|
28617 |
1137620 |
if (PL_sortcop) { |
1654
|
36 |
28581 |
PUSHSTACKi(PERLSI_SORT); |
1655
|
28596 |
21 |
if (!hasargs && !is_xsub) { |
|
28594 |
2 |
if (!hasargs && !is_xsub) { |
1664
|
28617 |
0 |
PUSHBLOCK(cx, CXt_NULL, PL_stack_base); |
1665
|
2038 |
26579 |
if (!(flags & OPf_SPECIAL)) { |
1672
|
2 |
2036 |
if (CvDEPTH(cv)) SvREFCNT_inc_simple_void_NN(cv); |
1673
|
1908 |
130 |
PUSHSUB(cx); |
|
0 |
1908 |
PUSHSUB(cx); |
|
2017 |
21 |
PUSHSUB(cx); |
|
2036 |
2 |
PUSHSUB(cx); |
1674
|
2036 |
2 |
if (!is_xsub) { |
1677
|
2 |
2034 |
if (++CvDEPTH(cv) >= 2) { |
1684
|
21 |
2015 |
if (hasargs) { |
1699
|
28615 |
2 |
sortsvp(aTHX_ start, max, |
|
28594 |
21 |
sortsvp(aTHX_ start, max, |
1703
|
2031 |
26566 |
if (!(flags & OPf_SPECIAL)) { |
1708
|
19 |
2012 |
POPSUB(cx, sv); |
|
3 |
16 |
POPSUB(cx, sv); |
|
2031 |
0 |
POPSUB(cx, sv); |
|
2031 |
0 |
POPSUB(cx, sv); |
|
2 |
2029 |
POPSUB(cx, sv); |
1713
|
0 |
28597 |
POPSTACK; |
1717
|
8 |
1137612 |
MEXTEND(SP, 20); /* Can't afford stack realloc on signal. */ |
1718
|
173 |
1137447 |
start = sorting_av ? AvARRAY(av) : ORIGMARK+1; |
1719
|
7422 |
1130198 |
sortsvp(aTHX_ start, max, |
|
22 |
7400 |
sortsvp(aTHX_ start, max, |
|
22 |
0 |
sortsvp(aTHX_ start, max, |
|
7400 |
0 |
sortsvp(aTHX_ start, max, |
1724
|
0 |
1130198 |
: ( IN_LOCALE_RUNTIME |
|
0 |
0 |
: ( IN_LOCALE_RUNTIME |
|
1130175 |
23 |
: ( IN_LOCALE_RUNTIME |
1731
|
192 |
1166025 |
if ((priv & OPpSORT_REVERSE) != 0) { |
1733
|
4242 |
192 |
while (start < q) { |
1740
|
2540 |
2637027 |
if (sorting_av) |
1742
|
4 |
2637023 |
else if (av && !sorting_av) { |
1745
|
12 |
4 |
for (i=0; i < max; i++) { |
1750
|
12 |
4 |
for (i=0; i < max; i++) { |
1753
|
9 |
3 |
if (SvSMAGICAL(sv)) |
1755
|
9 |
3 |
if (!didstore) |
1760
|
2637027 |
2540 |
PL_stack_sp = ORIGMARK + (sorting_av ? 0 : max); |
1785
|
4958650 |
1 |
if (PL_stack_sp != PL_stack_base + 1) { |
1790
|
4958633 |
18 |
if (SvNIOK_nog(resultsv)) result = SvIV(resultsv); |
|
4958633 |
0 |
if (SvNIOK_nog(resultsv)) result = SvIV(resultsv); |
|
4958633 |
0 |
if (SvNIOK_nog(resultsv)) result = SvIV(resultsv); |
1795
|
0 |
18 |
result = SvIV(resultsv); |
1798
|
579 |
4958649 |
while (PL_scopestack_ix > oldscopeix) { |
1821
|
8 |
86 |
if (AvREAL(av)) { |
1826
|
14 |
80 |
if (AvMAX(av) < 1) { |
1828
|
0 |
14 |
if (AvARRAY(av) != ary) { |
1832
|
14 |
0 |
if (AvMAX(av) < 1) { |
1849
|
1 |
93 |
if (PL_stack_sp != PL_stack_base + 1) { |
1851
|
0 |
1 |
result = SvIV(&PL_sv_undef); |
1853
|
86 |
7 |
else result = SvIV(*PL_stack_sp); |
1855
|
0 |
92 |
while (PL_scopestack_ix > oldscopeix) { |
1865
|
0 |
26 |
{ |
1876
|
0 |
26 |
PUSHMARK(SP); |
1882
|
0 |
26 |
if (PL_stack_sp != PL_stack_base + 1) |
1884
|
25 |
1 |
result = SvIV(*PL_stack_sp); |
1885
|
0 |
26 |
while (PL_scopestack_ix > oldscopeix) { |
1897
|
290280 |
2 |
const NV nv1 = SvNSIV(a); |
|
1 |
1 |
const NV nv1 = SvNSIV(a); |
1898
|
290281 |
1 |
const NV nv2 = SvNSIV(b); |
|
0 |
1 |
const NV nv2 = SvNSIV(b); |
1905
|
290282 |
0 |
if (nv1 != nv1 || nv2 != nv2) { |
|
1 |
290281 |
if (nv1 != nv1 || nv2 != nv2) { |
1907
|
1 |
0 |
if (ckWARN(WARN_UNINITIALIZED)) report_uninit(NULL); |
1910
|
139161 |
151120 |
return nv1 < nv2 ? -1 : nv1 > nv2 ? 1 : 0; |
1916
|
880 |
0 |
const IV iv1 = SvIV(a); |
1917
|
880 |
0 |
const IV iv2 = SvIV(b); |
1921
|
440 |
440 |
return iv1 < iv2 ? -1 : iv1 > iv2 ? 1 : 0; |
1935
|
0 |
0 |
SV * const tmpsv = tryCALL_AMAGICbin(a,b,ncmp_amg); |
|
0 |
0 |
SV * const tmpsv = tryCALL_AMAGICbin(a,b,ncmp_amg); |
|
0 |
0 |
SV * const tmpsv = tryCALL_AMAGICbin(a,b,ncmp_amg); |
|
0 |
0 |
SV * const tmpsv = tryCALL_AMAGICbin(a,b,ncmp_amg); |
|
0 |
0 |
SV * const tmpsv = tryCALL_AMAGICbin(a,b,ncmp_amg); |
|
0 |
0 |
SV * const tmpsv = tryCALL_AMAGICbin(a,b,ncmp_amg); |
1939
|
0 |
0 |
if (tmpsv) { |
1940
|
0 |
0 |
if (SvIOK(tmpsv)) { |
1942
|
0 |
0 |
return SORT_NORMAL_RETURN_VALUE(i); |
|
0 |
0 |
return SORT_NORMAL_RETURN_VALUE(i); |
1945
|
0 |
0 |
const NV d = SvNV(tmpsv); |
1946
|
0 |
0 |
return SORT_NORMAL_RETURN_VALUE(d); |
|
0 |
0 |
return SORT_NORMAL_RETURN_VALUE(d); |
1956
|
0 |
0 |
SV * const tmpsv = tryCALL_AMAGICbin(a,b,ncmp_amg); |
|
0 |
0 |
SV * const tmpsv = tryCALL_AMAGICbin(a,b,ncmp_amg); |
|
0 |
0 |
SV * const tmpsv = tryCALL_AMAGICbin(a,b,ncmp_amg); |
|
0 |
0 |
SV * const tmpsv = tryCALL_AMAGICbin(a,b,ncmp_amg); |
|
0 |
0 |
SV * const tmpsv = tryCALL_AMAGICbin(a,b,ncmp_amg); |
|
0 |
0 |
SV * const tmpsv = tryCALL_AMAGICbin(a,b,ncmp_amg); |
1960
|
0 |
0 |
if (tmpsv) { |
1961
|
0 |
0 |
if (SvIOK(tmpsv)) { |
1963
|
0 |
0 |
return SORT_NORMAL_RETURN_VALUE(i); |
|
0 |
0 |
return SORT_NORMAL_RETURN_VALUE(i); |
1966
|
0 |
0 |
const NV d = SvNV(tmpsv); |
1967
|
0 |
0 |
return SORT_NORMAL_RETURN_VALUE(d); |
|
0 |
0 |
return SORT_NORMAL_RETURN_VALUE(d); |
1977
|
193 |
0 |
SV * const tmpsv = tryCALL_AMAGICbin(str1,str2,scmp_amg); |
|
193 |
0 |
SV * const tmpsv = tryCALL_AMAGICbin(str1,str2,scmp_amg); |
|
0 |
193 |
SV * const tmpsv = tryCALL_AMAGICbin(str1,str2,scmp_amg); |
|
0 |
0 |
SV * const tmpsv = tryCALL_AMAGICbin(str1,str2,scmp_amg); |
|
0 |
0 |
SV * const tmpsv = tryCALL_AMAGICbin(str1,str2,scmp_amg); |
|
0 |
0 |
SV * const tmpsv = tryCALL_AMAGICbin(str1,str2,scmp_amg); |
1981
|
13 |
180 |
if (tmpsv) { |
1982
|
13 |
0 |
if (SvIOK(tmpsv)) { |
1984
|
12 |
1 |
return SORT_NORMAL_RETURN_VALUE(i); |
|
12 |
0 |
return SORT_NORMAL_RETURN_VALUE(i); |
1987
|
0 |
0 |
const NV d = SvNV(tmpsv); |
1988
|
0 |
0 |
return SORT_NORMAL_RETURN_VALUE(d); |
|
0 |
0 |
return SORT_NORMAL_RETURN_VALUE(d); |
1998
|
0 |
0 |
SV * const tmpsv = tryCALL_AMAGICbin(str1,str2,scmp_amg); |
|
0 |
0 |
SV * const tmpsv = tryCALL_AMAGICbin(str1,str2,scmp_amg); |
|
0 |
0 |
SV * const tmpsv = tryCALL_AMAGICbin(str1,str2,scmp_amg); |
|
0 |
0 |
SV * const tmpsv = tryCALL_AMAGICbin(str1,str2,scmp_amg); |
|
0 |
0 |
SV * const tmpsv = tryCALL_AMAGICbin(str1,str2,scmp_amg); |
|
0 |
0 |
SV * const tmpsv = tryCALL_AMAGICbin(str1,str2,scmp_amg); |
2002
|
0 |
0 |
if (tmpsv) { |
2003
|
0 |
0 |
if (SvIOK(tmpsv)) { |
2005
|
0 |
0 |
return SORT_NORMAL_RETURN_VALUE(i); |
|
0 |
0 |
return SORT_NORMAL_RETURN_VALUE(i); |
2008
|
0 |
0 |
const NV d = SvNV(tmpsv); |
2009
|
0 |
0 |
return SORT_NORMAL_RETURN_VALUE(d); |
|
0 |
0 |
return SORT_NORMAL_RETURN_VALUE(d); |