I don't know the answer to your question but I almost always start out on this sort of thing by looking in a few places: grep op_seq *.h (cop.h, embedvar.h, intrpvar.h, op.h, perlapi.h). op.h and cop.h show it as part of the base OP struct. A grep op_seq *.c shows it's only relevant in op.c and sv.c. Inspection of sv.c shows it's not really used there so the entire shebang is restricted to op.c.

op_seq itself is used all over op.c but after a quick scan it looks like it's used for scoping rules. So... relevant to your actual question I'd suggest you take a look at pad_addlex and see how op_seq is being used there. I'd guess that if you're adding lexicals that you just need to add the scope information to NVX/IVX. pad_find(lex/my) shows how your seq information is used.

So in general - the source is probably your best reference for this. Maybe someone here actually knows what to set your NVX/IVX values to. [Added NVX is your op_seq value and IVX is PL_seqmax. The difficulty is on how you find the right op_seq value and whether you have to increment PL_seqmax, increment other lexical's op_seq/seqmax values, walk the opcode tree to update their op_seq values... etc. That's why I was hazy.]

Addition: Oh yes - the whole point of this node is to demonstrate how it's easy to find these sorts of answers by reading the source. This is what fifteen minutes with grep and less returned - I'm sure that since you already have an environment which gives you access to these variables that it's even easier to verify their operation.


Fun Fun Fun in the Fluffy Chair


In reply to Re: What does op_seq do? by diotalevi
in thread What does op_seq do? by shotgunefx

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.