Skip to content

Commit

Permalink
Remove the flags OPpSORT_STABLE and OPpSORT_UNSTABLE.
Browse files Browse the repository at this point in the history
Remove the code in Perl_ck_sort() that reads from PL_hintgv that sets these,
and the code in pp_sort that reads them and sets SORTf_STABLE and
SORTf_UNSTABLE (which were no longer read. Remove these too.)
  • Loading branch information
nwc10 committed Jun 22, 2021
1 parent c286863 commit 70ae4f4
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 134 deletions.
8 changes: 1 addition & 7 deletions lib/B/Op_private.pm
Expand Up @@ -543,7 +543,7 @@ $bits{sin}{0} = $bf[0];
$bits{snetent}{0} = $bf[0];
@{$bits{socket}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]);
@{$bits{sockpair}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]);
@{$bits{sort}}{7,6,4,3,2,1,0} = ('OPpSORT_UNSTABLE', 'OPpSORT_STABLE', 'OPpSORT_DESCEND', 'OPpSORT_INPLACE', 'OPpSORT_REVERSE', 'OPpSORT_INTEGER', 'OPpSORT_NUMERIC');
@{$bits{sort}}{4,3,2,1,0} = ('OPpSORT_DESCEND', 'OPpSORT_INPLACE', 'OPpSORT_REVERSE', 'OPpSORT_INTEGER', 'OPpSORT_NUMERIC');
@{$bits{splice}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]);
@{$bits{split}}{4,3,2} = ('OPpSPLIT_ASSIGN', 'OPpSPLIT_LEX', 'OPpSPLIT_IMPLIM');
@{$bits{sprintf}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]);
Expand Down Expand Up @@ -684,8 +684,6 @@ our %defines = (
OPpSORT_INTEGER => 2,
OPpSORT_NUMERIC => 1,
OPpSORT_REVERSE => 4,
OPpSORT_STABLE => 64,
OPpSORT_UNSTABLE => 128,
OPpSPLIT_ASSIGN => 16,
OPpSPLIT_IMPLIM => 4,
OPpSPLIT_LEX => 8,
Expand Down Expand Up @@ -787,8 +785,6 @@ our %labels = (
OPpSORT_INTEGER => 'INT',
OPpSORT_NUMERIC => 'NUM',
OPpSORT_REVERSE => 'REV',
OPpSORT_STABLE => 'STABLE',
OPpSORT_UNSTABLE => 'UNSTABLE',
OPpSPLIT_ASSIGN => 'ASSIGN',
OPpSPLIT_IMPLIM => 'IMPLIM',
OPpSPLIT_LEX => 'LEX',
Expand Down Expand Up @@ -888,8 +884,6 @@ $ops_using{OPpSORT_INPLACE} = $ops_using{OPpSORT_DESCEND};
$ops_using{OPpSORT_INTEGER} = $ops_using{OPpSORT_DESCEND};
$ops_using{OPpSORT_NUMERIC} = $ops_using{OPpSORT_DESCEND};
$ops_using{OPpSORT_REVERSE} = $ops_using{OPpSORT_DESCEND};
$ops_using{OPpSORT_STABLE} = $ops_using{OPpSORT_DESCEND};
$ops_using{OPpSORT_UNSTABLE} = $ops_using{OPpSORT_DESCEND};
$ops_using{OPpSPLIT_IMPLIM} = $ops_using{OPpSPLIT_ASSIGN};
$ops_using{OPpSPLIT_LEX} = $ops_using{OPpSPLIT_ASSIGN};
$ops_using{OPpTRANS_COMPLEMENT} = $ops_using{OPpTRANS_CAN_FORCE_UTF8};
Expand Down
13 changes: 0 additions & 13 deletions op.c
Expand Up @@ -14098,23 +14098,10 @@ Perl_ck_sort(pTHX_ OP *o)
{
OP *firstkid;
OP *kid;
HV * const hinthv =
PL_hints & HINT_LOCALIZE_HH ? GvHV(PL_hintgv) : NULL;
U8 stacked;

PERL_ARGS_ASSERT_CK_SORT;

if (hinthv) {
SV ** const svp = hv_fetchs(hinthv, "sort", FALSE);
if (svp) {
const I32 sorthints = (I32)SvIV(*svp);
if ((sorthints & HINT_SORT_STABLE) != 0)
o->op_private |= OPpSORT_STABLE;
if ((sorthints & HINT_SORT_UNSTABLE) != 0)
o->op_private |= OPpSORT_UNSTABLE;
}
}

if (o->op_flags & OPf_STACKED)
simplify_sort(o);
firstkid = OpSIBLING(cLISTOPo->op_first); /* get past pushmark */
Expand Down

0 comments on commit 70ae4f4

Please sign in to comment.