op_first cUNOP->op_first opindex
op_last cBINOP->op_last opindex
op_other cLOGOP->op_other opindex
-op_children cLISTOP->op_children U32
op_pmreplroot cPMOP->op_pmreplroot opindex
op_pmreplrootgv *(SV**)&cPMOP->op_pmreplroot svindex
op_pmreplstart cPMOP->op_pmreplstart opindex
$insn_data{op_first} = [91, \&PUT_opindex, "GET_opindex"];
$insn_data{op_last} = [92, \&PUT_opindex, "GET_opindex"];
$insn_data{op_other} = [93, \&PUT_opindex, "GET_opindex"];
-$insn_data{op_children} = [94, \&PUT_U32, "GET_U32"];
-$insn_data{op_pmreplroot} = [95, \&PUT_opindex, "GET_opindex"];
-$insn_data{op_pmreplrootgv} = [96, \&PUT_svindex, "GET_svindex"];
-$insn_data{op_pmreplstart} = [97, \&PUT_opindex, "GET_opindex"];
-$insn_data{op_pmnext} = [98, \&PUT_opindex, "GET_opindex"];
-$insn_data{pregcomp} = [99, \&PUT_pvcontents, "GET_pvcontents"];
-$insn_data{op_pmflags} = [100, \&PUT_U16, "GET_U16"];
-$insn_data{op_pmpermflags} = [101, \&PUT_U16, "GET_U16"];
-$insn_data{op_sv} = [102, \&PUT_svindex, "GET_svindex"];
-$insn_data{op_padix} = [103, \&PUT_U32, "GET_U32"];
-$insn_data{op_pv} = [104, \&PUT_pvcontents, "GET_pvcontents"];
-$insn_data{op_pv_tr} = [105, \&PUT_op_tr_array, "GET_op_tr_array"];
-$insn_data{op_redoop} = [106, \&PUT_opindex, "GET_opindex"];
-$insn_data{op_nextop} = [107, \&PUT_opindex, "GET_opindex"];
-$insn_data{op_lastop} = [108, \&PUT_opindex, "GET_opindex"];
-$insn_data{cop_label} = [109, \&PUT_pvindex, "GET_pvindex"];
-$insn_data{cop_stashpv} = [110, \&PUT_pvindex, "GET_pvindex"];
-$insn_data{cop_file} = [111, \&PUT_pvindex, "GET_pvindex"];
-$insn_data{cop_seq} = [112, \&PUT_U32, "GET_U32"];
-$insn_data{cop_arybase} = [113, \&PUT_I32, "GET_I32"];
-$insn_data{cop_line} = [114, \&PUT_U16, "GET_U16"];
-$insn_data{cop_warnings} = [115, \&PUT_svindex, "GET_svindex"];
-$insn_data{main_start} = [116, \&PUT_opindex, "GET_opindex"];
-$insn_data{main_root} = [117, \&PUT_opindex, "GET_opindex"];
-$insn_data{curpad} = [118, \&PUT_svindex, "GET_svindex"];
-$insn_data{push_begin} = [119, \&PUT_svindex, "GET_svindex"];
-$insn_data{push_init} = [120, \&PUT_svindex, "GET_svindex"];
-$insn_data{push_end} = [121, \&PUT_svindex, "GET_svindex"];
+$insn_data{op_pmreplroot} = [94, \&PUT_opindex, "GET_opindex"];
+$insn_data{op_pmreplrootgv} = [95, \&PUT_svindex, "GET_svindex"];
+$insn_data{op_pmreplstart} = [96, \&PUT_opindex, "GET_opindex"];
+$insn_data{op_pmnext} = [97, \&PUT_opindex, "GET_opindex"];
+$insn_data{pregcomp} = [98, \&PUT_pvcontents, "GET_pvcontents"];
+$insn_data{op_pmflags} = [99, \&PUT_U16, "GET_U16"];
+$insn_data{op_pmpermflags} = [100, \&PUT_U16, "GET_U16"];
+$insn_data{op_sv} = [101, \&PUT_svindex, "GET_svindex"];
+$insn_data{op_padix} = [102, \&PUT_U32, "GET_U32"];
+$insn_data{op_pv} = [103, \&PUT_pvcontents, "GET_pvcontents"];
+$insn_data{op_pv_tr} = [104, \&PUT_op_tr_array, "GET_op_tr_array"];
+$insn_data{op_redoop} = [105, \&PUT_opindex, "GET_opindex"];
+$insn_data{op_nextop} = [106, \&PUT_opindex, "GET_opindex"];
+$insn_data{op_lastop} = [107, \&PUT_opindex, "GET_opindex"];
+$insn_data{cop_label} = [108, \&PUT_pvindex, "GET_pvindex"];
+$insn_data{cop_stashpv} = [109, \&PUT_pvindex, "GET_pvindex"];
+$insn_data{cop_file} = [110, \&PUT_pvindex, "GET_pvindex"];
+$insn_data{cop_seq} = [111, \&PUT_U32, "GET_U32"];
+$insn_data{cop_arybase} = [112, \&PUT_I32, "GET_I32"];
+$insn_data{cop_line} = [113, \&PUT_U16, "GET_U16"];
+$insn_data{cop_warnings} = [114, \&PUT_svindex, "GET_svindex"];
+$insn_data{main_start} = [115, \&PUT_opindex, "GET_opindex"];
+$insn_data{main_root} = [116, \&PUT_opindex, "GET_opindex"];
+$insn_data{curpad} = [117, \&PUT_svindex, "GET_svindex"];
+$insn_data{push_begin} = [118, \&PUT_svindex, "GET_svindex"];
+$insn_data{push_init} = [119, \&PUT_svindex, "GET_svindex"];
+$insn_data{push_end} = [120, \&PUT_svindex, "GET_svindex"];
my ($insn_name, $insn_data);
while (($insn_name, $insn_data) = each %insn_data) {
}
}
-sub B::LISTOP::bytecode {
- my $op = shift;
- my $children = $op->children unless $strip_syntree;
- $op->B::BINOP::bytecode;
- if (($op->type || !$compress_nullops) && !$strip_syntree) {
- asm "op_children $children\n";
- }
-}
-
sub B::LOOP::bytecode {
my $op = shift;
my $redoopix = $op->redoop->objix;
my ($op, $level) = @_;
my $sym = objsym($op);
return $sym if defined $sym;
- $listopsect->add(sprintf("s\\_%x, s\\_%x, NULL, %u, %u, %u, 0x%x, 0x%x, s\\_%x, s\\_%x, %u",
+ $listopsect->add(sprintf("s\\_%x, s\\_%x, NULL, %u, %u, %u, 0x%x, 0x%x, s\\_%x, s\\_%x",
${$op->next}, ${$op->sibling},
$op->targ, $op->type, $op_seq, $op->flags,
- $op->private, ${$op->first}, ${$op->last},
- $op->children));
+ $op->private, ${$op->first}, ${$op->last}));
my $ix = $listopsect->index;
$init->add(sprintf("listop_list[$ix].op_ppaddr = %s;", $op->ppaddr));
savesym($op, "(OP*)&listop_list[$ix]");
#warn sprintf("LOOP: redoop %s, nextop %s, lastop %s\n",
# peekop($op->redoop), peekop($op->nextop),
# peekop($op->lastop)); # debug
- $loopsect->add(sprintf("s\\_%x, s\\_%x, NULL, %u, %u, %u, 0x%x, 0x%x, s\\_%x, s\\_%x, %u, s\\_%x, s\\_%x, s\\_%x",
+ $loopsect->add(sprintf("s\\_%x, s\\_%x, NULL, %u, %u, %u, 0x%x, 0x%x, s\\_%x, s\\_%x, s\\_%x, s\\_%x, s\\_%x",
${$op->next}, ${$op->sibling},
$op->targ, $op->type, $op_seq, $op->flags,
$op->private, ${$op->first}, ${$op->last},
- $op->children, ${$op->redoop}, ${$op->nextop},
+ ${$op->redoop}, ${$op->nextop},
${$op->lastop}));
my $ix = $loopsect->index;
$init->add(sprintf("loop_list[$ix].op_ppaddr = %s;", $op->ppaddr));
# pmnext handling is broken in perl itself, I think. Bad op_pmnext
# fields aren't noticed in perl's runtime (unless you try reset) but we
# segfault when trying to dereference it to find op->op_pmnext->op_type
- $pmopsect->add(sprintf("s\\_%x, s\\_%x, NULL, %u, %u, %u, 0x%x, 0x%x, s\\_%x, s\\_%x, %u, %s, %s, 0, 0, 0x%x, 0x%x",
+ $pmopsect->add(sprintf("s\\_%x, s\\_%x, NULL, %u, %u, %u, 0x%x, 0x%x, s\\_%x, s\\_%x, %s, %s, 0, 0, 0x%x, 0x%x",
${$op->next}, ${$op->sibling}, $op->targ,
$op->type, $op_seq, $op->flags, $op->private,
- ${$op->first}, ${$op->last}, $op->children,
+ ${$op->first}, ${$op->last},
$replrootfield, $replstartfield,
$op->pmflags, $op->pmpermflags,));
my $pm = sprintf("pmop_list[%d]", $pmopsect->index);
cLOGOP->op_other = arg;
break;
}
- case INSN_OP_CHILDREN: /* 94 */
- {
- U32 arg;
- BGET_U32(arg);
- cLISTOP->op_children = arg;
- break;
- }
- case INSN_OP_PMREPLROOT: /* 95 */
+ case INSN_OP_PMREPLROOT: /* 94 */
{
opindex arg;
BGET_opindex(arg);
cPMOP->op_pmreplroot = arg;
break;
}
- case INSN_OP_PMREPLROOTGV: /* 96 */
+ case INSN_OP_PMREPLROOTGV: /* 95 */
{
svindex arg;
BGET_svindex(arg);
*(SV**)&cPMOP->op_pmreplroot = arg;
break;
}
- case INSN_OP_PMREPLSTART: /* 97 */
+ case INSN_OP_PMREPLSTART: /* 96 */
{
opindex arg;
BGET_opindex(arg);
cPMOP->op_pmreplstart = arg;
break;
}
- case INSN_OP_PMNEXT: /* 98 */
+ case INSN_OP_PMNEXT: /* 97 */
{
opindex arg;
BGET_opindex(arg);
*(OP**)&cPMOP->op_pmnext = arg;
break;
}
- case INSN_PREGCOMP: /* 99 */
+ case INSN_PREGCOMP: /* 98 */
{
pvcontents arg;
BGET_pvcontents(arg);
BSET_pregcomp(PL_op, arg);
break;
}
- case INSN_OP_PMFLAGS: /* 100 */
+ case INSN_OP_PMFLAGS: /* 99 */
{
U16 arg;
BGET_U16(arg);
cPMOP->op_pmflags = arg;
break;
}
- case INSN_OP_PMPERMFLAGS: /* 101 */
+ case INSN_OP_PMPERMFLAGS: /* 100 */
{
U16 arg;
BGET_U16(arg);
cPMOP->op_pmpermflags = arg;
break;
}
- case INSN_OP_SV: /* 102 */
+ case INSN_OP_SV: /* 101 */
{
svindex arg;
BGET_svindex(arg);
cSVOP->op_sv = arg;
break;
}
- case INSN_OP_PADIX: /* 103 */
+ case INSN_OP_PADIX: /* 102 */
{
PADOFFSET arg;
BGET_U32(arg);
cPADOP->op_padix = arg;
break;
}
- case INSN_OP_PV: /* 104 */
+ case INSN_OP_PV: /* 103 */
{
pvcontents arg;
BGET_pvcontents(arg);
cPVOP->op_pv = arg;
break;
}
- case INSN_OP_PV_TR: /* 105 */
+ case INSN_OP_PV_TR: /* 104 */
{
op_tr_array arg;
BGET_op_tr_array(arg);
cPVOP->op_pv = arg;
break;
}
- case INSN_OP_REDOOP: /* 106 */
+ case INSN_OP_REDOOP: /* 105 */
{
opindex arg;
BGET_opindex(arg);
cLOOP->op_redoop = arg;
break;
}
- case INSN_OP_NEXTOP: /* 107 */
+ case INSN_OP_NEXTOP: /* 106 */
{
opindex arg;
BGET_opindex(arg);
cLOOP->op_nextop = arg;
break;
}
- case INSN_OP_LASTOP: /* 108 */
+ case INSN_OP_LASTOP: /* 107 */
{
opindex arg;
BGET_opindex(arg);
cLOOP->op_lastop = arg;
break;
}
- case INSN_COP_LABEL: /* 109 */
+ case INSN_COP_LABEL: /* 108 */
{
pvindex arg;
BGET_pvindex(arg);
cCOP->cop_label = arg;
break;
}
- case INSN_COP_STASHPV: /* 110 */
+ case INSN_COP_STASHPV: /* 109 */
{
pvindex arg;
BGET_pvindex(arg);
BSET_cop_stashpv(cCOP, arg);
break;
}
- case INSN_COP_FILE: /* 111 */
+ case INSN_COP_FILE: /* 110 */
{
pvindex arg;
BGET_pvindex(arg);
BSET_cop_file(cCOP, arg);
break;
}
- case INSN_COP_SEQ: /* 112 */
+ case INSN_COP_SEQ: /* 111 */
{
U32 arg;
BGET_U32(arg);
cCOP->cop_seq = arg;
break;
}
- case INSN_COP_ARYBASE: /* 113 */
+ case INSN_COP_ARYBASE: /* 112 */
{
I32 arg;
BGET_I32(arg);
cCOP->cop_arybase = arg;
break;
}
- case INSN_COP_LINE: /* 114 */
+ case INSN_COP_LINE: /* 113 */
{
line_t arg;
BGET_U16(arg);
BSET_cop_line(cCOP, arg);
break;
}
- case INSN_COP_WARNINGS: /* 115 */
+ case INSN_COP_WARNINGS: /* 114 */
{
svindex arg;
BGET_svindex(arg);
cCOP->cop_warnings = arg;
break;
}
- case INSN_MAIN_START: /* 116 */
+ case INSN_MAIN_START: /* 115 */
{
opindex arg;
BGET_opindex(arg);
PL_main_start = arg;
break;
}
- case INSN_MAIN_ROOT: /* 117 */
+ case INSN_MAIN_ROOT: /* 116 */
{
opindex arg;
BGET_opindex(arg);
PL_main_root = arg;
break;
}
- case INSN_CURPAD: /* 118 */
+ case INSN_CURPAD: /* 117 */
{
svindex arg;
BGET_svindex(arg);
BSET_curpad(PL_curpad, arg);
break;
}
- case INSN_PUSH_BEGIN: /* 119 */
+ case INSN_PUSH_BEGIN: /* 118 */
{
svindex arg;
BGET_svindex(arg);
BSET_push_begin(PL_beginav, arg);
break;
}
- case INSN_PUSH_INIT: /* 120 */
+ case INSN_PUSH_INIT: /* 119 */
{
svindex arg;
BGET_svindex(arg);
BSET_push_init(PL_initav, arg);
break;
}
- case INSN_PUSH_END: /* 121 */
+ case INSN_PUSH_END: /* 120 */
{
svindex arg;
BGET_svindex(arg);
INSN_OP_FIRST, /* 91 */
INSN_OP_LAST, /* 92 */
INSN_OP_OTHER, /* 93 */
- INSN_OP_CHILDREN, /* 94 */
- INSN_OP_PMREPLROOT, /* 95 */
- INSN_OP_PMREPLROOTGV, /* 96 */
- INSN_OP_PMREPLSTART, /* 97 */
- INSN_OP_PMNEXT, /* 98 */
- INSN_PREGCOMP, /* 99 */
- INSN_OP_PMFLAGS, /* 100 */
- INSN_OP_PMPERMFLAGS, /* 101 */
- INSN_OP_SV, /* 102 */
- INSN_OP_PADIX, /* 103 */
- INSN_OP_PV, /* 104 */
- INSN_OP_PV_TR, /* 105 */
- INSN_OP_REDOOP, /* 106 */
- INSN_OP_NEXTOP, /* 107 */
- INSN_OP_LASTOP, /* 108 */
- INSN_COP_LABEL, /* 109 */
- INSN_COP_STASHPV, /* 110 */
- INSN_COP_FILE, /* 111 */
- INSN_COP_SEQ, /* 112 */
- INSN_COP_ARYBASE, /* 113 */
- INSN_COP_LINE, /* 114 */
- INSN_COP_WARNINGS, /* 115 */
- INSN_MAIN_START, /* 116 */
- INSN_MAIN_ROOT, /* 117 */
- INSN_CURPAD, /* 118 */
- INSN_PUSH_BEGIN, /* 119 */
- INSN_PUSH_INIT, /* 120 */
- INSN_PUSH_END, /* 121 */
- MAX_INSN = 121
+ INSN_OP_PMREPLROOT, /* 94 */
+ INSN_OP_PMREPLROOTGV, /* 95 */
+ INSN_OP_PMREPLSTART, /* 96 */
+ INSN_OP_PMNEXT, /* 97 */
+ INSN_PREGCOMP, /* 98 */
+ INSN_OP_PMFLAGS, /* 99 */
+ INSN_OP_PMPERMFLAGS, /* 100 */
+ INSN_OP_SV, /* 101 */
+ INSN_OP_PADIX, /* 102 */
+ INSN_OP_PV, /* 103 */
+ INSN_OP_PV_TR, /* 104 */
+ INSN_OP_REDOOP, /* 105 */
+ INSN_OP_NEXTOP, /* 106 */
+ INSN_OP_LASTOP, /* 107 */
+ INSN_COP_LABEL, /* 108 */
+ INSN_COP_STASHPV, /* 109 */
+ INSN_COP_FILE, /* 110 */
+ INSN_COP_SEQ, /* 111 */
+ INSN_COP_ARYBASE, /* 112 */
+ INSN_COP_LINE, /* 113 */
+ INSN_COP_WARNINGS, /* 114 */
+ INSN_MAIN_START, /* 115 */
+ INSN_MAIN_ROOT, /* 116 */
+ INSN_CURPAD, /* 117 */
+ INSN_PUSH_BEGIN, /* 118 */
+ INSN_PUSH_INIT, /* 119 */
+ INSN_PUSH_END, /* 120 */
+ MAX_INSN = 120
};
enum {
if (o->op_type != type)
return o;
- if (cLISTOPo->op_children < 7) {
- /* XXX do we really need to do this if we're done appending?? */
- for (kid = cLISTOPo->op_first; kid; kid = kid->op_sibling)
- last = kid;
- cLISTOPo->op_last = last; /* in case check substituted last arg */
- }
-
return fold_constants(o);
}
((LISTOP*)first)->op_first = last;
}
((LISTOP*)first)->op_last = last;
- ((LISTOP*)first)->op_children++;
return first;
}
first->op_last->op_sibling = last->op_first;
first->op_last = last->op_last;
- first->op_children += last->op_children;
- if (first->op_children)
- first->op_flags |= OPf_KIDS;
+ first->op_flags |= (last->op_flags & OPf_KIDS);
#ifdef PL_OP_SLAB_ALLOC
#else
first->op_sibling = ((LISTOP*)last)->op_first;
((LISTOP*)last)->op_first = first;
}
- ((LISTOP*)last)->op_children++;
+ last->op_flags |= OPf_KIDS;
return last;
}
listop->op_type = type;
listop->op_ppaddr = PL_ppaddr[type];
- listop->op_children = (first != 0) + (last != 0);
+ if (first || last)
+ flags |= OPf_KIDS;
listop->op_flags = flags;
if (!last && first)
if (!last)
listop->op_last = pushop;
}
- else if (listop->op_children)
- listop->op_flags |= OPf_KIDS;
return (OP*)listop;
}
kid = cLISTOPo->op_first->op_sibling;
cLISTOPo->op_first->op_sibling = kid->op_sibling; /* bypass old block */
op_free(kid); /* then delete it */
- cLISTOPo->op_children--;
}
OP *
BASEOP
OP * op_first;
OP * op_last;
- U32 op_children;
};
struct pmop {
BASEOP
OP * op_first;
OP * op_last;
- U32 op_children;
OP * op_pmreplroot;
OP * op_pmreplstart;
PMOP * op_pmnext; /* list of all scanpats */
BASEOP
OP * op_first;
OP * op_last;
- U32 op_children;
OP * op_redoop;
OP * op_nextop;
OP * op_lastop;