develooper Front page | perl.perl5.porters | Postings from May 2012

Removing from the opcode tree

Thread Next
From:
Eric Brine
Date:
May 15, 2012 16:01
Subject:
Removing from the opcode tree
Message ID:
CALJW-qHbODFgZqD2=EAA2V_FDNZZURK6LFw5Xt1EMfR2fgGkUg@mail.gmail.com
On Mon, May 14, 2012 at 7:37 PM, Father Chrysostomos via RT <
perlbug-followup@perl.org> wrote:
> Replacing the entersub op with something else is what
> cv_set_call_checker is for.

I haven't found an example that removes from the opcode tree. How would I
fill in the following call checker

STATIC OP* check_loop(pTHX_ OP* entersubop, GV* namegv, SV* ckobj) {
#define check_loop(a,b,c) check_loop(aTHX_ a,b,c)
   PERL_UNUSED_ARG(namegv);
   PERL_UNUSED_ARG(ckobj);

   return ...;
}

to remove the entersub it's tied to?

2     <;> nextstate(main 765 -e:1) v:%,{,2048 ->3
a     <1> entersub[t1] vKS/TARG,1 ->b               <-------
-        <1> ex-list K ->a
3           <0> pushmark s ->4
8           <2> leaveloop K/2 ->9
4              <{> enterloop(next->7 last->8 redo->5) ->5
-              <@> lineseq sKP ->8
5                 <;> nextstate(main 764 -e:1) v:%,{,2048 ->6
6                 <0> last v* ->7
7                 <0> unstack s ->5
-           <1> ex-rv2cv K/128 ->-
9              <$> gv(*loop) s ->a


(I'm implementing C<< loop BLOCK >> to familiarize myself.)

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About