in reply to What does op_seq do?

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

Replies are listed 'Best First'.
Re: Re: What does op_seq do?
by shotgunefx (Parson) on Jan 04, 2003 at 16:25 UTC
    Believe me, I have. Understanding it is another. My C/Asm days are long behind me (or were anyway). There's quite a bit to take in and with so many macros and things that functionally aren't documented (or at least I haven't been able to find them), it's rather daunting.

    On the "guts" side, it's more tinkering than programming. Sort of like when as a kid I took apart my Omega Supreme to see how it worked. It still worked but he never walked the same again.

    I hope to eventually get the kind of hold on Perl innards as I do on the outside but I think it's going to take me quite a bit of time.

    -Lee

    "To be civilized is to deny one's nature."
Re: Re: What does op_seq do?
by shotgunefx (Parson) on Jan 04, 2003 at 16:02 UTC
    Thanks! (hadn't even heard of pad_addlex yet)
    That's what I've been doing since I posted but it's definitely hard for myself. So many damn macros!I've been going along pp_padsv, etc and when I'm able to find what it does, just commenting it. I've I had the time it would be nice (for people like myself anyway) to automate this. It would certainly make for an easier introduction.

    -Lee

    "To be civilized is to deny one's nature."