[Python-Dev] Re: new bytecode results

Skip Montanaro skip@pobox.com
Fri, 28 Feb 2003 11:48:38 -0600


    >> > Are you suggesting a test for LOAD_FAST before the switch,
    >> >
    >> > e.g.
    >> > if (opcode == LOAD_FAST) {
    >> >  // load fast
    >> > }
    >> > else switch (opcode) {
    >> >  // body
    >> > }
    >> 
    >> Yes.


    Damien> Hmm, I might even be able to do something like this:

    Damien> if (opcode >= LOAD_FAST_0) {
    Damien>     oparg = opcode - LOAD_FAST_0;
    Damien>     ...
    Damien>     }
    Damien> else switch (opcode) {
    Damien> }


I think you want "&& opcode <= LOAD_FAST_15" in there somewhere, or
something to cap the range of the test.  Now you've increased the cost of
the check, maybe making it no longer worthwhile.

Skip