[Patches] Support for EXTENDED_ARG, fixes for bugs open/32 and open/134
Tim Peters
tim_one@email.msn.com
Tue, 23 May 2000 01:15:38 -0400
[Charles G Waldman]
> ...
> *** 643,652 ****
> #if defined(Py_DEBUG) || defined(LLTRACE)
> f->f_lasti = INSTR_OFFSET();
> #endif
> -
> opcode = NEXTOP();
> ! if (HAS_ARG(opcode))
> oparg = NEXTARG();
> #ifdef DYNAMIC_EXECUTION_PROFILE
> #ifdef DXPAIRS
> dxpairs[lastopcode][opcode]++;
> --- 645,660 ----
> #if defined(Py_DEBUG) || defined(LLTRACE)
> f->f_lasti = INSTR_OFFSET();
> #endif
> opcode = NEXTOP();
> ! if (HAS_ARG(opcode)) {
> oparg = NEXTARG();
> + if (IS_EXTENDED()) {
> + int extension;
> + NEXTOP(); /* skip over EXTENDED_ARG
> bytecode*/
> + extension = NEXTARG();
> + oparg = EXTEND_ARG(oparg, extension);
> + }
> + }
> #ifdef DYNAMIC_EXECUTION_PROFILE
> #ifdef DXPAIRS
> dxpairs[lastopcode][opcode]++;
> ...
I would like to see before-and-after timing tests on a few platforms: this
approach adds a test+branch to every dynamic instance of an opcode with an
argument, and e.g. SET_LINENO and LOAD_FAST are by far the most frequently
executed opcodes (and both have arguments).
cautiously y'rs - tim